; 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.
;
; ------------------------------------------------------------------------
-; 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
.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
rts
+; ------------------------------------------------------------------------
+; Data
+
.data
zpsave: .res zpspace
.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
; ------------------------------------------------------------------------
; Actual code
-.code
-
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
jmp RESTOR
+; ------------------------------------------------------------------------
+; Data
+
.data
zpsave: .res zpspace