diff --git a/cpuexec.h b/cpuexec.h index 7e65b313..1ffd5737 100644 --- a/cpuexec.h +++ b/cpuexec.h @@ -278,10 +278,11 @@ static inline void S9xCheckInterrupts (void) if (CPU.IRQLine && thisIRQ) CPU.IRQTransition = TRUE; - if (PPU.HTimerEnabled) + int32 htimepos = PPU.HTimerEnabled ? PPU.HTimerPosition : 10; + + if (thisIRQ) { - int32 htimepos = PPU.HTimerPosition; - if (CPU.Cycles >= Timings.H_Max) + if (CPU.Cycles >= Timings.H_Max && htimepos < CPU.PrevCycles) htimepos += Timings.H_Max; if (CPU.PrevCycles >= htimepos || CPU.Cycles < htimepos) @@ -291,7 +292,7 @@ static inline void S9xCheckInterrupts (void) if (PPU.VTimerEnabled) { int32 vcounter = CPU.V_Counter; - if (CPU.Cycles >= Timings.H_Max) + if (htimepos >= Timings.H_Max) vcounter++; if (vcounter != PPU.VTimerPosition)