diff --git a/Cargo.toml b/Cargo.toml index 89f7d78..3fc31ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fox32asm" -version = "0.1.0" +version = "0.2.0" edition = "2021" build = "build.rs" diff --git a/src/fox32.pest b/src/fox32.pest index f8874b7..fd1f407 100644 --- a/src/fox32.pest +++ b/src/fox32.pest @@ -104,7 +104,8 @@ instruction_one = @{ "rcall" | "rloop" | "push" | - "pop" + "pop" | + "int" } instruction_two = @{ diff --git a/src/main.rs b/src/main.rs index ca116d8..81c5900 100644 --- a/src/main.rs +++ b/src/main.rs @@ -177,6 +177,7 @@ enum InstructionOne { Rloop, Push, Pop, + Int, } #[derive(PartialEq, Debug, Clone, Copy)] @@ -896,6 +897,7 @@ fn parse_instruction_one(pair: pest::iterators::Pair, mut operand: AstNode }, "push" => InstructionOne::Push, "pop" => InstructionOne::Pop, + "int" => InstructionOne::Int, _ => panic!("Unsupported conditional instruction (one): {}", pair.as_str()), }, operand: Box::new(operand), @@ -1033,6 +1035,8 @@ fn instruction_to_byte(node: &AstNode) -> u8 { InstructionOne::Rloop => 0x29 | size_to_byte(size), InstructionOne::Push => 0x0A | size_to_byte(size), InstructionOne::Pop => 0x1A | size_to_byte(size), + InstructionOne::Int => 0x2C | size_to_byte(size), + } } AstNode::OperationTwo {size, instruction, ..} => {