diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-22 22:40:11 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-22 23:05:18 +0100 |
| commit | 4628873cfc53d3bdc7a0834b3edbb02b0b9cf4a7 (patch) | |
| tree | 59d4fefeac7ce0d095f6e86712d5c70816a2e428 /crates/nasm/src | |
| parent | 0bc97c99c644955096b3e13a2a7df6b281314e25 (diff) | |
| download | tools.nes-4628873cfc53d3bdc7a0834b3edbb02b0b9cf4a7.tar.gz tools.nes-4628873cfc53d3bdc7a0834b3edbb02b0b9cf4a7.zip | |
Transform mapping configurations into toml files
This will allow the creation of configuration files that can live
outside of this tree, so developers can fine tune configuration files of
their own without having to pick up whatever is currently available.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'crates/nasm/src')
| -rw-r--r-- | crates/nasm/src/main.rs | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs index 0c754e3..c93dda0 100644 --- a/crates/nasm/src/main.rs +++ b/crates/nasm/src/main.rs @@ -4,7 +4,7 @@ use std::fs::File; use std::io::{self, Read, Write}; use std::path::Path; use xixanta::assembler::Assembler; -use xixanta::mapping::{Mapping, EMPTY, NROM, NROM65, UXROM}; +use xixanta::mapping::get_mapping_configuration; /// Assembler for the 6502 microprocessor that targets the NES/Famicom. #[derive(ClapParser, Debug)] @@ -76,18 +76,13 @@ fn main() -> Result<()> { }; // Select the linker configuration. - let mapping: Vec<Mapping> = match args.config { - Some(c) => match c.to_lowercase().as_str() { - "empty" => EMPTY.to_vec(), - "nrom" => NROM.to_vec(), - "nrom65" => NROM65.to_vec(), - "uxrom" | "unrom" => UXROM.to_vec(), - _ => { - println!("Unknown linker configuration '{}'", c); - std::process::exit(1); - } - }, - None => NROM.to_vec(), + let config = args.config.unwrap_or("nrom".to_string()); + let mapping = match get_mapping_configuration(&config) { + Ok(cfg) => cfg, + Err(e) => { + eprintln!("error: {}", e); + std::process::exit(1); + } }; // And assemble. |
