summaryrefslogtreecommitdiff
path: root/z80_to_x86.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-05-08 23:31:19 -0700
committerMike Pavone <pavone@retrodev.com>2013-05-08 23:31:19 -0700
commit425d13d843f702871465815b33f3bc35dc338e1c (patch)
treeb2df5f58126ebd4c8d7b1c6e8e87de23e68e628b /z80_to_x86.c
parent9378eb782ae7c636455912c5d6c778b3618dd3fa (diff)
Properly handle negative displacements in Z80 core
Diffstat (limited to 'z80_to_x86.c')
-rw-r--r--z80_to_x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/z80_to_x86.c b/z80_to_x86.c
index b02df09..bbd0288 100644
--- a/z80_to_x86.c
+++ b/z80_to_x86.c
@@ -189,7 +189,7 @@ uint8_t * translate_z80_ea(z80inst * inst, x86_ea * ea, uint8_t * dst, x86_z80_o
case Z80_IY_DISPLACE:
reg = opts->regs[(inst->addr_mode & 0x1F) == Z80_IX_DISPLACE ? Z80_IX : Z80_IY];
dst = mov_rr(dst, reg, areg, SZ_W);
- dst = add_ir(dst, inst->ea_reg, areg, SZ_W);
+ dst = add_ir(dst, inst->ea_reg & 0x80 ? inst->ea_reg - 256 : inst->ea_reg, areg, SZ_W);
size = z80_size(inst);
if (read) {
if (modify) {