diff options
author | Michael Pavone <pavone@retrodev.com> | 2015-10-21 23:31:17 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2015-10-21 23:31:17 -0700 |
commit | bc7046c222aedfcdbdb59c9ced6baebee684b057 (patch) | |
tree | ed22ad4f6e25bbb41a02f3bfbf6ca30ae9f435f4 | |
parent | 2774b6e5fd4fb0ee9bd1a14df29bff237d927d59 (diff) |
Implemented nbcd
-rw-r--r-- | m68k_core.c | 1 | ||||
-rw-r--r-- | m68k_core_x86.c | 33 |
2 files changed, 23 insertions, 11 deletions
diff --git a/m68k_core.c b/m68k_core.c index e087f2f..09e2662 100644 --- a/m68k_core.c +++ b/m68k_core.c @@ -720,6 +720,7 @@ impl_info m68k_impls[] = { BINARY_IMPL(M68K_SUBX, X|N|V|C), OP_IMPL(M68K_ABCD, translate_m68k_abcd_sbcd), OP_IMPL(M68K_SBCD, translate_m68k_abcd_sbcd), + OP_IMPL(M68K_NBCD, translate_m68k_abcd_sbcd), BINARY_IMPL(M68K_AND, N|Z|V0|C0), BINARY_IMPL(M68K_EOR, N|Z|V0|C0), BINARY_IMPL(M68K_OR, N|Z|V0|C0), 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; |