From 1d0bb4d384d391b5603622d813a63cb192e0defb Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 16 Dec 2024 15:46:21 +0100 Subject: Fix the mapping of addresses on labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- crates/nasm/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates') 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 = match args.config { + let mapping: Vec = 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 { -- cgit v1.2.3