diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-16 15:46:21 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-16 16:10:15 +0100 |
| commit | 1d0bb4d384d391b5603622d813a63cb192e0defb (patch) | |
| tree | c5800c99e8657d1dade5b5f0eb13e7ee575abecd /crates/nasm/src/main.rs | |
| parent | 7ade650065a2693f41e3a858bfb25881bac06e9d (diff) | |
| download | tools.nes-1d0bb4d384d391b5603622d813a63cb192e0defb.tar.gz tools.nes-1d0bb4d384d391b5603622d813a63cb192e0defb.zip | |
Fix the mapping of addresses on labels
There was a big missunderstanding on how things were to be laid out in
the end file, and so it was needed to create a proper understanding on
what's a Mapping and what's a Segment. These turned out to be
fundamental concepts that I failed to grok up until this commit.
Hence, this commit re-arranges completely how variables and labels are
stored in the Context, and how these objects can then be translated into
bundles that can be spit out to the caller.
This commit, besides introducing the new Mapping struct, also introduced
a more general Object, which abstracts things from the Bundle struct,
and allows us to pass certain metadata about the bundle at hand.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'crates/nasm/src/main.rs')
| -rw-r--r-- | crates/nasm/src/main.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs index 9d97507..527455a 100644 --- a/crates/nasm/src/main.rs +++ b/crates/nasm/src/main.rs @@ -3,7 +3,7 @@ use clap::Parser as ClapParser; use std::fs::File; use std::io::{self, Read, Write}; use xixanta::assembler::Assembler; -use xixanta::mapping::{Segment, EMPTY, NROM, NROM65}; +use xixanta::mapping::{Mapping, EMPTY, NROM, NROM65}; /// Assembler for the 6502 microprocessor that targets the NES. #[derive(ClapParser, Debug)] @@ -57,7 +57,7 @@ fn main() -> Result<()> { }; // Select the linker configuration. - let segments: Vec<Segment> = match args.config { + let mapping: Vec<Mapping> = match args.config { Some(c) => match c.to_lowercase().as_str() { "empty" => EMPTY.to_vec(), "nrom" => NROM.to_vec(), @@ -71,7 +71,7 @@ fn main() -> Result<()> { }; // Initialize the assembler with the given linker configuration. - let mut assembler = Assembler::new(segments); + let mut assembler = Assembler::new(mapping); // After the parse operation, just print the results. if args.disassemble { |
