Clear WAI at different location. Fixes Top Gear 3000.

This commit is contained in:
Brandon Wright 2018-06-17 14:51:07 -05:00
parent 098f8c1c0c
commit 87fc997fb4
3 changed files with 21 additions and 22 deletions

View File

@ -243,7 +243,17 @@ void S9xMainLoop (void)
}
}
if (CPU.IRQTransition)
if (CPU.Cycles >= Timings.NextIRQTimer)
{
#ifdef DEBUGGER
S9xTraceMessage ("Timer triggered\n");
#endif
S9xUpdateIRQPositions(false);
CPU.IRQLine = TRUE;
}
if (CPU.IRQLine || CPU.IRQExternal)
{
if (CPU.WaitingForInterrupt)
{
@ -253,26 +263,13 @@ 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;
continue;
}
if ((CPU.IRQLine || CPU.IRQExternal) && !CheckFlag(IRQ))
{
/* The flag pushed onto the stack is the new value */
CHECK_FOR_IRQ_CHANGE();
S9xOpcode_IRQ();
if (!CheckFlag(IRQ))
{
/* The flag pushed onto the stack is the new value */
CHECK_FOR_IRQ_CHANGE();
S9xOpcode_IRQ();
}
}
/* Change IRQ flag for instructions that set it only on last cycle */
@ -408,8 +405,8 @@ void S9xDoHEventProcessing (void)
#ifdef DEBUGGER
if (Settings.TraceHCEvent)
S9xTraceFormattedMessage("--- HC event processing (%s) expected HC:%04d executed HC:%04d",
eventname[CPU.WhichEvent], CPU.NextEvent, CPU.Cycles);
S9xTraceFormattedMessage("--- HC event processing (%s) expected HC:%04d executed HC:%04d VC:%04d",
eventname[CPU.WhichEvent], CPU.NextEvent, CPU.Cycles, CPU.V_Counter);
#endif
switch (CPU.WhichEvent)

View File

@ -3488,6 +3488,7 @@ static void OpCB (void)
AddCycles(TWO_CYCLES);
#else
CPU.WaitingForInterrupt = TRUE;
Registers.PCw--;
AddCycles(ONE_CYCLE);
#endif

View File

@ -3,6 +3,7 @@ Snes9x 1.56.2
to cover the whole screen. (BearOso)
- Adjusted IRQ timing slightly. Fixes Dragon Ball Z - Super
Butouden 2. (BearOso)
- Clear WAI when IRQLine is active. Fixes Top Gear 3000. (BearOso)
- Fix reading the wrong tile data in mosaic drawing. Gets
rid of glitch at top of FF6 battle transitions. (BearOso)
- Win32: Don't mix garbage into the last line with NTSC