From: kub Date: Tue, 2 Jul 2024 20:43:26 +0000 (+0200) Subject: core z80, fix cycle counting if z80 in hold on frame change X-Git-Tag: v2.00~16 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f0c5639c13693092e36a00df5857b5b44302cef;p=picodrive.git core z80, fix cycle counting if z80 in hold on frame change --- diff --git a/pico/memory.c b/pico/memory.c index 34d0cf7b..69ca8aa3 100644 --- a/pico/memory.c +++ b/pico/memory.c @@ -530,7 +530,8 @@ void NOINLINE ctl_write_z80busreq(u32 d) { if (d) { - Pico.t.z80c_aim = Pico.t.z80c_cnt = z80_cycles_from_68k() + (Pico.t.z80_busdelay >> 8) + 2; + Pico.t.z80c_aim = Pico.t.z80c_cnt = z80_cycles_from_68k() + 2; + Pico.t.z80c_cnt += Pico.t.z80_busdelay >> 8; Pico.t.z80_busdelay &= 0xff; } else diff --git a/pico/pico_int.h b/pico/pico_int.h index c57c5f6a..3d495739 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -201,8 +201,10 @@ extern struct DrZ80 drZ80; #define Z80_STATE_SIZE 0x60 -#define z80_resetCycles() \ - Pico.t.z80c_cnt -= Pico.t.z80c_aim, Pico.t.z80c_aim = Pico.t.z80_scanline = 0 +#define z80_resetCycles() { \ + Pico.t.z80c_cnt -= Pico.t.z80c_aim, Pico.t.z80c_aim = Pico.t.z80_scanline = 0; \ + if (!Pico.m.z80Run | Pico.m.z80_reset) Pico.t.z80c_cnt = 0; \ +} #define z80_cyclesDone() \ (Pico.t.z80c_aim - z80_cyclesLeft)