Move zp space out of crt0.s

git-svn-id: svn://svn.cc65.org/cc65/trunk@1291 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-05-26 09:09:10 +00:00
parent 3aadd7f62b
commit 33c1e82bda
7 changed files with 20 additions and 174 deletions

View File

@@ -9,43 +9,14 @@
.import zerobss, push0 .import zerobss, push0
.import _main .import _main
.include "zeropage.inc"
.include "apple2.inc" .include "apple2.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime ; Actual code
.exportzp sp, sreg, regsave
.exportzp ptr1, ptr2, ptr3, ptr4
.exportzp tmp1, tmp2, tmp3, tmp4
.exportzp regbank, zpspace
; These zero page entries overlap with the sweet-16 registers in
; the standard apple2 linker config. They must be changed if sweet-16
; is to be supported
.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 .code
; ------------------------------------------------------------------------
; Actual code
ldx #zpspace-1 ldx #zpspace-1
L1: lda sp,x L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need sta zpsave,x ; Save the zero page locations we need

View File

@@ -18,39 +18,10 @@
.import _main,__filetab,getfd .import _main,__filetab,getfd
.import __CODE_LOAD__, __BSS_LOAD__ .import __CODE_LOAD__, __BSS_LOAD__
.include "zeropage.inc"
.include "atari.inc" .include "atari.inc"
.include "_file.inc" .include "_file.inc"
; ------------------------------------------------------------------------
; Define and export the ZP variables for the runtime
.exportzp sp, sreg, regsave
.exportzp ptr1, ptr2, ptr3, ptr4
.exportzp tmp1, tmp2, tmp3, tmp4
.exportzp fntemp, 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
fntemp: .res 2 ; Pointer to file name
regbank: .res 6 ; 6 byte register bank
zpspace = * - zpstart ; Zero page space allocated
.code
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; EXE header ; EXE header
@@ -58,12 +29,12 @@ zpspace = * - zpstart ; Zero page space allocated
.word $FFFF .word $FFFF
.word __CODE_LOAD__ .word __CODE_LOAD__
.word __BSS_LOAD__ - 1 .word __BSS_LOAD__ - 1
.code
.reloc
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Actual code ; Actual code
.code
rts ; fix for SpartaDOS / OS/A+ rts ; fix for SpartaDOS / OS/A+
; they first call the entry point from AUTOSTRT and ; they first call the entry point from AUTOSTRT and
; then the load addess (this rts here). ; then the load addess (this rts here).

View File

@@ -12,6 +12,7 @@
.import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__ .import __IRQFUNC_TABLE__, __IRQFUNC_COUNT__
.import __RAM_START__, __RAM_SIZE__ .import __RAM_START__, __RAM_SIZE__
.include "zeropage.inc"
.include "c128.inc" .include "c128.inc"
.include "../cbm/cbm.inc" .include "../cbm/cbm.inc"
@@ -21,31 +22,6 @@
IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime
.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
; Place the startup code in a special segment to cope with the quirks of ; Place the startup code in a special segment to cope with the quirks of
; c128 banking. Do also create an empty segment named "NMI" to avoid ; c128 banking. Do also create an empty segment named "NMI" to avoid
; warnings if the rs232 routines are not used. ; warnings if the rs232 routines are not used.

View File

@@ -10,35 +10,10 @@
.import _main .import _main
.import __RAM_START__, __RAM_SIZE__ ; Linker generated .import __RAM_START__, __RAM_SIZE__ ; Linker generated
.include "zeropage.inc"
.include "c64.inc" .include "c64.inc"
.include "../cbm/cbm.inc" .include "../cbm/cbm.inc"
; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime
.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 .code
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------

View File

@@ -9,7 +9,10 @@
.import popax, return0, _DbgEntry, _set_brk, _end_brk .import popax, return0, _DbgEntry, _set_brk, _end_brk
.import _DbgBreaks .import _DbgBreaks
.import _brk_pc .import _brk_pc
.importzp sp, sreg, ptr1, tmp1, zpspace .import __ZP_START__ ; Linker generated
.include "zeropage.inc"
; C callable function, will install the debugger ; C callable function, will install the debugger
@@ -60,7 +63,7 @@ DbgStack:
CTemp: CTemp:
_DbgCS: .res 2 ; sp _DbgCS: .res 2 ; sp
_DbgHI: .res 2 ; sreg _DbgHI: .res 2 ; sreg
.res 22 ; Other stuff .res (zpspace-4) ; Other stuff
_DbgSP: .res 1 _DbgSP: .res 1
retsav: .res 2 ; Save buffer for return address retsav: .res 2 ; Save buffer for return address
@@ -71,7 +74,7 @@ retsav: .res 2 ; Save buffer for return address
DbgSwapZP: DbgSwapZP:
ldy #zpspace-1 ldy #zpspace-1
Swap1: ldx CTemp,y Swap1: ldx CTemp,y
lda sp,y ; ###### lda <__ZP_START__,y
sta CTemp,y sta CTemp,y
txa txa
sta sp,y sta sp,y

View File

@@ -9,40 +9,15 @@
.import zerobss, push0 .import zerobss, push0
.import _main .import _main
.include "zeropage.inc"
.include "pet.inc" .include "pet.inc"
.include "../cbm/cbm.inc" .include "../cbm/cbm.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime ; BASIC header with a SYS call
.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 .code
; ------------------------------------------------------------------------
; BASIC header with a SYS call
.org $3FF .org $3FF
.word Head ; Load address .word Head ; Load address
Head: .word @Next Head: .word @Next

View File

@@ -8,40 +8,15 @@
.import initlib, donelib .import initlib, donelib
.import push0, _main, zerobss .import push0, _main, zerobss
.include "zeropage.inc"
.include "plus4.inc" .include "plus4.inc"
.include "../cbm/cbm.inc" .include "../cbm/cbm.inc"
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; Define and export the ZP variables for the C64 runtime ; BASIC header with a SYS call
.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 .code
; ------------------------------------------------------------------------
; BASIC header with a SYS call
.org $0FFF .org $0FFF
.word Head ; Load address .word Head ; Load address
Head: .word @Next Head: .word @Next