diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-18 09:43:16 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-18 09:43:16 +0100 |
| commit | da49e5e75f81a05081d1b858b6ea78cb378c017c (patch) | |
| tree | 97be6c508c563cbaf1041d3236e3eb51ab013ff4 /crates/nasm | |
| parent | 1da66eb87880894d503f26aaa432460cdebc66b5 (diff) | |
| download | tools.nes-da49e5e75f81a05081d1b858b6ea78cb378c017c.tar.gz tools.nes-da49e5e75f81a05081d1b858b6ea78cb378c017c.zip | |
nasm: Remove the option to disassemble a file
This never quite worked and since multiple re-writes of the
assembler/parser it was even commented out. Moreover, this functionality
appears to be more suitable to the new `readrom` binary introduced in
commit 407048d0037c ("Add the readrom binary"). Hence, just remove this
altogether.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'crates/nasm')
| -rw-r--r-- | crates/nasm/src/main.rs | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs index 105a995..e6d7c45 100644 --- a/crates/nasm/src/main.rs +++ b/crates/nasm/src/main.rs @@ -17,13 +17,8 @@ struct Args { #[arg(short = 'c', long)] config: Option<String>, - /// Disassemble instead of assembling. Disabled by default. - #[arg(short, long, default_value_t = false)] - disassemble: bool, - /// Place the output into the given <OUT> file. Ignored if the `stdout` flag - /// is provided. Defaults to `out.nes` when assembling, and to `out.s` when - /// disassembling. + /// is provided. Defaults to `out.nes`. #[arg(short = 'o', long)] out: Option<String>, @@ -46,14 +41,7 @@ fn main() -> Result<()> { let mut output: Box<dyn Write> = if args.stdout { Box::new(io::stdout()) } else { - match args.out { - Some(file) => Box::new(File::create(file)?), - None => Box::new(File::create(if args.disassemble { - "out.s" - } else { - "out.nes" - })?), - } + Box::new(File::create(args.out.unwrap_or(String::from("out.nes")))?) }; // Select the linker configuration. @@ -70,33 +58,21 @@ fn main() -> Result<()> { None => NROM.to_vec(), }; - // Initialize the assembler with the given linker configuration. + // And assemble. let mut assembler = Assembler::new(mapping); - - // After the parse operation, just print the results. - if args.disassemble { - println!("TBD"); - // let instructions = assembler.disassemble(input)?; - - // for instr in instructions { - // output.write_all(instr.to_human().as_bytes())?; - // output.write_all("\n".as_bytes())?; - // } - } else { - match assembler.assemble(input) { - Ok(bundles) => { - for b in bundles { - for i in 0..b.size { - output.write_all(&[b.bytes[i as usize]])?; - } + match assembler.assemble(input) { + Ok(bundles) => { + for b in bundles { + for i in 0..b.size { + output.write_all(&[b.bytes[i as usize]])?; } } - Err(errors) => { - for err in errors { - println!("{}", err); - } - std::process::exit(1); + } + Err(errors) => { + for err in errors { + println!("{}", err); } + std::process::exit(1); } } |
