diff --git a/LR35902/inc/GameBoyBus.h b/LR35902/inc/GameBoyBus.h index 1a48ca0..b783750 100644 --- a/LR35902/inc/GameBoyBus.h +++ b/LR35902/inc/GameBoyBus.h @@ -36,6 +36,9 @@ namespace EightBit { Bus() noexcept; + virtual void powerOn() override; + virtual void powerOff() override; + auto& CPU() { return m_cpu; } auto& VRAM() { return m_videoRam; } auto& OAMRAM() { return m_oamRam; } diff --git a/LR35902/src/GameBoyBus.cpp b/LR35902/src/GameBoyBus.cpp index abdfc61..be4fb94 100644 --- a/LR35902/src/GameBoyBus.cpp +++ b/LR35902/src/GameBoyBus.cpp @@ -8,6 +8,17 @@ EightBit::GameBoy::Bus::Bus() noexcept WrittenByte.connect(std::bind(&GameBoy::Bus::Bus_WrittenByte, this, std::placeholders::_1)); } +void EightBit::GameBoy::Bus::powerOn() { + EightBit::Bus::powerOn(); + CPU().powerOn(); + reset(); +} + +void EightBit::GameBoy::Bus::powerOff() { + CPU().powerOff(); + EightBit::Bus::powerOff(); +} + void EightBit::GameBoy::Bus::reset() { IO().reset(); LR35902::lower(CPU().RESET());