diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-10-09 15:41:30 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-12 07:46:17 +0100 |
| commit | 16114b2ca358dbbef09cb5a8d3a843a0e11a3b88 (patch) | |
| tree | 49103ed4c0e906128df23c20656d88e4c4d1645e /lib/xixanta/src/mapping.rs | |
| parent | abd9a7679e5da78a51ed5eb488ae081a2bcb2b6c (diff) | |
| download | tools.nes-16114b2ca358dbbef09cb5a8d3a843a0e11a3b88.tar.gz tools.nes-16114b2ca358dbbef09cb5a8d3a843a0e11a3b88.zip | |
Adapt the assembler to the changes on the parser
As of 184c39579227 ("Re-work the parser from scratch") the parser has a
proper AST, and the assembler has to traverse it accordingly.
Moreover, the assembler has been stripped from a lot of unneeded memory
allocations and it's overall more keen on using mere references when
possible.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/xixanta/src/mapping.rs')
| -rw-r--r-- | lib/xixanta/src/mapping.rs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/xixanta/src/mapping.rs b/lib/xixanta/src/mapping.rs index 231883f..9d313a5 100644 --- a/lib/xixanta/src/mapping.rs +++ b/lib/xixanta/src/mapping.rs @@ -1,9 +1,3 @@ -use crate::instruction::{Fill, Node, PString}; -use std::collections::HashMap; - -use crate::errors::ParseError; -type Result<T> = std::result::Result<T, ParseError>; - lazy_static! { pub static ref EMPTY: Vec<Segment> = vec![Segment { name: String::from("CODE"), @@ -16,25 +10,25 @@ lazy_static! { name: String::from("HEADER"), start: 0x0000, size: 0x0010, - fill: Some(Fill { value: 0x00 }), + fill: Some(0x00), }, Segment { name: String::from("VECTORS"), start: 0xFFFA, size: 0x0006, - fill: Some(Fill { value: 0x00 }), + fill: Some(0x00), }, Segment { name: String::from("CODE"), start: 0x8000, size: 0x7FFA, - fill: Some(Fill { value: 0x00 }), + fill: Some(0x00), }, Segment { name: String::from("CHARS"), start: 0x0000, size: 0x2000, - fill: Some(Fill { value: 0x00 }), + fill: Some(0x00), } ]; } @@ -44,9 +38,10 @@ pub struct Segment { pub name: String, pub start: u16, pub size: usize, - pub fill: Option<Fill>, + pub fill: Option<usize>, } +/* TODO #[derive(Debug)] pub struct Mapping { pub segments: Vec<Segment>, @@ -90,9 +85,10 @@ impl Mapping { pub fn switch(&mut self, id: &PString) -> Result<()> { if !self.nodes.contains_key(&id.value) { - return Err( - id.parser_error(format!("segment '{}' has not been defined", id.value).as_str()) - ); + // TODO + // return Err( + // id.parser_error(format!("segment '{}' has not been defined", id.value).as_str()) + // ); } id.value.clone_into(&mut self.current); @@ -114,3 +110,4 @@ impl Mapping { } } } +*/ |
