aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-04-28 13:33:23 +0200
committerMiquel Sabaté Solà <mssola@mssola.com>2026-04-28 13:33:23 +0200
commit83670aee223a5b7e8b1eb196e2f6b8635b99ed3f (patch)
treedd8a0ae44b958c96ac6ca69c0e12d01b8ebc0033 /lib/xixanta
parent98c8f0561d65f81b269400a35a99b64800207486 (diff)
downloadtools.nes-83670aee223a5b7e8b1eb196e2f6b8635b99ed3f.tar.gz
tools.nes-83670aee223a5b7e8b1eb196e2f6b8635b99ed3f.zip
nasm: add the --split-segments option
This allows the programmer to tell nasm to leave each segment into its own .out file. This can be useful when writing some specific segments into different chips. The caveat is that filling is not applied, and hence it's up to the programmer to account for that if two or more segments happened to be on the same mapping and needed some alignment in between. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'lib/xixanta')
-rw-r--r--lib/xixanta/src/assembler.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/xixanta/src/assembler.rs b/lib/xixanta/src/assembler.rs
index 7e5ff90..e36136e 100644
--- a/lib/xixanta/src/assembler.rs
+++ b/lib/xixanta/src/assembler.rs
@@ -1301,7 +1301,16 @@ impl<'a> Assembler<'a> {
global: true,
});
}
- res.append(&mut segment.bundles);
+
+ // The cheapest thing to do would be to call append(), but that
+ // would remove all the elements from 'segment.bundles' and
+ // that's not what we want in case the user wants to then
+ // retrieve the bundles for each specific segment (e.g. the
+ // '--split-segments' option on nasm). Hence, just go and copy
+ // everything. Even if that's theoretically expensive it
+ // shouldn't be that big of a deal considering the amount of
+ // data we are moving here in the end.
+ res.extend_from_slice(&segment.bundles);
}
let mut diff = mapping.size as isize - mapping.offset as isize;