]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
68000 address error FC field modification hack if PC relative addressing.
authorToni Wilen <twilen@winuae.net>
Wed, 14 Aug 2019 19:25:02 +0000 (22:25 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 14 Aug 2019 19:25:02 +0000 (22:25 +0300)
newcpu.cpp

index 33bf3bd86d38c870dc4fa38e7f133a7b48793e2d..e1c2938f985f589188cca9ca2056c912c563d0e3 100644 (file)
@@ -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));