new timing for main and cd

This commit is contained in:
notaz 2013-08-26 00:32:31 +03:00
parent 75a30842c4
commit ae214f1c37
19 changed files with 507 additions and 474 deletions

View file

@ -169,7 +169,7 @@ int PicoReset(void)
SekReset();
// s68k doesn't have the TAS quirk, so we just globally set normal TAS handler in MCD mode (used by Batman games).
SekSetRealTAS(PicoAHW & PAHW_MCD);
SekCycleCntT = SekCycleCnt = SekCycleAim = 0;
SekCycleCnt = SekCycleAim = 0;
if (PicoAHW & PAHW_MCD)
// needed for MCD to reset properly, probably some bug hides behind this..
@ -278,23 +278,25 @@ PICO_INTERNAL int CheckDMA(void)
#include "pico_cmn.c"
int z80stopCycle;
int z80_cycle_cnt; /* 'done' z80 cycles before z80_run() */
unsigned int last_z80_sync; /* in 68k cycles */
int z80_cycle_cnt;
int z80_cycle_aim;
int z80_scanline;
int z80_scanline_cycles; /* cycles done until z80_scanline */
/* sync z80 to 68k */
PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done)
PICO_INTERNAL void PicoSyncZ80(unsigned int m68k_cycles_done)
{
int cnt;
z80_cycle_aim = cycles_68k_to_z80(m68k_cycles_done);
z80_cycle_aim += cycles_68k_to_z80(m68k_cycles_done - last_z80_sync);
cnt = z80_cycle_aim - z80_cycle_cnt;
last_z80_sync = m68k_cycles_done;
pprof_start(z80);
elprintf(EL_BUSREQ, "z80 sync %i (%i|%i -> %i|%i)", cnt, z80_cycle_cnt, z80_cycle_cnt / 228,
z80_cycle_aim, z80_cycle_aim / 228);
elprintf(EL_BUSREQ, "z80 sync %i (%u|%u -> %u|%u)", cnt,
z80_cycle_cnt, z80_cycle_cnt / 288,
z80_cycle_aim, z80_cycle_aim / 288);
if (cnt > 0)
z80_cycle_cnt += z80_run(cnt);