Mercurial > repos > blastem
changeset 716:b707a8ddc202
Make sure z80_save_reg does nothing when there is no register in the reg field of the instruction. This fixes a bug that corrupted SP in the MDEM 2011 demo
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 17 May 2015 20:03:27 -0700 |
parents | 1c2020d3e275 |
children | 22dbdf50d33c |
files | z80_to_x86.c |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/z80_to_x86.c Sun May 17 19:14:41 2015 -0700 +++ b/z80_to_x86.c Sun May 17 20:03:27 2015 -0700 @@ -81,6 +81,9 @@ void z80_save_reg(z80inst * inst, z80_options * opts) { code_info *code = &opts->gen.code; + if (inst->reg == Z80_USE_IMMED || inst->reg == Z80_UNUSED) { + return; + } if (inst->reg == Z80_IYH) { if ((inst->addr_mode & 0x1F) == Z80_REG && inst->ea_reg == Z80_IYL) { ror_ir(code, 8, opts->regs[Z80_IY], SZ_W);