chore(interpreter): improve debug output

This commit is contained in:
2025-07-06 22:36:13 +09:00
parent 68fb5b7b56
commit 14a0d3d6f1
3 changed files with 28 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ impl Memory {
return Err(InterpreterError::MemoryOutOfBound(addr));
} else {
self.raw[addr as usize] = b;
log::debug!("Wrote raw byte {b:#04x} at addr {addr:#04x}");
}
}
ImmediateOperand::Word(w) => {
@@ -35,6 +36,9 @@ impl Memory {
let [low, high] = w.to_le_bytes();
self.raw[addr as usize] = low;
self.raw[(addr + 1) as usize] = high;
log::debug!(
"Wrote raw byte {low:#04x} and {high:#04x}, starting at addr {addr:#04x}"
);
}
}
}
@@ -54,6 +58,7 @@ impl Memory {
.get((addr + 1) as usize)
.ok_or(InterpreterError::MemoryOutOfBound(addr))?
.to_owned();
log::debug!("Read raw byte {b1:#04x} and {b2:#04x}, starting at addr {addr:#04x}");
Ok(Word::from_be_bytes([b2, b1]))
}
}