From 4afe69ed10ec12c3e7a86b83c95c637e7d23b9c4 Mon Sep 17 00:00:00 2001 From: Ry Date: Tue, 13 Sep 2022 17:37:42 -0700 Subject: [PATCH] Add FLP instruction --- src/fox32.pest | 3 ++- src/main.rs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/fox32.pest b/src/fox32.pest index e917224..19c2079 100644 --- a/src/fox32.pest +++ b/src/fox32.pest @@ -108,7 +108,8 @@ instruction_one = @{ "push" | "pop" | "int" | - "tlb" + "tlb" | + "flp" } instruction_two = @{ diff --git a/src/main.rs b/src/main.rs index 0a11d9b..0dec331 100644 --- a/src/main.rs +++ b/src/main.rs @@ -181,6 +181,7 @@ enum InstructionOne { Pop, Int, Tlb, + Flp, } #[derive(PartialEq, Debug, Clone, Copy)] @@ -904,6 +905,7 @@ fn parse_instruction_one(pair: pest::iterators::Pair, mut operand: AstNode "pop" => InstructionOne::Pop, "int" => InstructionOne::Int, "tlb" => InstructionOne::Tlb, + "flp" => InstructionOne::Flp, _ => panic!("Unsupported conditional instruction (one): {}", pair.as_str()), }, operand: Box::new(operand), @@ -1045,6 +1047,7 @@ fn instruction_to_byte(node: &AstNode) -> u8 { InstructionOne::Pop => 0x1A | size_to_byte(size), InstructionOne::Int => 0x2C | size_to_byte(size), InstructionOne::Tlb => 0x2D | size_to_byte(size), + InstructionOne::Flp => 0x3D | size_to_byte(size), } } AstNode::OperationTwo {size, instruction, ..} => {