From 76bc24ac8c824778ba36b0abb23346cdfa5014bf Mon Sep 17 00:00:00 2001 From: LeoRiether Date: Sun, 16 Jul 2023 14:13:53 -0300 Subject: [PATCH] Added `li a0 10` before last ecall --- src/parser/data/mod.rs | 2 +- src/parser/mod.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser/data/mod.rs b/src/parser/data/mod.rs index aa3a63c..170a2f6 100644 --- a/src/parser/data/mod.rs +++ b/src/parser/data/mod.rs @@ -242,6 +242,6 @@ mod tests { let Parsed { code, .. } = parse_tokens(tokens, DATA_SIZE).unwrap(); use crate::instruction::Instruction::{Ecall, Li}; - assert_eq!(&code, &[Li(0, 4), Li(0, 10), Li(0, 16), Li(0, 16), Li(17, 10), Ecall]) + assert_eq!(&code, &[Li(0, 4), Li(0, 10), Li(0, 16), Li(0, 16), Li(17, 10), Li(10, 0), Ecall]) } } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 4011755..a2eb427 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -228,6 +228,7 @@ pub fn parse_tokens>>( // If the program ever drops off bottom, we make an "exit" ecall and terminate execution ctx.code.extend(vec![ Instruction::Li(17, 10), // li a7 10 + Instruction::Li(10, 0), // li a0 0 Instruction::Ecall, ]);