From e7f81afa50bcc5261767d841fa1f0c8b84b3f2f9 Mon Sep 17 00:00:00 2001 From: Ry Date: Wed, 23 Mar 2022 11:54:32 -0700 Subject: [PATCH] fox32: Reading/writing unmapped memory is now an error --- src/memory.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/memory.rs b/src/memory.rs index 6ed6be5..f645f94 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -1,6 +1,6 @@ // memory.rs -use crate::warn; +use crate::error; use std::cell::UnsafeCell; use std::sync::Arc; @@ -66,8 +66,7 @@ impl Memory { *value } None => { - warn(&format!("attempting to read from unmapped memory address: {:#010X}", address)); - 0 + error(&format!("attempting to read from unmapped memory address: {:#010X}", address)); } } } @@ -86,8 +85,7 @@ impl Memory { let address = address as usize; if address >= MEMORY_ROM_START && address < MEMORY_ROM_START + MEMORY_ROM_SIZE { - warn(&format!("attempting to write to ROM address: {:#010X}", address)); - return; + error(&format!("attempting to write to ROM address: {:#010X}", address)); } match self.ram().get_mut(address - MEMORY_RAM_START) { @@ -95,7 +93,7 @@ impl Memory { *value = byte; } None => { - warn(&format!("attempting to write to unmapped memory address: {:#010X}", address)); + error(&format!("attempting to write to unmapped memory address: {:#010X}", address)); } } }