.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"
.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
jmp RESTOR
+; ------------------------------------------------------------------------
+; Data
.data
; ------------------------------------------------------------------------
-; 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
rts
+; ------------------------------------------------------------------------
+; Data
+
.bss
spsave: .res 1
}
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;
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;