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)