From 34243afa568ffeb6433200062f0d3c9bc7c2c0ca Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 8 Jul 2026 21:10:46 +0200 Subject: Add the SectionType::Vector enum value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's actually valuable to distinguish that part of PRG-ROM that is part of the vectors segment. Signed-off-by: Miquel Sabaté Solà --- lib/xixanta/src/mapping.rs | 11 +++++++++-- 1 file changed, 9 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 2270ad3..fe255d2 100644 --- a/lib/xixanta/src/mapping.rs +++ b/lib/xixanta/src/mapping.rs @@ -18,6 +18,9 @@ pub enum SectionType { /// Bank to be stored in CHR ROM with a size multiple of 4KB. ChrRom, + + /// The 6 final bytes describing the addresses for nmi, reset and irq. + Vector, } /// A segment inside of a memory mapping, used to organize the code inside of a @@ -149,11 +152,15 @@ fn validate_configuration(mappings: &[Mapping]) -> Result<(), String> { .iter() .filter(|m| m.section_type == SectionType::PrgRom) .fold(0, |acc, x| acc + x.size); + let vec_rom_len = mappings + .iter() + .filter(|m| m.section_type == SectionType::Vector) + .fold(0, |acc, x| acc + x.size); - if prg_rom_len < 0x4000 { + if prg_rom_len + vec_rom_len < 0x4000 { return Err("PRG ROM must be at least 8KB long".to_string()); } - if prg_rom_len % 0x4000 != 0 { + if (prg_rom_len + vec_rom_len) % 0x4000 != 0 { return Err("PRG ROM must be formed by banks of exactly 8KB".to_string()); } -- cgit v1.2.3