summaryrefslogtreecommitdiff
path: root/z80_to_x86.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-05-17 20:03:27 -0700
committerMichael Pavone <pavone@retrodev.com>2015-05-17 20:03:27 -0700
commit9c11d06c90e3d1f8e1c7bfbd5478b5852fcae876 (patch)
tree3e45cd07df9dc13671781e075b1335562cd3686d /z80_to_x86.c
parente51040f08071327061219caa1c54d3dcb346b1c7 (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
Diffstat (limited to 'z80_to_x86.c')
-rw-r--r--z80_to_x86.c3
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);