Mercurial > repos > blastem
comparison z80_to_x86.c @ 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 | 37afb9cf58be |
children | 6fdac0108e47 |
comparison
equal
deleted
inserted
replaced
1902:32a3aa7b4a45 | 1903:62166274e6c0 |
---|---|
3410 | 3410 |
3411 options->gen.handle_cycle_limit_int = code->cur; | 3411 options->gen.handle_cycle_limit_int = code->cur; |
3412 neg_r(code, options->gen.cycles, SZ_D); | 3412 neg_r(code, options->gen.cycles, SZ_D); |
3413 add_rdispr(code, options->gen.context_reg, offsetof(z80_context, target_cycle), options->gen.cycles, SZ_D); | 3413 add_rdispr(code, options->gen.context_reg, offsetof(z80_context, target_cycle), options->gen.cycles, SZ_D); |
3414 cmp_rdispr(code, options->gen.context_reg, offsetof(z80_context, int_cycle), options->gen.cycles, SZ_D); | 3414 cmp_rdispr(code, options->gen.context_reg, offsetof(z80_context, int_cycle), options->gen.cycles, SZ_D); |
3415 jcc(code, CC_B, skip_int); | |
3416 //check that we are not past the end of interrupt pulse | |
3417 cmp_rrdisp(code, options->gen.cycles, options->gen.context_reg, offsetof(z80_context, int_pulse_end), SZ_D); | |
3415 jcc(code, CC_B, skip_int); | 3418 jcc(code, CC_B, skip_int); |
3416 //set limit to the cycle limit | 3419 //set limit to the cycle limit |
3417 mov_rdispr(code, options->gen.context_reg, offsetof(z80_context, sync_cycle), options->gen.scratch2, SZ_D); | 3420 mov_rdispr(code, options->gen.context_reg, offsetof(z80_context, sync_cycle), options->gen.scratch2, SZ_D); |
3418 mov_rrdisp(code, options->gen.scratch2, options->gen.context_reg, offsetof(z80_context, target_cycle), SZ_D); | 3421 mov_rrdisp(code, options->gen.scratch2, options->gen.context_reg, offsetof(z80_context, target_cycle), SZ_D); |
3419 neg_r(code, options->gen.cycles, SZ_D); | 3422 neg_r(code, options->gen.cycles, SZ_D); |