--- hatari/src/uae-cpu/events.h 2019/04/01 07:09:16 1.1 +++ hatari/src/uae-cpu/events.h 2019/04/01 07:10:07 1.1.1.3 @@ -5,23 +5,22 @@ * slowdown. */ -#include "../includes/decode.h" #include "../includes/main.h" +#include "../includes/decode.h" STATIC_INLINE void do_cycles(unsigned long cycles_to_add) { -cycles_to_add*=2; /* ? Better values ? */ - SoundCycles += cycles_to_add; /* Add in cycle time to get cycle-accurate sample playback */ - PendingInterruptCount -= (short)cycles_to_add; /* Add cycle time including effective address time */ + cycles_to_add = (cycles_to_add+3)&0xfffffffc; + lastInstructionCycles = cycles_to_add; /* Store to find how many cycles last instruction took to execute */ + SoundCycles += cycles_to_add; /* Add in cycle time to get cycle-accurate sample playback */ + PendingInterruptCount -= (short)cycles_to_add; /* Add cycle time including effective address time */ if( PendingInterruptCount<=0 || PendingInterruptFlag) /* Check for any interrupts or flag to service */ { - if( PendingInterruptFlag&PENDING_INTERRUPT_FLAG_TRACE ) - M68000_TraceModeTriggered(); -//fprintf(stderr,"do_cycles: PendingInterruptFlag=%i, PendingInterruptCount=%i, PendingInterruptFunction=%lx\n", -// (int)PendingInterruptFlag, (int)PendingInterruptCount, (long)PendingInterruptFunction); - if( 1/*PendingInterruptFlag&PENDING_INTERRUPT_FLAG_MFP*/ ) - if( PendingInterruptCount<=0 && PendingInterruptFunction ) - { CALL_VAR(PendingInterruptFunction); } - MFP_CheckPendingInterrupts(); + /*if( PendingInterruptFlag&PENDING_INTERRUPT_FLAG_TRACE ) + M68000_TraceModeTriggered();*/ + if( PendingInterruptFlag&PENDING_INTERRUPT_FLAG_MFP ) + MFP_CheckPendingInterrupts(); + if( PendingInterruptCount<=0 && PendingInterruptFunction ) + CALL_VAR(PendingInterruptFunction); } }