# HG changeset patch # User Michael Pavone # Date 1461859242 25200 # Node ID 261995d06897650b79bcbfb95805ac4f9c3b139d # Parent f9ee6f746cb4438830f5678109953a2ae77f1979 Implemented A line and F line traps. diff -r f9ee6f746cb4 -r 261995d06897 68kinst.c --- a/68kinst.c Wed Apr 27 23:57:00 2016 -0700 +++ b/68kinst.c Thu Apr 28 09:00:42 2016 -0700 @@ -1221,7 +1221,8 @@ } } break; - case RESERVED: + case A_LINE: + decoded->op = M68K_A_LINE_TRAP; break; case CMP_XOR: size = (*istream >> 6) & 0x3; @@ -1540,8 +1541,9 @@ #endif } break; - case COPROC: - //TODO: Implement me + case F_LINE: + //TODO: Decode FPU instructions for members of the 68K family with an FPU + decoded->op = M68K_F_LINE_TRAP; break; } if (decoded->op == M68K_INVALID) { diff -r f9ee6f746cb4 -r 261995d06897 68kinst.h --- a/68kinst.h Wed Apr 27 23:57:00 2016 -0700 +++ b/68kinst.h Thu Apr 28 09:00:42 2016 -0700 @@ -26,12 +26,12 @@ MOVEQ, OR_DIV_SBCD, SUB_SUBX, - RESERVED, + A_LINE, CMP_XOR, AND_MUL_ABCD_EXG, ADD_ADDX, SHIFT_ROTATE, - COPROC + F_LINE } m68k_optypes; typedef enum { @@ -105,6 +105,8 @@ M68K_TST, M68K_UNLK, M68K_INVALID, + M68K_A_LINE_TRAP, + M68K_F_LINE_TRAP, #ifdef M68010 M68K_BKPT, M68K_MOVE_FROM_CCR, diff -r f9ee6f746cb4 -r 261995d06897 m68k_core.c --- a/m68k_core.c Wed Apr 27 23:57:00 2016 -0700 +++ b/m68k_core.c Thu Apr 28 09:00:42 2016 -0700 @@ -334,7 +334,20 @@ void translate_m68k_trap(m68k_options *opts, m68kinst *inst) { code_info *code = &opts->gen.code; - ldi_native(opts, inst->src.params.immed + VECTOR_TRAP_0, opts->gen.scratch2); + uint32_t vector; + switch (inst->op) + { + case M68K_TRAP: + vector = inst->src.params.immed + VECTOR_TRAP_0; + break; + case M68K_A_LINE_TRAP: + vector = VECTOR_LINE_1010; + break; + case M68K_F_LINE_TRAP: + vector = VECTOR_LINE_1111; + break; + } + ldi_native(opts, vector, opts->gen.scratch2); ldi_native(opts, inst->address+2, opts->gen.scratch1); jmp(code, opts->trap); } @@ -818,6 +831,8 @@ //traps OP_IMPL(M68K_CHK, translate_m68k_chk), RAW_IMPL(M68K_TRAP, translate_m68k_trap), + RAW_IMPL(M68K_A_LINE_TRAP, translate_m68k_trap), + RAW_IMPL(M68K_F_LINE_TRAP, translate_m68k_trap), RAW_IMPL(M68K_TRAPV, translate_m68k_trapv), RAW_IMPL(M68K_ILLEGAL, translate_m68k_illegal), RAW_IMPL(M68K_INVALID, translate_m68k_illegal),