aboutsummaryrefslogtreecommitdiff
path: root/crates/nasm/src
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-07-15 08:55:57 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-12 07:31:52 +0100
commitc6c9aa4e5f3e5a01fcb9ccabf6dbd2f6da277650 (patch)
tree55f205062606664d3f17ff762e475a7895ceefee /crates/nasm/src
parent587dd5bb80364688419bb43aba4afc044ac0ef48 (diff)
downloadtools.nes-c6c9aa4e5f3e5a01fcb9ccabf6dbd2f6da277650.tar.gz
tools.nes-c6c9aa4e5f3e5a01fcb9ccabf6dbd2f6da277650.zip
Add the notion of mapping
Mappings and segments are fundamental blocks on how code is distributed both on the actual ROM File and in the memory layout. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'crates/nasm/src')
-rw-r--r--crates/nasm/src/main.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs
index 9f26417..579ec02 100644
--- a/crates/nasm/src/main.rs
+++ b/crates/nasm/src/main.rs
@@ -3,6 +3,8 @@ use clap::Parser as ClapParser;
use std::fs::File;
use std::io::{self, Read, Write};
use xixanta::assembler::Assembler;
+use xixanta::instruction::Fill;
+use xixanta::mapping::Segment;
/// Assembler for the 6502 microprocessor that targets the NES.
#[derive(ClapParser, Debug)]
@@ -30,7 +32,13 @@ struct Args {
fn main() -> Result<()> {
let args = Args::parse();
- let mut assembler = Assembler::new();
+ // TODO: provide a handier way for this.
+ let mut assembler = Assembler::new(vec![Segment {
+ name: String::from("CODE"),
+ start: 0x00,
+ size: 0x10000,
+ fill_value: Some(Fill { value: 0x00 }),
+ }]);
// Select the input stream.
let input: Box<dyn Read> = match args.file {