--- hatari/src/uae-cpu/newcpu.c 2019/04/09 08:55:52 1.1.1.21 +++ hatari/src/uae-cpu/newcpu.c 2019/04/09 08:57:03 1.1.1.22 @@ -163,6 +163,7 @@ const char NewCpu_fileid[] = "Hatari new #include "debugui.h" #include "debugcpu.h" #include "68kDisass.h" +#include "stMemory.h" #ifdef HAVE_CAPSIMAGE #if CAPSIMAGE_VERSION == 5 @@ -391,9 +392,9 @@ struct regstruct regs; static long int m68kpc_offset; -#define get_ibyte_1(o) get_byte(regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1) -#define get_iword_1(o) get_word(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) -#define get_ilong_1(o) get_long(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) +#define get_ibyte_1(o) STMemory_ReadByte(regs.pc + (regs.pc_p - regs.pc_oldp) + (o) + 1) +#define get_iword_1(o) STMemory_ReadWord(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) +#define get_ilong_1(o) STMemory_ReadLong(regs.pc + (regs.pc_p - regs.pc_oldp) + (o)) uae_s32 ShowEA (FILE *f, int reg, amodes mode, wordsizes size, char *buf) { @@ -1060,7 +1061,9 @@ void Exception(int nr, uaecptr oldpc, in else if ( get_long(regs.instruction_pc) == 0x13f88e21 ) /* 13f8 8e21 move.b $ffff8e21.w,$xxxxx (Tymewarp) */ put_byte ( get_long(regs.instruction_pc+4) , 0x00 ); /* dest content should not be changed to "ff" but keep its value "00" */ - fprintf(stderr,"Bus Error at address $%x, PC=$%x addr_e3=%x op_e3=%x\n", BusErrorAddress, currpc, get_long(m68k_areg(regs, 7)+10) , BusError_opcode); + if (BusErrorAddress != 0xff8a00 || currpc < TosAddress || currpc > TosAddress + TosSize) + fprintf(stderr, "Bus Error at address $%x, PC=$%x addr_e3=%x op_e3=%x\n", + BusErrorAddress, currpc, get_long(m68k_areg(regs, 7)+10) , BusError_opcode); /* Check for double bus errors: */ if (regs.spcflags & SPCFLAG_BUSERROR) { @@ -1661,11 +1664,10 @@ static int do_specialties (void) Exception(2,0,M68000_EXC_SRC_CPU); } - if(regs.spcflags & SPCFLAG_EXTRA_CYCLES) { + if ( WaitStateCycles ) { /* Add some extra cycles to simulate a wait state */ - unset_special(SPCFLAG_EXTRA_CYCLES); - M68000_AddCycles(nWaitStateCycles); - nWaitStateCycles = 0; + M68000_AddCycles(WaitStateCycles); + WaitStateCycles = 0; } if (regs.spcflags & SPCFLAG_DOTRACE) { @@ -1816,11 +1818,11 @@ static void m68k_run_1 (void) #endif M68000_AddCyclesWithPairing(cycles); - if (regs.spcflags & SPCFLAG_EXTRA_CYCLES) { + + if ( WaitStateCycles ) { /* Add some extra cycles to simulate a wait state */ - unset_special(SPCFLAG_EXTRA_CYCLES); - M68000_AddCycles(nWaitStateCycles); - nWaitStateCycles = 0; + M68000_AddCycles(WaitStateCycles); + WaitStateCycles = 0; } /* We can have several interrupts at the same time before the next CPU instruction */ @@ -1843,7 +1845,7 @@ static void m68k_run_1 (void) /* Run DSP 56k code if necessary */ if (bDspEnabled) { - DSP_Run( Cycles_GetCounter(CYCLES_COUNTER_CPU) * 2); + DSP_Run( Cycles_GetCounter(CYCLES_COUNTER_CPU) * DSP_CPU_FREQ_RATIO); } } } @@ -1887,11 +1889,11 @@ static void m68k_run_2 (void) Cycles_SetCounter(CYCLES_COUNTER_CPU, 0); /* to measure the total number of cycles spent in the cpu */ M68000_AddCycles(cycles); - if (regs.spcflags & SPCFLAG_EXTRA_CYCLES) { + + if ( WaitStateCycles ) { /* Add some extra cycles to simulate a wait state */ - unset_special(SPCFLAG_EXTRA_CYCLES); - M68000_AddCycles(nWaitStateCycles); - nWaitStateCycles = 0; + M68000_AddCycles(WaitStateCycles); + WaitStateCycles = 0; } if ( PendingInterruptCount <= 0 ) @@ -1909,7 +1911,7 @@ static void m68k_run_2 (void) /* Run DSP 56k code if necessary */ if (bDspEnabled) { - DSP_Run( Cycles_GetCounter(CYCLES_COUNTER_CPU) ); + DSP_Run( Cycles_GetCounter(CYCLES_COUNTER_CPU) * DSP_CPU_FREQ_RATIO); } } }