diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp index 1298f14..12a9136 100644 --- a/cpu/cpu.cpp +++ b/cpu/cpu.cpp @@ -54,11 +54,11 @@ Cpu::Cpu(Mem_device* bus) void Cpu::step() { - if(stopped) return; + if(state.stopped) return; if(!handleInterrupts()) // if no isr has been called, decode an instruction { - if (halted) + if (state.halted) processed_mcycles += 4; else executeInstruction(); @@ -83,8 +83,8 @@ void Cpu::reset() state.IE = 0; state.IF = 0; - halted = false; - stopped = false; + state.halted = false; + state.stopped = false; } u8 Cpu::readPC8() @@ -235,7 +235,7 @@ bool Cpu::handleInterrupts() // Once there's an interrupt we exit halt mode if (si) - halted = false; + state.halted = false; if (state.IME == IME_SCHEDULED) state.IME = IME_ON; diff --git a/cpu/decoder.cpp b/cpu/decoder.cpp index 7c6699f..97f0dbb 100644 --- a/cpu/decoder.cpp +++ b/cpu/decoder.cpp @@ -472,11 +472,11 @@ void Cpu::executeInstruction() break; case 0x76: // HALT - halted = true; + state.halted = true; break; case 0x10: // STOP n8 (void)readPC8(); - stopped = true; + state.stopped = true; break; case 0xE8: // ADD SP, e8