diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-01-08 16:54:38 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-01-08 16:54:38 +0100 |
| commit | f9943b7f8cdc75aee4c6e3172387510c56dda1f7 (patch) | |
| tree | 13c85df542b038a57cf61b19ee82d37fbe82147d | |
| parent | c060ab9807e66caa328259a0e19559d7d2727533 (diff) | |
| download | tools.nes-f9943b7f8cdc75aee4c6e3172387510c56dda1f7.tar.gz tools.nes-f9943b7f8cdc75aee4c6e3172387510c56dda1f7.zip | |
Reset the literal mode on assignments
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
| -rw-r--r-- | lib/xixanta/src/assembler.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs index eb4821a..30547d2 100644 --- a/lib/xixanta/src/assembler.rs +++ b/lib/xixanta/src/assembler.rs @@ -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( @@ -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] |
