From bbbf2ac45a1f2573b8cc73320009c79ec5977c1e Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 22 Nov 2002 17:43:30 +0000 Subject: [PATCH] Move the startup code into its own segment git-svn-id: svn://svn.cc65.org/cc65/trunk@1581 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/c16/crt0.s | 15 ++++++++++----- libsrc/pet/crt0.s | 18 +++++++++++++----- libsrc/vic20/crt0.s | 15 ++++++++++++--- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/libsrc/c16/crt0.s b/libsrc/c16/crt0.s index c7916b9d2..d040f4e53 100644 --- a/libsrc/c16/crt0.s +++ b/libsrc/c16/crt0.s @@ -2,7 +2,7 @@ ; Startup code for cc65 (C16 version) ; ; This must be the *first* file on the linker command line -; +; ; Note: The C16 is actually the Plus/4 with just 16KB of memory. So many ; things are similar here, and we even use the plus4.inc include file. ; @@ -17,18 +17,23 @@ ; ------------------------------------------------------------------------ -; BASIC header with a SYS call +; Create an empty LOWCODE segment to avoid linker warnings -.code +.segment "LOWCODE" + +; ------------------------------------------------------------------------ +; Place the startup code in a special segment. + +.segment "STARTUP" + +; BASIC header with a SYS call - .org $0FFF .word Head ; Load address Head: .word @Next .word 1000 ; Line number .byte $9E,"4109" ; SYS 4109 .byte $00 ; End of BASIC line @Next: .word 0 ; BASIC end marker - .reloc ; ------------------------------------------------------------------------ ; Actual code diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index c1e5c009f..fb65973ec 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -15,25 +15,30 @@ .include "../cbm/cbm.inc" ; ------------------------------------------------------------------------ -; BASIC header with a SYS call +; Create an empty LOWCODE segment to avoid linker warnings + +.segment "LOWCODE" + +; ------------------------------------------------------------------------ +; Place the startup code in a special segment. -.code +.segment "STARTUP" + +; BASIC header with a SYS call - .org $3FF .word Head ; Load address Head: .word @Next .word 1000 ; Line number .byte $9E,"1037" ; SYS 1037 .byte $00 ; End of BASIC line @Next: .word 0 ; BASIC end marker - .reloc ; ------------------------------------------------------------------------ ; Actual code ldx #zpspace-1 L1: lda sp,x - sta zpsave,x ; Save the zero page locations we need + sta zpsave,x ; Save the zero page locations we need dex bpl L1 @@ -95,6 +100,9 @@ L2: lda zpsave,x rts +; ------------------------------------------------------------------------ +; Data + .data zpsave: .res zpspace diff --git a/libsrc/vic20/crt0.s b/libsrc/vic20/crt0.s index 286b0407c..ca3ff2f49 100644 --- a/libsrc/vic20/crt0.s +++ b/libsrc/vic20/crt0.s @@ -16,9 +16,17 @@ .include "../cbm/cbm.inc" ; ------------------------------------------------------------------------ +; Create an empty LOWCODE segment to avoid linker warnings + +.segment "LOWCODE" + +; ------------------------------------------------------------------------ +; Place the startup code in a special segment. + +.segment "STARTUP" + ; BASIC header with a SYS call -.segment "EXEHDR" .word Head ; Load address Head: .word @Next .word 1000 ; Line number @@ -34,8 +42,6 @@ Head: .word @Next ; ------------------------------------------------------------------------ ; Actual code -.code - ldx #zpspace-1 L1: lda sp,x sta zpsave,x ; Save the zero page locations we need @@ -99,6 +105,9 @@ L2: lda zpsave,x jmp RESTOR +; ------------------------------------------------------------------------ +; Data + .data zpsave: .res zpspace -- 2.39.5