diff --git a/cpuexec.cpp b/cpuexec.cpp index cba037e7..cd2b1ba1 100644 --- a/cpuexec.cpp +++ b/cpuexec.cpp @@ -24,9 +24,14 @@ void S9xMainLoop (void) #define CHECK_FOR_IRQ_CHANGE() \ if (Timings.IRQFlagChanging) \ { \ - if (Timings.IRQFlagChanging == IRQ_CLEAR_FLAG) \ + if (Timings.IRQFlagChanging & IRQ_TRIGGER_NMI) \ + { \ + CPU.NMIPending = TRUE; \ + Timings.NMITriggerPos = CPU.Cycles + 6; \ + } \ + if (Timings.IRQFlagChanging & IRQ_CLEAR_FLAG) \ ClearIRQ(); \ - else if (Timings.IRQFlagChanging == IRQ_SET_FLAG) \ + else if (Timings.IRQFlagChanging & IRQ_SET_FLAG) \ SetIRQ(); \ Timings.IRQFlagChanging = IRQ_NONE; \ } diff --git a/cpuops.cpp b/cpuops.cpp index f200068b..b2342bae 100644 --- a/cpuops.cpp +++ b/cpuops.cpp @@ -1452,7 +1452,7 @@ static void Op58 (void) AddCycles(ONE_CYCLE); #ifndef SA1_OPCODES - Timings.IRQFlagChanging = IRQ_CLEAR_FLAG; + Timings.IRQFlagChanging |= IRQ_CLEAR_FLAG; #else ClearIRQ(); #endif @@ -1464,7 +1464,7 @@ static void Op78 (void) AddCycles(ONE_CYCLE); #ifndef SA1_OPCODES - Timings.IRQFlagChanging = IRQ_SET_FLAG; + Timings.IRQFlagChanging |= IRQ_SET_FLAG; #else SetIRQ(); #endif diff --git a/memmap.cpp b/memmap.cpp index 392efceb..7d18f2f9 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -3614,8 +3614,6 @@ void CMemory::ApplyROMFixes (void) { //if (match_id("AVCJ")) // Rendering Ranger R2 // Timings.APUSpeedup = 2; - if (match_id("AANJ")) // Chou Aniki - Timings.APUSpeedup = -3; if (match_na("CIRCUIT USA")) Timings.APUSpeedup = 3; diff --git a/ppu.cpp b/ppu.cpp index 6bca9dc4..50446f3f 100644 --- a/ppu.cpp +++ b/ppu.cpp @@ -1403,8 +1403,7 @@ void S9xSetCPU (uint8 Byte, uint16 Address) { // FIXME: triggered at HC+=6, checked just before the final CPU cycle, // then, when to call S9xOpcode_NMI()? - CPU.NMIPending = TRUE; - Timings.NMITriggerPos = CPU.Cycles + 6 + 6; + Timings.IRQFlagChanging |= IRQ_TRIGGER_NMI; #ifdef DEBUGGER if (Settings.TraceHCEvent) diff --git a/snes9x.h b/snes9x.h index e096a1de..82d3aaf3 100644 --- a/snes9x.h +++ b/snes9x.h @@ -157,9 +157,10 @@ enum enum { - IRQ_NONE = 0, - IRQ_SET_FLAG = 1, - IRQ_CLEAR_FLAG = 2 + IRQ_NONE = 0x0, + IRQ_SET_FLAG = 0x1, + IRQ_CLEAR_FLAG = 0x2, + IRQ_TRIGGER_NMI = 0x4 }; struct STimings