diff --git a/LR35902/src/LR35902.cpp b/LR35902/src/LR35902.cpp index bf52c39..1fb7f57 100644 --- a/LR35902/src/LR35902.cpp +++ b/LR35902/src/LR35902.cpp @@ -338,8 +338,14 @@ int EightBit::LR35902::run(int limit) { auto ime = IME(); auto masked = interruptEnable & interruptFlags; - if (ime && masked) - m_bus.writeRegister(Bus::IF, 0); + if (masked) { + if (ime) { + m_bus.writeRegister(Bus::IF, 0); + } else { + if (isHalted()) + proceed(); + } + } if (ime && (masked & Bus::Interrupts::VerticalBlank)) { current += interrupt(0x40); diff --git a/inc/Processor.h b/inc/Processor.h index fba4ae8..1bb556f 100644 --- a/inc/Processor.h +++ b/inc/Processor.h @@ -50,6 +50,7 @@ namespace EightBit { bool isHalted() const { return m_halted; } void halt() { --PC().word; m_halted = true; } + void proceed() { ++PC().word; m_halted = false; } virtual void initialise();