diff options
| author | Miquel Sabaté Solà <msabate@suse.com> | 2023-11-07 14:14:55 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-02-04 21:02:07 +0100 |
| commit | cb854722b9890c171f7d0600812a7e9a3a2a25c9 (patch) | |
| tree | 1d9bce62db538471b1c98970115999b8ff93b43e /config | |
| parent | 988332816972638adfa8000dd7e1a474c5fea424 (diff) | |
| download | code.nes-cb854722b9890c171f7d0600812a7e9a3a2a25c9.tar.gz code.nes-cb854722b9890c171f7d0600812a7e9a3a2a25c9.zip | |
basics: Add an example on UNROM
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'config')
| -rw-r--r-- | config/unrom.cfg | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/config/unrom.cfg b/config/unrom.cfg new file mode 100644 index 0000000..5b18707 --- /dev/null +++ b/config/unrom.cfg @@ -0,0 +1,58 @@ +## +# This is a very minimalistic linker configuration for UNROM chips. This +# configuration assumes the standard UNROM configuration, with two regions +# defined that split $8000-$FFFF, where the first half is swappable. For the +# bank switching there are 7 banks, which coupled with the fixed region it sums +# up 128KB of total PRG-ROM. +# +# NOTE: it assumes that only assembly is being used, and thus a lot of magic +# required for C programs is missing. +# NOTE: it is following the example of games such as Castlevania or Megaman. +# Thus, there is no CHR segment because it's all done through RAM. + +MEMORY { + # iNES header. + HEADER: start = $0, size = $10, fill = yes; + + # Program RAM. Available if a battery-backed RAM was requested. + WRAM: 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 + # handy when inspecting things with an hex editor. + PRG0: start = $8000, size = $4000, fill = yes, fillval = $f8, define = yes; + PRG1: start = $8000, size = $4000, fill = yes, fillval = $f9, define = yes; + PRG2: start = $8000, size = $4000, fill = yes, fillval = $fa, define = yes; + PRG3: start = $8000, size = $4000, fill = yes, fillval = $fb, define = yes; + PRG4: start = $8000, size = $4000, fill = yes, fillval = $fc, define = yes; + PRG5: start = $8000, size = $4000, fill = yes, fillval = $fd, define = yes; + 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; +} + +SEGMENTS { + # iNES header. + HEADER: load = HEADER, type = ro; + + # This is the fixed bank, that spans $C000-$FFFF. Make sure to put the reset + # 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; + + ## + # 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; +} |
