changeset 1027:276cd582b728

Fix PC value pushed to stack for A and F line traps
author Michael Pavone <pavone@retrodev.com>
date Tue, 10 May 2016 21:26:27 -0700
parents 7267bc1ab547
children 56b1748a8473
files m68k_core.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/m68k_core.c	Tue May 10 08:59:17 2016 -0700
+++ b/m68k_core.c	Tue May 10 21:26:27 2016 -0700
@@ -334,11 +334,12 @@
 void translate_m68k_trap(m68k_options *opts, m68kinst *inst)
 {
 	code_info *code = &opts->gen.code;
-	uint32_t vector;
+	uint32_t vector, pc = inst->address;
 	switch (inst->op)
 	{
 	case M68K_TRAP:
 		vector = inst->src.params.immed + VECTOR_TRAP_0;
+		pc += 2;
 		break;
 	case M68K_A_LINE_TRAP:
 		vector = VECTOR_LINE_1010;
@@ -348,7 +349,7 @@
 		break;
 	}
 	ldi_native(opts, vector, opts->gen.scratch2);
-	ldi_native(opts, inst->address+2, opts->gen.scratch1);
+	ldi_native(opts, pc, opts->gen.scratch1);
 	jmp(code, opts->trap);
 }