From e0a619ff903112046ae4be0ff1aed38387d609d5 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 7 Sep 2000 21:49:13 +0000 Subject: [PATCH] Place the zero page variables into the ZEROPAGE segment git-svn-id: svn://svn.cc65.org/cc65/trunk@322 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/apple2/crt0.s | 46 +++++++++++++++++++++++++------------------ libsrc/atari/crt0.s | 47 +++++++++++++++++++++++++------------------- libsrc/c128/crt0.s | 32 ++++++++++++++++++------------ libsrc/c64/crt0.s | 32 ++++++++++++++++++------------ libsrc/cbm610/crt0.s | 32 ++++++++++++++++++------------ libsrc/pet/crt0.s | 32 ++++++++++++++++++------------ libsrc/plus4/crt0.s | 32 ++++++++++++++++++------------ 7 files changed, 149 insertions(+), 104 deletions(-) diff --git a/libsrc/apple2/crt0.s b/libsrc/apple2/crt0.s index 08eb57fd9..c3530ccf6 100644 --- a/libsrc/apple2/crt0.s +++ b/libsrc/apple2/crt0.s @@ -15,25 +15,33 @@ ; 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 - -; These zero page entries overlap with the sweet-16 registers. -; must be changed if sweet-16 is to be supported -sp = $00 ; stack pointer -sreg = $02 ; secondary register/high 16 bit for longs -regsave = $04 ; slot to save/restore (E)AX into -ptr1 = $08 ; -ptr2 = $0A -ptr3 = $0C -ptr4 = $0E -tmp1 = $10 -tmp2 = $11 -tmp3 = $12 -tmp4 = $13 -regbank = $14 ; 6 byte register bank -zpspace = $1A ; Zero page space allocated + .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 ; ------------------------------------------------------------------------ ; Actual code diff --git a/libsrc/atari/crt0.s b/libsrc/atari/crt0.s index 92fea420a..ca4a095d3 100644 --- a/libsrc/atari/crt0.s +++ b/libsrc/atari/crt0.s @@ -26,20 +26,27 @@ .exportzp tmp1, tmp2, tmp3, tmp4 .exportzp fntemp, regbank, zpspace -sp = $D2 ; (2bytes) stack pointer -sreg = $D4 ; (2bytes) secondary register/high 16 bit for longs -regsave = $D6 ; (4bytes) slot to save/restore (E)AX into -ptr1 = $DA ; (2bytes) -ptr2 = $DC ; (2bytes) -ptr3 = $DE ; (2bytes) -ptr4 = $E0 ; (2bytes) -tmp1 = $E2 ; (1byte) -tmp2 = $E3 ; (1byte) -tmp3 = $E4 ; (1byte) -tmp4 = $E5 ; (1byte) -fntemp = $E6 ; (2bytes) pointer to file name -regbank = $E8 ; (6bytes) 6 byte register bank -zpspace = $EE - sp ; Zero page space allocated + +.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 @@ -86,12 +93,12 @@ L1: lda sp,y sta appmsav+1 jsr getmemtop ; adjust for graphics mode to use - + sta sp sta APPMHI stx sp+1 ; Set argument stack ptr stx APPMHI+1 - + ; set left margin to 0 lda LMARGN @@ -104,7 +111,7 @@ L1: lda sp,y ldx SHFLOK stx old_shflok sta SHFLOK - + ; Initialize the heap jsr __hinit @@ -160,7 +167,7 @@ _exit: jsr doatexit ; call exit functions sta SHFLOK ; restore APPMHI - + lda appmsav sta APPMHI lda appmsav+1 @@ -259,9 +266,9 @@ grmemusage: ; 220 GRAPHICS 0 ; 230 FOR I=0 TO 31:PRINT #1;I;":",G(I);" - ";G(0)-G(I):NEXT I ; 240 CLOSE #1 -; 999 END +; 999 END ; 1000 VAL=PEEK(741)+256*PEEK(742) -; 1010 RETURN +; 1010 RETURN .bss diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index f10078d32..eaad29ed4 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -19,19 +19,25 @@ .exportzp tmp1, tmp2, tmp3, tmp4 .exportzp regbank, zpspace -sp = $02 ; stack pointer -sreg = $04 ; secondary register/high 16 bit for longs -regsave = $06 ; slot to save/restore (E)AX into -ptr1 = $0A ; -ptr2 = $0C -ptr3 = $0E -ptr4 = $10 -tmp1 = $12 -tmp2 = $13 -tmp3 = $14 -tmp4 = $15 -regbank = $16 ; 6 byte register bank -zpspace = $1A ; Zero page space allocated +.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 ; ------------------------------------------------------------------------ ; BASIC header with a SYS call diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index 6d68f23ae..1c5f3f97e 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -19,19 +19,25 @@ .exportzp tmp1, tmp2, tmp3, tmp4 .exportzp regbank, zpspace -sp = $02 ; stack pointer -sreg = $04 ; secondary register/high 16 bit for longs -regsave = $06 ; slot to save/restore (E)AX into -ptr1 = $0A ; -ptr2 = $0C -ptr3 = $0E -ptr4 = $10 -tmp1 = $12 -tmp2 = $13 -tmp3 = $14 -tmp4 = $15 -regbank = $16 ; 6 byte register bank -zpspace = $1A ; Zero page space allocated +.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 ; ------------------------------------------------------------------------ ; BASIC header with a SYS call diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index 3ab5257e0..5a9a9011b 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -25,19 +25,25 @@ .exportzp crtc, sid, IPCcia, cia, acia, tpi1, tpi2 .exportzp ktab1, ktab2, ktab3, ktab4, time, RecvBuf, SendBuf -sp = $02 ; stack pointer -sreg = $04 ; secondary register/high 16 bit for longs -regsave = $06 ; slot to save/restore (E)AX into -ptr1 = $0A ; -ptr2 = $0C -ptr3 = $0E -ptr4 = $10 -tmp1 = $12 -tmp2 = $13 -tmp3 = $14 -tmp4 = $15 -regbank = $16 ; 6 byte register bank -zpspace = $1A ; Zero page space allocated +.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 ; ------------------------------------------------------------------------ ; BASIC header and a small BASIC program. Since it is not possible to start diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index 58e67eb05..6d1849d87 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -19,19 +19,25 @@ .exportzp tmp1, tmp2, tmp3, tmp4 .exportzp regbank, zpspace -sp = $02 ; stack pointer -sreg = $04 ; secondary register/high 16 bit for longs -regsave = $06 ; slot to save/restore (E)AX into -ptr1 = $0A ; -ptr2 = $0C -ptr3 = $0E -ptr4 = $10 -tmp1 = $12 -tmp2 = $13 -tmp3 = $14 -tmp4 = $15 -regbank = $16 ; 6 byte register bank -zpspace = $1A ; Zero page space allocated +.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 ; ------------------------------------------------------------------------ ; BASIC header with a SYS call diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 72fce209d..bdba66793 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -19,19 +19,25 @@ .exportzp tmp1, tmp2, tmp3, tmp4 .exportzp regbank, zpspace -sp = $02 ; stack pointer -sreg = $04 ; secondary register/high 16 bit for longs -regsave = $06 ; slot to save/restore (E)AX into -ptr1 = $0A ; -ptr2 = $0C -ptr3 = $0E -ptr4 = $10 -tmp1 = $12 -tmp2 = $13 -tmp3 = $14 -tmp4 = $15 -regbank = $16 ; 6 byte register bank -zpspace = $1A ; Zero page space allocated +.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 ; ------------------------------------------------------------------------ ; BASIC header with a SYS call -- 2.39.5