From bc7046c222aedfcdbdb59c9ced6baebee684b057 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 21 Oct 2015 23:31:17 -0700 Subject: Implemented nbcd --- m68k_core_x86.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'm68k_core_x86.c') diff --git a/m68k_core_x86.c b/m68k_core_x86.c index 32f143b..bb3c702 100644 --- a/m68k_core_x86.c +++ b/m68k_core_x86.c @@ -1373,18 +1373,29 @@ void translate_m68k_invalid(m68k_options *opts, m68kinst *inst) void translate_m68k_abcd_sbcd(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op) { code_info *code = &opts->gen.code; - if (src_op->base != opts->gen.scratch2) { - if (src_op->mode == MODE_REG_DIRECT) { - mov_rr(code, src_op->base, opts->gen.scratch2, SZ_B); - } else { - mov_rdispr(code, src_op->base, src_op->disp, opts->gen.scratch2, SZ_B); + if (inst->op == M68K_NBCD) { + if (dst_op->base != opts->gen.scratch2) { + if (dst_op->mode == MODE_REG_DIRECT) { + mov_rr(code, dst_op->base, opts->gen.scratch2, SZ_B); + } else { + mov_rdispr(code, dst_op->base, dst_op->disp, opts->gen.scratch2, SZ_B); + } } - } - if (dst_op->base != opts->gen.scratch1) { - if (dst_op->mode == MODE_REG_DIRECT) { - mov_rr(code, dst_op->base, opts->gen.scratch1, SZ_B); - } else { - mov_rdispr(code, dst_op->base, dst_op->disp, opts->gen.scratch1, SZ_B); + xor_rr(code, opts->gen.scratch1, opts->gen.scratch1, SZ_B); + } else { + if (src_op->base != opts->gen.scratch2) { + if (src_op->mode == MODE_REG_DIRECT) { + mov_rr(code, src_op->base, opts->gen.scratch2, SZ_B); + } else { + mov_rdispr(code, src_op->base, src_op->disp, opts->gen.scratch2, SZ_B); + } + } + if (dst_op->base != opts->gen.scratch1) { + if (dst_op->mode == MODE_REG_DIRECT) { + mov_rr(code, dst_op->base, opts->gen.scratch1, SZ_B); + } else { + mov_rdispr(code, dst_op->base, dst_op->disp, opts->gen.scratch1, SZ_B); + } } } uint8_t other_reg; -- cgit v1.2.3