diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp index 8021826..dfa88e5 100644 --- a/cpu/cpu.cpp +++ b/cpu/cpu.cpp @@ -251,16 +251,16 @@ bool Cpu::handleInterrupts() if (state.IME == IME_SCHEDULED) state.IME = IME_ON; - else if (state.IME == IME_ON && si != 0) + else if (state.IME == IME_ON && state.SI() != 0) { u16 isr; InterruptType it; - if (si & INT_VBlank) { it = INT_VBlank; isr = 0x40; } - else if (si & INT_LCDSTAT) { it = INT_LCDSTAT; isr = 0x48; } - else if (si & INT_Timer) { it = INT_Timer; isr = 0x50; } - else if (si & INT_Serial) { it = INT_Serial; isr = 0x58; } - else if (si & INT_Joypad) { it = INT_Joypad; isr = 0x60; } + if (state.SI() & INT_VBlank) { it = INT_VBlank; isr = 0x40; } + else if (state.SI() & INT_LCDSTAT) { it = INT_LCDSTAT; isr = 0x48; } + else if (state.SI() & INT_Timer) { it = INT_Timer; isr = 0x50; } + else if (state.SI() & INT_Serial) { it = INT_Serial; isr = 0x58; } + else if (state.SI() & INT_Joypad) { it = INT_Joypad; isr = 0x60; } else panic("Can't find pending interrupt IE=%02x IF=%02x\n", state.IE, state.IF); state.IME = IME_OFF; // Disable IME