From 3c049017f21445f336524f5f6668a69a5f20af83 Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 3 Sep 2024 22:47:38 +0200 Subject: [PATCH] core, timing fixes --- pico/pico_cmn.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pico/pico_cmn.c b/pico/pico_cmn.c index e9b79952..215dbeb8 100644 --- a/pico/pico_cmn.c +++ b/pico/pico_cmn.c @@ -51,10 +51,10 @@ static int SekSyncM68k(int once) // accessing the main bus. Account for these by shortening the time // the 68K CPU runs. int z80_buscyc = Pico.t.z80_buscycles >> (~Pico.m.scanline & 1); - if (z80_buscyc <= cyc_do) - SekExecM68k(cyc_do - z80_buscyc); - else - z80_buscyc = cyc_do; + // NB the Z80 isn't fast enough to steal more than half the bandwidth. + if (z80_buscyc > cyc_do/2) + z80_buscyc = cyc_do/2; + SekExecM68k(cyc_do - z80_buscyc); Pico.t.m68c_cnt += z80_buscyc; Pico.t.z80_buscycles -= z80_buscyc; if (once) break; @@ -233,6 +233,7 @@ static int PicoFrameHints(void) // there must be a delay after vblank bit is set and irq is asserted (Mazin Saga) // also delay between F bit (bit 7) is set in SR and IRQ happens (Ex-Mutants) // also delay between last H-int and V-int (Golden Axe 3) + // also delay between F bit and IRQ must not be too long (Kessler Incident demo) Pico.t.m68c_line_start = Pico.t.m68c_aim; PicoVideoFIFOMode(pv->reg[1]&0x40, pv->reg[12]&1); do_timing_hacks_start(pv); @@ -244,8 +245,8 @@ static int PicoFrameHints(void) pv->pending_ints |= 0x20; if (pv->reg[1] & 0x20) { - if (Pico.t.m68c_cnt - Pico.t.m68c_aim < 60) // CPU blocked? - SekExecM68k(11); // HACK + if (Pico.t.m68c_cnt - Pico.t.m68c_aim < 40) // CPU blocked? + SekExecM68k(10); // HACK elprintf(EL_INTS, "vint: @ %06x [%u]", SekPc, SekCyclesDone()); SekInterrupt(6); } -- 2.39.5