From 376dcb684ce779a7051bbc9a95359114e94cae5e Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 17 Jul 2024 15:09:36 +0200 Subject: Add support for procedures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Procedures are marked with the '.proc' control statement and work both as a scoping mechanism and as a label that can be referenced. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/mapping.rs | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'lib/xixanta/src/mapping.rs') diff --git a/lib/xixanta/src/mapping.rs b/lib/xixanta/src/mapping.rs index c097fd8..d2f1410 100644 --- a/lib/xixanta/src/mapping.rs +++ b/lib/xixanta/src/mapping.rs @@ -4,12 +4,41 @@ use std::collections::HashMap; use crate::errors::ParseError; type Result = std::result::Result; +lazy_static! { + pub static ref NROM: Vec = vec![ + Segment { + name: String::from("HEADER"), + start: 0x0000, + size: 0x0010, + fill: Some(Fill { value: 0x00 }), + }, + Segment { + name: String::from("VECTORS"), + start: 0xFFFA, + size: 0x0006, + fill: Some(Fill { value: 0x00 }), + }, + Segment { + name: String::from("CODE"), + start: 0x8000, + size: 0x7FFA, + fill: Some(Fill { value: 0x00 }), + }, + Segment { + name: String::from("CHARS"), + start: 0x0000, + size: 0x2000, + fill: Some(Fill { value: 0x00 }), + } + ]; +} + #[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)] pub struct Segment { pub name: String, pub start: u16, pub size: usize, - pub fill_value: Option, + pub fill: Option, } #[derive(Debug)] @@ -21,7 +50,7 @@ pub struct Mapping { impl Mapping { pub fn new(mut segments: Vec) -> Self { - segments.sort_by(|a, b| b.start.cmp(&a.start)); + segments.sort_by(|a, b| a.start.cmp(&b.start)); let mut nodes = HashMap::new(); for segment in segments.iter() { -- cgit v1.2.3