Mercurial > repos > blastem
changeset 1903:62166274e6c0
Fix edge case in Z80 interrupt handling. Fixes music in Metal Blast 2277
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 25 Feb 2020 20:03:04 -0800 |
parents | 32a3aa7b4a45 |
children | 8312e574100a |
files | z80_to_x86.c |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/z80_to_x86.c Mon Feb 24 20:06:29 2020 -0800 +++ b/z80_to_x86.c Tue Feb 25 20:03:04 2020 -0800 @@ -3413,6 +3413,9 @@ 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);