From 8f5f2108b7b90ebfdb83a2567488b9ba0d728928 Mon Sep 17 00:00:00 2001 From: Barry Harris <44396066+barry65536@users.noreply.github.com> Date: Tue, 6 May 2014 20:20:42 +0000 Subject: [PATCH] Actually interleave the CPUs in Battle Shark and update VBlank IRQ timing in Taito-Z driver --- src/burn/drv/taito/d_taitoz.cpp | 34 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/burn/drv/taito/d_taitoz.cpp b/src/burn/drv/taito/d_taitoz.cpp index bf24054d5..3567f92f9 100644 --- a/src/burn/drv/taito/d_taitoz.cpp +++ b/src/burn/drv/taito/d_taitoz.cpp @@ -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(); }