--- hatari/src/uae-cpu/newcpu.c 2019/04/09 08:49:41 1.1.1.17 +++ hatari/src/uae-cpu/newcpu.c 2019/04/09 08:50:34 1.1.1.18 @@ -956,7 +956,7 @@ void Exception(int nr, uaecptr oldpc, in put_long (m68k_areg(regs, 7)+10, last_addr_for_exception_3); if (bExceptionDebugging) { fprintf(stderr,"Address Error at address $%x, PC=$%x\n",last_fault_for_exception_3,currpc); - DebugUI(); + DebugUI(REASON_CPU_EXCEPTION); } } else { /* Bus error */ @@ -977,7 +977,7 @@ void Exception(int nr, uaecptr oldpc, in BusErrorAddress, (long)currpc); unset_special(SPCFLAG_BUSERROR); if (bExceptionDebugging) - DebugUI(); + DebugUI(REASON_CPU_EXCEPTION); else DlgAlert_Notice("Detected double bus error => CPU halted!\nEmulation needs to be reset.\n"); regs.intmask = 7; @@ -986,7 +986,7 @@ void Exception(int nr, uaecptr oldpc, in } if (bExceptionDebugging && BusErrorAddress!=0xff8a00) { fprintf(stderr,"Bus Error at address $%x, PC=$%lx\n", BusErrorAddress, (long)currpc); - DebugUI(); + DebugUI(REASON_CPU_EXCEPTION); } } } @@ -994,7 +994,7 @@ void Exception(int nr, uaecptr oldpc, in /* Set PC and flags */ if (bExceptionDebugging && get_long (regs.vbr + 4*nr) == 0) { write_log("Uninitialized exception handler #%i!\n", nr); - DebugUI(); + DebugUI(REASON_CPU_EXCEPTION); } newpc = get_long (regs.vbr + 4*nr); if ( newpc & 1) /* check new pc is even */ @@ -1002,7 +1002,7 @@ void Exception(int nr, uaecptr oldpc, in if ( nr==2 || nr==3 ) /* address error during bus/address error -> stop emulation */ { fprintf(stderr,"Address Error during exception 2/3, aborting new PC=$%x\n",newpc); - DebugUI(); + DebugUI(REASON_CPU_EXCEPTION); } else { @@ -1741,6 +1741,9 @@ static void m68k_run_1 (void) /* the error to build the exception stack frame */ BusErrorPC = m68k_getpc(); + if (bDspEnabled) + Cycles_SetCounter(CYCLES_COUNTER_CPU, 0); /* to measure the total number of cycles spent in the cpu */ + cycles = (*cpufunctbl[opcode])(opcode); #ifdef DEBUG_PREFETCH @@ -1751,9 +1754,6 @@ static void m68k_run_1 (void) } #endif - if (bDspEnabled) - Cycles_SetCounter(CYCLES_COUNTER_CPU, 0); /* to measure the total number of cycles spent in the cpu */ - M68000_AddCyclesWithPairing(cycles); if (regs.spcflags & SPCFLAG_EXTRA_CYCLES) { /* Add some extra cycles to simulate a wait state */ @@ -1791,7 +1791,7 @@ static void m68k_run_1 (void) /* Run DSP 56k code if necessary */ if (bDspEnabled) { - DSP_Run( Cycles_GetCounter(CYCLES_COUNTER_CPU) ); + DSP_Run( Cycles_GetCounter(CYCLES_COUNTER_CPU) * 2); } } }