summaryrefslogtreecommitdiff
path: root/m68k_core_x86.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2014-12-27 14:51:50 -0800
committerMichael Pavone <pavone@retrodev.com>2014-12-27 14:51:50 -0800
commit7103c11ebae317680cbea6b4ae2c724206d8a6d4 (patch)
tree11d779fa90434c44e9d3bf7410696243c12de26d /m68k_core_x86.c
parent33f11a9c6f4b7497ba6830130501f1df1b90c463 (diff)
Decrement address register after fetching source in move with -(ax) dest to avoid bug when src is the dst addres reg
Diffstat (limited to 'm68k_core_x86.c')
-rw-r--r--m68k_core_x86.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/m68k_core_x86.c b/m68k_core_x86.c
index ef84721..4169389 100644
--- a/m68k_core_x86.c
+++ b/m68k_core_x86.c
@@ -604,10 +604,8 @@ void translate_m68k_move(m68k_options * opts, m68kinst * inst)
break;
case MODE_AREG_PREDEC:
dec_amount = inst->extra.size == OPSIZE_WORD ? 2 : (inst->extra.size == OPSIZE_LONG ? 4 : (inst->dst.params.regs.pri == 7 ? 2 : 1));
- subi_areg(opts, dec_amount, inst->dst.params.regs.pri);
case MODE_AREG_INDIRECT:
case MODE_AREG_POSTINC:
- areg_to_native(opts, inst->dst.params.regs.pri, opts->gen.scratch2);
if (src.mode == MODE_REG_DIRECT) {
if (src.base != opts->gen.scratch1) {
mov_rr(code, src.base, opts->gen.scratch1, inst->extra.size);
@@ -617,6 +615,10 @@ void translate_m68k_move(m68k_options * opts, m68kinst * inst)
} else {
mov_ir(code, src.disp, opts->gen.scratch1, inst->extra.size);
}
+ if (inst->dst.addr_mode == MODE_AREG_PREDEC) {
+ subi_areg(opts, dec_amount, inst->dst.params.regs.pri);
+ }
+ areg_to_native(opts, inst->dst.params.regs.pri, opts->gen.scratch2);
break;
case MODE_AREG_DISPLACE:
cycles(&opts->gen, BUS);