Exemple #1
0
void BurnYM2151Exit()
{
#if defined FBA_DEBUG
	if (!DebugSnd_YM2151Initted) bprintf(PRINT_ERROR, _T("BurnYM2151Exit called without init\n"));
#endif

	BurnYM2151SetIrqHandler(NULL);
	BurnYM2151SetPortHandler(NULL);

	YM2151Shutdown();

	if (pBuffer) {
		free(pBuffer);
		pBuffer = NULL;
	}
	
	DebugSnd_YM2151Initted = 0;
}
Exemple #2
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;
}
Exemple #3
0
int twinhawkInit()
{
	int nRet=0; int nLen=0;

	//--------------Allocate Memory-----------------
	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

	//--------------- Load Roms -------------------
	nRet=LoadRoms();
	if (nRet!=0)
		return 1; // Load the roms into memory

	// Map in memory:
	// ----------------- Cpu 1 68k ------------------------
	SekInit(0, 0x68000); // Allocate 1 68000
	SekOpen(0);
	SekMapMemory(    Rom  ,0x000000,0x3ffff,SM_ROM); // 68000 Rom
	SekMapMemory(twinhawk_src_pal,0xb00000,0xb00FFF,SM_RAM);
	SekMapMemory(sysbvidattr,0xd00000,0xd00fff,SM_RAM);
	SekMapMemory(sysbvidram,0xe00000,0xe03fff,SM_RAM);
	SekMapMemory(twinhawk_ram,0xf00000,0xf03fff,SM_RAM);

	SekSetReadWordHandler(0, twinhawkReadWord);
	SekSetWriteWordHandler(0, twinhawkWriteWord);
	SekSetReadByteHandler(0, twinhawkReadByte);
	SekSetWriteByteHandler(0, twinhawkWriteByte);
	SekClose();
	// ------------------------------------------------
	// ----------------- Cpu 2 Z80 ------------------------
	ZetInit(1);
	ZetOpen(0);
	ZetSetReadHandler(twinhawkZ80Read);
	ZetSetWriteHandler(twinhawkZ80Write);
	ZetMapArea (0x0000,0x3FFF,0,z80_rom);
	ZetMapArea (0x0000,0x3FFF,2,z80_rom);
//	ZetMapArea (0x4000,0x7FFF,0,z80_rom+0x4000);
//	ZetMapArea (0x4000,0x7FFF,2,z80_rom+0x4000);
	ZetMapArea (0xc000,0xdfff,0,z80_ram);
	ZetMapArea (0xc000,0xdfff,2,z80_ram);
	ZetMapArea (0xc000,0xdfff,1,z80_ram);
	ZetMemEnd();
	ZetMemCallback(0xe000, 0xFFFF, 0);			// Read
	ZetMemCallback(0xe000, 0xFFFF, 1);			// Write
	ZetReset();
	ZetClose();
	//-------------------------------------------------

	//-------- sound stuff ----------------------------
	//---------- YM2151 Setup ----------------------
	BurnYM2151Init(4000000, 50.0);
	BurnYM2151SetIrqHandler(&twinhawkYM2151IRQHandler);
	nCurrentBank=-1;

	//--------------------------------------------------
	// ------- GFX Init -------------------
	taito_pal=twinhawk_pal;
	SysXInit(0);
	drvDoReset();
	return 0;
	}
Exemple #4
0
int rastanInit()
{
	int nRet=0; int nLen=0;
	//--------------Allocate Memory-----------------
	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

	//--------------- Load Roms -------------------
	nRet=LoadRoms();
	if (nRet!=0)
		return 1; // Load the roms into memory
	taito_pal=rastan_pal;
	init_taito_gfx();

	// Map in memory:
	// ----------------- Cpu 1 ------------------------
	SekInit(0, 0x68000); // Allocate 1 68000
	SekOpen(0);
	SekMapMemory(    Rom  ,0x000000,0x05ffff,SM_ROM); // 68000 Rom
	SekMapMemory(rastan_ram,0x10c000,0x10ffff,SM_RAM); //0x4000
	SekMapMemory(rastan_src_pal,0x200000,0x200fff,SM_RAM);
	SekMapMemory(rastan_ram+0x4000,0x350008,0x350010,SM_RAM);
	SekMapMemory(PC090OJ_spritectrl,0x380000,0x380003,SM_RAM);
	SekMapMemory(rastan_ram+0x4012,0x3c0000,0x3c0003,SM_WRITE);
	SekMapMemory(PC080SN_word_0,0xc00000,0xc0ffff,SM_RAM);
	SekMapMemory(PC080SN_ctrl_word_0,0xc50000,0xc50003,SM_WRITE);
	SekMapMemory(PC090OJ_word_0,0xd00000,0xd03fff,SM_RAM);
	SekSetReadWordHandler(0, rastanReadWord);
	SekSetWriteWordHandler(0, rastanWriteWord);
	SekSetReadByteHandler(0, rastanReadByte);
	SekSetWriteByteHandler(0, rastanWriteByte);
	// ------------------------------------------------
	SekClose();

	ZetInit(1);
	ZetOpen(0);
	ZetSetReadHandler(RastanZ80Read);
	ZetSetWriteHandler(RastanZ80Write);
	ZetMapArea (0x0000,0x3FFF,0,z80_rom);
	ZetMapArea (0x0000,0x3FFF,2,z80_rom);
	ZetMapArea (0x4000,0x7FFF,0,z80_rom+0x4000);
	ZetMapArea (0x4000,0x7FFF,2,z80_rom+0x4000);
	ZetMapArea (0x8000,0x8FFF,0,z80_ram);
	ZetMapArea (0x8000,0x8FFF,1,z80_ram);
	ZetMemEnd();
	ZetMemCallback(0x9000, 0xa001, 0);			// Read
	ZetMemCallback(0x9000, 0xa001, 1);			// Write
	ZetReset();
	ZetClose();
	//-------------------------------------------------


	BurnYM2151Init(4000000, 50.0);
	BurnYM2151SetIrqHandler(&RastanYM2151IRQHandler);
	BurnYM2151SetPortHandler(&rastanBankSwitch);
	nCurrentBank=0; // bank number 0 or 1

	MSM5205Init(0,8000, 60,1);
	drvDoReset();
	return 0;
	}