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; }
// Map in the memory for the current 0x8000-0xc000 music bank static int QsndZBankMap() { unsigned int nOff; unsigned char* 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; }
void DrvYM2203WritePortB(UINT32, UINT32 d) { INT32 bank = (d & 0x0f) * 0x8000; ZetMapArea(0x8000, 0xffff, 0, DrvZ80Banks + bank); ZetMapArea(0x8000, 0xffff, 2, DrvZ80Banks + bank); }
void twinhawkBankSwitch(unsigned int /*a*/, unsigned int data) { Z80Bank=(data-1) & 0x03; unsigned char* nStartAddress = z80_rom + 0x4000+(Z80Bank*0x4000); nCurrentBank = Z80Bank; ZetMapArea(0x4000, 0x7FFF, 0, nStartAddress); ZetMapArea(0x4000, 0x7FFF, 2, nStartAddress); }
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); }
void SupermanBankSwitch(unsigned int data) { Z80Bank = (data - 1) & 0x03; unsigned char* nStartAddress = z80_rom + 0x4000 + (Z80Bank * 0x4000); nCurrentBank = Z80Bank; ZetMapArea(0x4000, 0x7fff, 0, nStartAddress); ZetMapArea(0x4000, 0x7fff, 2, nStartAddress); }
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; }
void rastanBankSwitch(unsigned int /*a*/, unsigned int data) { Z80Bank=(data^1) & 0x01; if (Z80Bank != nCurrentBank) { unsigned char* nStartAddress = z80_rom + 0x4000+(Z80Bank*0x4000); nCurrentBank = Z80Bank; ZetMapArea(0x4000, 0x7FFF, 0, nStartAddress); ZetMapArea(0x4000, 0x7FFF, 2, nStartAddress); } }
static void drvZ80Bankswitch(int nBank) { nBank &= 0x0F; if (nBank != nCurrentBank) { unsigned char* nStartAddress = RomZ80 + (nBank << 14); ZetMapArea(0x8000, 0xBFFF, 0, nStartAddress); ZetMapArea(0x8000, 0xBFFF, 2, nStartAddress); nCurrentBank = nBank; } }
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; } }
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]]); }
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); } } }
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; }
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; }
INT32 Sf2mdtSoundInit() { Sf2mdtZ80Ram = (UINT8*)BurnMalloc(0x800); ZetInit(0); ZetOpen(0); ZetSetReadHandler(Sf2mdtZ80Read); ZetSetWriteHandler(Sf2mdtZ80Write); ZetMapArea(0x0000, 0x7fff, 0, CpsZRom + 0x00000); ZetMapArea(0x0000, 0x7fff, 2, CpsZRom + 0x00000); ZetMapArea(0x8000, 0xbfff, 0, CpsZRom + 0x08000); ZetMapArea(0x8000, 0xbfff, 2, CpsZRom + 0x08000); ZetMapArea(0xd000, 0xd7ff, 0, Sf2mdtZ80Ram ); ZetMapArea(0xd000, 0xd7ff, 1, Sf2mdtZ80Ram ); ZetMapArea(0xd000, 0xd7ff, 2, Sf2mdtZ80Ram ); ZetClose(); BurnYM2151Init(3579540); BurnYM2151SetAllRoutes(0.35, BURN_SND_ROUTE_BOTH); MSM5205Init(0, Sf2mdtSynchroniseStream, 24000000 / 64, Sf2mdtMSM5205Vck0, MSM5205_S96_4B, 1); MSM5205Init(1, Sf2mdtSynchroniseStream, 24000000 / 64, Sf2mdtMSM5205Vck1, MSM5205_S96_4B, 1); MSM5205SetRoute(0, 0.25, BURN_SND_ROUTE_BOTH); MSM5205SetRoute(1, 0.25, BURN_SND_ROUTE_BOTH); nCpsZ80Cycles = 3579540 * 100 / nBurnFPS; Sf2mdtNumZ80Banks = (nCpsZRomLen / 0x4000) - 1; return 0; }
// Map in the memory for the current 0x8000-0xc000 bank static int PsndZBankMap() { unsigned int nOff; unsigned char *Bank; nOff=nPsndZBank<<14; nOff+=0x8000; if (nOff+0x4000>nCpsZRomLen) { nOff=0; // End of bank in out of range } Bank=CpsZRom+nOff; // Read and fetch the bank ZetMapArea(0x8000,0xbfff,0,Bank); ZetMapArea(0x8000,0xbfff,2,Bank); return 0; }
INT32 Sf2mdtSoundReset() { ZetOpen(0); ZetReset(); BurnYM2151Reset(); MSM5205Reset(); Sf2mdtZ80BankAddress = 0x8000; ZetMapArea(0x8000, 0xbfff, 0, CpsZRom + Sf2mdtZ80BankAddress); ZetMapArea(0x8000, 0xbfff, 2, CpsZRom + Sf2mdtZ80BankAddress); ZetClose(); Sf2mdtSoundLatch = 0; Sf2mdtSampleBuffer1 = 0; Sf2mdtSampleBuffer2 = 0; Sf2mdtSampleSelect1 = 0; Sf2mdtSampleSelect2 = 0; 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); } } }
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); } } }
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; }
void __fastcall Sf2mdtZ80Write(UINT16 a, UINT8 d) { switch (a) { case 0xd800: { BurnYM2151SelectRegister(d); return; } case 0xd801: { BurnYM2151WriteRegister(d); return; } case 0xe000: { MSM5205SetRoute(0, (d & 0x20) ? 0 : 0.25, BURN_SND_ROUTE_BOTH); MSM5205SetRoute(1, (d & 0x10) ? 0 : 0.25, BURN_SND_ROUTE_BOTH); Sf2mdtZ80BankAddress = (d & Sf2mdtNumZ80Banks) * 0x4000; ZetMapArea(0x8000, 0xbfff, 0, CpsZRom + Sf2mdtZ80BankAddress); ZetMapArea(0x8000, 0xbfff, 2, CpsZRom + Sf2mdtZ80BankAddress); return; } case 0xe400: { Sf2mdtSampleBuffer1 = d; return; } case 0xe800: { Sf2mdtSampleBuffer2 = d; return; } default: { bprintf(PRINT_NORMAL, _T("Z80 #1 Write => %04X, %02X\n"), a, d); } } }
static int DrvZ80Init() { // Init the Z80 ZetInit(1); 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(); return 0; }
static int DrvInit() { Mem = (unsigned char*)malloc ( 0x4800 ); if (Mem == NULL) { return 1; } if (BurnLoadRom(Mem, 0, 1)) return 1; ZetInit(1); ZetOpen(0); ZetMapArea (0x0000, 0x3fff, 0, Mem + 0x0000); // Read ROM ZetMapArea (0x0000, 0x3fff, 2, Mem + 0x0000); // Fetch ROM ZetMapArea (0x8000, 0x87ff, 0, Mem + 0x4000); // Read RAM ZetMapArea (0x8000, 0x87ff, 1, Mem + 0x4000); // Write RAM ZetMemEnd(); ZetSetInHandler(dotrikun_in_port); ZetSetOutHandler(dotrikun_out_port); ZetClose(); DrvDoReset(); return 0; }
int PsndZInit() { if (nCpsZRomLen<0x8000) { return 1; // Not enough Z80 Data } if (CpsZRom==NULL) { return 1; } PsndZRam=(unsigned char *)malloc(0x800); if (PsndZRam==NULL) { return 1; } ZetInit(1); ZetSetReadHandler(PsndZRead); ZetSetWriteHandler(PsndZWrite); ZetSetInHandler(PsndZIn); ZetSetOutHandler(PsndZOut); // 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; }
static int DrvInit() { AllMem = NULL; MemIndex(); int nLen = MemEnd - (unsigned char *)0; if ((AllMem = (unsigned char *)malloc(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); M6809SetWriteByteHandler(scotrsht_main_write); M6809SetReadByteHandler(scotrsht_main_read); M6809Close(); ZetInit(1); 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); DrvDoReset(); GenericTilesInit(); 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 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); bDrawScreen = true; DrvDoReset(); return 0; }
int TmntInit() { int nRet=0; int nLen=0; // Find out how much memory is needed Mem=NULL; MemIndex(); nLen=MemEnd-(unsigned char *)0; Mem=(unsigned char *)malloc(nLen); if (Mem==NULL) return 1; memset(Mem,0,nLen); // blank all memory MemIndex(); // Index the allocated memory TmntZ80Rom=(unsigned char *)malloc(0x08000); if (TmntZ80Rom==NULL) return 1; memset(TmntZ80Rom,0x11,0x08000); TmntZ80Ram=(unsigned char *)malloc(0x0800); if (TmntZ80Ram==NULL) return 1; memset(TmntZ80Ram,0x00,0x0800); nRet=LoadRoms(); if (nRet!=0) return 1; // Load the roms into memory SekInit(0,0x68000); // Allocate 68000 SekOpen(0); // Map in memory: // ----------------- Cpu 1 ------------------------ SekMapMemory(Tmnt68KROM01, 0x000000,0x05FFFF, SM_ROM); // 68000 Rom SekMapMemory(TmntRam06, 0x060000,0x063FFF, SM_RAM); SekMapMemory(TmntRam08, 0x080000,0x080FFF, SM_ROM); // Write goes through handler SekMapMemory(PriRam, 0x0c0000,0x0c00FF, SM_RAM); SekMapMemory(TmntRam10, 0x100000,0x107FFF, SM_RAM); SekMapMemory(K051960Ram, 0x140400,0x1407FF, SM_RAM); SekSetReadWordHandler(0,TmntReadWord); SekSetWriteWordHandler(0,TmntWriteWord); SekSetReadByteHandler(0,TmntReadByte); SekSetWriteByteHandler(0,TmntWriteByte); // ------------------------------------------------ // SekReset(); SekClose(); // Setup the Z80 emulation ZetInit(1); ZetOpen(0); ZetMapArea(0x0000, 0x7fff, 0, TmntZ80Rom); ZetMapArea(0x0000, 0x7fff, 2, TmntZ80Rom); ZetMapArea(0x8000, 0x87FF, 0, TmntZ80Ram); ZetMapArea(0x8000, 0x87FF,1, TmntZ80Ram); ZetMapArea(0x8000, 0x87FF, 2, TmntZ80Ram); ZetMemEnd(); ZetSetInHandler(tmntZ80In); ZetSetOutHandler(tmntZ80Out); ZetSetReadHandler(tmntZ80Read); ZetSetWriteHandler(tmntZ80Write); // ZetReset(); ZetClose(); // sound stuff // ym2151 BurnYM2151Init(3579545, 50.0); BurnYM2151SetIrqHandler(&tmntYM2151IRQHandler); // BurnYM2151Reset(); UPD7759Init(UPD7759_STANDARD_CLOCK, TmntSampleROM02); bInt5=0; GenericTilesInit(); TmntPalInit(); TmntReset(); 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; }
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); }