From 01317796c039412fb33543f4863fa6ad8b9a76e7 Mon Sep 17 00:00:00 2001 From: "Adrian.Conlon" Date: Thu, 24 Aug 2017 23:47:28 +0100 Subject: [PATCH] Effective address calculation isn't required for Gameboy MBC1 Signed-off-by: Adrian.Conlon --- LR35902/src/Bus.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/LR35902/src/Bus.cpp b/LR35902/src/Bus.cpp index 3b87107..beb722f 100644 --- a/LR35902/src/Bus.cpp +++ b/LR35902/src/Bus.cpp @@ -42,15 +42,14 @@ void EightBit::Bus::loadGameRom(const std::string& path) { uint8_t& EightBit::Bus::reference(uint16_t address, bool& rom) { rom = true; - auto effective = effectiveAddress(address); - if ((effective < 0x100) && bootRomEnabled()) - return m_bootRom[effective]; - if ((effective < 0x4000) && gameRomEnabled()) - return m_gameRom[effective]; - if ((effective < 0x8000) && gameRomEnabled()) - return m_gameRom[(effective - RomPageSize) + (m_romBank * RomPageSize)]; + if ((address < 0x100) && bootRomEnabled()) + return m_bootRom[address]; + if ((address < 0x4000) && gameRomEnabled()) + return m_gameRom[address]; + if ((address < 0x8000) && gameRomEnabled()) + return m_gameRom[(address - RomPageSize) + (m_romBank * RomPageSize)]; rom = false; - return m_bus[effective]; + return m_bus[address]; } void EightBit::Bus::Bus_WrittenByte(const AddressEventArgs& e) {