# HG changeset patch # User Mike Pavone # Date 1357509645 28800 # Node ID f03db3db48fb882acb225a3114cd08a791d627d6 # Parent 7d1b04537377a9c60a08c717701bd8db01a7dd19 Implement EORI CCR/SR diff -r 7d1b04537377 -r f03db3db48fb m68k_to_x86.c --- a/m68k_to_x86.c Sun Jan 06 13:58:33 2013 -0800 +++ b/m68k_to_x86.c Sun Jan 06 14:00:45 2013 -0800 @@ -2726,8 +2726,32 @@ dst = mov_ir(dst, 0, FLAG_V, SZ_B); dst = m68k_save_result(inst, dst, opts); break; - /*case M68K_EORI_CCR: - case M68K_EORI_SR:*/ + case M68K_EORI_CCR: + case M68K_EORI_SR: + dst = cycles(dst, 20); + //TODO: If ANDI to SR, trap if not in supervisor mode + if (inst->src.params.immed & 0x1) { + dst = xor_ir(dst, 1, FLAG_C, SZ_B); + } + if (inst->src.params.immed & 0x2) { + dst = xor_ir(dst, 1, FLAG_V, SZ_B); + } + if (inst->src.params.immed & 0x4) { + dst = xor_ir(dst, 1, FLAG_Z, SZ_B); + } + if (inst->src.params.immed & 0x8) { + dst = xor_ir(dst, 1, FLAG_N, SZ_B); + } + if (inst->src.params.immed & 0x10) { + dst = xor_irdisp8(dst, 1, CONTEXT, 0, SZ_B); + } + if (inst->op == M68K_ORI_SR) { + dst = xor_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B); + if (inst->src.params.immed & 0x700) { + dst = call(dst, (uint8_t *)do_sync); + } + } + break; case M68K_EXG: dst = cycles(dst, 6); if (dst_op.mode == MODE_REG_DIRECT) {