diff --git a/cfg/atari-asm.cfg b/cfg/atari-asm.cfg new file mode 100644 index 000000000..4e87a8884 --- /dev/null +++ b/cfg/atari-asm.cfg @@ -0,0 +1,29 @@ +FEATURES { + STARTADDRESS: default = $2E00; +} +SYMBOLS { + __EXEHDR__: type = import; + __AUTOSTART__: type = import; # force inclusion of autostart "trailer" + __STARTADDRESS__: type = export, value = %S; +} +MEMORY { + ZP: file = "", define = yes, start = $0082, size = $007E; + +# file header, just $FFFF + HEADER: file = %O, start = $0000, size = $0002; + +# "main program" load chunk + MAINHDR: file = %O, start = $0000, size = $0004; + RAM: file = %O, define = yes, start = %S, size = $BC20 - %S; + TRAILER: file = %O, start = $0000, size = $0006; +} +SEGMENTS { + EXEHDR: load = HEADER, type = ro, optional = yes; + MAINHDR: load = MAINHDR, type = ro, optional = yes; + CODE: load = RAM, type = ro, define = yes, optional = yes; + RODATA: load = RAM, type = ro optional = yes; + DATA: load = RAM, type = rw optional = yes; + BSS: load = RAM, type = bss, define = yes, optional = yes; + ZEROPAGE: load = ZP, type = zp; + AUTOSTRT: load = TRAILER, type = ro, optional = yes; +} diff --git a/cfg/atari-overlay.cfg b/cfg/atari-overlay.cfg index c58cf830a..1d339b208 100644 --- a/cfg/atari-overlay.cfg +++ b/cfg/atari-overlay.cfg @@ -2,11 +2,13 @@ FEATURES { STARTADDRESS: default = $2000; } SYMBOLS { + __EXEHDR__: type = import; + __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk + __AUTOSTART__: type = import; # force inclusion of autostart "trailer" __STACKSIZE__: type = weak, value = $0800; # 2k stack __OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay __STARTADDRESS__: type = export, value = %S; __RESERVED_MEMORY__: type = weak, value = $0000; - syschk: type = import; # force inclusion of SYSCHK } MEMORY { ZP: file = "", define = yes, start = $0082, size = $007E; diff --git a/cfg/atari.cfg b/cfg/atari.cfg index 69132cde3..dce593f05 100644 --- a/cfg/atari.cfg +++ b/cfg/atari.cfg @@ -2,10 +2,12 @@ FEATURES { STARTADDRESS: default = $2000; } SYMBOLS { + __EXEHDR__: type = import; + __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk + __AUTOSTART__: type = import; # force inclusion of autostart "trailer" __STACKSIZE__: type = weak, value = $0800; # 2k stack __STARTADDRESS__: type = export, value = %S; __RESERVED_MEMORY__: type = weak, value = $0000; - syschk: type = import; # force inclusion of SYSCHK } MEMORY { ZP: file = "", define = yes, start = $0082, size = $007E; diff --git a/cfg/atarixl-largehimem.cfg b/cfg/atarixl-largehimem.cfg index a4923d025..533987258 100644 --- a/cfg/atarixl-largehimem.cfg +++ b/cfg/atarixl-largehimem.cfg @@ -8,9 +8,11 @@ FEATURES { } SYMBOLS { + __EXEHDR__: type = import; + __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk + __AUTOSTART__: type = import; # force inclusion of autostart "trailer" __STACKSIZE__: type = weak, value = $0800; # 2k stack __STARTADDRESS__: type = export, value = %S; - syschk: type = import; # force inclusion of SYSCHK sramprep: type = import; # force inclusion of SRPREP } diff --git a/cfg/atarixl-overlay.cfg b/cfg/atarixl-overlay.cfg index b38dff731..0c903ef45 100644 --- a/cfg/atarixl-overlay.cfg +++ b/cfg/atarixl-overlay.cfg @@ -3,10 +3,12 @@ FEATURES { } SYMBOLS { + __EXEHDR__: type = import; + __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk + __AUTOSTART__: type = import; # force inclusion of autostart "trailer" __STACKSIZE__: type = weak, value = $0800; # 2k stack __OVERLAYSIZE__: type = weak, value = $1000; # 4k overlay __STARTADDRESS__: type = export, value = %S; - syschk: type = import; # force inclusion of SYSCHK sramprep: type = import; # force inclusion of SRPREP } diff --git a/cfg/atarixl.cfg b/cfg/atarixl.cfg index c57bef7b7..f2cf20bc6 100644 --- a/cfg/atarixl.cfg +++ b/cfg/atarixl.cfg @@ -3,9 +3,11 @@ FEATURES { } SYMBOLS { + __EXEHDR__: type = import; + __SYSTEM_CHECK__: type = import; # force inclusion of "system check" load chunk + __AUTOSTART__: type = import; # force inclusion of autostart "trailer" __STACKSIZE__: type = weak, value = $0800; # 2k stack __STARTADDRESS__: type = export, value = %S; - syschk: type = import; # force inclusion of SYSCHK sramprep: type = import; # force inclusion of SRPREP } diff --git a/libsrc/atari/crt0.s b/libsrc/atari/crt0.s index de72c1eb8..464557fa7 100644 --- a/libsrc/atari/crt0.s +++ b/libsrc/atari/crt0.s @@ -8,12 +8,11 @@ ; Stefan Haubenthal ; - .export _exit .export __STARTUP__ : absolute = 1 ; Mark as startup + .export _exit, start .import initlib, donelib .import callmain, zerobss - .import __STARTUP_LOAD__, __BSS_LOAD__ .import __RESERVED_MEMORY__ .import __RAM_START__, __RAM_SIZE__ .ifdef __ATARIXL__ @@ -28,19 +27,6 @@ .include "atari.inc" ; ------------------------------------------------------------------------ -; EXE header - -.segment "EXEHDR" - - .word $FFFF - -.segment "MAINHDR" - - .word __STARTUP_LOAD__ - .word __BSS_LOAD__ - 1 - -; ------------------------------------------------------------------------ -; Actual code .segment "STARTUP" @@ -212,9 +198,3 @@ LMARGN_save: .res 1 .ifndef __ATARIXL__ APPMHI_save: .res 2 .endif - - -.segment "AUTOSTRT" - .word RUNAD ; defined in atari.inc - .word RUNAD+1 - .word start diff --git a/libsrc/atari/exehdr.s b/libsrc/atari/exehdr.s new file mode 100644 index 000000000..ea9fa95d7 --- /dev/null +++ b/libsrc/atari/exehdr.s @@ -0,0 +1,11 @@ +; This file defines the EXE header and main chunk load header for Atari executables + + .export __EXEHDR__: absolute = 1 + .import __RAM_START__, __BSS_LOAD__ + +.segment "EXEHDR" + .word $FFFF + +.segment "MAINHDR" + .word __RAM_START__ + .word __BSS_LOAD__ - 1 diff --git a/libsrc/atari/exetrailer.s b/libsrc/atari/exetrailer.s new file mode 100644 index 000000000..8cae0bdf0 --- /dev/null +++ b/libsrc/atari/exetrailer.s @@ -0,0 +1,12 @@ +; This file defines the EXE file "trailer" which sets the entry point + + .export __AUTOSTART__: absolute = 1 + .import start + + .include "atari.inc" + +.segment "AUTOSTRT" + .word RUNAD ; defined in atari.inc + .word RUNAD+1 + .word start + diff --git a/libsrc/atari/system_check.s b/libsrc/atari/system_check.s index ef544ef6f..dbc0b5dfb 100644 --- a/libsrc/atari/system_check.s +++ b/libsrc/atari/system_check.s @@ -16,7 +16,7 @@ ;DEBUG = 1 - .export syschk + .export __SYSTEM_CHECK__: absolute = 1 .import __SYSCHK_LOAD__ .import __STARTADDRESS__