From: cuz Date: Sat, 23 Nov 2002 11:10:50 +0000 (+0000) Subject: Add STARTUP and LOWCODE segments X-Git-Tag: V2.12.0~2036 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d7d86886b6e571e55eb605ac4ba92c3970f6f8e3;p=cc65 Add STARTUP and LOWCODE segments git-svn-id: svn://svn.cc65.org/cc65/trunk@1601 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/apple2/crt0.s b/libsrc/apple2/crt0.s index a5ed0a833..b3cfb55c9 100644 --- a/libsrc/apple2/crt0.s +++ b/libsrc/apple2/crt0.s @@ -7,7 +7,7 @@ .export _exit .import initlib, donelib .import zerobss, push0 - .import __CODE_LOAD__, __BSS_LOAD__ ; Linker generated + .import __STARTUP_LOAD__, __BSS_LOAD__ ; Linker generated .import _main .include "zeropage.inc" @@ -18,13 +18,18 @@ .segment "EXEHDR" - .word __CODE_LOAD__ ; Start address - .word __BSS_LOAD__ - __CODE_LOAD__ ; Size + .word __STARTUP_LOAD__ ; Start address + .word __BSS_LOAD__ - __STARTUP_LOAD__ ; Size ; ------------------------------------------------------------------------ -; Actual code +; Create an empty LOWCODE segment to avoid linker warnings -.code +.segment "LOWCODE" + +; ------------------------------------------------------------------------ +; Place the startup code in a special segment. + +.segment "STARTUP" ldx #zpspace-1 L1: lda sp,x @@ -91,6 +96,8 @@ L2: lda zpsave,x jmp RESTOR +; ------------------------------------------------------------------------ +; Data .data diff --git a/libsrc/atmos/crt0.s b/libsrc/atmos/crt0.s index 5955fd94b..1fae39083 100644 --- a/libsrc/atmos/crt0.s +++ b/libsrc/atmos/crt0.s @@ -13,35 +13,14 @@ ; ------------------------------------------------------------------------ -; Define and export the ZP variables for the Oric runtime +; Create an empty LOWCODE segment to avoid linker warnings - .exportzp sp, sreg, regsave - .exportzp ptr1, ptr2, ptr3, ptr4 - .exportzp tmp1, tmp2, tmp3, tmp4 - .exportzp regbank, zpspace - -.zeropage - -zpstart = * -sp: .res 2 ; Stack pointer -sreg: .res 2 ; Secondary register/high 16 bit for longs -regsave: .res 2 ; slot to save/restore (E)AX into -ptr1: .res 2 -ptr2: .res 2 -ptr3: .res 2 -ptr4: .res 2 -tmp1: .res 1 -tmp2: .res 1 -tmp3: .res 1 -tmp4: .res 1 -regbank: .res 6 ; 6 byte register bank - -zpspace = * - zpstart ; Zero page space allocated - -.code +.segment "LOWCODE" ; ------------------------------------------------------------------------ -; Actual code +; Place the startup code in a special segment. + +.segment "STARTUP" ; Clear the BSS data @@ -82,6 +61,9 @@ _exit: jsr donelib ; Run module destructors rts +; ------------------------------------------------------------------------ +; Data + .bss spsave: .res 1 diff --git a/src/ld65/cfg/apple2.cfg b/src/ld65/cfg/apple2.cfg index 89ab2ef54..1248af0cb 100644 --- a/src/ld65/cfg/apple2.cfg +++ b/src/ld65/cfg/apple2.cfg @@ -5,7 +5,9 @@ MEMORY { } SEGMENTS { EXEHDR: load = HEADER, type = ro; - CODE: load = RAM, type = ro, define = yes; + STARTUP: load = RAM, type = ro, define = yes; + LOWCODE: load = RAM, type = ro; + CODE: load = RAM, type = ro; RODATA: load = RAM, type = ro; DATA: load = RAM, type = rw; BSS: load = RAM, type = bss, define = yes; diff --git a/src/ld65/cfg/atmos.cfg b/src/ld65/cfg/atmos.cfg index f16198324..48010c015 100644 --- a/src/ld65/cfg/atmos.cfg +++ b/src/ld65/cfg/atmos.cfg @@ -3,6 +3,8 @@ MEMORY { RAM: start = $0600, size = $9200, define = yes, file = %O; } SEGMENTS { + SATRTUP: load = RAM, type = wprot; + LOWCODE: load = RAM, type = wprot; CODE: load = RAM, type = wprot; RODATA: load = RAM, type = wprot; DATA: load = RAM, type = rw;