diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp index b14ecee..1298f14 100644 --- a/cpu/cpu.cpp +++ b/cpu/cpu.cpp @@ -54,6 +54,8 @@ Cpu::Cpu(Mem_device* bus) void Cpu::step() { + if(stopped) return; + if(!handleInterrupts()) // if no isr has been called, decode an instruction { if (halted) @@ -82,6 +84,7 @@ void Cpu::reset() state.IF = 0; halted = false; + stopped = false; } u8 Cpu::readPC8() diff --git a/cpu/cpu.h b/cpu/cpu.h index 0432c6f..8efd834 100644 --- a/cpu/cpu.h +++ b/cpu/cpu.h @@ -92,6 +92,7 @@ struct Cpu_state { u8 IF; bool halted; + bool stopped; void setAF(u16 v); u16 getAF();