diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-20 21:58:26 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-12-20 21:58:26 +0100 |
| commit | 0bc97c99c644955096b3e13a2a7df6b281314e25 (patch) | |
| tree | 1e09fa92a5ac71df1d097d8581e4538ce7182112 | |
| parent | 0087cc0631ae8e8b1892e674e34a9daa84ad0bb9 (diff) | |
| download | tools.nes-0bc97c99c644955096b3e13a2a7df6b281314e25.tar.gz tools.nes-0bc97c99c644955096b3e13a2a7df6b281314e25.zip | |
Add support for UxROM chips
I have also added an end-to-end test for it.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
| -rw-r--r-- | crates/nasm/src/main.rs | 5 | ||||
| -rw-r--r-- | lib/xixanta/src/mapping.rs | 163 | ||||
| -rwxr-xr-x | scripts/test-e2e.sh | 3 | ||||
| -rw-r--r-- | tests/bin/chr-ram.nes | bin | 0 -> 131088 bytes | |||
| -rw-r--r-- | tests/src/chr-ram.s | 279 |
5 files changed, 446 insertions, 4 deletions
diff --git a/crates/nasm/src/main.rs b/crates/nasm/src/main.rs index fc5d1c0..0c754e3 100644 --- a/crates/nasm/src/main.rs +++ b/crates/nasm/src/main.rs @@ -4,7 +4,7 @@ use std::fs::File; use std::io::{self, Read, Write}; use std::path::Path; use xixanta::assembler::Assembler; -use xixanta::mapping::{Mapping, EMPTY, NROM, NROM65}; +use xixanta::mapping::{Mapping, EMPTY, NROM, NROM65, UXROM}; /// Assembler for the 6502 microprocessor that targets the NES/Famicom. #[derive(ClapParser, Debug)] @@ -81,8 +81,9 @@ fn main() -> Result<()> { "empty" => EMPTY.to_vec(), "nrom" => NROM.to_vec(), "nrom65" => NROM65.to_vec(), + "uxrom" | "unrom" => UXROM.to_vec(), _ => { - println!("Unnown linker configuration '{}'", c); + println!("Unknown linker configuration '{}'", c); std::process::exit(1); } }, diff --git a/lib/xixanta/src/mapping.rs b/lib/xixanta/src/mapping.rs index 2859bbf..8cf752d 100644 --- a/lib/xixanta/src/mapping.rs +++ b/lib/xixanta/src/mapping.rs @@ -94,8 +94,167 @@ lazy_static! { }, ]; - // The same mapper as NROM, but it adds a "STARTUP" segment into the "ROM0" - // mapping so to behave the same as the default "cc65" configuration. + // Mapper for UxROM boards (UxROM (NES-UNROM, NES-UOROM, HVC-UN1ROM their + // HVC counterparts, and clone boards). + pub static ref UXROM: Vec<Mapping> = vec![ + Mapping { + name: String::from("HEADER"), + start: 0x0000, + size: 0x0010, + offset: 0, + fill: Some(0x00), + section_type: SectionType::Header, + segments: vec![Segment { + name: String::from("HEADER"), + len: 0, + offset: 0, + bundles: vec![], + }] + }, + Mapping { + name: String::from("PRG0"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xF8), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK0"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG1"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xF9), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK1"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG2"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xFA), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK2"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG3"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xFB), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK3"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG4"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xFC), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK4"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG5"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xFD), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK5"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG6"), + start: 0x8000, + size: 0x4000, + offset: 0, + fill: Some(0xFE), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("BANK6"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("PRG"), + start: 0xC000, + size: 0x3FFA, + offset: 0, + fill: Some(0xFF), + section_type: SectionType::PrgRom, + segments: vec![ + Segment { + name: String::from("FIXED"), + len: 0, + offset: 0, + bundles: vec![], + }, + ] + }, + Mapping { + name: String::from("ROMV"), + start: 0xFFFA, + size: 0x0006, + offset: 0, + fill: Some(0x00), + section_type: SectionType::PrgRom, + segments: vec![Segment { + name: String::from("VECTORS"), + len: 0, + offset: 0, + bundles: vec![], + },] + }, + ]; + pub static ref NROM65: Vec<Mapping> = vec