📄 d_superman.cpp
字号:
case 0xe001:
case 0xe002:
case 0xe003:
BurnYM2610Write(a & 3, d);
return;
case 0xe200:
tc0140_slave_port_w(d);
return;
case 0xe201:
tc0140_slave_comm_w(d);
return;
case 0xf200:
SupermanBankSwitch(d);
return;
}
}
unsigned short __fastcall SupermanReadWord(unsigned int a)
{
switch (a) {
case 0x500000:
case 0x500002:
case 0x500004:
case 0x500006:
case 0x800002:
SEK_DEF_READ_WORD(0, a);
}
// bprintf(PRINT_NORMAL, "68000: Read Word %06X\n",a);
return 0;
}
unsigned char __fastcall SupermanReadByte(unsigned int a)
{
if (a >= 0x900000 && a <= 0x900fff) {
return CChip_Read((a - 0x900000) / 2);
}
switch (a) {
case 0x500001: return (0xff - SupermanDip[0]) & 0x0f;
case 0x500003: return ((0xff - SupermanDip[0]) & 0xf0) >> 4;
case 0x500005: return (0xff - SupermanDip[1]) & 0x0f;
case 0x500007: return ((0xff - SupermanDip[1]) & 0xf0) >> 4;
case 0x800002: return 0xff;
case 0x800003: return tc0140_comm_r();
}
// bprintf(PRINT_NORMAL, "68000: Read Byte %06X\n", a);
return 0;
}
void __fastcall SupermanWriteWord(unsigned int a, unsigned short d)
{
switch (a) {
case 0x300000:
case 0x400000:
case 0x600000:
case 0x700000:
case 0xc00000:
return;
case 0x800000:
case 0x800002:
SEK_DEF_WRITE_WORD(0, a, d);
return;
}
// bprintf(PRINT_NORMAL, "68000: Write Word %06X %04X\n", a, d);
return;
}
void __fastcall SupermanWriteByte(unsigned int a, unsigned char d)
{
if (a >= 0x900000 && a <= 0x900fff) {
CChip_Write((a - 0x900000) / 2, d);
return;
}
switch (a) {
case 0x800001:
tc0140_port_w(d);
return;
case 0x800003:
SupermanSynchroniseZ80(0);
tc0140_comm_w(d);
return;
}
// bprintf(PRINT_NORMAL, "68000: Write Byte %06X %02X\n", a, d);
return;
}
static int SupermanDoReset()
{
SekOpen(0);
SekReset();
SekClose();
ZetOpen(0);
ZetReset();
Z80Bank = 0;
nCurrentBank = 0;
SupermanBankSwitch(0);
ZetClose();
BurnYM2610Reset();
nCyclesDone[0] = nCyclesDone[1] = 0;
return 0;
}
int SupermanInit()
{
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, 0x07ffff ,SM_ROM);
SekMapMemory(Superman_src_pal, 0xb00000, 0xb00fff, SM_RAM);
SekMapMemory(sysbvidattr , 0xd00000, 0xd00fff, SM_RAM);
SekMapMemory(sysbvidram , 0xe00000, 0xe03fff, SM_RAM);
SekMapMemory(Superman_ram , 0xf00000, 0xf03fff ,SM_RAM);
SekSetWriteWordHandler(0, SupermanWriteWord);
SekSetReadWordHandler(0, SupermanReadWord);
SekSetReadByteHandler(0, SupermanReadByte);
SekSetWriteByteHandler(0, SupermanWriteByte);
SekClose();
// ----------------- Cpu 2 Z80 ------------------------
ZetInit(1);
ZetSetReadHandler(SupermanZ80Read);
ZetSetWriteHandler(SupermanZ80Write);
ZetMapArea(0x0000, 0x3fff, 0, z80_rom);
ZetMapArea(0x0000, 0x3fff, 2, z80_rom);
ZetMapArea(0xc000, 0xdfff, 0, z80_ram);
ZetMapArea(0xc000, 0xdfff, 2, z80_ram);
ZetMapArea(0xc000, 0xdfff, 1, z80_ram);
ZetMemCallback(0xe000, 0xffff, 0);
ZetMemCallback(0xe000, 0xffff, 1);
ZetMemEnd();
ZetClose();
//-------------------------------------------------
//-------- sound stuff ----------------------------
nCurrentBank = -1;
int SupermanYM2610RomSize = 0x80000;
BurnYM2610Init(8000000, SupermanYM2610Rom, &SupermanYM2610RomSize, SupermanYM2610Rom, &SupermanYM2610RomSize, &SupermanFMIRQHandler, SupermanSynchroniseStream, SupermanGetTime);
BurnTimerAttachZet(4000000);
// ------- GFX Init -------------------
taito_pal=Superman_pal;
SysXInit(1);
SupermanDoReset();
return 0;
}
int SupermanExit()
{
free(ttiles);
SekExit();
ZetExit();
BurnYM2610Exit();
if (Mem != NULL)
free(Mem);
Mem = NULL;
return 0;
}
static int SupermanDraw()
{
SupermanPalUpdate();
SysXBG();
SysXSprites();
return 0;
}
int SupermanFrame()
{
if (SupermanReset) { // Reset machine
SupermanDoReset();
}
SupermanInpMake();
SekNewFrame();
ZetNewFrame();
SekOpen(0);
ZetOpen(0);
SekIdle(nCyclesDone[0]);
ZetIdle(nCyclesDone[1]);
nCyclesTotal[0] = 8000000 / 60;
nCyclesTotal[1] = 4000000 / 60;
SekRun(nCyclesTotal[0] - SekTotalCycles());
SekSetIRQLine(6, SEK_IRQSTATUS_AUTO);
nCycles68KSync = SekTotalCycles();
BurnTimerEndFrame(nCyclesTotal[1]);
BurnYM2610Update(nBurnSoundLen);
nCyclesDone[0] = SekTotalCycles() - nCyclesTotal[0];
nCyclesDone[1] = ZetTotalCycles() - nCyclesTotal[1];
ZetClose();
SekClose();
if (pBurnDraw) {
SupermanDraw(); // Draw screen if needed
}
return 0;
}
// Scan RAM
static int SupermanScan(int nAction,int *pnMin)
{
struct BurnArea ba;
if (nAction & 4) { // Scan volatile ram
if (pnMin != NULL) { // Return minimum compatible version
*pnMin = 0x029521;
}
memset(&ba, 0, sizeof(ba));
ba.Data = RamStart;
ba.nLen = RamEnd-RamStart;
ba.szName = "All Ram";
BurnAcb(&ba);
SekScan(nAction & 3); // Scan 68000
ZetScan(nAction); // Scan Z80
BurnYM2610Scan(nAction, pnMin);
// Scan critical driver variables
SCAN_VAR(SupermanInput);
SCAN_VAR(SupermanDip);
SCAN_VAR(Z80Bank);
SCAN_VAR(nCurrentBank);
SCAN_VAR(nCyclesDone);
}
return 0;
}
/// Rom information
static struct BurnRomInfo SupermanRomDesc[] = {
{ "a10_09.bin", 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG }, // 0 68000 Code
{ "a05_07.bin", 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG }, // 1
{ "a08_08.bin", 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG }, // 2
{ "a03_13.bin", 0x20000, 0x9f446a44, BRF_ESS | BRF_PRG }, // 3
{ "d18_10.bin", 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG }, // 4 Z80 Code
{ "f01_14.bin", 0x80000, 0x89368c3e, BRF_GRA }, // 5 Tiles
{ "j01_16.bin", 0x80000, 0x3622ed2f, BRF_GRA }, // 7
{ "h01_15.bin", 0x80000, 0x910cc4f9, BRF_GRA }, // 6
{ "k01_17.bin", 0x80000, 0xc34f27e0, BRF_GRA }, // 8
{ "e18_01.bin", 0x80000, 0x3cf99786, BRF_SND }, // 9 ADPCM Samples
};
STD_ROM_PICK(Superman);
STD_ROM_FN(Superman);
struct BurnDriver BurnDrvSuperman = {
"superman", NULL, NULL, "1988",
"Superman\0", NULL, "Taito Corporation", "Taito X System",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_MISC_MISC,
NULL, SupermanRomInfo, SupermanRomName, SupermanInputInfo, SupermanDIPInfo,
SupermanInit, SupermanExit, SupermanFrame, NULL, SupermanScan,
&taitoRecalcPal, 384, 240, 4, 3
};
// Rom information
static struct BurnRomInfo SuprmanjRomDesc[]=
{
{"a10_09.bin" , 0x20000, 0x640f1d58, BRF_ESS | BRF_PRG}, // 0 68000 Code
{"a05_07.bin" , 0x20000, 0xfddb9953, BRF_ESS | BRF_PRG}, // 1
{"a08_08.bin" , 0x20000, 0x79fc028e, BRF_ESS | BRF_PRG}, // 2
{"b61-06.a3" , 0x20000, 0x714a0b68, BRF_ESS | BRF_PRG}, // 3
{"d18_10.bin" , 0x10000, 0x6efe79e8, BRF_ESS | BRF_PRG}, // 4 Z80 Code
{"f01_14.bin" , 0x80000, 0x89368c3e, BRF_GRA}, // 5 Tiles
{"j01_16.bin" , 0x80000, 0x3622ed2f, BRF_GRA}, // 7
{"h01_15.bin" , 0x80000, 0x910cc4f9, BRF_GRA}, // 6
{"k01_17.bin" , 0x80000, 0xc34f27e0, BRF_GRA}, // 8
{"e18_01.bin" , 0x80000, 0x3cf99786, BRF_SND}, // 9 ADPCM Samples
};
STD_ROM_PICK(Suprmanj);
STD_ROM_FN(Suprmanj);
struct BurnDriver BurnDrvsuprmanj = {
"suprmanj", "superman", NULL, "1988",
"Superman (Japan)\0", NULL, "Taito Corporation", "Taito X System",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_MISC_MISC,
NULL, SuprmanjRomInfo, SuprmanjRomName, SupermanInputInfo, SupermanDIPInfo,
SupermanInit, SupermanExit, SupermanFrame, NULL, SupermanScan,
&taitoRecalcPal, 384, 240, 4, 3
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -