Actually interleave the CPUs in Battle Shark and update VBlank IRQ timing in Taito-Z driver

This commit is contained in:
Barry Harris 2014-05-06 20:20:42 +00:00
parent 8107ca47a8
commit 8f5f2108b7
1 changed files with 21 additions and 13 deletions

View File

@ -6412,7 +6412,8 @@ static void SpacegunDraw()
static INT32 TaitoZFrame()
{
INT32 nInterleave = TaitoFrameInterleave;
INT32 nInterleave = TaitoFrameInterleave;
INT32 nVBlankIRQFire = (INT32)(((double)256 / 271) * TaitoFrameInterleave);
if (TaitoReset) TaitoZDoReset();
@ -6433,18 +6434,26 @@ static INT32 TaitoZFrame()
nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU];
nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment);
if (i == 10 && Sci && ((GetCurrentFrame() & 1) == 0)) SekSetIRQLine(6, SEK_IRQSTATUS_AUTO);
if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO);
if (i == nVBlankIRQFire) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO);
SekClose();
// Run 68000 #2
if ((TaitoCpuACtrl & 0x01) && TaitoNumZ80s) {
nCurrentCPU = 1;
SekOpen(1);
nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave;
nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU];
nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment);
if (i == (TaitoFrameInterleave - 1)) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO);
SekClose();
if (TaitoNumZ80s) {
if (TaitoCpuACtrl & 0x01) {
nCurrentCPU = 1;
SekOpen(1);
nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave;
nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU];
nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment);
if (i == nVBlankIRQFire) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO);
SekClose();
}
} else {
nCurrentCPU = 1;
SekOpen(1);
BurnTimerUpdate(i * (nTaitoCyclesTotal[nCurrentCPU] / nInterleave));
if (i == nVBlankIRQFire) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO);
SekClose();
}
if (TaitoNumZ80s) {
@ -6460,10 +6469,9 @@ static INT32 TaitoZFrame()
if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen);
ZetClose();
} else {
SekOpen(1);
if (TaitoCpuACtrl & 0x01) BurnTimerEndFrame(nTaitoCyclesTotal[1]);
SekOpen(1);
if (TaitoCpuACtrl & 0x01) BurnTimerEndFrame(nTaitoCyclesTotal[1]);
if (pBurnSoundOut) BurnYM2610Update(pBurnSoundOut, nBurnSoundLen);
if (TaitoCpuACtrl & 0x01) SekSetIRQLine(TaitoIrqLine, SEK_IRQSTATUS_AUTO);
SekClose();
}