diff m68k_core.c @ 989:d70000fdff0b

Implemented IR and undefined bits of info word for address error exception frames
author Michael Pavone <pavone@retrodev.com>
date Wed, 27 Apr 2016 21:39:17 -0700
parents ce9df7a5fdf2
children 33a46d35b913
line wrap: on
line diff
--- a/m68k_core.c	Wed Apr 27 19:10:50 2016 -0700
+++ b/m68k_core.c	Wed Apr 27 21:39:17 2016 -0700
@@ -702,6 +702,17 @@
 	}
 }
 
+uint16_t m68k_get_ir(m68k_context *context)
+{
+	uint32_t inst_addr = get_instruction_start(context->options, context->native_code_map, context->last_prefetch_address-2);
+	uint16_t *native_addr = get_native_pointer(inst_addr, (void **)context->mem_pointers, &context->options->gen);
+	if (native_addr) {
+		return *native_addr;
+	}
+	fprintf(stderr, "M68K: Failed to calculate value of IR. Last prefetch address: %X\n", context->last_prefetch_address);
+	return 0xFFFF;
+}
+
 typedef enum {
 	RAW_FUNC = 1,
 	BINARY_ARITH,
@@ -826,6 +837,7 @@
 	if (
 		(inst->src.addr_mode > MODE_AREG && inst->src.addr_mode < MODE_IMMEDIATE) 
 		|| (inst->dst.addr_mode > MODE_AREG && inst->dst.addr_mode < MODE_IMMEDIATE)
+		|| (inst->op == M68K_BCC && (inst->src.params.immed & 1))
 	) {
 		//Not accurate for all cases, but probably good enough for now
 		m68k_set_last_prefetch(opts, inst->address + inst->bytes);