Skip to content

Commit

Permalink
core z80, fix cycle counting if z80 in hold on frame change
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Jul 2, 2024
1 parent 25559e5 commit 2f0c563
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pico/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions pico/pico_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2f0c563

Please sign in to comment.