📄 d_rastan.cpp
字号:
void __fastcall rastanWriteWord(unsigned int a,unsigned short d)
{
switch (a){
case 0xc20000:
if (PC080SN_ctrl_word_0[0]&0x01) {
d= -d;
}
p1scrolly=-d;
return;
case 0xc20002:
if (PC080SN_ctrl_word_0[0]&0x01) {
d= -d;
}
p2scrolly=-d;
return;
case 0xc40000:
if (PC080SN_ctrl_word_0[0]&0x01) {
d= -d;
}
p1scrollx=-d;
return;
case 0xc40002:
if (PC080SN_ctrl_word_0[0]&0x01) {
d= -d;
}
p2scrollx=-d;
return;
default:
bprintf(PRINT_NORMAL, _T("Word%x,%x\n"),a,d);
return;
}
}
void __fastcall rastanWriteByte(unsigned int a,unsigned char d)
{
switch (a)
{
case 0x3e0001:
tc0140_port_w(d);
return;
case 0x3e0003:
tc0140_comm_w(d);
return;
default:
bprintf(PRINT_NORMAL, _T("writebyte %x to %x\n"),a,d);
}
}
static int drvDoReset()
{
SekOpen(0);
SekReset();
SekClose();
ZetOpen(0);
ZetReset();
ZetRun(40000000/60);
ZetClose();
BurnYM2151Reset();
MSM5205Reset(0);
return 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;
}
int rastanExit()
{
free(tsprites);
free(ttiles);
BurnYM2151Exit();
MSM5205Exit(0);
SekExit(); // Deallocate 68000
ZetExit();
if (Mem!=NULL)
free(Mem);
Mem=NULL;
return 0;
}
static int rastanGFX()
{
PC080SN_bg();
PC080SN_fg();
PC090OJ_draw_sprites();
return 0;
}
static int rastanDraw()
{
BurnClearScreen();
rastanPalUpdate();
rastanGFX();
return 0;
}
int rastanFrame()
{
int nInterleave = 100;
rastanInpMake();
if (drvReset) { // Reset machine
drvDoReset();
}
SekNewFrame();
SekOpen(0);
ZetOpen(0);
nCyclesTotal[0] = 8000000/60;
nCyclesTotal[1] = 4000000/60;
rCyclesDone[0] = rCyclesDone[1] = 0;
int nSoundBufferPos = 0;
for (int i = 0; i < nInterleave; i++) {
int nCurrentCPU;
int nNext;
// Run 68000
nCurrentCPU = 0;
nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
nCyclesSegment = nNext - rCyclesDone[nCurrentCPU];
rCyclesDone[nCurrentCPU] += SekRun(nCyclesSegment);
// Run Z80
nCurrentCPU = 1;
nNext = (i + 1) * nCyclesTotal[nCurrentCPU] / nInterleave;
nCyclesSegment = nNext - rCyclesDone[nCurrentCPU];
nCyclesSegment = ZetRun(nCyclesSegment);
rCyclesDone[nCurrentCPU] += nCyclesSegment;
{
// Render sound segment
if (pBurnSoundOut) {
int nSegmentLength = nBurnSoundLen / nInterleave;
short* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM5205Render(0,pSoundBuf, nSegmentLength); //this wrong??
nSoundBufferPos += nSegmentLength;
}
}
}
{
// Make sure the buffer is entirely filled.
if (pBurnSoundOut) {
int nSegmentLength = nBurnSoundLen - nSoundBufferPos;
short* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1);
if (nSegmentLength) {
BurnYM2151Render(pSoundBuf, nSegmentLength);
MSM5205Render(0,pSoundBuf, nSegmentLength); //this wrong??
}
}
}
SekSetIRQLine(5, SEK_IRQSTATUS_AUTO);
SekClose();
ZetClose();
if (pBurnDraw) {
rastanDraw(); // Draw screen if needed
}
return 0;
}
int rastanScan(int nAction,int *pnMin)
{
return 1;
}
////
STDINPUTINFO(rastan);
/// Rom information
static struct BurnRomInfo rastanRomDesc[] = {
{ "ic19_38.bin", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "ic07_37.bin", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic20_40.bin", 0x10000, 0x0930d4b3, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "ic08_39.bin", 0x10000, 0xd95ade5e, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic21_42.bin", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "ic09_43.bin", 0x10000, 0xc34b9152, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic49_19.bin", 0x10000, 0xee81fdd8, BRF_GRA }, // 2 z80 code
{ "ic40_01.bin", 0x20000, 0xcd30de19, BRF_GRA }, // 2 8x8 tile bitmaps
{ "ic39_03.bin", 0x20000, 0xab67e064, BRF_GRA }, // 3
{ "ic67_02.bin", 0x20000, 0x54040fec, BRF_GRA }, // 4
{ "ic66_04.bin", 0x20000, 0x94737e93, BRF_GRA }, // 5
{ "ic15_05.bin", 0x20000, 0xc22d94ac, BRF_GRA }, // 6 Sprite
{ "ic14_07.bin", 0x20000, 0xb5632a51, BRF_GRA }, // 7
{ "ic28_06.bin", 0x20000, 0x002ccf39, BRF_GRA }, // 8
{ "ic27_08.bin", 0x20000, 0xfeafca05, BRF_GRA }, // 9
{ "ic76_20.bin", 0x10000, 0xfd1a34cc, BRF_GRA }, // samples
};
STD_ROM_PICK(rastan);
STD_ROM_FN(rastan);
/// Rom information
static struct BurnRomInfo rastanuRomDesc[] = {
{ "ic19_38.bin", 0x10000, 0x1c91dbb1, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "ic07_37.bin", 0x10000, 0xecf20bdd, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "b04-45.20", 0x10000, 0x362812dd, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "b04-44.8", 0x10000, 0x51cc5508, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic21_42.bin", 0x10000, 0x1857a7cb, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "b04-41-1.9", 0x10000, 0xbd403269, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic49_19.bin", 0x10000, 0xee81fdd8, BRF_GRA }, // 2 z80 code
{ "ic40_01.bin", 0x20000, 0xcd30de19, BRF_GRA }, // 2 8x8 tile bitmaps
{ "ic39_03.bin", 0x20000, 0xab67e064, BRF_GRA }, // 3
{ "ic67_02.bin", 0x20000, 0x54040fec, BRF_GRA }, // 4
{ "ic66_04.bin", 0x20000, 0x94737e93, BRF_GRA }, // 5
{ "ic15_05.bin", 0x20000, 0xc22d94ac, BRF_GRA }, // 6 Sprite
{ "ic14_07.bin", 0x20000, 0xb5632a51, BRF_GRA }, // 7
{ "ic28_06.bin", 0x20000, 0x002ccf39, BRF_GRA }, // 8
{ "ic27_08.bin", 0x20000, 0xfeafca05, BRF_GRA }, // 9
{ "ic76_20.bin", 0x10000, 0xfd1a34cc, BRF_GRA }, // samples
};
STD_ROM_PICK(rastanu);
STD_ROM_FN(rastanu);
/// Rom information
static struct BurnRomInfo rastanu2RomDesc[] = {
{ "rs19_38.bin", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "b04-21.7", 0x10000, 0x7c8dde9a, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "b04-23.20", 0x10000, 0x254b3dce, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "b04-22.8", 0x10000, 0x98e8edcf, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "b04-25.21", 0x10000, 0xd1e5adee, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "b04-24.9", 0x10000, 0xa3dcc106, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic49_19.bin", 0x10000, 0xee81fdd8, BRF_GRA }, // 2 z80 code
{ "ic40_01.bin", 0x20000, 0xcd30de19, BRF_GRA }, // 2 8x8 tile bitmaps
{ "ic39_03.bin", 0x20000, 0xab67e064, BRF_GRA }, // 3
{ "ic67_02.bin", 0x20000, 0x54040fec, BRF_GRA }, // 4
{ "ic66_04.bin", 0x20000, 0x94737e93, BRF_GRA }, // 5
{ "ic15_05.bin", 0x20000, 0xc22d94ac, BRF_GRA }, // 6 Sprite
{ "ic14_07.bin", 0x20000, 0xb5632a51, BRF_GRA }, // 7
{ "ic28_06.bin", 0x20000, 0x002ccf39, BRF_GRA }, // 8
{ "ic27_08.bin", 0x20000, 0xfeafca05, BRF_GRA }, // 9
{ "ic76_20.bin", 0x10000, 0xfd1a34cc, BRF_GRA }, // samples
};
STD_ROM_PICK(rastanu2);
STD_ROM_FN(rastanu2);
/// Rom information
static struct BurnRomInfo rastsagaRomDesc[] = {
{ "rs19_38.bin", 0x10000, 0xa38ac909, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "rs07_37.bin", 0x10000, 0xbad60872, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "rs20_40.bin", 0x10000, 0x6bcf70dc, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "rs08_39.bin", 0x10000, 0x8838ecc5, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "rs21_42.bin", 0x10000, 0xb626c439, BRF_ESS | BRF_PRG }, // 0 68000 code (even)
{ "rs09_43.bin", 0x10000, 0xc928a516, BRF_ESS | BRF_PRG }, // 1 (odd)
{ "ic49_19.bin", 0x10000, 0xee81fdd8, BRF_GRA }, // 2 z80 code
{ "ic40_01.bin", 0x20000, 0xcd30de19, BRF_GRA }, // 2 8x8 tile bitmaps
{ "ic39_03.bin", 0x20000, 0xab67e064, BRF_GRA }, // 3
{ "ic67_02.bin", 0x20000, 0x54040fec, BRF_GRA }, // 4
{ "ic66_04.bin", 0x20000, 0x94737e93, BRF_GRA }, // 5
{ "ic15_05.bin", 0x20000, 0xc22d94ac, BRF_GRA }, // 6 Sprite
{ "ic14_07.bin", 0x20000, 0xb5632a51, BRF_GRA }, // 7
{ "ic28_06.bin", 0x20000, 0x002ccf39, BRF_GRA }, // 8
{ "ic27_08.bin", 0x20000, 0xfeafca05, BRF_GRA }, // 9
{ "ic76_20.bin", 0x10000, 0xfd1a34cc, BRF_GRA }, // samples
};
STD_ROM_PICK(rastsaga);
STD_ROM_FN(rastsaga);
struct BurnDriver BurnDrvrastan = {
"rastan", NULL, NULL, "1987",
"Rastan\0", NULL, "Taito Corporation Japan", "Custom Taito",
NULL, NULL, NULL, NULL,
1,2,HARDWARE_MISC_MISC,
NULL,rastanRomInfo,rastanRomName,rastanInputInfo, rastanDIPInfo,
rastanInit,rastanExit,rastanFrame,NULL,rastanScan,
NULL,320,240,4,3
};
struct BurnDriver BurnDrvrastanu = {
"rastanu", "rastan", NULL, "1987",
"Rastan (US set 1)\0", NULL, "Taito America Corporation", "Custom Taito",
NULL, NULL, NULL, NULL,
1 | BDF_CLONE,2,HARDWARE_MISC_MISC,
NULL,rastanuRomInfo,rastanuRomName,rastanInputInfo, rastanDIPInfo,
rastanInit,rastanExit,rastanFrame,NULL,rastanScan,
NULL,320,240,4,3
};
struct BurnDriver BurnDrvrastanu2 = {
"rastanu2", "rastan", NULL, "1987",
"Rastan (US set 2)\0", NULL, "Taito America Corporation", "Custom Taito",
NULL, NULL, NULL, NULL,
1 | BDF_CLONE,2,HARDWARE_MISC_MISC,
NULL,rastanu2RomInfo,rastanu2RomName,rastanInputInfo, rastanDIPInfo,
rastanInit,rastanExit,rastanFrame,NULL,rastanScan,
NULL,320,240,4,3
};
struct BurnDriver BurnDrvrastsaga = {
"rastsaga", "rastan", NULL, "1987",
"Rastan Saga (Japan)\0", NULL, "Taito Corporation", "Custom Taito",
NULL, NULL, NULL, NULL,
1 | BDF_CLONE,2,HARDWARE_MISC_MISC,
NULL,rastsagaRomInfo,rastsagaRomName,rastanInputInfo, rastanDIPInfo,
rastanInit,rastanExit,rastanFrame,NULL,rastanScan,
NULL,320,240,4,3
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -