cpu/cpu - Implement stop mode

This commit is contained in:
madmaurice 2023-08-29 23:46:36 +02:00
parent 4e506a4d3c
commit 2ab37c6468
2 changed files with 4 additions and 0 deletions

View file

@ -54,6 +54,8 @@ Cpu::Cpu(Mem_device* bus)
void Cpu::step() void Cpu::step()
{ {
if(stopped) return;
if(!handleInterrupts()) // if no isr has been called, decode an instruction if(!handleInterrupts()) // if no isr has been called, decode an instruction
{ {
if (halted) if (halted)
@ -82,6 +84,7 @@ void Cpu::reset()
state.IF = 0; state.IF = 0;
halted = false; halted = false;
stopped = false;
} }
u8 Cpu::readPC8() u8 Cpu::readPC8()

View file

@ -92,6 +92,7 @@ struct Cpu_state {
u8 IF; u8 IF;
bool halted; bool halted;
bool stopped;
void setAF(u16 v); void setAF(u16 v);
u16 getAF(); u16 getAF();