fox32: Reading/writing unmapped memory is now an error
This commit is contained in:
parent
1f89b59f83
commit
e7f81afa50
|
@ -1,6 +1,6 @@
|
||||||
// memory.rs
|
// memory.rs
|
||||||
|
|
||||||
use crate::warn;
|
use crate::error;
|
||||||
|
|
||||||
use std::cell::UnsafeCell;
|
use std::cell::UnsafeCell;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -66,8 +66,7 @@ impl Memory {
|
||||||
*value
|
*value
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
warn(&format!("attempting to read from unmapped memory address: {:#010X}", address));
|
error(&format!("attempting to read from unmapped memory address: {:#010X}", address));
|
||||||
0
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +85,7 @@ impl Memory {
|
||||||
let address = address as usize;
|
let address = address as usize;
|
||||||
|
|
||||||
if address >= MEMORY_ROM_START && address < MEMORY_ROM_START + MEMORY_ROM_SIZE {
|
if address >= MEMORY_ROM_START && address < MEMORY_ROM_START + MEMORY_ROM_SIZE {
|
||||||
warn(&format!("attempting to write to ROM address: {:#010X}", address));
|
error(&format!("attempting to write to ROM address: {:#010X}", address));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.ram().get_mut(address - MEMORY_RAM_START) {
|
match self.ram().get_mut(address - MEMORY_RAM_START) {
|
||||||
|
@ -95,7 +93,7 @@ impl Memory {
|
||||||
*value = byte;
|
*value = byte;
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
warn(&format!("attempting to write to unmapped memory address: {:#010X}", address));
|
error(&format!("attempting to write to unmapped memory address: {:#010X}", address));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user