summaryrefslogtreecommitdiff
path: root/m68k_core_x86.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-10-28 19:45:24 -0700
committerMichael Pavone <pavone@retrodev.com>2015-10-28 19:45:24 -0700
commit0a372b26313bf60fe7afedfcfeea20149f2b4399 (patch)
tree277a76d229f40f2e5341fdc9d586e3a9e6dcc81d /m68k_core_x86.c
parent2d194bb1c94eb4eb4901d8cfa14cacb67450d833 (diff)
Implement TAS
Diffstat (limited to 'm68k_core_x86.c')
-rw-r--r--m68k_core_x86.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/m68k_core_x86.c b/m68k_core_x86.c
index bb3c702..f23c51d 100644
--- a/m68k_core_x86.c
+++ b/m68k_core_x86.c
@@ -1312,6 +1312,39 @@ void translate_m68k_cmp(m68k_options * opts, m68kinst * inst)
translate_m68k_arith(opts, inst, N|Z|V|C, &src_op, &dst_op);
}
+void translate_m68k_tas(m68k_options *opts, m68kinst *inst)
+{
+ code_info *code = &opts->gen.code;
+ host_ea op;
+ translate_m68k_op(inst, &op, opts, 1);
+ if (op.mode == MODE_REG_DIRECT) {
+ cmp_ir(code, 0, op.base, SZ_B);
+ } else {
+ cmp_irdisp(code, 0, op.base, op.disp, SZ_B);
+ }
+ update_flags(opts, N|Z|V0|C0);
+ if (inst->dst.addr_mode == MODE_REG) {
+ cycles(&opts->gen, BUS);
+ if (op.mode == MODE_REG_DIRECT) {
+ bts_ir(code, 7, op.base, SZ_B);
+ } else {
+ bts_irdisp(code, 7, op.base, op.disp, SZ_B);
+ }
+ } else {
+ if (opts->gen.flags & M68K_OPT_BROKEN_READ_MODIFY) {
+ //2 cycles for processing
+ //4 for failed writeback
+ //4 for prefetch
+ cycles(&opts->gen, BUS * 2 + 2);
+ } else {
+ cycles(&opts->gen, 2);
+ bts_ir(code, 7, op.base, SZ_B);
+ m68k_save_result(inst, opts);
+ cycles(&opts->gen, BUS);
+ }
+ }
+}
+
void op_r(code_info *code, m68kinst *inst, uint8_t dst, uint8_t size)
{
switch(inst->op)