diff options
author | Michael Pavone <pavone@retrodev.com> | 2020-02-25 20:03:04 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2020-02-25 20:03:04 -0800 |
commit | 94c3e706af264bad799db8cc51a51f86356c6481 (patch) | |
tree | 0a801293f53693b1535b231b6f61195b5c24d62d /z80_to_x86.c | |
parent | b3a637af75c186c4243f9529aec2ab599c204c70 (diff) |
Fix edge case in Z80 interrupt handling. Fixes music in Metal Blast 2277
Diffstat (limited to 'z80_to_x86.c')
-rw-r--r-- | z80_to_x86.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/z80_to_x86.c b/z80_to_x86.c index 9c77674..d447ee3 100644 --- a/z80_to_x86.c +++ b/z80_to_x86.c @@ -3413,6 +3413,9 @@ void init_z80_opts(z80_options * options, memmap_chunk const * chunks, uint32_t add_rdispr(code, options->gen.context_reg, offsetof(z80_context, target_cycle), options->gen.cycles, SZ_D); cmp_rdispr(code, options->gen.context_reg, offsetof(z80_context, int_cycle), options->gen.cycles, SZ_D); jcc(code, CC_B, skip_int); + //check that we are not past the end of interrupt pulse + cmp_rrdisp(code, options->gen.cycles, options->gen.context_reg, offsetof(z80_context, int_pulse_end), SZ_D); + jcc(code, CC_B, skip_int); //set limit to the cycle limit mov_rdispr(code, options->gen.context_reg, offsetof(z80_context, sync_cycle), options->gen.scratch2, SZ_D); mov_rrdisp(code, options->gen.scratch2, options->gen.context_reg, offsetof(z80_context, target_cycle), SZ_D); |