diff --git a/src/main.rs b/src/main.rs index 6a21afa..7865e46 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1148,6 +1148,7 @@ fn condition_source_destination_to_byte(node: &AstNode) -> u8 { match lhs.as_ref() { AstNode::Register(_) => 0x00, AstNode::RegisterPointer(_) => 0x04, + AstNode::Immediate8(_) | AstNode::Immediate16(_) | AstNode::Immediate32(_) | AstNode::LabelOperand {..} => 0x08, AstNode::ImmediatePointer(_) | AstNode::LabelOperandPointer {..} => 0x0C, _ => panic!("Attempting to parse a non-instruction AST node as an instruction: {:#?}", node), } @@ -1286,6 +1287,9 @@ fn node_to_immediate_values(node: &AstNode, instruction: &AssembledInstruction) AstNode::Register (register) => vec.push(register), AstNode::RegisterPointer(register) => vec.push(register), + AstNode::Immediate8 (immediate) => vec.push(immediate), + AstNode::Immediate16 (immediate) => vec.extend_from_slice(&immediate.to_le_bytes()), + AstNode::Immediate32 (immediate) => vec.extend_from_slice(&immediate.to_le_bytes()), AstNode::ImmediatePointer(immediate) => vec.extend_from_slice(&immediate.to_le_bytes()), AstNode::LabelOperand {ref name, ref size, is_relative} => {