diff options
author | Michael Pavone <pavone@retrodev.com> | 2015-05-17 20:03:27 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2015-05-17 20:03:27 -0700 |
commit | 9c11d06c90e3d1f8e1c7bfbd5478b5852fcae876 (patch) | |
tree | 3e45cd07df9dc13671781e075b1335562cd3686d | |
parent | e51040f08071327061219caa1c54d3dcb346b1c7 (diff) |
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
-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 bef749f..6d33c14 100644 --- a/z80_to_x86.c +++ b/z80_to_x86.c @@ -81,6 +81,9 @@ void translate_z80_reg(z80inst * inst, host_ea * ea, z80_options * opts) 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); |