Use IRQTransition again.

This commit is contained in:
Brandon Wright 2018-06-02 19:02:17 -05:00
parent 756f370021
commit e8afbb5e46

View File

@ -243,14 +243,8 @@ void S9xMainLoop (void)
}
}
if ((CPU.Cycles >= Timings.NextIRQTimer))
if (CPU.IRQTransition)
{
S9xUpdateIRQPositions(false);
#ifdef DEBUGGER
S9xTraceMessage ("Timer triggered\n");
#endif
if (CPU.WaitingForInterrupt)
{
CPU.WaitingForInterrupt = FALSE;
@ -259,10 +253,20 @@ void S9xMainLoop (void)
while (CPU.Cycles >= CPU.NextEvent)
S9xDoHEventProcessing();
}
CPU.IRQTransition = FALSE;
CPU.IRQLine = TRUE;
}
if (CPU.Cycles >= Timings.NextIRQTimer)
{
#ifdef DEBUGGER
S9xTraceMessage ("Timer triggered\n");
#endif
S9xUpdateIRQPositions(false);
CPU.IRQTransition = TRUE;
}
if ((CPU.IRQLine || CPU.IRQExternal) && !CheckFlag(IRQ))
{
/* The flag pushed onto the stack is the new value */
@ -273,7 +277,6 @@ void S9xMainLoop (void)
/* Change IRQ flag for instructions that set it only on last cycle */
CHECK_FOR_IRQ_CHANGE();
#ifdef DEBUGGER
if ((CPU.Flags & BREAK_FLAG) && !(CPU.Flags & SINGLE_STEP_FLAG))
{