From e38e35ba810cafa33fb9c8c03f84e5ab91b7c2dd Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sun, 21 Aug 2022 20:59:14 +0200 Subject: [PATCH] Emulator: Add checks for undefined memory spaces --- src/emu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/emu.cpp b/src/emu.cpp index e75432c..eb6d614 100644 --- a/src/emu.cpp +++ b/src/emu.cpp @@ -12,6 +12,7 @@ #include "emu.h" #include "ruc/file.h" #include "ruc/format/print.h" +#include "ruc/meta/assert.h" void Emu::init(uint32_t frequency, std::string_view bootrom) { @@ -65,9 +66,11 @@ void Emu::writeMemory(uint32_t address, uint32_t value) } memory.memory[memory.active_bank][address] = value; - break; + return; } } + + VERIFY_NOT_REACHED(); } uint32_t Emu::readMemory(uint32_t address) const @@ -76,9 +79,9 @@ uint32_t Emu::readMemory(uint32_t address) const auto memory = memory_space.second; if (address >= memory.start_address && address <= memory.end_address) { return memory.memory[memory.active_bank][address]; - break; } } + VERIFY_NOT_REACHED(); return 0; }