Skip to content

Commit

Permalink
Added li a0 10 before last ecall
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoRiether committed Jul 16, 2023
1 parent 577479c commit 76bc24a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
1 change: 1 addition & 0 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ pub fn parse_tokens<I: Iterator<Item = Result<Token, Error>>>(
// 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,
]);

Expand Down

0 comments on commit 76bc24a

Please sign in to comment.