diff m68k_core.c @ 986:f680fe746a7d

Implement illegal instruction trap
author Michael Pavone <pavone@retrodev.com>
date Tue, 26 Apr 2016 00:07:15 -0700
parents 751280fb4494
children 1f09994e92c5
line wrap: on
line diff
--- a/m68k_core.c	Sun Apr 24 21:23:28 2016 -0700
+++ b/m68k_core.c	Tue Apr 26 00:07:15 2016 -0700
@@ -339,6 +339,15 @@
 	jmp(code, opts->trap);
 }
 
+void translate_m68k_illegal(m68k_options *opts, m68kinst *inst)
+{
+	code_info *code = &opts->gen.code;
+	cycles(&opts->gen, BUS);
+	ldi_native(opts, VECTOR_ILLEGAL_INST, opts->gen.scratch2);
+	ldi_native(opts, inst->address, opts->gen.scratch1);
+	jmp(code, opts->trap);
+}
+
 void translate_m68k_move_usp(m68k_options *opts, m68kinst *inst)
 {
 	cycles(&opts->gen, BUS);
@@ -800,7 +809,7 @@
 	RAW_IMPL(M68K_TRAP, translate_m68k_trap),
 	RAW_IMPL(M68K_TRAPV, translate_m68k_trapv),
 	RAW_IMPL(M68K_ILLEGAL, translate_m68k_illegal),
-	RAW_IMPL(M68K_INVALID, translate_m68k_invalid),
+	RAW_IMPL(M68K_INVALID, translate_m68k_illegal),
 
 	//misc
 	RAW_IMPL(M68K_NOP, translate_m68k_nop),