Ejemplo n.º 1
0
void install_protection_asic27a_svg()
{
	nPGMArm7Type = 3;

	pPgmScanCallback = svg_asic27aScan;

	svg_ram_sel = 0;
	svg_ram[0] = PGMARMShareRAM;
	svg_ram[1] = PGMARMShareRAM2;

	SekOpen(0);
	SekMapHandler(5,		0x500000, 0x5fffff, MAP_RAM);
	SekSetReadWordHandler(5, 	svg_read_word);
	SekSetWriteWordHandler(5, 	svg_write_word);
	SekSetWriteByteHandler(5, 	svg_write_byte);
	SekClose();

	Arm7Init(0);
	Arm7Open(0);
	Arm7MapMemory(PGMARMROM,	0x00000000, 0x00003fff, MAP_ROM);
	Arm7MapMemory(PGMUSER0,		0x08000000, 0x08000000 | (nPGMExternalARMLen-1), MAP_ROM);
	Arm7MapMemory(PGMARMRAM0,	0x10000000, 0x100003ff, MAP_RAM);
	Arm7MapMemory(PGMARMRAM1,	0x18000000, 0x1803ffff, MAP_RAM);
	Arm7MapMemory(svg_ram[1],	0x38000000, 0x3800ffff, MAP_RAM);
	Arm7MapMemory(PGMARMRAM2,	0x50000000, 0x500003ff, MAP_RAM);
	Arm7SetWriteByteHandler(svg_arm7_write_byte);
	Arm7SetReadByteHandler(svg_arm7_read_byte);
	Arm7Close();
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
0
static int DrvInit()
{
	int nRet;
	
	Mem = NULL;
	MemIndex();
	int nLen = MemEnd - (unsigned char *)0;
	if ((Mem = (unsigned char *)malloc(nLen)) == NULL) return 1;
	memset(Mem, 0, nLen);										// blank all memory
	MemIndex();	
	
	nRet = BurnLoadRom(Rom68K + 0x000000, 0, 2); if (nRet != 0) return 1;
	nRet = BurnLoadRom(Rom68K + 0x000001, 1, 2); if (nRet != 0) return 1;
	
	BurnLoadRom(RomSpr + 0, 2, 2);
	BurnLoadRom(RomSpr + 1, 3, 2);
	
	// decode sprites 
	unsigned char * tmp = RomSpr;
	for (int i=0; i<(0x400000/4); i++) {
		unsigned char c = tmp[2];
		tmp[2] = tmp[1];
		tmp[1] = c;
		tmp += 4;
	}
	
	BurnLoadRom(RomBg, 4, 1);
	
	BurnLoadRom(MSM6295ROM + 0x00000, 5, 1);
	BurnLoadRom(MSM6295ROM + 0x80000, 6, 1);
	
	{
		SekInit(0, 0x68000);										// Allocate 68000
	    SekOpen(0);

		// Map 68000 memory:
		SekMapMemory(Rom68K,		0x000000, 0x0FFFFF, SM_ROM);	// CPU 0 ROM
		SekMapMemory(Ram68K,		0x100000, 0x10FFFF, SM_RAM);	// CPU 0 RAM
		SekMapMemory((unsigned char *)RamPal,
									0x200000, 0x200FFF, SM_ROM);	// palette
		SekMapMemory((unsigned char *)RamSpr0,
									0x240000, 0x240FFF, SM_RAM);	// sprites 0
		SekMapMemory((unsigned char *)RamSpr1,
									0x280000, 0x280FFF, SM_RAM);	// sprites 1
		SekMapMemory((unsigned char *)RamBg,
									0x2C0000, 0x2C0FFF, SM_RAM);	// back ground
		SekMapMemory(Ram68K+0x10000,0x8C0000, 0x8CFFFF, SM_RAM);	// not used?
		
		SekMapHandler(1,			0x200000, 0x200FFF, SM_WRITE);
		
		SekSetReadWordHandler(0, k1945iiiReadWord);
//		SekSetReadByteHandler(0, k1945iiiReadByte);
		SekSetWriteWordHandler(0, k1945iiiWriteWord);
		SekSetWriteByteHandler(0, k1945iiiWriteByte);
		
//		SekSetWriteByteHandler(1, k1945iiiWriteBytePalette);
		SekSetWriteWordHandler(1, k1945iiiWriteWordPalette);

		SekClose();
	}
	
	MSM6295Init(0, 7500, 80, 1);
	MSM6295Init(1, 7500, 80, 1);
	
	DrvDoReset();
	return 0;
}
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
0
static int drvInit()
{
	int nLen;

#ifdef DRIVER_ROTATION
	bToaRotateScreen = true;
#endif

	nGP9001ROMSize[0] = 0x01000000;

	// Find out how much memory is needed
	Mem = NULL;
	MemIndex();
	nLen = MemEnd - (unsigned char*)0;
	if ((Mem = (unsigned char*)malloc(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, 50.0);
	MSM6295Init(0, 32000000 / 10 / 132, 50.0, 1);
	MSM6295Init(1, 32000000 / 10 / 165, 50.0, 1);

	nToaPalLen = nColCount;
	ToaPalSrc = RamPal;
	ToaPalInit();

	nTextROMStatus = -1;
	bDrawScreen = true;

#if defined FBA_DEBUG && defined USE_SPEEDHACKS
	bprintf(PRINT_IMPORTANT, _T("  * Using speed-hacks (detecting idle loops).\n"));
#endif

	drvDoReset(); // Reset machine
	return 0;
}
Ejemplo n.º 8
0
INT32 CpsMemInit()
{
    if (AllocateMemory()) {
        return 1;
    }

    SekOpen(0);

    SekSetResetCallback(CPSResetCallback);

    // Map in memory:
    // 68000 Rom (as seen as is, through read)
    SekMapMemory(CpsRom, 0, nCpsRomLen - 1, SM_READ);

    // 68000 Rom (as seen decrypted, through fetch)
    if (nCpsCodeLen > 0) {
        // Decoded part (up to nCpsCodeLen)
        SekMapMemory(CpsCode, 0, nCpsCodeLen - 1, SM_FETCH);
    }
    if (nCpsRomLen > nCpsCodeLen) {
        // The rest (up to nCpsRomLen)
        SekMapMemory(CpsRom + nCpsCodeLen, nCpsCodeLen, nCpsRomLen - 1, SM_FETCH);
    }

    nCpsObjectBank = -1;
    CpsMapObjectBanks(0);

#if 0
    SekMapHandler(3, 0x660000, 0x663FFF, SM_RAM);
    SekSetReadByteHandler(3, CPSExtraNVRAMReadByte);
    SekSetWriteByteHandler(3, CPSExtraNVRAMWriteByte);
#else
    SekMapMemory(CpsRam660, 0x660000, 0x663FFF, SM_RAM);
#endif

    //		SekMapHandler(4, 0x708000, 0x709FFF, SM_WRITE);
    //		SekMapHandler(4, 0x70A000, 0x70BFFF, SM_WRITE);
    //		SekMapHandler(4, 0x70C000, 0x70DFFF, SM_WRITE);
    //		SekMapHandler(4, 0x70E000, 0x70FFFF, SM_WRITE);

    //		SekSetWriteByteHandler(4, CpsWriteSpriteByte);
    //		SekSetWriteWordHandler(4, CpsWriteSpriteWord);

    SekMapMemory(CpsRam90,		0x900000, 0x92FFFF, SM_RAM);	// Gfx Ram
    SekMapMemory(CpsRamFF,		0xFF0000, 0xFFFFFF, SM_RAM);	// Work Ram

    SekSetReadByteHandler(0, CpsReadByte);
    SekSetWriteByteHandler(0, CpsWriteByte);
    SekSetReadWordHandler(0, CpsReadWord);
    SekSetWriteWordHandler(0, CpsWriteWord);

    // QSound
    if (!Cps2DisableQSnd)
    {
        SekMapHandler(1,	0x618000, 0x619FFF, SM_RAM);

        SekSetReadByteHandler(1, CPSQSoundC0ReadByte);
        SekSetWriteByteHandler(1, CPSQSoundC0WriteByte);
    }

    SekClose();

    return 0;
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
0
INT32 CpsMemInit()
{
	if (AllocateMemory()) {
		return 1;
	}

	SekOpen(0);

	SekSetResetCallback(CPSResetCallback);

	// Map in memory:
	// 68000 Rom (as seen as is, through read)
	SekMapMemory(CpsRom, 0, nCpsRomLen - 1, SM_READ);

	// 68000 Rom (as seen decrypted, through fetch)
	if (nCpsCodeLen > 0) {
		// Decoded part (up to nCpsCodeLen)
		SekMapMemory(CpsCode, 0, nCpsCodeLen - 1, SM_FETCH);
	}
	if (nCpsRomLen > nCpsCodeLen) {
		// The rest (up to nCpsRomLen)
		SekMapMemory(CpsRom + nCpsCodeLen, nCpsCodeLen, nCpsRomLen - 1, SM_FETCH);
	}

	if (Cps == 2) {
		nCpsObjectBank = -1;
		CpsMapObjectBanks(0);

#if 0
		SekMapHandler(3, 0x660000, 0x663FFF, SM_RAM);
		SekSetReadByteHandler(3, CPSExtraNVRAMReadByte);
		SekSetWriteByteHandler(3, CPSExtraNVRAMWriteByte);
#else
		SekMapMemory(CpsRam660, 0x660000, 0x663FFF, SM_RAM);
#endif

//		SekMapHandler(4, 0x708000, 0x709FFF, SM_WRITE);
//		SekMapHandler(4, 0x70A000, 0x70BFFF, SM_WRITE);
//		SekMapHandler(4, 0x70C000, 0x70DFFF, SM_WRITE);
//		SekMapHandler(4, 0x70E000, 0x70FFFF, SM_WRITE);

//		SekSetWriteByteHandler(4, CpsWriteSpriteByte);
//		SekSetWriteWordHandler(4, CpsWriteSpriteWord);
	}

	SekMapMemory(CpsRam90,		0x900000, 0x92FFFF, SM_RAM);	// Gfx Ram
	SekMapMemory(CpsRamFF,		0xFF0000, 0xFFFFFF, SM_RAM);	// Work Ram

	SekSetReadByteHandler(0, CpsReadByte);
	SekSetWriteByteHandler(0, CpsWriteByte);
	SekSetReadWordHandler(0, CpsReadWord);
	SekSetWriteWordHandler(0, CpsWriteWord);

	// QSound
	if ((Cps == 2) && !Cps2DisableQSnd) {
		SekMapHandler(1,	0x618000, 0x619FFF, SM_RAM);

		SekSetReadByteHandler(1, CPSQSoundC0ReadByte);
		SekSetWriteByteHandler(1, CPSQSoundC0WriteByte);
	}

	if (Cps1Qs == 1) {
		// Map the 1st 32KB of the QSound ROM into the 68K address space
		for (INT32 i = 0x7FFF; i >= 0; i--) {
			CpsEncZRom[(i << 1) + 0] = CpsEncZRom[i];
			CpsEncZRom[(i << 1) + 1] = 0xFF;
		}
		SekMapMemory(CpsEncZRom, 0xF00000, 0xF0FFFF, SM_ROM);

		// QSound shared RAM
		SekMapHandler(1,	0xF18000, 0xF19FFF, SM_RAM);
		SekMapHandler(2,	0xF1E000, 0xF1FFFF, SM_RAM);

		SekSetReadByteHandler(1, CPSQSoundC0ReadByte);
		SekSetWriteByteHandler(1, CPSQSoundC0WriteByte);
		SekSetReadByteHandler(2, CPSQSoundF0ReadByte);
		SekSetWriteByteHandler(2, CPSQSoundF0WriteByte);
	}

	SekClose();

	return 0;
}
Ejemplo n.º 11
0
static int DrvInit()
{
    int 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 - (unsigned char *)0;
    if ((Mem = (unsigned char *)malloc(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);
    BurnTimerAttachZet(28000000 / 8);

    bDrawScreen = true;

    DrvDoReset();												// Reset machine
    return 0;
}