aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-18 16:47:20 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-18 16:49:26 +0100
commit5ddfd96f7311292e222a1bc8287eef33a8e097d8 (patch)
tree17d31000c9a68572462b9337f7248e71aaa87aa7 /lib/xixanta
parent4c3d4f15f24e32d043670939ace34fdb6993a51b (diff)
downloadtools.nes-5ddfd96f7311292e222a1bc8287eef33a8e097d8.tar.gz
tools.nes-5ddfd96f7311292e222a1bc8287eef33a8e097d8.zip
Reset literal mode on pending nodes
Failing to do so would spill over the previous literal mode into the evaluation of nodes pending to be crunched. Fixes: a9f50efdef40 ("Fix label references on control statements") Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta')
-rw-r--r--lib/xixanta/src/assembler.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs
index f42db16..0341753 100644
--- a/lib/xixanta/src/assembler.rs
+++ b/lib/xixanta/src/assembler.rs
@@ -320,6 +320,7 @@ impl Assembler {
self.labels_seen = pn.labels_seen;
self.context.force_context_switch(&pn.context);
+ self.literal_mode = None;
match self.evaluate_node(&pn.node) {
Ok(mut bundle) => {
let current = &self.mappings[pn.mapping].segments[pn.segment];
@@ -2548,6 +2549,7 @@ nop
.segment "ONE"
lala:
rts
+ .byte $F3
.segment "TWO"
code:
@@ -2560,12 +2562,12 @@ code:
"#
.as_bytes(),
)
- .unwrap()[0x11..]; // Ignoring HEADER + rts from ONE
+ .unwrap()[0x12..]; // Ignoring HEADER + first two ONE
// "jsr code" from ONE (notice that it's intertwined!)
assert_eq!(bundles[0].size, 3);
assert_eq!(bundles[0].bytes[0], 0x20);
- assert_eq!(bundles[0].bytes[1], 0x04);
+ assert_eq!(bundles[0].bytes[1], 0x05);
assert_eq!(bundles[0].bytes[2], 0x80);
// "jsr lala" from TWO
@@ -2577,7 +2579,7 @@ code:
// "jsr code" from TWO (again, notice that it's intertwined)
assert_eq!(bundles[2].size, 3);
assert_eq!(bundles[2].bytes[0], 0x20);
- assert_eq!(bundles[2].bytes[1], 0x04);
+ assert_eq!(bundles[2].bytes[1], 0x05);
assert_eq!(bundles[2].bytes[2], 0x80);
}