Skip to content

Commit

Permalink
Reset the literal mode on assignments
Browse files Browse the repository at this point in the history
Signed-off-by: Miquel Sabaté Solà <[email protected]>
  • Loading branch information
mssola committed Jan 8, 2025
1 parent c060ab9 commit f9943b7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/xixanta/src/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl<'a> Assembler<'a> {
}));
continue;
}
self.literal_mode = None;
match self.evaluate_node(node.left.as_ref().unwrap()) {
Ok(value) => {
if let Err(err) = self.context.set_variable(
Expand Down Expand Up @@ -2230,6 +2231,20 @@ mod tests {
);
}

#[test]
fn reset_literal_mode_on_assignment() {
let res = just_bundles(
r#"var1 = $31
var2 = 20
cpx #(4 * var2)"#,
);

assert_eq!(res.len(), 1);
assert_eq!(res[0].bytes[0], 0xE0);
assert_eq!(res[0].bytes[1], 0x50);
assert_eq!(res[0].bytes[2], 0x00);
}

// Regular instructions

#[test]
Expand Down

0 comments on commit f9943b7

Please sign in to comment.