diff --git a/src/emu.cpp b/src/emu.cpp index 9a1631f..e75432c 100644 --- a/src/emu.cpp +++ b/src/emu.cpp @@ -58,7 +58,6 @@ void Emu::writeMemory(uint32_t address, uint32_t value) { for (auto& memory_space : m_memory_spaces) { auto memory = memory_space.second; - if (address >= memory.start_address && address <= memory.end_address) { // Note: ECHO RAM hack if (address >= 0xc000 && address <= 0xddff) { @@ -71,9 +70,9 @@ void Emu::writeMemory(uint32_t address, uint32_t value) } } -uint32_t Emu::readMemory(uint32_t address) +uint32_t Emu::readMemory(uint32_t address) const { - for (auto& memory_space : m_memory_spaces) { + for (const auto& memory_space : m_memory_spaces) { auto memory = memory_space.second; if (address >= memory.start_address && address <= memory.end_address) { return memory.memory[memory.active_bank][address]; diff --git a/src/emu.h b/src/emu.h index de8ebbf..b6dab9d 100644 --- a/src/emu.h +++ b/src/emu.h @@ -38,7 +38,7 @@ public: void addMemorySpace(std::string_view name, uint32_t start_address, uint32_t end_address, uint32_t amount_of_banks = 1); void writeMemory(uint32_t address, uint32_t value); - uint32_t readMemory(uint32_t address); + uint32_t readMemory(uint32_t address) const; // -------------------------------------