Skip to content

Commit

Permalink
z80: prevent infinite loop when op-stepping with wait active (fixes #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Dec 9, 2024
1 parent 5e8aa8c commit cf3b149
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void sim_step_op(void) {
prev_m1 = cpu_readM1(sim.cpu_state);
sim_step(1);
cur_m1 = cpu_readM1(sim.cpu_state);
} while (!(prev_m1 && !cur_m1)); // M1 pin is active-low!
} while (!(prev_m1 && !cur_m1) && cpu_readWAIT(sim.cpu_state)); // M1 pin is active-low!
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions src/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ uint8_t trace_z80_get_mcycle(uint32_t index) {
case (1<<2): return 3;
case (1<<3): return 4;
case (1<<4): return 5;
default: return 0xFF;
default: return 0;
}
}

Expand All @@ -441,7 +441,7 @@ uint8_t trace_z80_get_tstate(uint32_t index) {
case (1<<3): return 4;
case (1<<4): return 5;
case (1<<5): return 6;
default: return 0xFF;
default: return 0;
}
}

Expand Down

0 comments on commit cf3b149

Please sign in to comment.