# HG changeset patch # User Michael Pavone # Date 1446170766 25200 # Node ID 4556818b6847a3e9fb3a625b0684a2fd1ee8b7fb # Parent 9a5dc22297f2b78184c843e912294c5b030a39e0 Implement TRAPV diff -r 9a5dc22297f2 -r 4556818b6847 m68k_core.c --- a/m68k_core.c Thu Oct 29 01:06:48 2015 -0700 +++ b/m68k_core.c Thu Oct 29 19:06:06 2015 -0700 @@ -790,6 +790,7 @@ //traps OP_IMPL(M68K_CHK, translate_m68k_chk), 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), @@ -797,9 +798,6 @@ RAW_IMPL(M68K_NOP, translate_m68k_nop), RAW_IMPL(M68K_RESET, translate_m68k_reset), RAW_IMPL(M68K_TAS, translate_m68k_tas), - - //currently unimplemented - //M68K_TRAPV }; void translate_m68k(m68k_options * opts, m68kinst * inst) diff -r 9a5dc22297f2 -r 4556818b6847 m68k_core_x86.c --- a/m68k_core_x86.c Thu Oct 29 01:06:48 2015 -0700 +++ b/m68k_core_x86.c Thu Oct 29 19:06:06 2015 -0700 @@ -2116,6 +2116,19 @@ jcc(code, CC_C, loop_top); } +void translate_m68k_trapv(m68k_options *opts, m68kinst *inst) +{ + code_info *code = &opts->gen.code; + cycles(&opts->gen, BUS); + flag_to_carry(opts, FLAG_V); + code_ptr no_trap = code->cur + 1; + jcc(code, CC_NC, no_trap); + ldi_native(opts, VECTOR_TRAPV, opts->gen.scratch2); + ldi_native(opts, inst->address+2, opts->gen.scratch1); + jmp(code, opts->trap); + *no_trap = code->cur - (no_trap + 1); +} + void translate_m68k_move_from_sr(m68k_options *opts, m68kinst *inst, host_ea *src_op, host_ea *dst_op) { code_info *code = &opts->gen.code; diff -r 9a5dc22297f2 -r 4556818b6847 m68k_internal.h --- a/m68k_internal.h Thu Oct 29 01:06:48 2015 -0700 +++ b/m68k_internal.h Thu Oct 29 19:06:06 2015 -0700 @@ -60,6 +60,7 @@ void translate_m68k_dbcc(m68k_options * opts, m68kinst * inst); void translate_m68k_rtr(m68k_options *opts, m68kinst * inst); void translate_m68k_trap(m68k_options *opts, m68kinst *inst); +void translate_m68k_trapv(m68k_options *opts, m68kinst *inst); void translate_m68k_move(m68k_options * opts, m68kinst * inst); void translate_m68k_movep(m68k_options * opts, m68kinst * inst); void translate_m68k_arith(m68k_options *opts, m68kinst * inst, uint32_t flag_mask, host_ea *src_op, host_ea *dst_op);