diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-04-28 13:33:23 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-04-28 13:33:23 +0200 |
| commit | 83670aee223a5b7e8b1eb196e2f6b8635b99ed3f (patch) | |
| tree | dd8a0ae44b958c96ac6ca69c0e12d01b8ebc0033 /lib/xixanta | |
| parent | 98c8f0561d65f81b269400a35a99b64800207486 (diff) | |
| download | tools.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.rs | 11 |
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; |
