fix(interpreter): typo selected wrong byte

This commit is contained in:
2025-07-08 09:35:28 +09:00
parent ecbe478dcd
commit 0a1fd0e4c6
2 changed files with 3 additions and 2 deletions

View File

@@ -265,7 +265,8 @@ impl Computer {
match lhs {
ImmediateOperand::Word(lhsw) => match rhs {
ImmediateOperand::Byte(_) => {
let [low, _] = lhsw.to_be_bytes();
let [low, _] = lhsw.to_le_bytes();
log::debug!("lhs was word, so cmp'ing only {low:#04x} - {rhs:#04x}");
return ImmediateOperand::Byte(low) - rhs;
}
_ => {}

View File

@@ -59,6 +59,6 @@ impl Memory {
.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]))
Ok(Word::from_le_bytes([b1, b2]))
}
}