From 9f2a6ad91632a8136186d7965623a15e395e3bbb Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 14 Aug 2019 22:25:02 +0300 Subject: [PATCH] 68000 address error FC field modification hack if PC relative addressing. --- newcpu.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/newcpu.cpp b/newcpu.cpp index 33bf3bd8..e1c2938f 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -62,7 +62,7 @@ bool check_prefs_changed_comp (bool checkonly) { return false; } uae_s32 pissoff = 0; /* Opcode of faulting instruction */ -static uae_u16 last_op_for_exception_3; +static uae_u32 last_op_for_exception_3; /* PC at fault time */ static uaecptr last_addr_for_exception_3; /* Address that generated the exception */ @@ -2488,7 +2488,7 @@ static void Exception_ce000 (int nr) cpu_halt (CPU_HALT_DOUBLE_FAULT); return; } - write_log(_T("Exception %d (%04x %x) at %x -> %x!\n"), + write_log(_T("Exception %d (%08x %x) at %x -> %x!\n"), nr, last_op_for_exception_3, last_addr_for_exception_3, currpc, get_long_debug(4 * nr)); if (currprefs.cpu_model == 68000) { uae_u16 mode = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1); @@ -2496,6 +2496,10 @@ static void Exception_ce000 (int nr) mode |= last_notinstruction_for_exception_3 ? 8 : 0; // undocumented bits seem to contain opcode mode |= last_op_for_exception_3 & ~31; + uae_u16 statusormask = (last_op_for_exception_3 >> 16) & 0xff; + uae_u16 statusandmask = (last_op_for_exception_3 >> 24) & 0xff; + mode |= statusormask; + mode &= ~statusandmask; m68k_areg(regs, 7) -= 14; exception_in_exception = -1; x_put_word(m68k_areg(regs, 7) + 12, last_addr_for_exception_3); @@ -2939,6 +2943,10 @@ static void Exception_normal (int nr) uae_u16 mode = (sv ? 4 : 0) | (last_instructionaccess_for_exception_3 ? 2 : 1); mode |= last_writeaccess_for_exception_3 ? 0 : 16; mode |= last_notinstruction_for_exception_3 ? 8 : 0; + uae_u16 statusormask = (last_op_for_exception_3 >> 16) & 0xff; + uae_u16 statusandmask = (last_op_for_exception_3 >> 24) & 0xff; + mode |= statusormask; + mode &= ~statusandmask; exception_in_exception = -1; Exception_build_68000_address_error_stack_frame(mode, last_op_for_exception_3, last_fault_for_exception_3, last_addr_for_exception_3); write_log (_T("Exception %d (%x) at %x -> %x!\n"), nr, last_fault_for_exception_3, currpc, get_long_debug (regs.vbr + 4 * vector_nr)); -- 2.47.3