From 2ab37c6468e5e908623d3516ce2275e40497e643 Mon Sep 17 00:00:00 2001 From: MadMaurice Date: Tue, 29 Aug 2023 23:46:36 +0200 Subject: [PATCH] cpu/cpu - Implement stop mode --- cpu/cpu.cpp | 3 +++ cpu/cpu.h | 1 + 2 files changed, 4 insertions(+) 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();