Add STARTUP and LOWCODE segments
git-svn-id: svn://svn.cc65.org/cc65/trunk@1601 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
fe75b5c3f3
commit
d7d86886b6
4 changed files with 25 additions and 32 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue