From 0082473630675bdc91e323fbadde7d68260cdba5 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sun, 23 Feb 2025 00:35:23 +0100 Subject: [PATCH 1/2] Atari: fix fallout of change of INIT segment to 'bss' type The size of the load chunk was calculated incorrectly in exehdr.s since the INIT segment is no longer being part of the file anymore. While at it, change atari-cassette.cfg so that order of BSS and INIT is the same as in the other configs. See 692f96409d4e809d8 why it was in different order. --- cfg/atari-cassette.cfg | 2 +- cfg/atari-overlay.cfg | 2 +- cfg/atari-xex.cfg | 2 +- cfg/atari.cfg | 2 +- cfg/atarixl-largehimem.cfg | 2 +- cfg/atarixl-overlay.cfg | 2 +- cfg/atarixl-xex.cfg | 2 +- cfg/atarixl.cfg | 2 +- libsrc/atari/cashdr.s | 6 +++--- libsrc/atari/exehdr.s | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cfg/atari-cassette.cfg b/cfg/atari-cassette.cfg index 13b34cc73..1d7d02f93 100644 --- a/cfg/atari-cassette.cfg +++ b/cfg/atari-cassette.cfg @@ -22,8 +22,8 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro, optional = yes; DATA: load = MAIN, type = rw, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes, optional = yes; - INIT: load = MAIN, type = bss, optional = yes; } FEATURES { CONDES: type = constructor, diff --git a/cfg/atari-overlay.cfg b/cfg/atari-overlay.cfg index 60f98e453..1dde26331 100644 --- a/cfg/atari-overlay.cfg +++ b/cfg/atari-overlay.cfg @@ -52,7 +52,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; AUTOSTRT: load = TRAILER, type = ro; OVERLAY1: load = OVL1, type = ro, define = yes, optional = yes; diff --git a/cfg/atari-xex.cfg b/cfg/atari-xex.cfg index deab5c7a5..1ab60af2e 100644 --- a/cfg/atari-xex.cfg +++ b/cfg/atari-xex.cfg @@ -36,7 +36,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; } FEATURES { diff --git a/cfg/atari.cfg b/cfg/atari.cfg index 37337ea53..0af121de3 100644 --- a/cfg/atari.cfg +++ b/cfg/atari.cfg @@ -40,7 +40,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; AUTOSTRT: load = TRAILER, type = ro; } diff --git a/cfg/atarixl-largehimem.cfg b/cfg/atarixl-largehimem.cfg index 8f70597aa..6df9b3f80 100644 --- a/cfg/atarixl-largehimem.cfg +++ b/cfg/atarixl-largehimem.cfg @@ -67,7 +67,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; AUTOSTRT: load = TRAILER, type = ro; } diff --git a/cfg/atarixl-overlay.cfg b/cfg/atarixl-overlay.cfg index 3b8da4256..5cfdcdbc5 100644 --- a/cfg/atarixl-overlay.cfg +++ b/cfg/atarixl-overlay.cfg @@ -78,7 +78,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; AUTOSTRT: load = TRAILER, type = ro; diff --git a/cfg/atarixl-xex.cfg b/cfg/atarixl-xex.cfg index 853096c6f..a0a4a971d 100644 --- a/cfg/atarixl-xex.cfg +++ b/cfg/atarixl-xex.cfg @@ -58,7 +58,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; SRPREPHDR: load = UNUSED, type = ro; SRPREPTRL: load = UNUSED, type = ro; diff --git a/cfg/atarixl.cfg b/cfg/atarixl.cfg index 1517afb5a..5e7199cd3 100644 --- a/cfg/atarixl.cfg +++ b/cfg/atarixl.cfg @@ -65,7 +65,7 @@ SEGMENTS { CODE: load = MAIN, type = ro, define = yes; RODATA: load = MAIN, type = ro; DATA: load = MAIN, type = rw; - INIT: load = MAIN, type = bss, optional = yes; + INIT: load = MAIN, type = bss, define = yes, optional = yes; BSS: load = MAIN, type = bss, define = yes; AUTOSTRT: load = TRAILER, type = ro; } diff --git a/libsrc/atari/cashdr.s b/libsrc/atari/cashdr.s index c00ee98c2..c0d64a56b 100644 --- a/libsrc/atari/cashdr.s +++ b/libsrc/atari/cashdr.s @@ -10,10 +10,10 @@ .include "atari.inc" - .import __BSS_RUN__, __STARTADDRESS__, _cas_init + .import __INIT_RUN__, __STARTADDRESS__, _cas_init .export _cas_hdr -.assert ((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) < $101, error, "File to big to load from cassette" +.assert ((__INIT_RUN__ - __STARTADDRESS__ + 127) / 128) < $101, error, "File to big to load from cassette" ; for a description of the cassette header, see De Re Atari, appendix C @@ -22,7 +22,7 @@ _cas_hdr: .byte 0 ; ignored - .byte <((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) ; # of 128-byte records to read + .byte <((__INIT_RUN__ - __STARTADDRESS__ + 127) / 128) ; # of 128-byte records to read .word __STARTADDRESS__ ; load address .word _cas_init ; init address diff --git a/libsrc/atari/exehdr.s b/libsrc/atari/exehdr.s index 7abb7c1ac..fe17aeafd 100644 --- a/libsrc/atari/exehdr.s +++ b/libsrc/atari/exehdr.s @@ -1,11 +1,11 @@ ; This file defines the EXE header and main chunk load header for Atari executables .export __EXEHDR__: absolute = 1 - .import __MAIN_START__, __BSS_LOAD__ + .import __MAIN_START__, __INIT_LOAD__ .segment "EXEHDR" .word $FFFF .segment "MAINHDR" .word __MAIN_START__ - .word __BSS_LOAD__ - 1 + .word __INIT_LOAD__ - 1 From 04ada63935c6ac6eb57ab47ff08fb74ad0f19478 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Sun, 23 Feb 2025 01:06:08 +0100 Subject: [PATCH 2/2] Atari: let crt0.s always provide an (empty) INIT segment --- libsrc/atari/crt0.s | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsrc/atari/crt0.s b/libsrc/atari/crt0.s index 381aa699f..50e3ca7b6 100644 --- a/libsrc/atari/crt0.s +++ b/libsrc/atari/crt0.s @@ -204,6 +204,10 @@ APPMHI_save: .res 2 ; ------------------------------------------------------------------------ +.segment "INIT" ; have at least one (empty) segment of INIT, exehdr.s needs its definition + +; ------------------------------------------------------------------------ + .segment "LOWCODE" ; have at least one (empty) segment of LOWCODE, so that the next line works even if the program doesn't make use of this segment .assert (__LOWCODE_RUN__ + __LOWCODE_SIZE__ <= $4000 || __LOWCODE_RUN__ > $7FFF || __LOWCODE_SIZE__ = 0), warning, "'lowcode area' reaches into $4000..$7FFF bank memory window" ; check for LOWBSS_SIZE = 0 not needed since the only file which uses LOWBSS (irq.s) also uses LOWCODE