Mercurial > repos > blastem
changeset 269:3c054d977175
Fix IX/IY displace modes. Fix check for registers requiring REX.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 02 May 2013 22:18:22 -0700 |
parents | 6c2d7e003a55 |
children | df5bf4c113dc |
files | z80_to_x86.c |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/z80_to_x86.c Thu May 02 21:54:04 2013 -0700 +++ b/z80_to_x86.c Thu May 02 22:18:22 2013 -0700 @@ -123,7 +123,7 @@ if (ea->base >= AH && ea->base <= BH) { if ((inst->addr_mode & 0x1F) == Z80_REG) { uint8_t other_reg = opts->regs[inst->ea_reg]; - if (other_reg > R8 || (other_reg >= RSP && other_reg <= RDI)) { + if (other_reg >= R8 || (other_reg >= RSP && other_reg <= RDI)) { //we can't mix an *H reg with a register that requires the REX prefix ea->base = opts->regs[z80_low_reg(inst->reg)]; dst = ror_ir(dst, 8, ea->base, SZ_W); @@ -150,7 +150,7 @@ } else if (opts->regs[inst->reg] >= AH && opts->regs[inst->reg] <= BH) { if ((inst->addr_mode & 0x1F) == Z80_REG) { uint8_t other_reg = opts->regs[inst->ea_reg]; - if (other_reg > R8 || (other_reg >= RSP && other_reg <= RDI)) { + if (other_reg >= R8 || (other_reg >= RSP && other_reg <= RDI)) { //we can't mix an *H reg with a register that requires the REX prefix dst = ror_ir(dst, 8, opts->regs[z80_low_reg(inst->reg)], SZ_W); } @@ -177,7 +177,7 @@ ea->base = opts->regs[inst->ea_reg]; if (ea->base >= AH && ea->base <= BH && inst->reg != Z80_UNUSED && inst->reg != Z80_USE_IMMED) { uint8_t other_reg = opts->regs[inst->reg]; - if (other_reg > R8 || (other_reg >= RSP && other_reg <= RDI)) { + if (other_reg >= R8 || (other_reg >= RSP && other_reg <= RDI)) { //we can't mix an *H reg with a register that requires the REX prefix ea->base = opts->regs[z80_low_reg(inst->ea_reg)]; dst = ror_ir(dst, 8, ea->base, SZ_W); @@ -244,6 +244,7 @@ dst = pop_r(dst, SCRATCH2); } } + ea->base = SCRATCH1; break; case Z80_UNUSED: ea->mode = MODE_UNUSED; @@ -262,7 +263,7 @@ dst = ror_ir(dst, 8, opts->regs[Z80_IY], SZ_W); } else if (inst->reg != Z80_UNUSED && inst->reg != Z80_USE_IMMED && opts->regs[inst->ea_reg] >= AH && opts->regs[inst->ea_reg] <= BH) { uint8_t other_reg = opts->regs[inst->reg]; - if (other_reg > R8 || (other_reg >= RSP && other_reg <= RDI)) { + if (other_reg >= R8 || (other_reg >= RSP && other_reg <= RDI)) { //we can't mix an *H reg with a register that requires the REX prefix dst = ror_ir(dst, 8, opts->regs[z80_low_reg(inst->ea_reg)], SZ_W); }