diff --git a/cfg/atari7800.cfg b/cfg/atari7800.cfg index cf663be3d..8029ca674 100644 --- a/cfg/atari7800.cfg +++ b/cfg/atari7800.cfg @@ -2,6 +2,16 @@ SYMBOLS { __STACKSIZE__: type = weak, value = $0010; # 16 bytes stack + __EXEHDR__: type = import; + __VEC_BOTTOM__: value = $fffa, type = export; + __VEC_SIZE__: value = $6, type = export; + __ENCRYPT_BOTTOM__: value = $ff7a, type = export; + __ENCRYPT_SIZE__: value = $80, type = export; + __MEMORY_TOP__: value = __ENCRYPT_BOTTOM__, type = export; + __INIT_SIZE__: value = 69, type = export; + __MEMORY_INIT__: value = __MEMORY_TOP__ - __INIT_SIZE__, type = export; + __MEMORY_BOTTOM__: value = $8000, type = export; + __FREE_ROM_SIZE__: value = __MEMORY_INIT__ - __MEMORY_BOTTOM__, type = export; } MEMORY { @@ -10,27 +20,31 @@ MEMORY { RAM1: file = "", define = yes, start = $1800, size = $0840, type = rw; RAM2: file = "", define = yes, start = $2100, size = $0040, type = rw; RAM3: file = "", define = yes, start = $2200, size = $0600, type = rw; + # For emulators you also need a header file + HEADER: file = %O, start = $0000, size = 128; # "Normal" cartridge rom. Multiple banks arent supported # by this script. You may change the rom size, but keep # two things in mind: # - start must be a multiple of $1000 # - ROM must end at $ff79 - ROM: file = %O, define = yes, start = $8000, size = $7f7a, type = ro, fill = yes, fillval = $ff; + ROM: file = %O, define = yes, start = __MEMORY_BOTTOM__, size = __FREE_ROM_SIZE__, type = ro, fill = yes, fillval = $ff; + ROMS: file = %O, define = yes, start = __MEMORY_INIT__, size = __INIT_SIZE__, type = ro, fill = yes, fillval = $ff; # Encryption stuff - ROME: file = %O, start = $ff7a, size = $80, type = ro, fill = yes, fillval = $ff; + ROME: file = %O, start = __ENCRYPT_BOTTOM__, size = __ENCRYPT_SIZE__, type = ro, fill = yes, fillval = $ff; # Interrupt vectors - ROMV: file = %O, start = $fffa, size = $6, type = ro, fill = yes, fillval = $ff; + ROMV: file = %O, start = __VEC_BOTTOM__, size = __VEC_SIZE__, type = ro, fill = yes, fillval = $ff; } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - STARTUP: load = ROM, type = ro, define = yes; - ONCE: load = ROM, type = ro, define = yes; + EXEHDR: load = HEADER, type = ro, define = yes; + STARTUP: load = ROMS, type = ro, define = yes; + ONCE: load = ROMS, type = ro, define = yes; CODE: load = ROM, type = ro, define = yes; RODATA: load = ROM, type = ro, define = yes, align = 256; DATA: load = ROM, run = RAM1, type = rw, define = yes; BSS: load = RAM1, type = bss, define = yes; - VECTORS: load = ROM, type = ro, define = yes; + VECTORS: load = ROMV, type = ro, define = yes; ENCRYPTION: load = ROME, type = ro define = yes; } diff --git a/libsrc/atari7800/exehdr.s b/libsrc/atari7800/exehdr.s index 15ce7ea29..6f3023040 100644 --- a/libsrc/atari7800/exehdr.s +++ b/libsrc/atari7800/exehdr.s @@ -1,3 +1,10 @@ +; +; Karri Kaksonen, 2022 +; +; This header contains data for emulators +; + .export __EXEHDR__: absolute = 1 + ; ------------------------------------------------------------------------ ; EXE header .segment "EXEHDR"