From 621166e8c626f09ef4b981166e950c7e67a62701 Mon Sep 17 00:00:00 2001 From: nat Date: Fri, 13 Dec 2024 11:03:22 -0800 Subject: [PATCH] fix: correct binary arithmetic that was zeroing out x coordinates in forestry ops --- src/bin/ponderosa-asm.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/ponderosa-asm.rs b/src/bin/ponderosa-asm.rs index b97d4f8..66a43c4 100644 --- a/src/bin/ponderosa-asm.rs +++ b/src/bin/ponderosa-asm.rs @@ -89,11 +89,12 @@ fn parse_forestry_op(tokens: &Vec<&str>, opcode: u16) -> Result { Err(format!("Cannot reach cell at {relative_y} along the Y-axis; trees may only access cells in the range of -16 to 15")) } else { Ok( - opcode<<11 - | stack<<10 - | ((relative_x as u16)<<5) & 0b11111 - | (relative_y as u16) & 0b11111 + (opcode<<11) + | (stack<<10) + | (((relative_x as u16) & 0b11111)<<5) + | ((relative_y as u16) & 0b11111) ) + } }