aboutsummaryrefslogtreecommitdiff
path: root/lib/xixanta/src/mapping.rs
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-10-23 12:54:14 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-12 07:49:33 +0100
commitd492aa8271f9fb02351b1144733508194df67746 (patch)
treea035d7c495ebc6a12b01e0018b345760de24ba22 /lib/xixanta/src/mapping.rs
parent4f24eb5e5754c4e1e2c6069bdaf1b0f34c856c1b (diff)
downloadtools.nes-d492aa8271f9fb02351b1144733508194df67746.tar.gz
tools.nes-d492aa8271f9fb02351b1144733508194df67746.zip
Re-work the support on labels, variables and jumps
As a way to firstly adapt on the latest changes from the parser since 184c39579227 ("Re-work the parser from scratch"), the assembler had to leave out some features on 16114b2ca358 ("Adapt the assembler to the changes on the parser"). This commit reintroduces support for settings labels, variables and referencing them, while also providing a more robust implementation at that. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/mapping.rs')
-rw-r--r--lib/xixanta/src/mapping.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/xixanta/src/mapping.rs b/lib/xixanta/src/mapping.rs
index 9d313a5..238f39d 100644
--- a/lib/xixanta/src/mapping.rs
+++ b/lib/xixanta/src/mapping.rs
@@ -1,34 +1,46 @@
+use crate::assembler::Bundle;
+
lazy_static! {
pub static ref EMPTY: Vec<Segment> = vec![Segment {
name: String::from("CODE"),
start: 0x0000,
size: 0xFFFF,
+ offset: 0,
fill: None,
+ bundles: vec![],
}];
pub static ref NROM: Vec<Segment> = vec![
Segment {
name: String::from("HEADER"),
start: 0x0000,
size: 0x0010,
+ offset: 0,
fill: Some(0x00),
+ bundles: vec![],
},
Segment {
name: String::from("VECTORS"),
start: 0xFFFA,
size: 0x0006,
+ offset: 0,
fill: Some(0x00),
+ bundles: vec![],
},
Segment {
name: String::from("CODE"),
start: 0x8000,
size: 0x7FFA,
+ offset: 0,
fill: Some(0x00),
+ bundles: vec![],
},
Segment {
name: String::from("CHARS"),
start: 0x0000,
size: 0x2000,
+ offset: 0,
fill: Some(0x00),
+ bundles: vec![],
}
];
}
@@ -38,7 +50,9 @@ pub struct Segment {
pub name: String,
pub start: u16,
pub size: usize,
+ pub offset: usize,
pub fill: Option<usize>,
+ pub bundles: Vec<Bundle>,
}
/* TODO