Wire the GameBoy board like a piece of powered hardware.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-11-12 00:38:03 +00:00
parent e326490cd9
commit 68b352d1df
2 changed files with 14 additions and 0 deletions

View File

@ -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; }

View File

@ -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());