From be3ee220863ef3e11cd4f158a5dc57224364c8af Mon Sep 17 00:00:00 2001 From: Riyyi Date: Thu, 25 Aug 2022 13:10:12 +0200 Subject: [PATCH] Emulator: Add error message when reading unloaded cartridge header --- src/emu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/emu.cpp b/src/emu.cpp index 7959ab0..6be7de5 100644 --- a/src/emu.cpp +++ b/src/emu.cpp @@ -12,6 +12,7 @@ #include "cpu.h" #include "emu.h" +#include "ruc/format/log.h" #include "ruc/format/print.h" #include "ruc/meta/assert.h" @@ -82,6 +83,11 @@ uint32_t Emu::readMemory(uint32_t address) const } } + // When trying to access the cartridge header + if (address >= 0x100 && address <= 0x14f) { + ruc::error("No cartridge loaded!"); + } + VERIFY_NOT_REACHED(); return 0; }