From 0aefffacb5cb08202f7ba53b6e3b9a7303b1d66e Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 23 Jan 2025 13:57:45 +0100 Subject: Use custom configurations everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moreover, I have introduced a linker configuration for MMC1 as well, so to properly implement the `basics/persist.s` example. Signed-off-by: Miquel Sabaté Solà --- config/mmc1.cfg | 26 ++++++++++++++++++++++++++ config/nrom.cfg | 24 ++++++++++++++++++++++++ config/unrom.cfg | 24 +++++++++++------------- 3 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 config/mmc1.cfg create mode 100644 config/nrom.cfg (limited to 'config') diff --git a/config/mmc1.cfg b/config/mmc1.cfg new file mode 100644 index 0000000..5544c1f --- /dev/null +++ b/config/mmc1.cfg @@ -0,0 +1,26 @@ +MEMORY { + # iNES header. + HEADER: start = $0, size = $10, fill = yes; + + # Banked PRG ROM. + PRG0: start = $8000, size = $4000, fill = yes, fillval = $f8, define = yes; + PRG1: start = $C000, size = $3FFA, fill = yes, fillval = $f9, define = yes; + + # Hardware Vectors. + ROMV: start = $FFFA, size = $0006, fill = yes; + + # Banked CHR banks. + ROM2_0: start = $0000, size = $2000, fill = yes, fillval = $11; + ROM2_1: start = $2000, size = $2000, fill = yes, fillval = $22; +} + +SEGMENTS { + HEADER: load = HEADER, type = ro; + + BANK0: load = PRG0, type = ro; + BANK1: load = PRG1, type = ro; + VECTORS: load = ROMV, type = ro; + + CHR0: load = ROM2_0, type = ro; + CHR1: load = ROM2_1, type = ro; +} diff --git a/config/nrom.cfg b/config/nrom.cfg new file mode 100644 index 0000000..41a1f2a --- /dev/null +++ b/config/nrom.cfg @@ -0,0 +1,24 @@ +## +# Same as the default NROM configuration provided by cc65, but with C stuff +# stripped away (e.g. namely, there are no more segments like 'STARTUP'). + +MEMORY { + # iNES header + HEADER: file = %O, start = $0000, size = $0010, fill = yes; + + # Fixed ROM. + ROM0: file = %O, start = $8000, size = $7FFA, fill = yes, define = yes; + + # Hardware Vectors. + ROMV: file = %O, start = $FFFA, size = $0006, fill = yes; + + # 1 8k CHR Bank + ROM2: file = %O, start = $0000, size = $2000, fill = yes; +} + +SEGMENTS { + HEADER: load = HEADER, type = ro; + CODE: load = ROM0, type = ro, define = yes; + VECTORS: load = ROMV, type = rw; + CHARS: load = ROM2, type = rw; +} diff --git a/config/unrom.cfg b/config/unrom.cfg index 5b18707..fccdb88 100644 --- a/config/unrom.cfg +++ b/config/unrom.cfg @@ -15,7 +15,7 @@ MEMORY { HEADER: start = $0, size = $10, fill = yes; # Program RAM. Available if a battery-backed RAM was requested. - WRAM: start = $6000, size = $2000, define = yes; + WRAM: file = "" start = $6000, size = $2000, define = yes; # Swappable ROM addresses. Note the filled values. This is done so it's also # clear by inspecting the memory which bank we are on. This can come in @@ -29,7 +29,8 @@ MEMORY { PRG6: start = $8000, size = $4000, fill = yes, fillval = $fe, define = yes; # Fixed ROM address. - PRG: start = $C000, size = $4000, fill = yes, fillval = $ff, define = yes; + PRG: start = $C000, size = $3FFA, fill = yes, fillval = $ff, define = yes; + ROMV: start = $FFFA, size = $0006, fill = yes; } SEGMENTS { @@ -40,19 +41,16 @@ SEGMENTS { # code and basic stuff that you don't want ever to be gone here. This will # include stuff like the reset code, bank switching utilities, etc. FIXED: load = PRG, type = ro, define = yes; + VECTORS: load = ROMV, type = ro, define = yes; ## # Swappable banks. - BANK0: load = PRG0, type = ro, define = yes; - BANK1: load = PRG1, type = ro, define = yes; - BANK2: load = PRG2, type = ro, define = yes; - BANK3: load = PRG3, type = ro, define = yes; - BANK4: load = PRG4, type = ro, define = yes; - BANK5: load = PRG5, type = ro, define = yes; - BANK6: load = PRG6, type = ro, define = yes; - - # Last but not least, the vectors must be the last thing and they are - # expecting a very special place on the fixed bank. - VECTORS: load = PRG, start = $fffa, type = ro; + BANK0: load = PRG0, type = ro; + BANK1: load = PRG1, type = ro; + BANK2: load = PRG2, type = ro; + BANK3: load = PRG3, type = ro; + BANK4: load = PRG4, type = ro; + BANK5: load = PRG5, type = ro; + BANK6: load = PRG6, type = ro; } -- cgit v1.2.3