Mercurial > repos > blastem
comparison z80_to_x86.c @ 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 | 9ef6db986982 |
comparison
equal
deleted
inserted
replaced
715:1c2020d3e275 | 716:b707a8ddc202 |
---|---|
79 } | 79 } |
80 | 80 |
81 void z80_save_reg(z80inst * inst, z80_options * opts) | 81 void z80_save_reg(z80inst * inst, z80_options * opts) |
82 { | 82 { |
83 code_info *code = &opts->gen.code; | 83 code_info *code = &opts->gen.code; |
84 if (inst->reg == Z80_USE_IMMED || inst->reg == Z80_UNUSED) { | |
85 return; | |
86 } | |
84 if (inst->reg == Z80_IYH) { | 87 if (inst->reg == Z80_IYH) { |
85 if ((inst->addr_mode & 0x1F) == Z80_REG && inst->ea_reg == Z80_IYL) { | 88 if ((inst->addr_mode & 0x1F) == Z80_REG && inst->ea_reg == Z80_IYL) { |
86 ror_ir(code, 8, opts->regs[Z80_IY], SZ_W); | 89 ror_ir(code, 8, opts->regs[Z80_IY], SZ_W); |
87 mov_rr(code, opts->gen.scratch1, opts->regs[Z80_IYL], SZ_B); | 90 mov_rr(code, opts->gen.scratch1, opts->regs[Z80_IYL], SZ_B); |
88 ror_ir(code, 8, opts->regs[Z80_IY], SZ_W); | 91 ror_ir(code, 8, opts->regs[Z80_IY], SZ_W); |