diff m68k_to_x86.c @ 106:1eba2b9455f8

Implement ORI to CCR/SR
author Mike Pavone <pavone@retrodev.com>
date Fri, 28 Dec 2012 11:07:13 -0800
parents 1a0fd122ca8f
children 9705075fcf36
line wrap: on
line diff
--- a/m68k_to_x86.c	Fri Dec 28 10:37:09 2012 -0800
+++ b/m68k_to_x86.c	Fri Dec 28 11:07:13 2012 -0800
@@ -2037,9 +2037,30 @@
 		dst = mov_ir(dst, 0, FLAG_V, SZ_B);
 		dst = m68k_save_result(inst, dst, opts);
 		break;
-	/*case M68K_ORI_CCR:
+	case M68K_ORI_CCR:
 	case M68K_ORI_SR:
-	case M68K_PEA:
+		dst = cycles(dst, 20);
+		//TODO: If ANDI to SR, trap if not in supervisor mode
+		if (inst->src.params.immed & 0x1) {
+			dst = mov_ir(dst, 1, FLAG_C, SZ_B);
+		}
+		if (inst->src.params.immed & 0x2) {
+			dst = mov_ir(dst, 1, FLAG_V, SZ_B);
+		}
+		if (inst->src.params.immed & 0x4) {
+			dst = mov_ir(dst, 1, FLAG_Z, SZ_B);
+		}
+		if (inst->src.params.immed & 0x8) {
+			dst = mov_ir(dst, 1, FLAG_N, SZ_B);
+		}
+		if (inst->src.params.immed & 0x10) {
+			dst = mov_irind(dst, 1, CONTEXT, SZ_B);
+		}
+		if (inst->op == M68K_ANDI_SR) {
+			dst = or_irdisp8(dst, inst->src.params.immed >> 8, CONTEXT, offsetof(m68k_context, status), SZ_B);
+		}
+		break;
+	/*case M68K_PEA:
 	case M68K_RESET:
 	case M68K_ROL:
 	case M68K_ROR: