aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-08-18 07:53:04 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-08-18 07:53:04 +0200
commit2c837b9c1ee0761a0b6d2d4b65f43ff6a54f4a23 (patch)
tree6d209929f6ece2cf5c6df83f95fab9901ad4b286
parentb0d0a76bc4d78753a002b3217f6f3c92ee871ed1 (diff)
downloadtools.nes-2c837b9c1ee0761a0b6d2d4b65f43ff6a54f4a23.tar.gz
tools.nes-2c837b9c1ee0761a0b6d2d4b65f43ff6a54f4a23.zip
Reset literal mode before left arm of an operation
On an arithmetical/logical operation, the literal mode needed to be reset before evaluating the left arm since the previous evaluation of the node could have altered it. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
-rw-r--r--lib/xixanta/src/assembler.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs
index 26d5396..40d2438 100644
--- a/lib/xixanta/src/assembler.rs
+++ b/lib/xixanta/src/assembler.rs
@@ -900,6 +900,11 @@ impl<'a> Assembler<'a> {
let mut right = self.evaluate_node(node.right.as_ref().unwrap())?;
let rval = right.value();
+ // Some operations need to evaluate a "left" node, and the literal mode
+ // might have been changed by the previous evaluation of the "right"
+ // node. Hence, reset it here to avoid problems.
+ self.literal_mode = None;
+
let res: isize = match operation_type {
OperationType::UnaryPositive => {
right.negative = false;