Fix page offset miscalculation in instruction fetch

This commit is contained in:
2025-12-22 18:28:31 +01:00
parent 7177633477
commit e00103375d

View File

@@ -38,7 +38,7 @@ impl Core {
pub fn run(&mut self) { pub fn run(&mut self) {
loop { loop {
let page = (self.pc / 4096) as usize; let page = (self.pc / 4096) as usize;
let offset = (self.pc / 4) as u16; let offset = (self.pc % 4096 / 4) as u16;
if !self.pc.is_multiple_of(4) { if !self.pc.is_multiple_of(4) {
//replace eprint with logging, replace break with exception //replace eprint with logging, replace break with exception
eprintln!("PC not aligned"); eprintln!("PC not aligned");