# # ca83: Linker script for Game Boy games without MBC # Copyright 2019, 2021 Damian Yerrick # # Copying and distribution of this file, with or without # modification, are permitted in any medium without royalty # provided the copyright notice and this notice are preserved. # This file is offered as-is, without any warranty. # MEMORY { # Game Boy memory WRAM0: start = $C000, size = $1000, type = rw; WRAM1: start = $D000, size = $1000, type = rw; HRAM: start = $FF80, size = $7F, type = rw; # Game Gear memory WRAM: start = $C000, size = $1FF0, type = rw; LOWROM00: start = $0000, size = $0100, type = ro, file = %O, fill=yes, fillval=$FF; LOWROM01: start = $0100, size = $0100, type = ro, file = %O, fill=yes, fillval=$FF; ROM0: start = $0200, size = $7DF0, type = ro, file = %O, fill=yes, fillval=$FF; TMRFOOTER:start = $7FF0, size = $0010, type = ro, file = %O, fill=yes, fillval=$00; } # A "segment" in ca65 is bigger than a "section" in RGBDS. # Consider it as a group of sections that may be placed # consecutively in the same bank. SEGMENTS { HRAM: load = HRAM, type = bss; GBBSS: load = WRAM0, type = bss, define = yes, align = $100, optional = yes; GBBSS1: load = WRAM1, type = bss, define = yes, align = $100, optional = yes; BSS: load = WRAM, type = bss, define = yes, align = $100, optional = yes; LOWROM00: load = LOWROM00, type = ro, align = $80; LOWROM01: load = LOWROM01, type = ro, align = $100; CODE: load = ROM0, type = ro, align = $100; RODATA: load = ROM0, type = ro, align = $100; TMRFOOTER: load = TMRFOOTER, type = ro, optional = yes; # Will need to do this on Game Gear side: # memcpy(__DATA_RUN__, __DATA_LOAD__, __DATA_SIZE__); # memcpy(__RAMCODE_RUN__, __RAMCODE_LOAD__, __RAMCODE_SIZE__); # And on Game Boy side: # memcpy(__GBDATA_RUN__, __GBDATA_LOAD__, __GBDATA_SIZE__); # memcpy(__GBRAMCODE_RUN__, __GBRAMCODE_LOAD__, __GBRAMCODE_SIZE__); # memcpy(__GBHRAMCODE_RUN__, __GBHRAMCODE_LOAD__, __GBHRAMCODE_SIZE__); GBHRAMCODE: load = ROM0, run = HRAM, type = rw, define = yes, optional = yes; GBRAMCODE: load = ROM0, run = WRAM0, type = rw, define = yes, optional = yes; GBDATA: load = ROM0, run = WRAM0, type = rw, define = yes, optional = yes; RAMCODE: load = ROM0, run = WRAM0, type = rw, define = yes, optional = yes; DATA: load = ROM0, run = WRAM0, type = rw, define = yes, optional = yes; } FILES { %O: format = bin; }