diff --git a/src/interpreter/computer.rs b/src/interpreter/computer.rs index f98bf7f..42e1af8 100644 --- a/src/interpreter/computer.rs +++ b/src/interpreter/computer.rs @@ -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; } _ => {} diff --git a/src/interpreter/memory.rs b/src/interpreter/memory.rs index 4bc4f1f..c6906ee 100644 --- a/src/interpreter/memory.rs +++ b/src/interpreter/memory.rs @@ -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])) } }