From b6f42f9ab260d0974281aae15aa74166edddac1d Mon Sep 17 00:00:00 2001 From: Gorilla Sapiens Date: Wed, 4 Jun 2025 06:37:59 +0000 Subject: [PATCH] changed "spc" to "c_sp" --- asminc/zeropage.inc | 2 +- doc/atari.sgml | 2 +- doc/ca65.sgml | 6 +- doc/cc65-intern.sgml | 12 +- doc/customizing.sgml | 4 +- doc/sim65.sgml | 2 +- libsrc/apple2/callmain.s | 2 +- libsrc/apple2/crt0.s | 6 +- libsrc/apple2/exec.s | 4 +- libsrc/apple2/filename.s | 14 +- libsrc/apple2/mli_file_info_direct.s | 4 +- libsrc/apple2/mou/a2.stdmou.s | 4 +- libsrc/apple2/open.s | 4 +- libsrc/apple2/syschdir.s | 4 +- libsrc/apple2/sysmkdir.s | 4 +- libsrc/apple2/sysremove.s | 4 +- libsrc/apple2/sysrename.s | 8 +- libsrc/atari/crt0.s | 8 +- libsrc/atari/diopncls.s | 8 +- libsrc/atari/fdtable.s | 4 +- libsrc/atari/mcbpm.s | 14 +- libsrc/atari/mou/atrjoy.s | 4 +- libsrc/atari/mou/atrst.s | 4 +- libsrc/atari/mou/atrtt.s | 4 +- libsrc/atari/sysrename.s | 22 ++-- libsrc/atari/ucase_fn.s | 12 +- libsrc/atari2600/crt0.s | 4 +- libsrc/atari5200/crt0.s | 4 +- libsrc/atari7800/crt0.s | 4 +- libsrc/atari7800/mono_setcursor.s | 2 +- libsrc/atari7800/setcursor.s | 2 +- libsrc/atmos/crt0.s | 8 +- libsrc/c128/crt0.s | 8 +- libsrc/c128/mou/c128-1351.s | 4 +- libsrc/c128/mou/c128-inkwell.s | 4 +- libsrc/c128/mou/c128-joy.s | 4 +- libsrc/c128/mou/c128-pot.s | 4 +- libsrc/c16/crt0.s | 8 +- libsrc/c64/crt0.s | 8 +- libsrc/c64/mou/c64-1351.s | 4 +- libsrc/c64/mou/c64-inkwell.s | 4 +- libsrc/c64/mou/c64-joy.s | 4 +- libsrc/c64/mou/c64-pot.s | 4 +- libsrc/cbm/dir.s | 8 +- libsrc/cbm/open.s | 2 +- libsrc/cbm/write.s | 2 +- libsrc/cbm510/crt0.s | 12 +- libsrc/cbm510/mou/cbm510-inkwl.s | 4 +- libsrc/cbm510/mou/cbm510-joy.s | 4 +- libsrc/cbm610/crt0.s | 12 +- libsrc/common/_fopen.s | 10 +- libsrc/common/_heap.s | 6 +- libsrc/common/_idiv32by16r16.s | 8 +- libsrc/common/_printf.s | 14 +- libsrc/common/_udiv32by16r16.s | 8 +- libsrc/common/fprintf.s | 8 +- libsrc/common/fread.s | 14 +- libsrc/common/fscanf.s | 8 +- libsrc/common/interrupt.s | 4 +- libsrc/common/itoa.s | 10 +- libsrc/common/longjmp.s | 6 +- libsrc/common/lz4.s | 2 +- libsrc/common/memcpy.s | 6 +- libsrc/common/memset.s | 6 +- libsrc/common/printf.s | 6 +- libsrc/common/realloc.s | 2 +- libsrc/common/scanf.s | 6 +- libsrc/common/setjmp.s | 6 +- libsrc/common/snprintf.s | 8 +- libsrc/common/sprintf.s | 8 +- libsrc/common/sscanf.s | 8 +- libsrc/common/vfprintf.s | 10 +- libsrc/common/vfscanf.s | 8 +- libsrc/common/vprintf.s | 14 +- libsrc/common/vscanf.s | 12 +- libsrc/common/vsnprintf.s | 14 +- libsrc/common/vsscanf.s | 10 +- libsrc/conio/cprintf.s | 6 +- libsrc/conio/cscanf.s | 4 +- libsrc/conio/vcprintf.s | 10 +- libsrc/creativision/crt0.s | 4 +- libsrc/cx16/crt0.s | 4 +- libsrc/cx16/mou/cx16-std.s | 4 +- libsrc/dbg/dbgdump.s | 12 +- libsrc/dbg/dbgsupp.s | 8 +- libsrc/gamate/crt0.s | 4 +- libsrc/geos-common/drivers/geos-stdmou.s | 12 +- libsrc/geos-common/system/crt0.s | 6 +- libsrc/kim1/crt0.s | 4 +- libsrc/lynx/crt0.s | 4 +- libsrc/lynx/lseek.s | 2 +- libsrc/nes/crt0.s | 4 +- libsrc/none/crt0.s | 4 +- libsrc/osic1p/crt0.s | 4 +- libsrc/pce/_printf.s | 12 +- libsrc/pce/crt0.s | 6 +- libsrc/pce/memcpy.s | 6 +- libsrc/pet/crt0.s | 8 +- libsrc/plus4/crt0.s | 8 +- libsrc/rp6502/crt0.s | 4 +- libsrc/rp6502/ria.s | 2 +- libsrc/rp6502/xreg.s | 6 +- libsrc/runtime/add.s | 24 ++-- libsrc/runtime/addeqsp.s | 10 +- libsrc/runtime/addysp.s | 8 +- libsrc/runtime/and.s | 8 +- libsrc/runtime/bpushbsp.s | 4 +- libsrc/runtime/decsp1.s | 8 +- libsrc/runtime/decsp2.s | 8 +- libsrc/runtime/decsp3.s | 8 +- libsrc/runtime/decsp4.s | 8 +- libsrc/runtime/decsp5.s | 8 +- libsrc/runtime/decsp6.s | 8 +- libsrc/runtime/decsp7.s | 8 +- libsrc/runtime/decsp8.s | 8 +- libsrc/runtime/enter.s | 10 +- libsrc/runtime/eq.s | 2 +- libsrc/runtime/icmp.s | 14 +- libsrc/runtime/incsp1.s | 6 +- libsrc/runtime/incsp2.s | 16 +-- libsrc/runtime/ladd.s | 12 +- libsrc/runtime/laddeqsp.s | 18 +-- libsrc/runtime/land.s | 12 +- libsrc/runtime/lcmp.s | 10 +- libsrc/runtime/ldau0sp.s | 6 +- libsrc/runtime/ldauisp.s | 6 +- libsrc/runtime/ldaxsp.s | 6 +- libsrc/runtime/ldeaxysp.s | 10 +- libsrc/runtime/leaaxsp.s | 6 +- libsrc/runtime/leave.s | 18 +-- libsrc/runtime/lmul.s | 12 +- libsrc/runtime/lor.s | 12 +- libsrc/runtime/lpop.s | 12 +- libsrc/runtime/lpush.s | 12 +- libsrc/runtime/lrsub.s | 12 +- libsrc/runtime/lsub.s | 12 +- libsrc/runtime/lsubeqsp.s | 18 +-- libsrc/runtime/ludiv.s | 12 +- libsrc/runtime/lxor.s | 12 +- libsrc/runtime/or.s | 8 +- libsrc/runtime/popa.s | 10 +- libsrc/runtime/popptr1.s | 8 +- libsrc/runtime/popsreg.s | 8 +- libsrc/runtime/pusha.s | 16 +-- libsrc/runtime/pushax.s | 14 +- libsrc/runtime/pushbsp.s | 4 +- libsrc/runtime/pushlysp.s | 10 +- libsrc/runtime/pushwsp.s | 16 +-- libsrc/runtime/regswap.s | 6 +- libsrc/runtime/regswap1.s | 6 +- libsrc/runtime/regswap2.s | 10 +- libsrc/runtime/rsub.s | 8 +- libsrc/runtime/staspidx.s | 6 +- libsrc/runtime/staxsp.s | 8 +- libsrc/runtime/staxspi.s | 8 +- libsrc/runtime/steaxsp.s | 12 +- libsrc/runtime/stkchk.s | 14 +- libsrc/runtime/sub.s | 8 +- libsrc/runtime/subeqsp.s | 10 +- libsrc/runtime/subysp.s | 8 +- libsrc/runtime/swap.s | 14 +- libsrc/runtime/tosint.s | 12 +- libsrc/runtime/toslong.s | 26 ++-- libsrc/runtime/xor.s | 8 +- libsrc/runtime/zeropage.s | 2 +- libsrc/sim6502/crt0.s | 4 +- libsrc/sim6502/exehdr.s | 4 +- libsrc/supervision/crt0.s | 4 +- libsrc/sym1/crt0.s | 4 +- libsrc/telestrat/crt0.s | 8 +- libsrc/telestrat/open.s | 2 +- libsrc/telestrat/wherex.s | 2 +- libsrc/tgi/tgi_outtextxy.s | 10 +- libsrc/vic20/crt0.s | 8 +- libsrc/zlib/inflatemem.s | 10 +- samples/getsp.s | 6 +- samples/tinyshell.c | 12 +- src/cc65/codegen.c | 155 ++++++++++++----------- src/cc65/codeinfo.c | 5 +- src/cc65/codeinfo.h | 6 +- src/cc65/codeopt.c | 2 +- src/cc65/codeoptutil.c | 22 ++-- src/cc65/coptadd.c | 60 ++++----- src/cc65/coptadd.h | 20 +-- src/cc65/coptbool.c | 12 +- src/cc65/coptcmp.c | 16 +-- src/cc65/coptcmp.h | 4 +- src/cc65/coptmisc.c | 22 ++-- src/cc65/coptptrload.c | 10 +- src/cc65/coptptrload.h | 8 +- src/cc65/coptptrstore.c | 12 +- src/cc65/coptptrstore.h | 10 +- src/cc65/coptstop.c | 6 +- src/cc65/coptstore.c | 2 +- src/cc65/locals.c | 2 +- src/cc65/stdfunc.c | 34 ++--- src/dbginfo/dbgsh.c | 2 +- src/sim65/main.c | 2 +- targettest/atari/mem.c | 2 +- targettest/ft.c | 12 +- targettest/getsp.s | 6 +- test/asm/opcodes/m740-opcodes.s | 2 +- test/val/bug1652-optimizer.c | 8 +- test/val/cq85.c | 2 +- 204 files changed, 913 insertions(+), 909 deletions(-) diff --git a/asminc/zeropage.inc b/asminc/zeropage.inc index 75e498b39..5285779ba 100644 --- a/asminc/zeropage.inc +++ b/asminc/zeropage.inc @@ -8,7 +8,7 @@ ; by the compiler, ready for usage in asm code. - .globalzp spc, sreg, regsave + .globalzp c_sp, sreg, regsave .globalzp ptr1, ptr2, ptr3, ptr4 .globalzp tmp1, tmp2, tmp3, tmp4 .globalzp regbank diff --git a/doc/atari.sgml b/doc/atari.sgml index 96948f791..1a83d74fb 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -1121,7 +1121,7 @@ If BSS and/or the stack shouldn't stay at the end of the program, some parts of the cc65 runtime lib need to be replaced/modified. common/_heap.s defines the location of the heap and atari/crt0.s -defines the location of the stack by initializing spc. +defines the location of the stack by initializing c_sp. Upgrading from an older cc65 version

diff --git a/doc/ca65.sgml b/doc/ca65.sgml index 20684c283..ba4355f9f 100644 --- a/doc/ca65.sgml +++ b/doc/ca65.sgml @@ -4788,17 +4788,17 @@ bit. Using .if (.cpu .bitand CPU_ISET_65SC02) - lda (spc) + lda (c_sp) .else ldy #$00 - lda (spc),y + lda (c_sp),y .endif it is possible to determine if the - lda (spc) + lda (c_sp) instruction is supported, which is the case for the 65SC02, 65C02 and 65816 diff --git a/doc/cc65-intern.sgml b/doc/cc65-intern.sgml index 3f1c99008..9c59cd79a 100644 --- a/doc/cc65-intern.sgml +++ b/doc/cc65-intern.sgml @@ -131,7 +131,7 @@ All other parameters will be pushed to the C-stack from left to right. The rightmost parameter will have the lowest address on the stack, and multi-byte parameters will have their least significant byte at the lower address. -The Epilogue, after the function call

@@ -175,12 +175,12 @@ used if the return type is 32-bit. If the function has a void return type, the compiler will not depend on the result of A/X/sreg, so these may be clobbered by the function. -The C-stack pointer 1 byte 1 byte 1 byte 1 word (__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 .else @@ -75,11 +75,11 @@ start: lda MEMTOP sbc #<__RESERVED_MEMORY__ sta APPMHI ; initialize our APPMHI value - sta spc ; set up runtime stack part 1 + sta c_sp ; set up runtime stack part 1 lda MEMTOP+1 sbc #>__RESERVED_MEMORY__ sta APPMHI+1 - sta spc+1 ; set up runtime stack part 2 + sta c_sp+1 ; set up runtime stack part 2 .endif diff --git a/libsrc/atari/diopncls.s b/libsrc/atari/diopncls.s index 9e67829ef..a5c145081 100644 --- a/libsrc/atari/diopncls.s +++ b/libsrc/atari/diopncls.s @@ -16,7 +16,7 @@ .export sectsizetab .import ___oserror, __sio_call, _dio_read .import pushax, addysp, subysp - .importzp ptr2, spc + .importzp ptr2, c_sp .include "atari.inc" @@ -78,10 +78,10 @@ _dio_open: ldy #128 jsr subysp ; allocate buffer on the stack - lda spc + lda c_sp pha - lda spc+1 - pha ; save spc (buffer address) on processor stack + lda c_sp+1 + pha ; save c_sp (buffer address) on processor stack lda ptr2 ldx ptr2+1 diff --git a/libsrc/atari/fdtable.s b/libsrc/atari/fdtable.s index 5556716dd..9323af5d3 100644 --- a/libsrc/atari/fdtable.s +++ b/libsrc/atari/fdtable.s @@ -6,7 +6,7 @@ .include "atari.inc" .include "fd.inc" - .importzp tmp1,tmp2,tmp3,ptr4,spc + .importzp tmp1,tmp2,tmp3,ptr4,c_sp .import fd_table,fd_index .import fdt_to_fdi .export clriocb @@ -229,7 +229,7 @@ freefnd:txa beq l2 l1: ldy #0 - lda (spc),y ; get device + lda (c_sp),y ; get device l2: sta fd_table+ft_dev,x ; set device lda #1 sta fd_table+ft_usa,x ; set usage counter diff --git a/libsrc/atari/mcbpm.s b/libsrc/atari/mcbpm.s index 361af145e..bc36b6f99 100644 --- a/libsrc/atari/mcbpm.s +++ b/libsrc/atari/mcbpm.s @@ -8,7 +8,7 @@ ; .include "atari.inc" - .importzp spc + .importzp c_sp .export _mouse_pm_callbacks .constructor pm_init, 27 .destructor pm_down @@ -193,22 +193,22 @@ pm_init: .else -; use top of memory and lower spc accordingly - sta spc +; use top of memory and lower c_sp accordingly + sta c_sp sta MOUSE_PM_BASE - lda spc+1 + lda c_sp+1 and #7 ; offset within 2K cmp #3 + MOUSE_PM_RAW + 1 ; can we use it? bcc @decr ; no - lda spc+1 + lda c_sp+1 and #$F8 @set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3 sta MOUSE_PM_BASE+1 - sta spc+1 + sta c_sp+1 bne @cont ; jump always -@decr: lda spc+1 +@decr: lda c_sp+1 and #$F8 sbc #8 - 1 ; CF is clear, subtracts 8 bcs @set ; jump always diff --git a/libsrc/atari/mou/atrjoy.s b/libsrc/atari/mou/atrjoy.s index 425e1176a..f30d72050 100644 --- a/libsrc/atari/mou/atrjoy.s +++ b/libsrc/atari/mou/atrjoy.s @@ -241,11 +241,11 @@ MOVE: php jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/atari/mou/atrst.s b/libsrc/atari/mou/atrst.s index 4a3b87f5c..7f915cc36 100644 --- a/libsrc/atari/mou/atrst.s +++ b/libsrc/atari/mou/atrst.s @@ -399,12 +399,12 @@ MOVE: php jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 sta XPosWrk+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position sta XPosWrk jsr CMOVEX ; Move the cursor diff --git a/libsrc/atari/mou/atrtt.s b/libsrc/atari/mou/atrtt.s index 9870096fe..516565844 100644 --- a/libsrc/atari/mou/atrtt.s +++ b/libsrc/atari/mou/atrtt.s @@ -236,11 +236,11 @@ MOVE: php jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/atari/sysrename.s b/libsrc/atari/sysrename.s index f71ec5bb5..b410ebcfd 100644 --- a/libsrc/atari/sysrename.s +++ b/libsrc/atari/sysrename.s @@ -6,7 +6,7 @@ .include "atari.inc" .import findfreeiocb - .importzp tmp4, spc, ptr2, ptr3 + .importzp tmp4, c_sp, ptr2, ptr3 .import incsp2, subysp, addysp, popax .ifdef UCASE_FILENAME .importzp tmp3 @@ -118,19 +118,19 @@ L1: jsr subysp ; make room on the stack ; copy old name ldy #0 con: lda (ptr3),y - sta (spc),y + sta (c_sp),y beq copyend iny bne con copyend:lda #$20 ; space - sta (spc),y + sta (c_sp),y iny tya ; get current offset (beyond old name) clc - adc spc + adc c_sp sta ptr3 - lda spc+1 + lda c_sp+1 adc #0 sta ptr3+1 ; ptr3 now contains pointer to space for new filename @@ -143,9 +143,9 @@ cnn: lda (ptr2),y bne cnn copend2:ldx tmp4 - lda spc + lda c_sp sta ICBAL,x - lda spc+1 + lda c_sp+1 sta ICBAH,x lda #RENAME sta ICCOM,x @@ -160,13 +160,13 @@ copend2:ldx tmp4 ; clean up stack - lda spc + lda c_sp clc adc sspc - sta spc - lda spc+1 + sta c_sp + lda c_sp+1 adc sspc+1 - sta spc+1 + sta c_sp+1 ; handle status diff --git a/libsrc/atari/ucase_fn.s b/libsrc/atari/ucase_fn.s index bec17e18e..d67fa36e5 100644 --- a/libsrc/atari/ucase_fn.s +++ b/libsrc/atari/ucase_fn.s @@ -24,7 +24,7 @@ .importzp tmp2 .import __defdev .endif - .importzp tmp3,ptr4,spc + .importzp tmp3,ptr4,c_sp .import subysp,addysp .export ucase_fn @@ -63,13 +63,13 @@ hasdev: ldy #0 loop2: lda (ptr4),y - sta (spc),y + sta (c_sp),y beq copy_end bmi L1 ; Not lowercase (also, invalid, should reject) cmp #'a' bcc L1 ; Not lowercase and #$DF ; make upper case char, assume ASCII chars - sta (spc),y ; store back + sta (c_sp),y ; store back L1: iny bpl loop2 ; bpl: this way we only support a max. length of 127 @@ -93,15 +93,15 @@ copy_end: jsr subysp ; adjust stack pointer dey cpdev: lda __defdev,y - sta (spc),y ; insert device name, number and ':' + sta (c_sp),y ; insert device name, number and ':' dey bpl cpdev hasdev2: .endif ; leave A and X pointing to the modified filename - lda spc - ldx spc+1 + lda c_sp + ldx c_sp+1 clc ; indicate success rts diff --git a/libsrc/atari2600/crt0.s b/libsrc/atari2600/crt0.s index b6ebd5db5..7b5b679b0 100644 --- a/libsrc/atari2600/crt0.s +++ b/libsrc/atari2600/crt0.s @@ -35,8 +35,8 @@ clearLoop: ; Initialize C stack pointer lda #<(__RAM_START__ + __RAM_SIZE__) ldx #>(__RAM_START__ + __RAM_SIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Call main jsr _main diff --git a/libsrc/atari5200/crt0.s b/libsrc/atari5200/crt0.s index 6c28874ff..b0b0738a0 100644 --- a/libsrc/atari5200/crt0.s +++ b/libsrc/atari5200/crt0.s @@ -27,8 +27,8 @@ start: lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__) ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Call the module constructors. diff --git a/libsrc/atari7800/crt0.s b/libsrc/atari7800/crt0.s index 5a372eb0e..dea351473 100644 --- a/libsrc/atari7800/crt0.s +++ b/libsrc/atari7800/crt0.s @@ -30,9 +30,9 @@ start: ; Set up parameter stack lda #<(__RAM3_START__ + __RAM3_SIZE__) - sta spc + sta c_sp lda #>(__RAM3_START__ + __RAM3_SIZE__) - sta spc+1 + sta c_sp+1 jsr copydata jsr zerobss diff --git a/libsrc/atari7800/mono_setcursor.s b/libsrc/atari7800/mono_setcursor.s index 2136a7440..995f0d661 100644 --- a/libsrc/atari7800/mono_setcursor.s +++ b/libsrc/atari7800/mono_setcursor.s @@ -27,7 +27,7 @@ .constructor mono_init_cursor .interruptor mono_blink_cursor - .importzp spc + .importzp c_sp .import _zonecounter .import _mono_zones .import cursor diff --git a/libsrc/atari7800/setcursor.s b/libsrc/atari7800/setcursor.s index dabb8e984..040732cff 100644 --- a/libsrc/atari7800/setcursor.s +++ b/libsrc/atari7800/setcursor.s @@ -27,7 +27,7 @@ .constructor init_cursor .interruptor blink_cursor - .importzp spc + .importzp c_sp .import _zonecounter .import _zones .import cursor diff --git a/libsrc/atmos/crt0.s b/libsrc/atmos/crt0.s index 332002a3a..05137193c 100644 --- a/libsrc/atmos/crt0.s +++ b/libsrc/atmos/crt0.s @@ -51,7 +51,7 @@ _exit: jsr donelib ldx #zpspace - 1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 @@ -68,7 +68,7 @@ L2: lda zpsave,x ; Save the zero-page area that we're about to use. init: ldx #zpspace - 1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -85,8 +85,8 @@ L1: lda spc,x lda #<(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Call the module constructors. diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index 2517d991c..b54533864 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -39,7 +39,7 @@ Start: ; Save the zero-page locations that we need. ldx #zpspace-1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -58,8 +58,8 @@ L1: lda spc,x lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Call the module constructors. @@ -85,7 +85,7 @@ _exit: pha ; Save the return code on stack ldx #zpspace-1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 diff --git a/libsrc/c128/mou/c128-1351.s b/libsrc/c128/mou/c128-1351.s index a9237a6cb..f6954c823 100644 --- a/libsrc/c128/mou/c128-1351.s +++ b/libsrc/c128/mou/c128-1351.s @@ -296,11 +296,11 @@ MOVE: sei ; No interrupts jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/c128/mou/c128-inkwell.s b/libsrc/c128/mou/c128-inkwell.s index b7cf54490..b86959788 100644 --- a/libsrc/c128/mou/c128-inkwell.s +++ b/libsrc/c128/mou/c128-inkwell.s @@ -323,10 +323,10 @@ MOVE: sei ; No interrupts jsr MoveY ldy #$01 - lda (spc),y + lda (c_sp),y tax dey - lda (spc),y + lda (c_sp),y jsr MoveX ; Move the cursor cli ; Allow interrupts diff --git a/libsrc/c128/mou/c128-joy.s b/libsrc/c128/mou/c128-joy.s index d1e45bc1e..26367f8df 100644 --- a/libsrc/c128/mou/c128-joy.s +++ b/libsrc/c128/mou/c128-joy.s @@ -297,11 +297,11 @@ MOVE: sei ; No interrupts jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/c128/mou/c128-pot.s b/libsrc/c128/mou/c128-pot.s index 596ec6041..55de4ac12 100644 --- a/libsrc/c128/mou/c128-pot.s +++ b/libsrc/c128/mou/c128-pot.s @@ -297,11 +297,11 @@ MOVE: sei ; No interrupts jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/c16/crt0.s b/libsrc/c16/crt0.s index 2dc73c7e5..491000e52 100644 --- a/libsrc/c16/crt0.s +++ b/libsrc/c16/crt0.s @@ -24,7 +24,7 @@ Start: ; Save the zero-page locations that we need. ldx #zpspace-1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -49,8 +49,8 @@ L1: lda spc,x bcc MemOk ldy #$80 ldx #$00 -MemOk: stx spc - sty spc+1 ; set argument stack ptr +MemOk: stx c_sp + sty c_sp+1 ; set argument stack ptr ; Call the module constructors. @@ -69,7 +69,7 @@ _exit: pha ; Save the return code on stack ldx #zpspace-1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 diff --git a/libsrc/c64/crt0.s b/libsrc/c64/crt0.s index e8aaaf8c6..9e0162513 100644 --- a/libsrc/c64/crt0.s +++ b/libsrc/c64/crt0.s @@ -55,7 +55,7 @@ _exit: pha ; Save the return code on stack ldx #zpspace-1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 @@ -85,7 +85,7 @@ init: ; Save the zero-page locations that we need. ldx #zpspace-1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -94,8 +94,8 @@ L1: lda spc,x lda #<(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Switch to the second charset. diff --git a/libsrc/c64/mou/c64-1351.s b/libsrc/c64/mou/c64-1351.s index d49037479..dcf949730 100644 --- a/libsrc/c64/mou/c64-1351.s +++ b/libsrc/c64/mou/c64-1351.s @@ -239,11 +239,11 @@ MOVE: sei ; No interrupts jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/c64/mou/c64-inkwell.s b/libsrc/c64/mou/c64-inkwell.s index 4be817db3..68941260c 100644 --- a/libsrc/c64/mou/c64-inkwell.s +++ b/libsrc/c64/mou/c64-inkwell.s @@ -249,10 +249,10 @@ MOVE: sei ; No interrupts jsr MoveY ldy #$01 - lda (spc),y + lda (c_sp),y tax dey - lda (spc),y + lda (c_sp),y jsr MoveX ; Move the cursor cli ; Allow interrupts diff --git a/libsrc/c64/mou/c64-joy.s b/libsrc/c64/mou/c64-joy.s index 558b43c07..901b9c42d 100644 --- a/libsrc/c64/mou/c64-joy.s +++ b/libsrc/c64/mou/c64-joy.s @@ -245,11 +245,11 @@ MOVE: sei ; No interrupts jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/c64/mou/c64-pot.s b/libsrc/c64/mou/c64-pot.s index 8147bb333..1728913e1 100644 --- a/libsrc/c64/mou/c64-pot.s +++ b/libsrc/c64/mou/c64-pot.s @@ -230,11 +230,11 @@ MOVE: sei ; No interrupts jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/cbm/dir.s b/libsrc/cbm/dir.s index c8057cf93..a78fc94a5 100644 --- a/libsrc/cbm/dir.s +++ b/libsrc/cbm/dir.s @@ -44,10 +44,10 @@ __dirread: ; Replace dir by dir->fd ldy #2 - lda (spc),y + lda (c_sp),y sta ptr1 iny - lda (spc),y + lda (c_sp),y sta ptr1+1 ldy #DIR::fd+1 lda (ptr1),y @@ -55,10 +55,10 @@ __dirread: dey lda (ptr1),y ldy #2 - sta (spc),y + sta (c_sp),y pla iny - sta (spc),y + sta (c_sp),y ; Get count, save it again, clear the high byte and call read(). By the ; previous actions, the stack frame is as read() needs it, and read() will diff --git a/libsrc/cbm/open.s b/libsrc/cbm/open.s index 16c71e02e..bf937ee0f 100644 --- a/libsrc/cbm/open.s +++ b/libsrc/cbm/open.s @@ -12,7 +12,7 @@ .import opencmdchannel, closecmdchannel, readdiskerror .import fnunit, fnisfile .import _close - .importzp spc, tmp2, tmp3 + .importzp c_sp, tmp2, tmp3 .include "errno.inc" .include "fcntl.inc" diff --git a/libsrc/cbm/write.s b/libsrc/cbm/write.s index a699c691c..43c7582f0 100644 --- a/libsrc/cbm/write.s +++ b/libsrc/cbm/write.s @@ -8,7 +8,7 @@ .constructor initstdout .import rwcommon - .importzp spc, ptr1, ptr2, ptr3 + .importzp c_sp, ptr1, ptr2, ptr3 .include "cbm.inc" .include "errno.inc" diff --git a/libsrc/cbm510/crt0.s b/libsrc/cbm510/crt0.s index 0731673b3..80d587ff5 100644 --- a/libsrc/cbm510/crt0.s +++ b/libsrc/cbm510/crt0.s @@ -117,7 +117,7 @@ entry: php tya sec sbc #7 - sta $1FF ; Save new spc + sta $1FF ; Save new c_sp tay tsx @@ -145,7 +145,7 @@ entry: php iny sta (sysp1),y - ldy $1FF ; Restore spc in bank 15 + ldy $1FF ; Restore c_sp in bank 15 lda #.hibyte(expull-1) sta (sysp1),y @@ -245,7 +245,7 @@ L1: lda extzp,x dex bpl L1 -; Save the old stack pointer from the system bank; and, set up our hw spc. +; Save the old stack pointer from the system bank; and, set up our hw c_sp. tsx txa @@ -279,9 +279,9 @@ L3: lda vectors,x ; Set up the C stack. lda #.lobyte(callbank15::entry) - sta spc + sta c_sp lda #.hibyte(callbank15::entry) - sta spc+1 + sta c_sp+1 ; Set up the subroutine and jump vector table that redirects Kernal calls to ; the system bank. @@ -495,7 +495,7 @@ _exit: pha ; Save the return code on stack ; Set up the welcome code at the stack bottom in the system bank. ldy #$FF - lda (sysp1),y ; Load system bank spc + lda (sysp1),y ; Load system bank c_sp tax iny ; Y = 0 lda #$58 ; CLI opcode diff --git a/libsrc/cbm510/mou/cbm510-inkwl.s b/libsrc/cbm510/mou/cbm510-inkwl.s index e6e239fbd..e5328cf75 100644 --- a/libsrc/cbm510/mou/cbm510-inkwl.s +++ b/libsrc/cbm510/mou/cbm510-inkwl.s @@ -256,10 +256,10 @@ MOVE: sei ; No interrupts jsr MoveY ldy #$01 - lda (spc),y + lda (c_sp),y tax dey - lda (spc),y + lda (c_sp),y jsr MoveX ; Move the cursor cli ; Allow interrupts diff --git a/libsrc/cbm510/mou/cbm510-joy.s b/libsrc/cbm510/mou/cbm510-joy.s index f974c112f..912842be7 100644 --- a/libsrc/cbm510/mou/cbm510-joy.s +++ b/libsrc/cbm510/mou/cbm510-joy.s @@ -225,11 +225,11 @@ MOVE: sei ; No interrupts jsr MoveY ; Set new y position ldy #1 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y jsr MoveX ; Move the pointer cli ; Allow interrupts diff --git a/libsrc/cbm610/crt0.s b/libsrc/cbm610/crt0.s index 814dbbdac..dc56fa2de 100644 --- a/libsrc/cbm610/crt0.s +++ b/libsrc/cbm610/crt0.s @@ -115,7 +115,7 @@ entry: php tya sec sbc #7 - sta $1FF ; Save new spc + sta $1FF ; Save new c_sp tay tsx @@ -143,7 +143,7 @@ entry: php iny sta (sysp1),y - ldy $1FF ; Restore spc in bank 15 + ldy $1FF ; Restore c_sp in bank 15 lda #.hibyte(expull-1) sta (sysp1),y @@ -243,7 +243,7 @@ L1: lda extzp,x dex bpl L1 -; Save the old stack pointer from the system bank; and, set up our hw spc. +; Save the old stack pointer from the system bank; and, set up our hw c_sp. tsx txa @@ -277,9 +277,9 @@ L3: lda vectors,x ; Set up the C stack. lda #.lobyte(callbank15::entry) - sta spc + sta c_sp lda #.hibyte(callbank15::entry) - sta spc+1 + sta c_sp+1 ; Set up the subroutine and jump vector table that redirects Kernal calls to ; the system bank. @@ -400,7 +400,7 @@ _exit: pha ; Save the return code ; Set up the welcome code at the stack bottom in the system bank. ldy #$FF - lda (sysp1),y ; Load system bank spc + lda (sysp1),y ; Load system bank c_sp tax iny ; Y = 0 lda #$58 ; CLI opcode diff --git a/libsrc/common/_fopen.s b/libsrc/common/_fopen.s index 3959ff1a7..0c234097e 100644 --- a/libsrc/common/_fopen.s +++ b/libsrc/common/_fopen.s @@ -9,7 +9,7 @@ .import _open .import pushax, incsp4, return0 - .importzp spc, ptr1 + .importzp c_sp, ptr1 .include "errno.inc" @@ -28,10 +28,10 @@ ; Get a pointer to the mode string ldy #1 - lda (spc),y + lda (c_sp),y sta ptr1+1 dey - lda (spc),y + lda (c_sp),y sta ptr1 ; Look at the first character in mode @@ -78,10 +78,10 @@ invmode: modeok: ldy #$00 txa ; Mode -> A - sta (spc),y + sta (c_sp),y tya iny - sta (spc),y + sta (c_sp),y ldy #4 ; Size of arguments in bytes jsr _open ; Will cleanup the stack diff --git a/libsrc/common/_heap.s b/libsrc/common/_heap.s index aa609a7a1..e5d71d1be 100644 --- a/libsrc/common/_heap.s +++ b/libsrc/common/_heap.s @@ -6,7 +6,7 @@ .constructor initheap, 24 .import __BSS_RUN__, __BSS_SIZE__, __STACKSIZE__ - .importzp spc + .importzp c_sp .include "_heap.inc" @@ -31,10 +31,10 @@ ___heaplast: initheap: sec - lda spc + lda c_sp sbc #<__STACKSIZE__ sta ___heapend - lda spc+1 + lda c_sp+1 sbc #>__STACKSIZE__ sta ___heapend+1 rts diff --git a/libsrc/common/_idiv32by16r16.s b/libsrc/common/_idiv32by16r16.s index 6884bcf7e..9534f751f 100644 --- a/libsrc/common/_idiv32by16r16.s +++ b/libsrc/common/_idiv32by16r16.s @@ -20,17 +20,17 @@ ; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent. ldy #3 -@L1: lda (spc),y +@L1: lda (c_sp),y sta ptr1,y dey bpl @L1 lda #4 clc - adc spc - sta spc + adc c_sp + sta c_sp bcc @L2 - inc spc+1 + inc c_sp+1 @L2: pla ; Old rhs jmp idiv32by16r16 diff --git a/libsrc/common/_printf.s b/libsrc/common/_printf.s index 3b445f5e7..40ab0bc64 100644 --- a/libsrc/common/_printf.s +++ b/libsrc/common/_printf.s @@ -338,25 +338,25 @@ MainLoop: jsr decsp6 ; 3 args ldy #5 lda OutData+1 - sta (spc),y + sta (c_sp),y dey lda OutData - sta (spc),y + sta (c_sp),y dey lda FSave+1 - sta (spc),y + sta (c_sp),y dey lda FSave - sta (spc),y + sta (c_sp),y dey lda FCount+1 - sta (spc),y + sta (c_sp),y dey lda FCount .if (.cpu .bitand ::CPU_ISET_65SC02) - sta (spc) + sta (c_sp) .else - sta (spc),y + sta (c_sp),y .endif jsr CallOutFunc ; Call the output function diff --git a/libsrc/common/_udiv32by16r16.s b/libsrc/common/_udiv32by16r16.s index 452fcba50..987390c04 100644 --- a/libsrc/common/_udiv32by16r16.s +++ b/libsrc/common/_udiv32by16r16.s @@ -21,17 +21,17 @@ ; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent. ldy #3 -@L1: lda (spc),y +@L1: lda (c_sp),y sta ptr1,y dey bpl @L1 lda #4 clc - adc spc - sta spc + adc c_sp + sta c_sp bcc @L2 - inc spc+1 + inc c_sp+1 @L2: jmp udiv32by16r16m diff --git a/libsrc/common/fprintf.s b/libsrc/common/fprintf.s index 21e30121e..af9a58ebc 100644 --- a/libsrc/common/fprintf.s +++ b/libsrc/common/fprintf.s @@ -6,7 +6,7 @@ .export _fprintf .import addysp, decsp4, _vfprintf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -38,9 +38,9 @@ _fprintf: ; Calculate a pointer to the Format argument lda ParamSize - add spc + add c_sp sta ptr1 - ldx spc+1 + ldx c_sp+1 bcc @L1 inx @L1: stx ptr1+1 @@ -49,7 +49,7 @@ _fprintf: ldy #4-1 @L2: lda (ptr1),y - sta (spc),y + sta (c_sp),y dey bpl @L2 diff --git a/libsrc/common/fread.s b/libsrc/common/fread.s index 81c401bf3..2dc9ad936 100644 --- a/libsrc/common/fread.s +++ b/libsrc/common/fread.s @@ -14,7 +14,7 @@ .import pushwysp .import tosumulax, tosudivax - .importzp ptr1, spc + .importzp ptr1, c_sp .include "errno.inc" .include "_file.inc" @@ -136,23 +136,23 @@ ; to read() by one, so read() starts to store data at buf+1. .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) sta ptr1 add #1 - sta (spc) + sta (c_sp) ldy #1 .else ldy #0 - lda (spc),y + lda (c_sp),y sta ptr1 add #1 - sta (spc),y + sta (c_sp),y iny .endif - lda (spc),y + lda (c_sp),y sta ptr1+1 adc #0 - sta (spc),y ; ptr1 = buf++; + sta (c_sp),y ; ptr1 = buf++; ; Get the buffered character and place it as first character into the read ; buffer. diff --git a/libsrc/common/fscanf.s b/libsrc/common/fscanf.s index 1af61c4cb..c687a0624 100644 --- a/libsrc/common/fscanf.s +++ b/libsrc/common/fscanf.s @@ -6,7 +6,7 @@ .export _fscanf .import addysp, decsp4, _vfscanf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -50,9 +50,9 @@ _fscanf: ; Calculate a pointer to the Format argument lda ParamSize - add spc + add c_sp sta ptr1 - ldx spc+1 + ldx c_sp+1 bcc @L1 inx @L1: stx ptr1+1 @@ -61,7 +61,7 @@ _fscanf: ldy #4-1 @L2: lda (ptr1),y - sta (spc),y + sta (c_sp),y dey bpl @L2 diff --git a/libsrc/common/interrupt.s b/libsrc/common/interrupt.s index 5a53a2dd8..a67d51fda 100644 --- a/libsrc/common/interrupt.s +++ b/libsrc/common/interrupt.s @@ -93,8 +93,8 @@ zpsave: .res zpsavespace ; Set C level interrupt stack lda irqsp ldx irqsp+1 - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Call C level interrupt request handler jsr irqvec diff --git a/libsrc/common/itoa.s b/libsrc/common/itoa.s index 02e2b8f9e..a1cd53c8b 100644 --- a/libsrc/common/itoa.s +++ b/libsrc/common/itoa.s @@ -8,7 +8,7 @@ .export _itoa, _utoa .import addysp1 .import __hextab - .importzp spc, sreg, ptr2, ptr3, tmp1 + .importzp c_sp, sreg, ptr2, ptr3, tmp1 .rodata specval: @@ -21,18 +21,18 @@ specval: dopop: sta tmp1 ; will lose high byte ldy #0 - lda (spc),y + lda (c_sp),y sta ptr2 sta ptr3 iny - lda (spc),y + lda (c_sp),y sta ptr2+1 sta ptr3+1 iny - lda (spc),y + lda (c_sp),y sta sreg iny - lda (spc),y + lda (c_sp),y sta sreg+1 jmp addysp1 ; Bump stack pointer diff --git a/libsrc/common/longjmp.s b/libsrc/common/longjmp.s index a4508569f..8855286a9 100644 --- a/libsrc/common/longjmp.s +++ b/libsrc/common/longjmp.s @@ -7,7 +7,7 @@ .export _longjmp .import popptr1 - .importzp spc, ptr1, ptr2 + .importzp c_sp, ptr1, ptr2 _longjmp: sta ptr2 ; Save retval @@ -23,10 +23,10 @@ _longjmp: lda (ptr1),y iny - sta spc + sta c_sp lda (ptr1),y iny - sta spc+1 + sta c_sp+1 ; Get the old stack pointer diff --git a/libsrc/common/lz4.s b/libsrc/common/lz4.s index ebedcc1e3..5d26cb56a 100644 --- a/libsrc/common/lz4.s +++ b/libsrc/common/lz4.s @@ -61,7 +61,7 @@ ; } ; } - .importzp spc, sreg, regsave, regbank + .importzp c_sp, sreg, regsave, regbank .importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4 .macpack longbranch .import memcpy_upwards,pushax,popax diff --git a/libsrc/common/memcpy.s b/libsrc/common/memcpy.s index 0cbb7d4a5..e9c3f1968 100644 --- a/libsrc/common/memcpy.s +++ b/libsrc/common/memcpy.s @@ -12,7 +12,7 @@ .export _memcpy, memcpy_upwards, memcpy_getparams .import popax, popptr1 - .importzp spc, ptr1, ptr2, ptr3 + .importzp c_sp, ptr1, ptr2, ptr3 ; ---------------------------------------------------------------------- _memcpy: @@ -70,10 +70,10 @@ memcpy_getparams: ; IMPORTANT! Function has to leave with Y=0! iny ; Y=0 guaranteed by popptr1, we need '1' here... ; (direct stack access is three cycles faster ; (total cycle count with return)) - lda (spc),y + lda (c_sp),y tax stx ptr2+1 ; save high byte of ptr2 dey ; Y = 0 - lda (spc),y ; Get ptr2 low + lda (c_sp),y ; Get ptr2 low sta ptr2 rts diff --git a/libsrc/common/memset.s b/libsrc/common/memset.s index 6241d7800..13e8ece9f 100644 --- a/libsrc/common/memset.s +++ b/libsrc/common/memset.s @@ -17,7 +17,7 @@ .export _memset, _bzero, ___bzero .import popax - .importzp spc, ptr1, ptr2, ptr3 + .importzp c_sp, ptr1, ptr2, ptr3 _bzero: ___bzero: @@ -36,10 +36,10 @@ _memset: common: ; Fill value is in X! ldy #1 - lda (spc),y + lda (c_sp),y sta ptr1+1 ; save high byte of ptr dey ; Y = 0 - lda (spc),y ; Get ptr + lda (c_sp),y ; Get ptr sta ptr1 lsr ptr3+1 ; divide number of diff --git a/libsrc/common/printf.s b/libsrc/common/printf.s index 1ad909eff..76e08e584 100644 --- a/libsrc/common/printf.s +++ b/libsrc/common/printf.s @@ -6,7 +6,7 @@ .export _printf .import _stdout, pushax, addysp, _vfprintf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -43,8 +43,8 @@ _printf: ; Now calculate the va_list pointer, which does points to Format - lda spc - ldx spc+1 + lda c_sp + ldx c_sp+1 add ParamSize bcc @L1 inx diff --git a/libsrc/common/realloc.s b/libsrc/common/realloc.s index eca1d3d0e..16d5eea41 100644 --- a/libsrc/common/realloc.s +++ b/libsrc/common/realloc.s @@ -4,7 +4,7 @@ ; void* __fastcall__ realloc (void* block, register size_t size) ; - .importzp ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, tmp4, spc + .importzp ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, tmp4, c_sp .import _malloc, _memcpy, _free .import pushax, popptr1, return0 .import incsp2, decsp2 diff --git a/libsrc/common/scanf.s b/libsrc/common/scanf.s index a5f3937a8..92460b629 100644 --- a/libsrc/common/scanf.s +++ b/libsrc/common/scanf.s @@ -8,7 +8,7 @@ .export _scanf .import _stdin, pushax, addysp, _vfscanf - .import spc:zp, ptr1:zp + .import c_sp:zp, ptr1:zp .macpack generic @@ -34,8 +34,8 @@ _scanf: ; Now, calculate the va_list pointer, which does point to Format. - lda spc - ldx spc+1 + lda c_sp + ldx c_sp+1 add ArgSize bcc @L1 inx diff --git a/libsrc/common/setjmp.s b/libsrc/common/setjmp.s index d32200c3d..3c0b8aa17 100644 --- a/libsrc/common/setjmp.s +++ b/libsrc/common/setjmp.s @@ -8,7 +8,7 @@ .export ___setjmp .import return0 - .importzp spc, ptr1 + .importzp c_sp, ptr1 ___setjmp: sta ptr1 ; Save buf @@ -17,10 +17,10 @@ ___setjmp: ; The parameter stack is now empty, put it into buf - lda spc + lda c_sp sta (ptr1),y iny - lda spc+1 + lda c_sp+1 sta (ptr1),y iny diff --git a/libsrc/common/snprintf.s b/libsrc/common/snprintf.s index f924453df..c922a55bc 100644 --- a/libsrc/common/snprintf.s +++ b/libsrc/common/snprintf.s @@ -6,7 +6,7 @@ .export _snprintf .import pushax, addysp, decsp6, _vsnprintf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -38,9 +38,9 @@ _snprintf: ; Calculate a pointer to the Format argument lda ParamSize - add spc + add c_sp sta ptr1 - ldx spc+1 + ldx c_sp+1 bcc @L1 inx @L1: stx ptr1+1 @@ -49,7 +49,7 @@ _snprintf: ldy #6-1 @L2: lda (ptr1),y - sta (spc),y + sta (c_sp),y dey bpl @L2 diff --git a/libsrc/common/sprintf.s b/libsrc/common/sprintf.s index feec141e5..d2ce6602e 100644 --- a/libsrc/common/sprintf.s +++ b/libsrc/common/sprintf.s @@ -6,7 +6,7 @@ .export _sprintf .import pushax, addysp, decsp4, _vsprintf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -38,9 +38,9 @@ _sprintf: ; Calculate a pointer to the Format argument lda ParamSize - add spc + add c_sp sta ptr1 - ldx spc+1 + ldx c_sp+1 bcc @L1 inx @L1: stx ptr1+1 @@ -49,7 +49,7 @@ _sprintf: ldy #4-1 @L2: lda (ptr1),y - sta (spc),y + sta (c_sp),y dey bpl @L2 diff --git a/libsrc/common/sscanf.s b/libsrc/common/sscanf.s index 6542116ae..d393087d8 100644 --- a/libsrc/common/sscanf.s +++ b/libsrc/common/sscanf.s @@ -6,7 +6,7 @@ .export _sscanf .import addysp, decsp4, _vsscanf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -51,9 +51,9 @@ _sscanf: ; Calculate a pointer to the fixed parameters lda ParamSize - add spc + add c_sp sta ptr1 - ldx spc+1 + ldx c_sp+1 bcc @L1 inx @L1: stx ptr1+1 @@ -62,7 +62,7 @@ _sscanf: ldy #4-1 @L2: lda (ptr1),y - sta (spc),y + sta (c_sp),y dey bpl @L2 diff --git a/libsrc/common/vfprintf.s b/libsrc/common/vfprintf.s index 4b941af9b..65bf62a22 100644 --- a/libsrc/common/vfprintf.s +++ b/libsrc/common/vfprintf.s @@ -8,7 +8,7 @@ .export _vfprintf .import push1, pushwysp, incsp6 .import _fwrite, __printf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -121,15 +121,15 @@ _vfprintf: ; exactly as _printf expects it. Parameters will get dropped by _printf. ldy #2 - lda (spc),y ; Low byte of f + lda (c_sp),y ; Low byte of f sta ptr lda #outdesc - sta (spc),y + sta (c_sp),y ; Restore low byte of ap and call _printf diff --git a/libsrc/common/vfscanf.s b/libsrc/common/vfscanf.s index 2324f30a4..71d7c634c 100644 --- a/libsrc/common/vfscanf.s +++ b/libsrc/common/vfscanf.s @@ -61,16 +61,16 @@ _vfscanf: ; Swap f against &d on the stack, placing f into d.data ldy #2 ; Offset of f on the stack - lda (spc),y + lda (c_sp),y sta d + SCANFDATA::DATA lda #d - sta (spc),y + sta (c_sp),y ; Restore the low byte of ap, and call the _scanf function diff --git a/libsrc/common/vprintf.s b/libsrc/common/vprintf.s index fbfeb9951..1c44b61ef 100644 --- a/libsrc/common/vprintf.s +++ b/libsrc/common/vprintf.s @@ -7,7 +7,7 @@ .export _vprintf .import _vfprintf, _stdout .import decsp2 - .importzp spc + .importzp c_sp .proc _vprintf @@ -23,20 +23,20 @@ ; Move the format parameter down and store stdout in it's place ldy #2 - lda (spc),y + lda (c_sp),y ldy #0 - sta (spc),y + sta (c_sp),y ldy #3 - lda (spc),y + lda (c_sp),y ldy #1 - sta (spc),y + sta (c_sp),y iny lda _stdout - sta (spc),y + sta (c_sp),y iny lda _stdout+1 - sta (spc),y + sta (c_sp),y ; Restore A diff --git a/libsrc/common/vscanf.s b/libsrc/common/vscanf.s index f6a34c34d..1681acd97 100644 --- a/libsrc/common/vscanf.s +++ b/libsrc/common/vscanf.s @@ -31,22 +31,22 @@ _vscanf: ; Move the format down ldy #2 - lda (spc),y ; Load byte of format + lda (c_sp),y ; Load byte of format ldy #0 - sta (spc),y + sta (c_sp),y ldy #3 - lda (spc),y + lda (c_sp),y ldy #1 - sta (spc),y + sta (c_sp),y ; Store stdin into the stack frame iny lda _stdin - sta (spc),y + sta (c_sp),y iny lda _stdin+1 - sta (spc),y + sta (c_sp),y ; Restore the low byte of ap and jump to vfscanf, which will cleanup the stack diff --git a/libsrc/common/vsnprintf.s b/libsrc/common/vsnprintf.s index e1bd1e80d..780ab10ee 100644 --- a/libsrc/common/vsnprintf.s +++ b/libsrc/common/vsnprintf.s @@ -8,7 +8,7 @@ .export _vsnprintf, vsnprintf .import ldaxysp, popax, incsp2, incsp6 .import _memcpy, __printf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .include "errno.inc" @@ -55,19 +55,19 @@ vsnprintf: ; be formatted and counted. ldy #2 - lda (spc),y + lda (c_sp),y sta ptr1 lda #outdesc - sta (spc),y + sta (c_sp),y ; Write size-1 to outdesc.uns. It will be -1 if there is no buffer. @@ -178,12 +178,12 @@ out: clc adc ccount+0 ldy #4 - sta (spc),y + sta (c_sp),y lda bufptr+1 adc ccount+1 iny - sta (spc),y + sta (c_sp),y ; Get Count from stack diff --git a/libsrc/common/vsscanf.s b/libsrc/common/vsscanf.s index 9e261389c..2061861dc 100644 --- a/libsrc/common/vsscanf.s +++ b/libsrc/common/vsscanf.s @@ -9,7 +9,7 @@ .export _vsscanf .import popax, __scanf - .importzp spc, ptr1, ptr2 + .importzp c_sp, ptr1, ptr2 .macpack generic @@ -165,15 +165,15 @@ d: .addr get ; to d ldy #2 ; Stack offset of str - lda (spc),y + lda (c_sp),y sta sd + SSCANFDATA::STR lda #d - sta (spc),y + sta (c_sp),y lda #$00 sta sd + SSCANFDATA::INDEX diff --git a/libsrc/conio/cprintf.s b/libsrc/conio/cprintf.s index 64bdf9d3c..80bca2308 100644 --- a/libsrc/conio/cprintf.s +++ b/libsrc/conio/cprintf.s @@ -6,7 +6,7 @@ .export _cprintf .import pushax, addysp, _vcprintf - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack generic @@ -31,9 +31,9 @@ _cprintf: dey dey ; Sub size of Format tya - add spc + add c_sp sta ptr1 - ldx spc+1 + ldx c_sp+1 bcc @L1 inx @L1: stx ptr1+1 diff --git a/libsrc/conio/cscanf.s b/libsrc/conio/cscanf.s index 5d575185e..7ee532626 100644 --- a/libsrc/conio/cscanf.s +++ b/libsrc/conio/cscanf.s @@ -23,8 +23,8 @@ _cscanf: ; Now, calculate the va_list pointer -- which points to format. - ldx spc+1 - add spc + ldx c_sp+1 + add c_sp bcc @L1 inx @L1: sta ptr1 diff --git a/libsrc/conio/vcprintf.s b/libsrc/conio/vcprintf.s index 677a9f5fd..c6371f00e 100644 --- a/libsrc/conio/vcprintf.s +++ b/libsrc/conio/vcprintf.s @@ -7,7 +7,7 @@ .export _vcprintf .import pushax, popax, popptr1 .import __printf, _cputc - .importzp spc, ptr1, ptr2, ptr3, tmp1 + .importzp c_sp, ptr1, ptr2, ptr3, tmp1 .macpack generic .macpack cpu @@ -138,10 +138,10 @@ _vcprintf: ; Get the format parameter and push it again ldy #1 - lda (spc),y + lda (c_sp),y tax dey - lda (spc),y + lda (c_sp),y jsr pushax ; Replace the passed format parameter on the stack by &d - this creates @@ -150,10 +150,10 @@ _vcprintf: ldy #2 ; Low byte of d lda #outdesc - sta (spc),y + sta (c_sp),y ; Restore ap and call _printf diff --git a/libsrc/creativision/crt0.s b/libsrc/creativision/crt0.s index dd6213b45..70009e2ba 100644 --- a/libsrc/creativision/crt0.s +++ b/libsrc/creativision/crt0.s @@ -40,8 +40,8 @@ entry: ; Setup the argument stack ptr lda #<(__ZP_LAST__ + __STACKSIZE__) ldx #>(__ZP_LAST__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Call module constructors jsr initlib diff --git a/libsrc/cx16/crt0.s b/libsrc/cx16/crt0.s index ab16a95d8..0f8452a32 100644 --- a/libsrc/cx16/crt0.s +++ b/libsrc/cx16/crt0.s @@ -80,8 +80,8 @@ init: lda #<(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Switch to the lower/UPPER PetSCII charset. diff --git a/libsrc/cx16/mou/cx16-std.s b/libsrc/cx16/mou/cx16-std.s index 78b87e1aa..5bfe27a7d 100644 --- a/libsrc/cx16/mou/cx16-std.s +++ b/libsrc/cx16/mou/cx16-std.s @@ -238,11 +238,11 @@ MOVE: php jsr CMOVEY ; Set it ldy #$01 - lda (spc),y + lda (c_sp),y sta XPos+1 tax dey - lda (spc),y + lda (c_sp),y sta XPos ; New X position jsr CMOVEX ; Move the cursor diff --git a/libsrc/dbg/dbgdump.s b/libsrc/dbg/dbgdump.s index a0ed097cc..2a4aea3f7 100644 --- a/libsrc/dbg/dbgdump.s +++ b/libsrc/dbg/dbgdump.s @@ -7,23 +7,23 @@ .export _DbgMemDump .import addysp1 .import __hextab - .importzp spc, tmp2, tmp3, tmp4, ptr3, ptr4 + .importzp c_sp, tmp2, tmp3, tmp4, ptr3, ptr4 _DbgMemDump: ldy #0 - lda (spc),y ; Get length + lda (c_sp),y ; Get length sta tmp4 iny - lda (spc),y ; Get the string buffer + lda (c_sp),y ; Get the string buffer sta ptr3 iny - lda (spc),y + lda (c_sp),y sta ptr3+1 iny - lda (spc),y ; Get the address + lda (c_sp),y ; Get the address sta ptr4 iny - lda (spc),y + lda (c_sp),y sta ptr4+1 jsr addysp1 ; Drop the parameters diff --git a/libsrc/dbg/dbgsupp.s b/libsrc/dbg/dbgsupp.s index 02e8a0d90..ce503bcab 100644 --- a/libsrc/dbg/dbgsupp.s +++ b/libsrc/dbg/dbgsupp.s @@ -36,9 +36,9 @@ DbgBreak: jsr DbgSwapZP ; Swap stuff lda #DbgStack - sta spc+1 + sta c_sp+1 jsr ResetDbgBreaks ; Reset temporary breakpoints jsr _DbgEntry ; Call C code jsr SetDbgBreaks ; Set temporary breakpoints @@ -61,7 +61,7 @@ DbgStack: ; Swap space for the C temporaries CTemp: -_DbgCS: .res 2 ; spc +_DbgCS: .res 2 ; c_sp _DbgHI: .res 2 ; sreg .res (zpsavespace-4) ; Other stuff @@ -78,7 +78,7 @@ Swap1: ldx CTemp,y lda <__ZP_START__,y sta CTemp,y txa - sta spc,y + sta c_sp,y dey bpl Swap1 rts diff --git a/libsrc/gamate/crt0.s b/libsrc/gamate/crt0.s index be0281e8e..67fa8813f 100644 --- a/libsrc/gamate/crt0.s +++ b/libsrc/gamate/crt0.s @@ -34,8 +34,8 @@ Start: ; Set up the stack lda #<(__RAM_START__+__RAM_SIZE__) ldx #>(__RAM_START__+__RAM_SIZE__) - sta spc - stx spc + 1 + sta c_sp + stx c_sp + 1 ; Call module constructors jsr initlib diff --git a/libsrc/geos-common/drivers/geos-stdmou.s b/libsrc/geos-common/drivers/geos-stdmou.s index 9b04d549a..aacb2590e 100644 --- a/libsrc/geos-common/drivers/geos-stdmou.s +++ b/libsrc/geos-common/drivers/geos-stdmou.s @@ -13,7 +13,7 @@ .export _mouse_move, _mouse_buttons .import popsreg, addysp1 - .importzp spc, sreg, ptr1 + .importzp c_sp, sreg, ptr1 .include "const.inc" .include "jumptab.inc" @@ -87,22 +87,22 @@ _mouse_box: sta mouseBottom - lda (spc),y + lda (c_sp),y sta mouseRight iny - lda (spc),y + lda (c_sp),y sta mouseRight+1 ; maxx iny - lda (spc),y + lda (c_sp),y sta mouseTop iny ; Skip high byte iny - lda (spc),y + lda (c_sp),y sta mouseLeft iny - lda (spc),y + lda (c_sp),y sta mouseLeft+1 ; minx jmp addysp1 ; Drop params, return diff --git a/libsrc/geos-common/system/crt0.s b/libsrc/geos-common/system/crt0.s index 47918a022..e1751baef 100644 --- a/libsrc/geos-common/system/crt0.s +++ b/libsrc/geos-common/system/crt0.s @@ -11,7 +11,7 @@ .import initlib, donelib .import callmain .import zerobss - .importzp spc + .importzp c_sp .include "jumptab.inc" .include "geossym.inc" @@ -48,8 +48,8 @@ lda #<(__STACKADDR__ + __STACKSIZE__) ldx #>(__STACKADDR__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Call the module constructors. diff --git a/libsrc/kim1/crt0.s b/libsrc/kim1/crt0.s index 3bd6e3e76..adc934a78 100644 --- a/libsrc/kim1/crt0.s +++ b/libsrc/kim1/crt0.s @@ -26,9 +26,9 @@ _init: cld ; Clear decimal mode ; Set cc65 argument stack pointer lda #<(__RAM_START__ + __RAM_SIZE__) - sta spc + sta c_sp lda #>(__RAM_START__ + __RAM_SIZE__) - sta spc+1 + sta c_sp+1 ; Initialize memory storage diff --git a/libsrc/lynx/crt0.s b/libsrc/lynx/crt0.s index 8187c1f05..e1f1c078e 100644 --- a/libsrc/lynx/crt0.s +++ b/libsrc/lynx/crt0.s @@ -80,8 +80,8 @@ MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$2 lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Init Mickey. diff --git a/libsrc/lynx/lseek.s b/libsrc/lynx/lseek.s index 8b3184a04..da0a1922b 100644 --- a/libsrc/lynx/lseek.s +++ b/libsrc/lynx/lseek.s @@ -11,7 +11,7 @@ ; ; off_t __fastcall__ lseek(int fd, off_t offset, int whence); - .importzp spc, sreg, regsave, regbank, tmp1, ptr1, ptr2 + .importzp c_sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 .macpack longbranch .export _lseek .import addysp, stax0sp, tosand0ax, pusheax, asreax2 diff --git a/libsrc/nes/crt0.s b/libsrc/nes/crt0.s index edf9248af..9b5ceb337 100644 --- a/libsrc/nes/crt0.s +++ b/libsrc/nes/crt0.s @@ -107,8 +107,8 @@ start: lda #<(__SRAM_START__ + __SRAM_SIZE__) ldx #>(__SRAM_START__ + __SRAM_SIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Call the module constructors. diff --git a/libsrc/none/crt0.s b/libsrc/none/crt0.s index bc6fb65c5..443f453b9 100644 --- a/libsrc/none/crt0.s +++ b/libsrc/none/crt0.s @@ -10,8 +10,8 @@ lda #<__STACKSTART__ ldx #>__STACKSTART__ - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 jsr zerobss jsr initlib jsr _main diff --git a/libsrc/osic1p/crt0.s b/libsrc/osic1p/crt0.s index b85113902..46d29ed66 100644 --- a/libsrc/osic1p/crt0.s +++ b/libsrc/osic1p/crt0.s @@ -34,8 +34,8 @@ _init: ldx #$FF ; Initialize stack pointer to $01FF lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; --------------------------------------------------------------------------- ; Initialize memory storage diff --git a/libsrc/pce/_printf.s b/libsrc/pce/_printf.s index 8e2f7758f..675076ec6 100644 --- a/libsrc/pce/_printf.s +++ b/libsrc/pce/_printf.s @@ -329,22 +329,22 @@ MainLoop: jsr decsp6 ; 3 args ldy #5 lda OutData+1 - sta (spc),y + sta (c_sp),y dey lda OutData - sta (spc),y + sta (c_sp),y dey lda FSave+1 - sta (spc),y + sta (c_sp),y dey lda FSave - sta (spc),y + sta (c_sp),y dey lda FCount+1 - sta (spc),y + sta (c_sp),y dey lda FCount - sta (spc),y + sta (c_sp),y jsr CallOutFunc ; Call the output function ; We're back from out(), or we didn't call it. Check for end of string. diff --git a/libsrc/pce/crt0.s b/libsrc/pce/crt0.s index 2bd13253b..660faae7f 100644 --- a/libsrc/pce/crt0.s +++ b/libsrc/pce/crt0.s @@ -13,7 +13,7 @@ .import initlib, donelib .import push0, _main .import IRQStub, __nmi - .importzp spc + .importzp c_sp ; Linker-generated .import __CARTSIZE__ @@ -86,8 +86,8 @@ start: sei ; Set up the stack lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Call the module constructors. jsr initlib diff --git a/libsrc/pce/memcpy.s b/libsrc/pce/memcpy.s index 184250bcb..5a0822ec1 100644 --- a/libsrc/pce/memcpy.s +++ b/libsrc/pce/memcpy.s @@ -18,7 +18,7 @@ .export memcpy_increment, memcpy_transfer, memcpy_getparams .import incsp2, popax, popptr1 - .importzp spc, ptr1, ptr2, ptr3 + .importzp c_sp, ptr1, ptr2, ptr3 ; The structure of the transfer instructions @@ -86,9 +86,9 @@ memcpy_getparams: ; (Direct stack access is six cycles faster [total cycle count].) iny ; (Y=0 by popptr1, need '1' here) save dest - lda (spc),y ; get high byte + lda (c_sp),y ; get high byte tax - lda (spc) ; get low byte + lda (c_sp) ; get low byte sta ptr2 stx ptr2+1 rts ; return dest address (for memmove) diff --git a/libsrc/pet/crt0.s b/libsrc/pet/crt0.s index 3732eba3c..ff57d7bac 100644 --- a/libsrc/pet/crt0.s +++ b/libsrc/pet/crt0.s @@ -23,7 +23,7 @@ Start: ; Save the zero-page locations that we need. ldx #zpspace-1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -52,9 +52,9 @@ L1: lda spc,x stx spsave ; Save the system stack ptr lda MEMSIZE - sta spc + sta c_sp lda MEMSIZE+1 - sta spc+1 ; Set argument stack ptr + sta c_sp+1 ; Set argument stack ptr ; Call the module constructors. @@ -73,7 +73,7 @@ _exit: pha ; Save the return code on stack ldx #zpspace-1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 50f7740fa..85bdcac8e 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -34,7 +34,7 @@ Start: sei ; No interrupts since we're banking out the ROM sta ENABLE_RAM ldx #zpspace-1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -54,8 +54,8 @@ L1: lda spc,x lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 ; Set up the IRQ vector in the banked RAM; and, switch off the ROM. @@ -99,7 +99,7 @@ _exit: pha ; Save the return code ldx #zpspace-1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 diff --git a/libsrc/rp6502/crt0.s b/libsrc/rp6502/crt0.s index 45c24eb9e..32d565fda 100644 --- a/libsrc/rp6502/crt0.s +++ b/libsrc/rp6502/crt0.s @@ -24,9 +24,9 @@ _init: ; Set cc65 argument stack pointer lda #<(__RAM_START__ + __RAM_SIZE__) - sta spc + sta c_sp lda #>(__RAM_START__ + __RAM_SIZE__) - sta spc+1 + sta c_sp+1 ; Initialize memory storage jsr zerobss ; Clear BSS segment diff --git a/libsrc/rp6502/ria.s b/libsrc/rp6502/ria.s index e23177344..78da4daba 100644 --- a/libsrc/rp6502/ria.s +++ b/libsrc/rp6502/ria.s @@ -11,7 +11,7 @@ .export _ria_call_int, _ria_call_long .export _ria_call_int_errno, _ria_call_long_errno -.importzp spc, sreg +.importzp c_sp, sreg .import ___mappederrno, incsp1 .code diff --git a/libsrc/rp6502/xreg.s b/libsrc/rp6502/xreg.s index 8d5fb9402..a882ab10f 100644 --- a/libsrc/rp6502/xreg.s +++ b/libsrc/rp6502/xreg.s @@ -5,7 +5,7 @@ ; int __cdecl__ xreg(char device, char channel, unsigned char address, ...); .export _xreg -.importzp spc +.importzp c_sp .import addysp, _ria_call_int_errno .include "rp6502.inc" @@ -20,12 +20,12 @@ @copy: ; copy stack dey - lda (spc),y + lda (c_sp),y sta RIA_XSTACK tya bne @copy - ; recover variadic size and move spc + ; recover variadic size and move c_sp txa tay jsr addysp diff --git a/libsrc/runtime/add.s b/libsrc/runtime/add.s index 8d48b30a5..b308614a1 100644 --- a/libsrc/runtime/add.s +++ b/libsrc/runtime/add.s @@ -9,7 +9,7 @@ ; called a lot! .export tosadda0, tosaddax - .importzp spc, tmp1 + .importzp c_sp, tmp1 .macpack cpu @@ -20,34 +20,34 @@ tosaddax: .if (.cpu .bitand ::CPU_ISET_65SC02) - adc (spc) ; (7) + adc (c_sp) ; (7) tay ; (9) - inc spc ; (14) + inc c_sp ; (14) bne hiadd ; (17) - inc spc+1 ; (-1+5) + inc c_sp+1 ; (-1+5) hiadd: txa ; (19) - adc (spc) ; (24) + adc (c_sp) ; (24) tax ; (26) - inc spc ; (31) + inc c_sp ; (31) bne done ; (34) - inc spc+1 ; (-1+5) + inc c_sp+1 ; (-1+5) done: tya ; (36) .else ldy #0 ; (4) - adc (spc),y ; (9) lo byte + adc (c_sp),y ; (9) lo byte iny ; (11) sta tmp1 ; (14) save it txa ; (16) - adc (spc),y ; (21) hi byte + adc (c_sp),y ; (21) hi byte tax ; (23) clc ; (25) - lda spc ; (28) + lda c_sp ; (28) adc #2 ; (30) - sta spc ; (33) + sta c_sp ; (33) bcc L1 ; (36) - inc spc+1 ; (-1+5) + inc c_sp+1 ; (-1+5) L1: lda tmp1 ; (39) restore low byte .endif diff --git a/libsrc/runtime/addeqsp.s b/libsrc/runtime/addeqsp.s index d042e0e8b..3c098ea5f 100644 --- a/libsrc/runtime/addeqsp.s +++ b/libsrc/runtime/addeqsp.s @@ -5,19 +5,19 @@ ; .export addeq0sp, addeqysp - .importzp spc + .importzp c_sp addeq0sp: ldy #0 addeqysp: clc - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y pha iny txa - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y tax pla rts diff --git a/libsrc/runtime/addysp.s b/libsrc/runtime/addysp.s index 246b0f4c9..553ed98c7 100644 --- a/libsrc/runtime/addysp.s +++ b/libsrc/runtime/addysp.s @@ -5,17 +5,17 @@ ; .export addysp1, addysp - .importzp spc + .importzp c_sp addysp1: iny addysp: pha ; Save A clc tya ; Get the value - adc spc ; Add low byte - sta spc ; Put it back + adc c_sp ; Add low byte + sta c_sp ; Put it back bcc @L1 ; If no carry, we're done - inc spc+1 ; Inc high byte + inc c_sp+1 ; Inc high byte @L1: pla ; Restore A rts diff --git a/libsrc/runtime/and.s b/libsrc/runtime/and.s index 7ad593b5c..21acebb66 100644 --- a/libsrc/runtime/and.s +++ b/libsrc/runtime/and.s @@ -6,7 +6,7 @@ .export tosanda0, tosandax .import addysp1 - .importzp spc, ptr4 + .importzp c_sp, ptr4 .macpack cpu @@ -14,16 +14,16 @@ tosanda0: ldx #$00 tosandax: .if (.cpu .bitand CPU_ISET_65SC02) - and (spc) ; 65SC02 version, saves 2 cycles and 1 byte + and (c_sp) ; 65SC02 version, saves 2 cycles and 1 byte ldy #1 .else ldy #0 - and (spc),y + and (c_sp),y iny .endif pha txa - and (spc),y + and (c_sp),y tax pla jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/bpushbsp.s b/libsrc/runtime/bpushbsp.s index 6f94aa322..c2cc18cf6 100644 --- a/libsrc/runtime/bpushbsp.s +++ b/libsrc/runtime/bpushbsp.s @@ -6,12 +6,12 @@ .export bpushbsp, bpushbysp .import pusha - .importzp spc + .importzp c_sp bpushbsp: ldy #0 bpushbysp: - lda (spc),y + lda (c_sp),y jmp pusha diff --git a/libsrc/runtime/decsp1.s b/libsrc/runtime/decsp1.s index 73b03f5db..4fd5392bb 100644 --- a/libsrc/runtime/decsp1.s +++ b/libsrc/runtime/decsp1.s @@ -5,14 +5,14 @@ ; .export decsp1 - .importzp spc + .importzp c_sp .proc decsp1 - ldy spc + ldy c_sp bne @L1 - dec spc+1 -@L1: dec spc + dec c_sp+1 +@L1: dec c_sp rts .endproc diff --git a/libsrc/runtime/decsp2.s b/libsrc/runtime/decsp2.s index 8d4e38477..c6c533d83 100644 --- a/libsrc/runtime/decsp2.s +++ b/libsrc/runtime/decsp2.s @@ -5,18 +5,18 @@ ; .export decsp2 - .importzp spc + .importzp c_sp .proc decsp2 - lda spc + lda c_sp sec sbc #2 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/decsp3.s b/libsrc/runtime/decsp3.s index cd4cb4798..2a2b22a15 100644 --- a/libsrc/runtime/decsp3.s +++ b/libsrc/runtime/decsp3.s @@ -5,18 +5,18 @@ ; .export decsp3 - .importzp spc + .importzp c_sp .proc decsp3 - lda spc + lda c_sp sec sbc #3 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/decsp4.s b/libsrc/runtime/decsp4.s index 739bc43f1..c756473bd 100644 --- a/libsrc/runtime/decsp4.s +++ b/libsrc/runtime/decsp4.s @@ -5,18 +5,18 @@ ; .export decsp4 - .importzp spc + .importzp c_sp .proc decsp4 - lda spc + lda c_sp sec sbc #4 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/decsp5.s b/libsrc/runtime/decsp5.s index 6d63cd290..71b2fb176 100644 --- a/libsrc/runtime/decsp5.s +++ b/libsrc/runtime/decsp5.s @@ -5,18 +5,18 @@ ; .export decsp5 - .importzp spc + .importzp c_sp .proc decsp5 - lda spc + lda c_sp sec sbc #5 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/decsp6.s b/libsrc/runtime/decsp6.s index 06f1bee2f..1d0b93136 100644 --- a/libsrc/runtime/decsp6.s +++ b/libsrc/runtime/decsp6.s @@ -5,18 +5,18 @@ ; .export decsp6 - .importzp spc + .importzp c_sp .proc decsp6 - lda spc + lda c_sp sec sbc #6 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/decsp7.s b/libsrc/runtime/decsp7.s index 341ce4dff..1646d9ec9 100644 --- a/libsrc/runtime/decsp7.s +++ b/libsrc/runtime/decsp7.s @@ -5,18 +5,18 @@ ; .export decsp7 - .importzp spc + .importzp c_sp .proc decsp7 - lda spc + lda c_sp sec sbc #7 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/decsp8.s b/libsrc/runtime/decsp8.s index 68bb08d17..1726331c5 100644 --- a/libsrc/runtime/decsp8.s +++ b/libsrc/runtime/decsp8.s @@ -5,18 +5,18 @@ ; .export decsp8 - .importzp spc + .importzp c_sp .proc decsp8 - lda spc + lda c_sp sec sbc #8 - sta spc + sta c_sp bcc @L1 rts -@L1: dec spc+1 +@L1: dec c_sp+1 rts .endproc diff --git a/libsrc/runtime/enter.s b/libsrc/runtime/enter.s index b9091b0eb..5915f579a 100644 --- a/libsrc/runtime/enter.s +++ b/libsrc/runtime/enter.s @@ -5,14 +5,14 @@ ; .export enter - .importzp spc + .importzp c_sp enter: tya ; get arg size - ldy spc + ldy c_sp bne L1 - dec spc+1 -L1: dec spc + dec c_sp+1 +L1: dec c_sp ldy #0 - sta (spc),y ; Store the arg count + sta (c_sp),y ; Store the arg count rts diff --git a/libsrc/runtime/eq.s b/libsrc/runtime/eq.s index 073232e34..87cf1c085 100644 --- a/libsrc/runtime/eq.s +++ b/libsrc/runtime/eq.s @@ -6,7 +6,7 @@ .export toseq00, toseqa0, toseqax .import tosicmp, booleq - .importzp spc, tmp1 + .importzp c_sp, tmp1 toseq00: lda #$00 diff --git a/libsrc/runtime/icmp.s b/libsrc/runtime/icmp.s index 5c91d2c5a..0d3bb6140 100644 --- a/libsrc/runtime/icmp.s +++ b/libsrc/runtime/icmp.s @@ -6,7 +6,7 @@ ; .export tosicmp, tosicmp0 - .importzp spc, sreg + .importzp c_sp, sreg tosicmp0: @@ -17,16 +17,16 @@ tosicmp: stx sreg+1 ; Save ax ldy #$00 - lda (spc),y ; Get low byte + lda (c_sp),y ; Get low byte tax - inc spc ; 5 + inc c_sp ; 5 bne @L1 ; 3 - inc spc+1 ; (5) + inc c_sp+1 ; (5) @L1: - lda (spc),y ; Get high byte - inc spc ; 5 + lda (c_sp),y ; Get high byte + inc c_sp ; 5 bne @L2 ; 3 - inc spc+1 ; (5) + inc c_sp+1 ; (5) ; Do the compare. diff --git a/libsrc/runtime/incsp1.s b/libsrc/runtime/incsp1.s index d19412a7d..dde6c47b2 100644 --- a/libsrc/runtime/incsp1.s +++ b/libsrc/runtime/incsp1.s @@ -5,13 +5,13 @@ ; .export incsp1 - .importzp spc + .importzp c_sp .proc incsp1 - inc spc + inc c_sp bne @L1 - inc spc+1 + inc c_sp+1 @L1: rts .endproc diff --git a/libsrc/runtime/incsp2.s b/libsrc/runtime/incsp2.s index f7a0937e8..0d84dc7bb 100644 --- a/libsrc/runtime/incsp2.s +++ b/libsrc/runtime/incsp2.s @@ -5,7 +5,7 @@ ; this module also contains the popax function. .export popax, incsp2 - .importzp spc + .importzp c_sp .macpack cpu @@ -14,13 +14,13 @@ .proc popax ldy #1 - lda (spc),y ; get hi byte + lda (c_sp),y ; get hi byte tax ; into x .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) ; get lo byte + lda (c_sp) ; get lo byte .else dey - lda (spc),y ; get lo byte + lda (c_sp),y ; get lo byte .endif .endproc @@ -29,14 +29,14 @@ .proc incsp2 - inc spc ; 5 + inc c_sp ; 5 beq @L1 ; 2 - inc spc ; 5 + inc c_sp ; 5 beq @L2 ; 2 rts -@L1: inc spc ; 5 -@L2: inc spc+1 ; 5 +@L1: inc c_sp ; 5 +@L2: inc c_sp+1 ; 5 rts .endproc diff --git a/libsrc/runtime/ladd.s b/libsrc/runtime/ladd.s index 3e9b546d7..6658d7ec6 100644 --- a/libsrc/runtime/ladd.s +++ b/libsrc/runtime/ladd.s @@ -6,7 +6,7 @@ .export tosadd0ax, tosaddeax .import addysp1 - .importzp spc, sreg, tmp1 + .importzp c_sp, sreg, tmp1 .macpack cpu @@ -20,24 +20,24 @@ tosadd0ax: tosaddeax: clc .if (.cpu .bitand CPU_ISET_65SC02) - adc (spc) ; 65SC02 version - saves 2 cycles + adc (c_sp) ; 65SC02 version - saves 2 cycles ldy #1 .else ldy #0 - adc (spc),y ; lo byte + adc (c_sp),y ; lo byte iny .endif sta tmp1 ; use as temp storage txa - adc (spc),y ; byte 1 + adc (c_sp),y ; byte 1 tax iny lda sreg - adc (spc),y ; byte 2 + adc (c_sp),y ; byte 2 sta sreg iny lda sreg+1 - adc (spc),y ; byte 3 + adc (c_sp),y ; byte 3 sta sreg+1 lda tmp1 ; load byte 0 jmp addysp1 ; drop TOS diff --git a/libsrc/runtime/laddeqsp.s b/libsrc/runtime/laddeqsp.s index 21c41e8d9..13dbf8112 100644 --- a/libsrc/runtime/laddeqsp.s +++ b/libsrc/runtime/laddeqsp.s @@ -5,29 +5,29 @@ ; .export laddeq0sp, laddeqysp - .importzp spc, sreg + .importzp c_sp, sreg laddeq0sp: ldy #0 laddeqysp: clc - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y pha iny txa - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y tax iny lda sreg - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y sta sreg iny lda sreg+1 - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y sta sreg+1 pla rts diff --git a/libsrc/runtime/land.s b/libsrc/runtime/land.s index c14de06f3..9dd3cad6a 100644 --- a/libsrc/runtime/land.s +++ b/libsrc/runtime/land.s @@ -7,7 +7,7 @@ .export tosand0ax, tosandeax .import addysp1 - .importzp spc, sreg, tmp1 + .importzp c_sp, sreg, tmp1 .macpack cpu @@ -23,24 +23,24 @@ tosand0ax: tosandeax: .if (.cpu .bitand ::CPU_ISET_65SC02) - and (spc) ; byte 0 + and (c_sp) ; byte 0 ldy #1 .else ldy #0 - and (spc),y ; byte 0 + and (c_sp),y ; byte 0 iny .endif sta tmp1 txa - and (spc),y ; byte 1 + and (c_sp),y ; byte 1 tax iny lda sreg - and (spc),y ; byte 2 + and (c_sp),y ; byte 2 sta sreg iny lda sreg+1 - and (spc),y ; byte 3 + and (c_sp),y ; byte 3 sta sreg+1 lda tmp1 diff --git a/libsrc/runtime/lcmp.s b/libsrc/runtime/lcmp.s index a8633578f..59c02dd56 100644 --- a/libsrc/runtime/lcmp.s +++ b/libsrc/runtime/lcmp.s @@ -7,7 +7,7 @@ .export toslcmp .import incsp4 - .importzp spc, sreg, ptr1 + .importzp c_sp, sreg, ptr1 toslcmp: @@ -15,23 +15,23 @@ toslcmp: stx ptr1+1 ; EAX now in sreg:ptr1 ldy #$03 - lda (spc),y + lda (c_sp),y sec sbc sreg+1 bne L4 dey - lda (spc),y + lda (c_sp),y cmp sreg bne L1 dey - lda (spc),y + lda (c_sp),y cmp ptr1+1 bne L1 dey - lda (spc),y + lda (c_sp),y cmp ptr1 L1: php ; Save flags diff --git a/libsrc/runtime/ldau0sp.s b/libsrc/runtime/ldau0sp.s index 88834a698..a808f6f84 100644 --- a/libsrc/runtime/ldau0sp.s +++ b/libsrc/runtime/ldau0sp.s @@ -5,17 +5,17 @@ ; .export ldau00sp, ldau0ysp - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack cpu ldau00sp: ldy #1 ldau0ysp: - lda (spc),y + lda (c_sp),y sta ptr1+1 dey - lda (spc),y + lda (c_sp),y sta ptr1 ldx #0 .if (.cpu .bitand CPU_ISET_65SC02) diff --git a/libsrc/runtime/ldauisp.s b/libsrc/runtime/ldauisp.s index 0019a1f68..957f245be 100644 --- a/libsrc/runtime/ldauisp.s +++ b/libsrc/runtime/ldauisp.s @@ -5,15 +5,15 @@ ; .export ldaui0sp, ldauiysp - .importzp spc, ptr1 + .importzp c_sp, ptr1 ldaui0sp: ldy #1 ldauiysp: - lda (spc),y + lda (c_sp),y sta ptr1+1 dey - lda (spc),y + lda (c_sp),y sta ptr1 txa tay diff --git a/libsrc/runtime/ldaxsp.s b/libsrc/runtime/ldaxsp.s index 085c0cd36..88a3043a0 100644 --- a/libsrc/runtime/ldaxsp.s +++ b/libsrc/runtime/ldaxsp.s @@ -5,16 +5,16 @@ ; .export ldax0sp, ldaxysp - .importzp spc + .importzp c_sp ; Beware: The optimizer knows about the value in Y after return! ldax0sp: ldy #1 ldaxysp: - lda (spc),y ; get high byte + lda (c_sp),y ; get high byte tax ; and save it dey ; point to lo byte - lda (spc),y ; load low byte + lda (c_sp),y ; load low byte rts diff --git a/libsrc/runtime/ldeaxysp.s b/libsrc/runtime/ldeaxysp.s index 566925265..b6ce7254f 100644 --- a/libsrc/runtime/ldeaxysp.s +++ b/libsrc/runtime/ldeaxysp.s @@ -9,20 +9,20 @@ .export ldeax0sp, ldeaxysp - .importzp sreg, spc + .importzp sreg, c_sp ldeax0sp: ldy #3 ldeaxysp: - lda (spc),y + lda (c_sp),y sta sreg+1 dey - lda (spc),y + lda (c_sp),y sta sreg dey - lda (spc),y + lda (c_sp),y tax dey - lda (spc),y + lda (c_sp),y rts diff --git a/libsrc/runtime/leaaxsp.s b/libsrc/runtime/leaaxsp.s index 09f2bfccc..451d7191f 100644 --- a/libsrc/runtime/leaaxsp.s +++ b/libsrc/runtime/leaaxsp.s @@ -5,16 +5,16 @@ ; .export leaaxsp, leaa0sp - .importzp spc + .importzp c_sp leaa0sp: ldx #$00 leaaxsp: clc - adc spc + adc c_sp pha txa - adc spc+1 + adc c_sp+1 tax pla rts diff --git a/libsrc/runtime/leave.s b/libsrc/runtime/leave.s index 0dfd79556..a917ab955 100644 --- a/libsrc/runtime/leave.s +++ b/libsrc/runtime/leave.s @@ -12,7 +12,7 @@ .export leave00, leave0, leavey00, leavey0, leavey .export leave .import addysp - .importzp spc + .importzp c_sp .macpack cpu @@ -31,24 +31,24 @@ leavey: .if (.cpu .bitand ::CPU_ISET_65SC02) leave: tay ; save A a sec - lda (spc) ; that's the pushed arg size + lda (c_sp) ; that's the pushed arg size sec ; Count the byte, the count's stored in - adc spc - sta spc + adc c_sp + sta c_sp bcc L1 - inc spc+1 + inc c_sp+1 L1: tya ; Get return value back .else leave: pha ; save A a sec ldy #0 - lda (spc),y ; that's the pushed arg size + lda (c_sp),y ; that's the pushed arg size sec ; Count the byte, the count's stored in - adc spc - sta spc + adc c_sp + sta c_sp bcc L1 - inc spc+1 + inc c_sp+1 L1: pla ; Get return value back .endif diff --git a/libsrc/runtime/lmul.s b/libsrc/runtime/lmul.s index 2c337e143..a68c3e5c1 100644 --- a/libsrc/runtime/lmul.s +++ b/libsrc/runtime/lmul.s @@ -7,7 +7,7 @@ .export tosumul0ax, tosumuleax, tosmul0ax, tosmuleax .import addysp1 - .importzp spc, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4 + .importzp c_sp, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4 .macpack cpu @@ -27,21 +27,21 @@ tosumuleax: mul32: sta ptr1 stx ptr1+1 ; op2 now in ptr1/sreg .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) ldy #1 .else ldy #0 - lda (spc),y + lda (c_sp),y iny .endif sta ptr3 - lda (spc),y + lda (c_sp),y sta ptr3+1 iny - lda (spc),y + lda (c_sp),y sta ptr4 iny - lda (spc),y + lda (c_sp),y sta ptr4+1 ; op1 in pre3/ptr4 jsr addysp1 ; Drop TOS diff --git a/libsrc/runtime/lor.s b/libsrc/runtime/lor.s index 521f53e07..94731adac 100644 --- a/libsrc/runtime/lor.s +++ b/libsrc/runtime/lor.s @@ -7,7 +7,7 @@ .export tosor0ax, tosoreax .import addysp1 - .importzp spc, sreg, tmp1 + .importzp c_sp, sreg, tmp1 .macpack cpu @@ -23,24 +23,24 @@ tosor0ax: tosoreax: .if (.cpu .bitand ::CPU_ISET_65SC02) - ora (spc) + ora (c_sp) ldy #1 .else ldy #0 - ora (spc),y ; byte 0 + ora (c_sp),y ; byte 0 iny .endif sta tmp1 txa - ora (spc),y ; byte 1 + ora (c_sp),y ; byte 1 tax iny lda sreg - ora (spc),y ; byte 2 + ora (c_sp),y ; byte 2 sta sreg iny lda sreg+1 - ora (spc),y ; byte 3 + ora (c_sp),y ; byte 3 sta sreg+1 lda tmp1 diff --git a/libsrc/runtime/lpop.s b/libsrc/runtime/lpop.s index 3c57e5b15..9690aff24 100644 --- a/libsrc/runtime/lpop.s +++ b/libsrc/runtime/lpop.s @@ -7,24 +7,24 @@ .export popeax .import incsp4 - .importzp spc, sreg + .importzp c_sp, sreg .macpack cpu popeax: ldy #3 - lda (spc),y + lda (c_sp),y sta sreg+1 dey - lda (spc),y + lda (c_sp),y sta sreg dey - lda (spc),y + lda (c_sp),y tax .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) .else dey - lda (spc),y + lda (c_sp),y .endif jmp incsp4 diff --git a/libsrc/runtime/lpush.s b/libsrc/runtime/lpush.s index 7a101af13..ec2c865af 100644 --- a/libsrc/runtime/lpush.s +++ b/libsrc/runtime/lpush.s @@ -10,7 +10,7 @@ ; .export pushl0, push0ax, pusheax .import decsp4 - .importzp spc, sreg + .importzp c_sp, sreg .macpack cpu @@ -31,19 +31,19 @@ pusheax: jsr decsp4 ldy #3 lda sreg+1 - sta (spc),y + sta (c_sp),y dey lda sreg - sta (spc),y + sta (c_sp),y dey txa - sta (spc),y + sta (c_sp),y pla .if (.cpu .bitand ::CPU_ISET_65SC02) - sta (spc) + sta (c_sp) .else dey - sta (spc),y + sta (c_sp),y .endif rts diff --git a/libsrc/runtime/lrsub.s b/libsrc/runtime/lrsub.s index bf7e3ee50..3bf941951 100644 --- a/libsrc/runtime/lrsub.s +++ b/libsrc/runtime/lrsub.s @@ -10,7 +10,7 @@ ; .export tosrsub0ax, tosrsubeax .import addysp1 - .importzp spc, sreg, tmp1 + .importzp c_sp, sreg, tmp1 .macpack cpu @@ -27,24 +27,24 @@ tosrsub0ax: tosrsubeax: sec .if (.cpu .bitand ::CPU_ISET_65SC02) - sbc (spc) + sbc (c_sp) ldy #1 .else ldy #0 - sbc (spc),y ; byte 0 + sbc (c_sp),y ; byte 0 iny .endif sta tmp1 ; use as temp storage txa - sbc (spc),y ; byte 1 + sbc (c_sp),y ; byte 1 tax iny lda sreg - sbc (spc),y ; byte 2 + sbc (c_sp),y ; byte 2 sta sreg iny lda sreg+1 - sbc (spc),y ; byte 3 + sbc (c_sp),y ; byte 3 sta sreg+1 lda tmp1 jmp addysp1 ; drop TOS diff --git a/libsrc/runtime/lsub.s b/libsrc/runtime/lsub.s index 559d0362f..2c0082deb 100644 --- a/libsrc/runtime/lsub.s +++ b/libsrc/runtime/lsub.s @@ -9,7 +9,7 @@ ; .export tossub0ax, tossubeax .import addysp1 - .importzp spc, sreg + .importzp c_sp, sreg .macpack cpu @@ -27,24 +27,24 @@ tossubeax: sec eor #$FF .if (.cpu .bitand ::CPU_ISET_65SC02) - adc (spc) ; 65SC02 version - saves 2 cycles + adc (c_sp) ; 65SC02 version - saves 2 cycles ldy #1 .else ldy #0 - adc (spc),y ; lo byte + adc (c_sp),y ; lo byte iny .endif pha ; Save low byte txa eor #$FF - adc (spc),y ; byte 1 + adc (c_sp),y ; byte 1 tax iny - lda (spc),y + lda (c_sp),y sbc sreg ; byte 2 sta sreg iny - lda (spc),y + lda (c_sp),y sbc sreg+1 ; byte 3 sta sreg+1 pla ; Restore byte 0 diff --git a/libsrc/runtime/lsubeqsp.s b/libsrc/runtime/lsubeqsp.s index af2a38cc4..6f8377484 100644 --- a/libsrc/runtime/lsubeqsp.s +++ b/libsrc/runtime/lsubeqsp.s @@ -5,31 +5,31 @@ ; .export lsubeq0sp, lsubeqysp - .importzp spc, sreg + .importzp c_sp, sreg lsubeq0sp: ldy #0 lsubeqysp: sec eor #$FF - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y pha ; Save low byte iny txa eor #$FF - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y tax iny - lda (spc),y + lda (c_sp),y sbc sreg - sta (spc),y + sta (c_sp),y sta sreg iny - lda (spc),y + lda (c_sp),y sbc sreg+1 - sta (spc),y + sta (c_sp),y sta sreg+1 pla rts diff --git a/libsrc/runtime/ludiv.s b/libsrc/runtime/ludiv.s index 695fac4f3..b47207222 100644 --- a/libsrc/runtime/ludiv.s +++ b/libsrc/runtime/ludiv.s @@ -7,7 +7,7 @@ .export tosudiv0ax, tosudiveax, getlop, udiv32 .import addysp1 - .importzp spc, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4 + .importzp c_sp, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4 .macpack cpu @@ -39,21 +39,21 @@ getlop: sta ptr3 ; Put right operand in place sta ptr4+1 .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) ldy #1 .else ldy #0 ; Put left operand in place - lda (spc),y + lda (c_sp),y iny .endif sta ptr1 - lda (spc),y + lda (c_sp),y sta ptr1+1 iny - lda (spc),y + lda (c_sp),y sta sreg iny - lda (spc),y + lda (c_sp),y sta sreg+1 jmp addysp1 ; Drop parameters diff --git a/libsrc/runtime/lxor.s b/libsrc/runtime/lxor.s index fa012118d..8b17d8df6 100644 --- a/libsrc/runtime/lxor.s +++ b/libsrc/runtime/lxor.s @@ -7,7 +7,7 @@ .export tosxor0ax, tosxoreax .import addysp1 - .importzp spc, sreg, tmp1 + .importzp c_sp, sreg, tmp1 .macpack cpu @@ -23,24 +23,24 @@ tosxor0ax: tosxoreax: .if (.cpu .bitand ::CPU_ISET_65SC02) - eor (spc) ; byte 0 + eor (c_sp) ; byte 0 ldy #1 .else ldy #0 - eor (spc),y ; byte 0 + eor (c_sp),y ; byte 0 iny .endif sta tmp1 txa - eor (spc),y ; byte 1 + eor (c_sp),y ; byte 1 tax iny lda sreg - eor (spc),y ; byte 2 + eor (c_sp),y ; byte 2 sta sreg iny lda sreg+1 - eor (spc),y ; byte 3 + eor (c_sp),y ; byte 3 sta sreg+1 lda tmp1 diff --git a/libsrc/runtime/or.s b/libsrc/runtime/or.s index dc06c92ed..04389be5f 100644 --- a/libsrc/runtime/or.s +++ b/libsrc/runtime/or.s @@ -7,7 +7,7 @@ .export tosora0, tosorax .import addysp1 - .importzp spc, tmp1 + .importzp c_sp, tmp1 .macpack cpu @@ -15,16 +15,16 @@ tosora0: ldx #$00 tosorax: .if (.cpu .bitand ::CPU_ISET_65SC02) - ora (spc) + ora (c_sp) ldy #1 .else ldy #0 - ora (spc),y + ora (c_sp),y iny .endif sta tmp1 txa - ora (spc),y + ora (c_sp),y tax lda tmp1 jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/popa.s b/libsrc/runtime/popa.s index d24391293..c90f2be59 100644 --- a/libsrc/runtime/popa.s +++ b/libsrc/runtime/popa.s @@ -5,23 +5,23 @@ ; .export popa - .importzp spc + .importzp c_sp .macpack cpu .proc popa .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) .else ldy #0 ; (2) - lda (spc),y ; (7) Read byte + lda (c_sp),y ; (7) Read byte .endif - inc spc ; (12) + inc c_sp ; (12) beq @L1 ; (14) rts ; (20) -@L1: inc spc+1 +@L1: inc c_sp+1 rts .endproc diff --git a/libsrc/runtime/popptr1.s b/libsrc/runtime/popptr1.s index 5c52b5d34..caa43f3e0 100644 --- a/libsrc/runtime/popptr1.s +++ b/libsrc/runtime/popptr1.s @@ -6,19 +6,19 @@ .export popptr1 .import incsp2 - .importzp spc, ptr1 + .importzp c_sp, ptr1 .macpack cpu .proc popptr1 ; 14 bytes (four usages = at least 2 bytes saved) ldy #1 - lda (spc),y ; get hi byte + lda (c_sp),y ; get hi byte sta ptr1+1 ; into ptr hi dey ; dey even for for 65C02 here to have Y=0 at exit! .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) ; get lo byte + lda (c_sp) ; get lo byte .else - lda (spc),y ; get lo byte + lda (c_sp),y ; get lo byte .endif sta ptr1 ; to ptr lo jmp incsp2 diff --git a/libsrc/runtime/popsreg.s b/libsrc/runtime/popsreg.s index 2f2236813..6c1a61a32 100644 --- a/libsrc/runtime/popsreg.s +++ b/libsrc/runtime/popsreg.s @@ -6,20 +6,20 @@ .export popsreg .import incsp2 - .importzp spc, sreg + .importzp c_sp, sreg .macpack cpu popsreg: pha ; save A ldy #1 - lda (spc),y ; get hi byte + lda (c_sp),y ; get hi byte sta sreg+1 ; store it .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) ; get lo byte + lda (c_sp) ; get lo byte .else dey - lda (spc),y ; get lo byte + lda (c_sp),y ; get lo byte .endif sta sreg ; store it pla ; get A back diff --git a/libsrc/runtime/pusha.s b/libsrc/runtime/pusha.s index f7c65f35d..253612172 100644 --- a/libsrc/runtime/pusha.s +++ b/libsrc/runtime/pusha.s @@ -5,7 +5,7 @@ ; .export pusha0sp, pushaysp, pusha - .importzp spc + .importzp c_sp .macpack cpu @@ -14,16 +14,16 @@ pusha0sp: ldy #$00 pushaysp: - lda (spc),y -pusha: ldy spc ; (3) + lda (c_sp),y +pusha: ldy c_sp ; (3) beq @L1 ; (6) - dec spc ; (11) + dec c_sp ; (11) ldy #0 ; (13) - sta (spc),y ; (19) + sta (c_sp),y ; (19) rts ; (25) -@L1: dec spc+1 ; (11) - dec spc ; (16) - sta (spc),y ; (22) +@L1: dec c_sp+1 ; (11) + dec c_sp ; (16) + sta (c_sp),y ; (22) rts ; (28) diff --git a/libsrc/runtime/pushax.s b/libsrc/runtime/pushax.s index 06e7d4942..247a38630 100644 --- a/libsrc/runtime/pushax.s +++ b/libsrc/runtime/pushax.s @@ -5,7 +5,7 @@ ; .export push0, pusha0, pushax - .importzp spc + .importzp c_sp .macpack cpu @@ -20,21 +20,21 @@ pusha0: ldx #0 .proc pushax pha ; (3) - lda spc ; (6) + lda c_sp ; (6) sec ; (8) sbc #2 ; (10) - sta spc ; (13) + sta c_sp ; (13) bcs @L1 ; (17) - dec spc+1 ; (+5) + dec c_sp+1 ; (+5) @L1: ldy #1 ; (19) txa ; (21) - sta (spc),y ; (27) + sta (c_sp),y ; (27) pla ; (31) dey ; (33) .if (.cpu .bitand ::CPU_ISET_65SC02) - sta (spc) ; (37) + sta (c_sp) ; (37) .else - sta (spc),y ; (38) + sta (c_sp),y ; (38) .endif rts ; (44/43) diff --git a/libsrc/runtime/pushbsp.s b/libsrc/runtime/pushbsp.s index abbaf7589..64da06723 100644 --- a/libsrc/runtime/pushbsp.s +++ b/libsrc/runtime/pushbsp.s @@ -6,12 +6,12 @@ .export pushbsp, pushbysp .import pusha0 - .importzp spc + .importzp c_sp pushbsp: ldy #0 pushbysp: - lda (spc),y ; get lo byte + lda (c_sp),y ; get lo byte jmp pusha0 ; promote to unsigned and push diff --git a/libsrc/runtime/pushlysp.s b/libsrc/runtime/pushlysp.s index c64c90d7d..86bb87dbd 100644 --- a/libsrc/runtime/pushlysp.s +++ b/libsrc/runtime/pushlysp.s @@ -7,23 +7,23 @@ .export pushlysp .import pusheax - .importzp sreg, spc + .importzp sreg, c_sp .proc pushlysp iny iny - lda (spc),y + lda (c_sp),y iny sta sreg - lda (spc),y + lda (c_sp),y sta sreg+1 dey dey - lda (spc),y + lda (c_sp),y dey tax - lda (spc),y + lda (c_sp),y jmp pusheax .endproc diff --git a/libsrc/runtime/pushwsp.s b/libsrc/runtime/pushwsp.s index de005d08c..3bd164230 100644 --- a/libsrc/runtime/pushwsp.s +++ b/libsrc/runtime/pushwsp.s @@ -5,27 +5,27 @@ ; .export pushwysp, pushw0sp - .importzp spc + .importzp c_sp .macpack generic pushw0sp: ldy #3 pushwysp: - lda spc ; 3 + lda c_sp ; 3 sub #2 ; 4 - sta spc ; 3 + sta c_sp ; 3 bcs @L1 ; 3(+1) - dec spc+1 ; (5) -@L1: lda (spc),y ; 5 =16 + dec c_sp+1 ; (5) +@L1: lda (c_sp),y ; 5 =16 tax ; 2 dey ; 2 - lda (spc),y ; 5 + lda (c_sp),y ; 5 ldy #$00 ; 2 - sta (spc),y ; 5 + sta (c_sp),y ; 5 iny ; 2 txa ; 2 - sta (spc),y ; 5 + sta (c_sp),y ; 5 rts diff --git a/libsrc/runtime/regswap.s b/libsrc/runtime/regswap.s index 0185b0503..96080c823 100644 --- a/libsrc/runtime/regswap.s +++ b/libsrc/runtime/regswap.s @@ -5,17 +5,17 @@ ; .export regswap - .importzp spc, regbank, tmp1 + .importzp c_sp, regbank, tmp1 .proc regswap sta tmp1 ; Store count @L1: lda regbank,x ; Get old value pha ; Save it - lda (spc),y ; Get stack loc + lda (c_sp),y ; Get stack loc sta regbank,x ; Store new value pla - sta (spc),y ; Store old value + sta (c_sp),y ; Store old value inx iny dec tmp1 diff --git a/libsrc/runtime/regswap1.s b/libsrc/runtime/regswap1.s index 28e069562..34cfd50eb 100644 --- a/libsrc/runtime/regswap1.s +++ b/libsrc/runtime/regswap1.s @@ -5,16 +5,16 @@ ; .export regswap1 - .importzp spc, regbank + .importzp c_sp, regbank .proc regswap1 lda regbank,x ; Get old value pha ; Save it - lda (spc),y ; Get stack loc + lda (c_sp),y ; Get stack loc sta regbank,x ; Store new value pla - sta (spc),y ; Store old value + sta (c_sp),y ; Store old value rts .endproc diff --git a/libsrc/runtime/regswap2.s b/libsrc/runtime/regswap2.s index 205458fa2..4f55fad40 100644 --- a/libsrc/runtime/regswap2.s +++ b/libsrc/runtime/regswap2.s @@ -5,7 +5,7 @@ ; .export regswap2 - .importzp spc, regbank + .importzp c_sp, regbank .proc regswap2 @@ -13,20 +13,20 @@ lda regbank,x ; Get old value pha ; Save it - lda (spc),y ; Get stack loc + lda (c_sp),y ; Get stack loc sta regbank,x ; Store new value pla - sta (spc),y ; Store old value + sta (c_sp),y ; Store old value ; Second byte iny lda regbank+1,x ; Get old value pha ; Save it - lda (spc),y ; Get stack loc + lda (c_sp),y ; Get stack loc sta regbank+1,x ; Store new value pla - sta (spc),y ; Store old value + sta (c_sp),y ; Store old value rts diff --git a/libsrc/runtime/rsub.s b/libsrc/runtime/rsub.s index afee1f7c3..c91b983dd 100644 --- a/libsrc/runtime/rsub.s +++ b/libsrc/runtime/rsub.s @@ -7,7 +7,7 @@ .export tosrsuba0, tosrsubax .import addysp1 - .importzp spc, tmp1 + .importzp c_sp, tmp1 .macpack cpu @@ -20,16 +20,16 @@ tosrsuba0: tosrsubax: sec .if (.cpu .bitand CPU_ISET_65SC02) - sbc (spc) + sbc (c_sp) ldy #1 .else ldy #0 - sbc (spc),y ; lo byte + sbc (c_sp),y ; lo byte iny .endif sta tmp1 ; save lo byte txa - sbc (spc),y ; hi byte + sbc (c_sp),y ; hi byte tax lda tmp1 jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/staspidx.s b/libsrc/runtime/staspidx.s index c1018b0d2..bd9b0c79d 100644 --- a/libsrc/runtime/staspidx.s +++ b/libsrc/runtime/staspidx.s @@ -6,17 +6,17 @@ .export staspidx .import incsp2 - .importzp spc, tmp1, ptr1 + .importzp c_sp, tmp1, ptr1 .proc staspidx pha sty tmp1 ; Save Index ldy #1 - lda (spc),y + lda (c_sp),y sta ptr1+1 dey - lda (spc),y + lda (c_sp),y sta ptr1 ; Pointer now in ptr1 ldy tmp1 ; Restore offset pla ; Restore value diff --git a/libsrc/runtime/staxsp.s b/libsrc/runtime/staxsp.s index bacadcddc..15bec22ee 100644 --- a/libsrc/runtime/staxsp.s +++ b/libsrc/runtime/staxsp.s @@ -1,20 +1,20 @@ ; ; Ullrich von Bassewitz, 31.08.1998 ; -; CC65 runtime: Store ax at (spc),y +; CC65 runtime: Store ax at (c_sp),y ; .export staxysp, stax0sp - .importzp spc + .importzp c_sp stax0sp: ldy #0 staxysp: - sta (spc),y + sta (c_sp),y iny pha txa - sta (spc),y + sta (c_sp),y pla rts diff --git a/libsrc/runtime/staxspi.s b/libsrc/runtime/staxspi.s index 44fee6789..aefed428f 100644 --- a/libsrc/runtime/staxspi.s +++ b/libsrc/runtime/staxspi.s @@ -7,7 +7,7 @@ .export staxspidx .import incsp2 - .importzp spc, tmp1, ptr1 + .importzp c_sp, tmp1, ptr1 .macpack cpu @@ -16,13 +16,13 @@ sty tmp1 ; Save Y pha ; Save A ldy #1 - lda (spc),y + lda (c_sp),y sta ptr1+1 .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) .else dey - lda (spc),y + lda (c_sp),y .endif sta ptr1 ; Address now in ptr1 ldy tmp1 ; Restore Y diff --git a/libsrc/runtime/steaxsp.s b/libsrc/runtime/steaxsp.s index 89d013fe7..33dbc04d7 100644 --- a/libsrc/runtime/steaxsp.s +++ b/libsrc/runtime/steaxsp.s @@ -1,26 +1,26 @@ ; ; Ullrich von Bassewitz, 31.08.1998 ; -; CC65 runtime: Store eax at (spc),y +; CC65 runtime: Store eax at (c_sp),y ; .export steaxysp, steax0sp - .importzp spc, sreg + .importzp c_sp, sreg steax0sp: ldy #0 steaxysp: - sta (spc),y + sta (c_sp),y iny pha txa - sta (spc),y + sta (c_sp),y iny lda sreg - sta (spc),y + sta (c_sp),y iny lda sreg+1 - sta (spc),y + sta (c_sp),y pla rts diff --git a/libsrc/runtime/stkchk.s b/libsrc/runtime/stkchk.s index 6125ae442..a7ca39f21 100644 --- a/libsrc/runtime/stkchk.s +++ b/libsrc/runtime/stkchk.s @@ -17,7 +17,7 @@ .constructor initstkchk, 25 .import __STACKSIZE__ ; Linker defined .import pusha0, _exit - .importzp spc + .importzp c_sp ; Use macros for better readability .macpack generic @@ -32,11 +32,11 @@ .proc initstkchk - lda spc + lda c_sp sta initialsp sub #<__STACKSIZE__ sta lowwater - lda spc+1 + lda c_sp+1 sta initialsp+1 sbc #>__STACKSIZE__ .if (.cpu .bitand ::CPU_ISET_65SC02) @@ -70,7 +70,7 @@ cstkchk: ; Check the high byte of the software stack @L0: lda lowwater+1 - cmp spc+1 + cmp c_sp+1 bcs @L1 rts @@ -78,7 +78,7 @@ cstkchk: @L1: bne CStackOverflow lda lowwater - cmp spc + cmp c_sp bcs CStackOverflow Done: rts @@ -87,9 +87,9 @@ Done: rts CStackOverflow: lda initialsp - sta spc + sta c_sp lda initialsp+1 - sta spc+1 + sta c_sp+1 ; Generic abort entry. We should output a diagnostic here, but this is ; difficult, since we're operating at a lower level here. diff --git a/libsrc/runtime/sub.s b/libsrc/runtime/sub.s index 4134987e0..07e7dc5e3 100644 --- a/libsrc/runtime/sub.s +++ b/libsrc/runtime/sub.s @@ -6,7 +6,7 @@ .export tossuba0, tossubax .import addysp1 - .importzp spc + .importzp c_sp .macpack cpu @@ -18,17 +18,17 @@ tossubax: sec eor #$FF .if (.cpu .bitand CPU_ISET_65SC02) - adc (spc) + adc (c_sp) ldy #1 .else ldy #0 - adc (spc),y ; Subtract low byte + adc (c_sp),y ; Subtract low byte iny .endif pha ; Save high byte txa eor #$FF - adc (spc),y ; Subtract high byte + adc (c_sp),y ; Subtract high byte tax ; High byte into X pla ; Restore low byte jmp addysp1 ; drop TOS diff --git a/libsrc/runtime/subeqsp.s b/libsrc/runtime/subeqsp.s index 568b73df9..880e5f2fc 100644 --- a/libsrc/runtime/subeqsp.s +++ b/libsrc/runtime/subeqsp.s @@ -5,21 +5,21 @@ ; .export subeq0sp, subeqysp - .importzp spc + .importzp c_sp subeq0sp: ldy #0 subeqysp: sec eor #$FF - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y pha ; Save low byte iny txa eor #$FF - adc (spc),y - sta (spc),y + adc (c_sp),y + sta (c_sp),y tax pla ; Restore low byte rts diff --git a/libsrc/runtime/subysp.s b/libsrc/runtime/subysp.s index 3fe03bc53..8f5bea806 100644 --- a/libsrc/runtime/subysp.s +++ b/libsrc/runtime/subysp.s @@ -6,17 +6,17 @@ ; .export subysp - .importzp spc + .importzp c_sp .proc subysp tya eor #$ff sec - adc spc - sta spc + adc c_sp + sta c_sp bcs @L1 - dec spc+1 + dec c_sp+1 @L1: rts .endproc diff --git a/libsrc/runtime/swap.s b/libsrc/runtime/swap.s index fd4e8154d..3796b0a97 100644 --- a/libsrc/runtime/swap.s +++ b/libsrc/runtime/swap.s @@ -6,7 +6,7 @@ ; .export swapstk - .importzp spc, ptr4 + .importzp c_sp, ptr4 .macpack cpu @@ -14,22 +14,22 @@ swapstk: sta ptr4 stx ptr4+1 ldy #1 ; index - lda (spc),y + lda (c_sp),y tax lda ptr4+1 - sta (spc),y + sta (c_sp),y .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) tay lda ptr4 - sta (spc) + sta (c_sp) tya .else dey - lda (spc),y + lda (c_sp),y pha lda ptr4 - sta (spc),y + sta (c_sp),y pla .endif rts ; whew! diff --git a/libsrc/runtime/tosint.s b/libsrc/runtime/tosint.s index 80341050d..b924a53e3 100644 --- a/libsrc/runtime/tosint.s +++ b/libsrc/runtime/tosint.s @@ -6,7 +6,7 @@ .export tosint .import incsp2 - .importzp spc + .importzp c_sp .macpack cpu @@ -16,17 +16,17 @@ pha .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (spc) + lda (c_sp) .else ldy #0 - lda (spc),y ; spc+1 + lda (c_sp),y ; c_sp+1 .endif ldy #2 - sta (spc),y + sta (c_sp),y dey - lda (spc),y + lda (c_sp),y ldy #3 - sta (spc),y + sta (c_sp),y pla jmp incsp2 ; Drop 16 bit diff --git a/libsrc/runtime/toslong.s b/libsrc/runtime/toslong.s index 7df441383..8e417367f 100644 --- a/libsrc/runtime/toslong.s +++ b/libsrc/runtime/toslong.s @@ -6,7 +6,7 @@ .export tosulong, toslong .import decsp2 - .importzp spc + .importzp c_sp .macpack cpu @@ -16,25 +16,25 @@ tosulong: pha jsr decsp2 ; Make room ldy #2 - lda (spc),y + lda (c_sp),y .if (.cpu .bitand CPU_ISET_65SC02) - sta (spc) ; 65C02 version + sta (c_sp) ; 65C02 version iny ; Y = 3 .else ldy #0 - sta (spc),y + sta (c_sp),y ldy #3 .endif - lda (spc),y + lda (c_sp),y toslong1: ldy #1 - sta (spc),y + sta (c_sp),y lda #0 ; Zero extend toslong2: iny - sta (spc),y + sta (c_sp),y iny - sta (spc),y + sta (c_sp),y pla rts @@ -42,19 +42,19 @@ toslong: pha jsr decsp2 ; Make room ldy #2 - lda (spc),y + lda (c_sp),y .if (.cpu .bitand CPU_ISET_65SC02) - sta (spc) ; 65C02 version + sta (c_sp) ; 65C02 version iny ; Y = 3 .else ldy #0 - sta (spc),y + sta (c_sp),y ldy #3 .endif - lda (spc),y + lda (c_sp),y bpl toslong1 ; Jump if positive, high word is zero ldy #1 - sta (spc),y + sta (c_sp),y lda #$FF bne toslong2 ; Branch always diff --git a/libsrc/runtime/xor.s b/libsrc/runtime/xor.s index 38c127a90..15394413c 100644 --- a/libsrc/runtime/xor.s +++ b/libsrc/runtime/xor.s @@ -7,7 +7,7 @@ .export tosxora0, tosxorax .import addysp1 - .importzp spc, tmp1 + .importzp c_sp, tmp1 .macpack cpu @@ -15,16 +15,16 @@ tosxora0: ldx #$00 tosxorax: .if (.cpu .bitand CPU_ISET_65SC02) - eor (spc) + eor (c_sp) ldy #1 .else ldy #0 - eor (spc),y + eor (c_sp),y iny .endif sta tmp1 txa - eor (spc),y + eor (c_sp),y tax lda tmp1 jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/zeropage.s b/libsrc/runtime/zeropage.s index 2b95a2899..73b25bf0a 100644 --- a/libsrc/runtime/zeropage.s +++ b/libsrc/runtime/zeropage.s @@ -10,7 +10,7 @@ .zeropage -spc: .res 2 ; Stack pointer +c_sp: .res 2 ; Stack pointer sreg: .res 2 ; Secondary register/high 16 bit for longs regsave: .res 4 ; Slot to save/restore (E)AX into ptr1: .res 2 diff --git a/libsrc/sim6502/crt0.s b/libsrc/sim6502/crt0.s index a2d4e7e97..26be7888b 100644 --- a/libsrc/sim6502/crt0.s +++ b/libsrc/sim6502/crt0.s @@ -22,8 +22,8 @@ startup:cld txs lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 + sta c_sp + stx c_sp+1 jsr zerobss jsr initlib jsr callmain diff --git a/libsrc/sim6502/exehdr.s b/libsrc/sim6502/exehdr.s index 7eb1c1c74..0a0e4bb26 100644 --- a/libsrc/sim6502/exehdr.s +++ b/libsrc/sim6502/exehdr.s @@ -5,7 +5,7 @@ ; .export __EXEHDR__ : absolute = 1 ; Linker referenced - .importzp spc + .importzp c_sp .import __MAIN_START__ .import startup @@ -24,6 +24,6 @@ .else .error Unknown CPU type. .endif - .byte spc ; spc address + .byte c_sp ; c_sp address .addr __MAIN_START__ ; load address .addr startup ; reset address diff --git a/libsrc/supervision/crt0.s b/libsrc/supervision/crt0.s index 8a3f59c66..931ec8be8 100644 --- a/libsrc/supervision/crt0.s +++ b/libsrc/supervision/crt0.s @@ -33,8 +33,8 @@ reset: lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) ldx #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr jsr initlib jsr _main _exit: jsr donelib diff --git a/libsrc/sym1/crt0.s b/libsrc/sym1/crt0.s index 4ce070c9c..d20b4cf6c 100644 --- a/libsrc/sym1/crt0.s +++ b/libsrc/sym1/crt0.s @@ -33,9 +33,9 @@ _init: jsr ACCESS ; Unlock System RAM ; Set cc65 argument stack pointer lda #<(__RAM_START__ + __RAM_SIZE__) - sta spc + sta c_sp lda #>(__RAM_START__ + __RAM_SIZE__) - sta spc+1 + sta c_sp+1 ; Initialize memory storage diff --git a/libsrc/telestrat/crt0.s b/libsrc/telestrat/crt0.s index f6796487d..430c4f8c8 100644 --- a/libsrc/telestrat/crt0.s +++ b/libsrc/telestrat/crt0.s @@ -47,7 +47,7 @@ _exit: jsr donelib ldx #zpspace - 1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 @@ -64,7 +64,7 @@ L2: lda zpsave,x ; Save the zero-page area that we're about to use. init: ldx #zpspace - 1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -74,8 +74,8 @@ L1: lda spc,x lda #<(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Call the module constructors. diff --git a/libsrc/telestrat/open.s b/libsrc/telestrat/open.s index c53a01b53..08c572e23 100644 --- a/libsrc/telestrat/open.s +++ b/libsrc/telestrat/open.s @@ -2,7 +2,7 @@ .import addysp,popax - .importzp spc,tmp2,tmp3,tmp1 + .importzp c_sp,tmp2,tmp3,tmp1 .include "telestrat.inc" diff --git a/libsrc/telestrat/wherex.s b/libsrc/telestrat/wherex.s index 835a57c0e..256b967c3 100644 --- a/libsrc/telestrat/wherex.s +++ b/libsrc/telestrat/wherex.s @@ -3,7 +3,7 @@ ; .export _wherex - .importzp spc + .importzp c_sp .include "telestrat.inc" diff --git a/libsrc/tgi/tgi_outtextxy.s b/libsrc/tgi/tgi_outtextxy.s index ea0f3d098..24183396f 100644 --- a/libsrc/tgi/tgi_outtextxy.s +++ b/libsrc/tgi/tgi_outtextxy.s @@ -8,7 +8,7 @@ .include "tgi-kernel.inc" .import addysp1 - .importzp spc + .importzp c_sp .proc _tgi_outtextxy @@ -17,16 +17,16 @@ pha ; ldy #0 - lda (spc),y + lda (c_sp),y sta _tgi_cury iny - lda (spc),y + lda (c_sp),y sta _tgi_cury+1 iny - lda (spc),y + lda (c_sp),y sta _tgi_curx iny - lda (spc),y + lda (c_sp),y sta _tgi_curx+1 pla jsr addysp1 ; Drop arguments from stack diff --git a/libsrc/vic20/crt0.s b/libsrc/vic20/crt0.s index 9e07f832d..64ccf6085 100644 --- a/libsrc/vic20/crt0.s +++ b/libsrc/vic20/crt0.s @@ -24,7 +24,7 @@ Start: ; Save the zero-page locations that we need. ldx #zpspace-1 -L1: lda spc,x +L1: lda c_sp,x sta zpsave,x dex bpl L1 @@ -45,8 +45,8 @@ L1: lda spc,x lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) - sta spc - stx spc+1 ; Set argument stack ptr + sta c_sp + stx c_sp+1 ; Set argument stack ptr ; Call the module constructors. @@ -65,7 +65,7 @@ _exit: pha ; Save the return code on stack ldx #zpspace-1 L2: lda zpsave,x - sta spc,x + sta c_sp,x dex bpl L2 diff --git a/libsrc/zlib/inflatemem.s b/libsrc/zlib/inflatemem.s index 35d0532b3..2f2a1b295 100644 --- a/libsrc/zlib/inflatemem.s +++ b/libsrc/zlib/inflatemem.s @@ -12,7 +12,7 @@ .export _inflatemem .import incsp2 - .importzp spc, sreg, ptr1, ptr2, ptr3, ptr4 + .importzp c_sp, sreg, ptr1, ptr2, ptr3, ptr4 ; -------------------------------------------------------------------------- ; @@ -79,10 +79,10 @@ _inflatemem: stx inputPointer+1 ; outputPointer = dest ldy #1 - lda (spc),y + lda (c_sp),y sta outputPointer+1 dey - lda (spc),y + lda (c_sp),y sta outputPointer ; ldy #0 @@ -129,11 +129,11 @@ inflate_nextBlock: lda outputPointer ; ldy #0 ; sec - sbc (spc),y + sbc (c_sp),y iny pha lda outputPointer+1 - sbc (spc),y + sbc (c_sp),y tax pla ; pop dest diff --git a/samples/getsp.s b/samples/getsp.s index 6f0d4bdde..95db689f4 100644 --- a/samples/getsp.s +++ b/samples/getsp.s @@ -1,11 +1,11 @@ .export _getsp - .importzp spc + .importzp c_sp .proc _getsp - ldx spc+1 - lda spc + ldx c_sp+1 + lda c_sp rts .endproc diff --git a/samples/tinyshell.c b/samples/tinyshell.c index 300ad6e91..a8d5340d9 100644 --- a/samples/tinyshell.c +++ b/samples/tinyshell.c @@ -112,17 +112,17 @@ static void get_command(void) #ifdef CHECK_SP static char firstcall = 1; static unsigned int good_sp; - unsigned int spc; + unsigned int c_sp; if (firstcall) - spc = good_sp = getsp(); + c_sp = good_sp = getsp(); else - spc = getsp(); + c_sp = getsp(); - if (spc != good_sp) { - printf("SP: 0x%04X ***MISMATCH*** 0x%04X\n", spc, good_sp); + if (c_sp != good_sp) { + printf("SP: 0x%04X ***MISMATCH*** 0x%04X\n", c_sp, good_sp); } else if (verbose) - printf("SP: 0x%04X\n", spc); + printf("SP: 0x%04X\n", c_sp); #endif arg1 = arg2 = arg3 = NULL; diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index a986b4244..f07d289be 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -218,7 +218,10 @@ void g_preamble (void) AddTextLine ("\t.debuginfo\t%s", (DebugInfo != 0)? "on" : "off"); /* Import zero page variables */ - AddTextLine ("\t.importzp\tspc, sreg, regsave, regbank"); + AddTextLine ("\t.importzp\t" "c_sp, sreg, regsave, regbank"); + /* The space above is intentional, to ease replacement of the name of + ** the stack pointer. Don't worry, the preprocessor will concatenate them. + */ AddTextLine ("\t.importzp\ttmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4"); /* Define long branch macros */ @@ -569,11 +572,11 @@ void g_swap_regvars (int StackOffs, int RegOffs, unsigned Bytes) AddCodeLine ("ldx #$%02X", RegOffs & 0xFF); AddCodeLine ("jsr regswap1"); } else { - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("ldx regbank%+d", RegOffs); AddCodeLine ("sta regbank%+d", RegOffs); AddCodeLine ("txa"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); } } else if (Bytes == 2) { @@ -615,7 +618,7 @@ void g_save_regvars (int RegOffs, unsigned Bytes) AddCodeLine ("ldx #$%02X", (unsigned char) Bytes); g_defcodelabel (Label); AddCodeLine ("lda regbank%+d,x", RegOffs-1); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("dey"); AddCodeLine ("dex"); AddCodeLine ("bne %s", LocalLabelName (Label)); @@ -639,28 +642,28 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes) if (Bytes == 1) { AddCodeLine ("ldy #$%02X", StackOffs); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d", RegOffs); } else if (Bytes == 2) { AddCodeLine ("ldy #$%02X", StackOffs); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d", RegOffs); AddCodeLine ("iny"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d", RegOffs+1); } else if (Bytes == 3 && IS_Get (&CodeSizeFactor) >= 133) { AddCodeLine ("ldy #$%02X", StackOffs); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d", RegOffs); AddCodeLine ("iny"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d", RegOffs+1); AddCodeLine ("iny"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d", RegOffs+2); } else if (StackOffs <= RegOffs) { @@ -672,7 +675,7 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes) unsigned Label = GetLocalLabel (); AddCodeLine ("ldy #$%02X", StackOffs); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d,y", RegOffs - StackOffs); AddCodeLine ("iny"); AddCodeLine ("cpy #$%02X", StackOffs + Bytes); @@ -688,7 +691,7 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes) AddCodeLine ("ldy #$%02X", (unsigned char) (StackOffs + Bytes - 1)); AddCodeLine ("ldx #$%02X", (unsigned char) (Bytes - 1)); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta regbank%+d,x", RegOffs); AddCodeLine ("dey"); AddCodeLine ("dex"); @@ -834,11 +837,11 @@ void g_getlocal (unsigned Flags, int Offs) CheckLocalOffs (Offs); if ((Flags & CF_FORCECHAR) || (Flags & CF_TEST)) { AddCodeLine ("ldy #$%02X", Offs); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); } else { AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("ldx #$00"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); if ((Flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); AddCodeLine ("bpl %s", LocalLabelName (L)); @@ -852,9 +855,9 @@ void g_getlocal (unsigned Flags, int Offs) CheckLocalOffs (Offs + 1); AddCodeLine ("ldy #$%02X", (unsigned char) (Offs+1)); if (Flags & CF_TEST) { - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("dey"); - AddCodeLine ("ora (spc),y"); + AddCodeLine ("ora (c_sp),y"); } else { AddCodeLine ("jsr ldaxysp"); } @@ -935,7 +938,7 @@ void g_leasp (int Offs) { unsigned char Lo, Hi; - /* Calculate the offset relative to spc */ + /* Calculate the offset relative to c_sp */ Offs -= StackPtr; /* Get low and high byte */ @@ -945,17 +948,17 @@ void g_leasp (int Offs) /* Generate code */ if (Lo == 0) { if (Hi <= 3) { - AddCodeLine ("lda spc"); - AddCodeLine ("ldx spc+1"); + AddCodeLine ("lda c_sp"); + AddCodeLine ("ldx c_sp+1"); while (Hi--) { AddCodeLine ("inx"); } } else { - AddCodeLine ("lda spc+1"); + AddCodeLine ("lda c_sp+1"); AddCodeLine ("clc"); AddCodeLine ("adc #$%02X", Hi); AddCodeLine ("tax"); - AddCodeLine ("lda spc"); + AddCodeLine ("lda c_sp"); } } else if (Hi == 0) { /* 8 bit offset */ @@ -966,8 +969,8 @@ void g_leasp (int Offs) } else { /* 8 bit offset inlined */ unsigned L = GetLocalLabel (); - AddCodeLine ("lda spc"); - AddCodeLine ("ldx spc+1"); + AddCodeLine ("lda c_sp"); + AddCodeLine ("ldx c_sp+1"); AddCodeLine ("clc"); AddCodeLine ("adc #$%02X", Lo); AddCodeLine ("bcc %s", LocalLabelName (L)); @@ -981,11 +984,11 @@ void g_leasp (int Offs) AddCodeLine ("jsr leaaxsp"); } else { /* Full 16 bit offset inlined */ - AddCodeLine ("lda spc"); + AddCodeLine ("lda c_sp"); AddCodeLine ("clc"); AddCodeLine ("adc #$%02X", Lo); AddCodeLine ("pha"); - AddCodeLine ("lda spc+1"); + AddCodeLine ("lda c_sp+1"); AddCodeLine ("adc #$%02X", Hi); AddCodeLine ("tax"); AddCodeLine ("pla"); @@ -1001,10 +1004,10 @@ void g_leavariadic (int Offs) { unsigned ArgSizeOffs; - /* Calculate the offset relative to spc */ + /* Calculate the offset relative to c_sp */ Offs -= StackPtr; - /* Get the offset of the parameter which is stored at spc+0 on function + /* Get the offset of the parameter which is stored at c_sp+0 on function ** entry and check if this offset is reachable with a byte offset. */ CHECK (StackPtr <= 0); @@ -1013,14 +1016,14 @@ void g_leavariadic (int Offs) /* Get the size of all parameters. */ AddCodeLine ("ldy #$%02X", ArgSizeOffs); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); /* Add the value of the stackpointer */ if (IS_Get (&CodeSizeFactor) > 250) { unsigned L = GetLocalLabel(); - AddCodeLine ("ldx spc+1"); + AddCodeLine ("ldx c_sp+1"); AddCodeLine ("clc"); - AddCodeLine ("adc spc"); + AddCodeLine ("adc c_sp"); AddCodeLine ("bcc %s", LocalLabelName (L)); AddCodeLine ("inx"); g_defcodelabel (L); @@ -1092,14 +1095,14 @@ void g_putlocal (unsigned Flags, int Offs, long Val) AddCodeLine ("lda #$%02X", (unsigned char) Val); } AddCodeLine ("ldy #$%02X", Offs); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); break; case CF_INT: if (Flags & CF_CONST) { AddCodeLine ("ldy #$%02X", Offs+1); AddCodeLine ("lda #$%02X", (unsigned char) (Val >> 8)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); if ((Flags & CF_NOKEEP) == 0) { /* Place high byte into X */ AddCodeLine ("tax"); @@ -1112,16 +1115,16 @@ void g_putlocal (unsigned Flags, int Offs, long Val) AddCodeLine ("dey"); AddCodeLine ("lda #$%02X", (unsigned char) Val); } - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); } else { AddCodeLine ("ldy #$%02X", Offs); if ((Flags & CF_NOKEEP) == 0 || IS_Get (&CodeSizeFactor) < 160) { AddCodeLine ("jsr staxysp"); } else { - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCodeLine ("txa"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); } } break; @@ -1161,12 +1164,12 @@ void g_putind (unsigned Flags, unsigned Offs) AddCodeLine ("pha"); } AddCodeLine ("lda #$%02X", Offs & 0xFF); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCodeLine ("lda #$%02X", (Offs >> 8) & 0xFF); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); if ((Flags & CF_NOKEEP) == 0) { AddCodeLine ("pla"); } @@ -1183,8 +1186,8 @@ void g_putind (unsigned Flags, unsigned Offs) AddCodeLine ("pha"); } AddCodeLine ("lda #$%02X", (Offs >> 8) & 0xFF); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); if ((Flags & CF_NOKEEP) == 0) { AddCodeLine ("pla"); } @@ -1618,7 +1621,7 @@ void g_addlocal (unsigned flags, int offs) L = GetLocalLabel(); AddCodeLine ("ldy #$%02X", NewOff & 0xFF); AddCodeLine ("clc"); - AddCodeLine ("adc (spc),y"); + AddCodeLine ("adc (c_sp),y"); AddCodeLine ("bcc %s", LocalLabelName (L)); AddCodeLine ("inx"); g_defcodelabel (L); @@ -1627,11 +1630,11 @@ void g_addlocal (unsigned flags, int offs) case CF_INT: AddCodeLine ("ldy #$%02X", NewOff & 0xFF); AddCodeLine ("clc"); - AddCodeLine ("adc (spc),y"); + AddCodeLine ("adc (c_sp),y"); AddCodeLine ("pha"); AddCodeLine ("txa"); AddCodeLine ("iny"); - AddCodeLine ("adc (spc),y"); + AddCodeLine ("adc (c_sp),y"); AddCodeLine ("tax"); AddCodeLine ("pla"); break; @@ -1839,12 +1842,12 @@ void g_addeqlocal (unsigned flags, int Offs, unsigned long val) if (flags & CF_CONST) { AddCodeLine ("clc"); AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); } else { AddCodeLine ("clc"); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); } if ((flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); @@ -1862,16 +1865,16 @@ void g_addeqlocal (unsigned flags, int Offs, unsigned long val) if (IS_Get (&CodeSizeFactor) >= 400) { AddCodeLine ("clc"); AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCodeLine ("lda #$%02X", (int) ((val >> 8) & 0xFF)); - AddCodeLine ("adc (spc),y"); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("adc (c_sp),y"); + AddCodeLine ("sta (c_sp),y"); if ((flags & CF_NOKEEP) == 0) { AddCodeLine ("tax"); AddCodeLine ("dey"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); } } else { g_getimmed (flags, val, 0); @@ -1923,7 +1926,7 @@ void g_addeqind (unsigned flags, unsigned offs, unsigned long val) case CF_INT: case CF_LONG: AddCodeLine ("jsr pushax"); /* Push the address */ - push (CF_PTR); /* Correct the internal spc */ + push (CF_PTR); /* Correct the internal c_sp */ g_getind (flags, offs); /* Fetch the value */ g_inc (flags, val); /* Increment value in primary */ g_putind (flags, offs); /* Store the value back */ @@ -2089,15 +2092,15 @@ void g_subeqlocal (unsigned flags, int Offs, unsigned long val) AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("ldx #$00"); if (flags & CF_CONST) { - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sec"); AddCodeLine ("sbc #$%02X", (unsigned char)val); } else { AddCodeLine ("eor #$FF"); AddCodeLine ("sec"); - AddCodeLine ("adc (spc),y"); + AddCodeLine ("adc (c_sp),y"); } - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); if ((flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); AddCodeLine ("bpl %s", LocalLabelName (L)); @@ -2157,7 +2160,7 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val) case CF_INT: case CF_LONG: AddCodeLine ("jsr pushax"); /* Push the address */ - push (CF_PTR); /* Correct the internal spc */ + push (CF_PTR); /* Correct the internal c_sp */ g_getind (flags, offs); /* Fetch the value */ g_dec (flags, val); /* Increment value in primary */ g_putind (flags, offs); /* Store the value back */ @@ -2208,10 +2211,10 @@ void g_addaddr_local (unsigned flags attribute ((unused)), int offs) /* Label was used above */ g_defcodelabel (L); } - AddCodeLine ("adc spc"); + AddCodeLine ("adc c_sp"); AddCodeLine ("tay"); AddCodeLine ("txa"); - AddCodeLine ("adc spc+1"); + AddCodeLine ("adc c_sp+1"); AddCodeLine ("tax"); AddCodeLine ("tya"); } @@ -2512,10 +2515,10 @@ void g_callind (unsigned Flags, unsigned ArgSize, int Offs) CheckLocalOffs (Offs); AddCodeLine ("pha"); AddCodeLine ("ldy #$%02X", Offs); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta jmpvec+1"); AddCodeLine ("iny"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta jmpvec+2"); AddCodeLine ("pla"); AddCodeLine ("jsr jmpvec"); @@ -2573,11 +2576,11 @@ void g_lateadjustSP (unsigned label) AddCodeLine ("pha"); AddCodeLine ("lda %s", LocalDataLabelName (label)); AddCodeLine ("clc"); - AddCodeLine ("adc spc"); - AddCodeLine ("sta spc"); + AddCodeLine ("adc c_sp"); + AddCodeLine ("sta c_sp"); AddCodeLine ("lda %s+1", LocalDataLabelName (label)); - AddCodeLine ("adc spc+1"); - AddCodeLine ("sta spc+1"); + AddCodeLine ("adc c_sp+1"); + AddCodeLine ("sta c_sp+1"); AddCodeLine ("pla"); } @@ -2591,11 +2594,11 @@ void g_drop (unsigned Space) AddCodeLine ("pha"); AddCodeLine ("lda #$%02X", (unsigned char) Space); AddCodeLine ("clc"); - AddCodeLine ("adc spc"); - AddCodeLine ("sta spc"); + AddCodeLine ("adc c_sp"); + AddCodeLine ("sta c_sp"); AddCodeLine ("lda #$%02X", (unsigned char) (Space >> 8)); - AddCodeLine ("adc spc+1"); - AddCodeLine ("sta spc+1"); + AddCodeLine ("adc c_sp+1"); + AddCodeLine ("sta c_sp+1"); AddCodeLine ("pla"); } else if (Space > 8) { AddCodeLine ("ldy #$%02X", Space); @@ -2618,13 +2621,13 @@ void g_space (int Space) ** overhead. */ AddCodeLine ("pha"); - AddCodeLine ("lda spc"); + AddCodeLine ("lda c_sp"); AddCodeLine ("sec"); AddCodeLine ("sbc #$%02X", (unsigned char) Space); - AddCodeLine ("sta spc"); - AddCodeLine ("lda spc+1"); + AddCodeLine ("sta c_sp"); + AddCodeLine ("lda c_sp+1"); AddCodeLine ("sbc #$%02X", (unsigned char) (Space >> 8)); - AddCodeLine ("sta spc+1"); + AddCodeLine ("sta c_sp+1"); AddCodeLine ("pla"); } else if (Space > 8) { AddCodeLine ("ldy #$%02X", Space); @@ -4584,14 +4587,14 @@ void g_initauto (unsigned Label, unsigned Size) AddCodeLine ("ldy #$%02X", Size-1); g_defcodelabel (CodeLabel); AddCodeLine ("lda %s,y", GetLabelName (CF_STATIC, Label, 0)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("dey"); AddCodeLine ("bpl %s", LocalLabelName (CodeLabel)); } else if (Size <= 256) { AddCodeLine ("ldy #$00"); g_defcodelabel (CodeLabel); AddCodeLine ("lda %s,y", GetLabelName (CF_STATIC, Label, 0)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCmpCodeIfSizeNot256 ("cpy #$%02X", Size); AddCodeLine ("bne %s", LocalLabelName (CodeLabel)); diff --git a/src/cc65/codeinfo.c b/src/cc65/codeinfo.c index 5be8a38e2..5e5c431aa 100644 --- a/src/cc65/codeinfo.c +++ b/src/cc65/codeinfo.c @@ -380,7 +380,10 @@ static const FuncInfo FuncInfoTable[] = { #define FuncInfoCount (sizeof(FuncInfoTable) / sizeof(FuncInfoTable[0])) /* Table with names of zero page locations used by the compiler */ +/* MUST BE SORTED BY NAME !!! */ static const ZPInfo ZPInfoTable[] = { + { 0, "c_sp", 2, REG_SP_LO, REG_SP }, + { 0, "c_sp+1", 1, REG_SP_HI, REG_SP }, { 0, "ptr1", 2, REG_PTR1_LO, REG_PTR1 }, { 0, "ptr1+1", 1, REG_PTR1_HI, REG_PTR1 }, { 0, "ptr2", 2, REG_PTR2_LO, REG_PTR2 }, @@ -390,8 +393,6 @@ static const ZPInfo ZPInfoTable[] = { { 7, "regbank", 6, REG_NONE, REG_NONE }, { 0, "regsave", 4, REG_SAVE_LO, REG_SAVE }, { 0, "regsave+1", 3, REG_SAVE_HI, REG_SAVE }, - { 0, "spc", 2, REG_SP_LO, REG_SP }, - { 0, "spc+1", 1, REG_SP_HI, REG_SP }, { 0, "sreg", 2, REG_SREG_LO, REG_SREG }, { 0, "sreg+1", 1, REG_SREG_HI, REG_SREG }, { 0, "tmp1", 1, REG_TMP1, REG_TMP1 }, diff --git a/src/cc65/codeinfo.h b/src/cc65/codeinfo.h index 01cf345c5..d03962343 100644 --- a/src/cc65/codeinfo.h +++ b/src/cc65/codeinfo.h @@ -75,8 +75,8 @@ struct RegContents; #define REG_SP_HI 0x2000U /* Defines for some special register usage */ -#define SLV_IND 0x00010000U /* Accesses (spc),y */ -#define SLV_TOP 0x00020000U /* Accesses (spc),0 */ +#define SLV_IND 0x00010000U /* Accesses (c_sp),y */ +#define SLV_TOP 0x00020000U /* Accesses (c_sp),0 */ #define SLV_SP65 0x00200000U /* Accesses 6502 stack pointer */ #define SLV_PH65 0x00400000U /* Pushes onto 6502 stack */ #define SLV_PL65 0x00800000U /* Pops from 6502 stack */ @@ -122,7 +122,7 @@ struct RegContents; typedef struct ZPInfo ZPInfo; struct ZPInfo { unsigned char Len; /* Length of the following string */ - char Name[10]; /* Name of zero page symbol */ + char Name[64]; /* Name of zero page symbol */ unsigned char Size; /* Maximum buffer size of this register */ unsigned short ByteUse; /* Register info for this symbol */ unsigned short WordUse; /* Register info for 16 bit access */ diff --git a/src/cc65/codeopt.c b/src/cc65/codeopt.c index 3a896a9c1..f4027c64e 100644 --- a/src/cc65/codeopt.c +++ b/src/cc65/codeopt.c @@ -810,7 +810,7 @@ static unsigned RunOptGroup5 (CodeSeg* S) static unsigned RunOptGroup6 (CodeSeg* S) -/* This one is quite special. It tries to replace "lda (spc),y" by "lda (spc,x)". +/* This one is quite special. It tries to replace "lda (c_sp),y" by "lda (c_sp,x)". ** The latter is ony cycle slower, but if we're able to remove the necessary ** load of the Y register, because X is zero anyway, we gain 1 cycle and ** shorten the code by one (transfer) or two bytes (load). So what we do is diff --git a/src/cc65/codeoptutil.c b/src/cc65/codeoptutil.c index 2335a283a..bab271ee9 100644 --- a/src/cc65/codeoptutil.c +++ b/src/cc65/codeoptutil.c @@ -333,14 +333,14 @@ static int Affected (LoadRegInfo* LRI, const CodeEntry* E) */ if (E->AM == AM65_ABS || E->AM == AM65_ZP || - (E->AM == AM65_ZP_INDY && strcmp (E->ArgBase, "spc") == 0) + (E->AM == AM65_ZP_INDY && strcmp (E->ArgBase, "c_sp") == 0) ) { if ((LRI->Flags & LI_CHECK_ARG) != 0) { if (AE == 0 || (AE->AM != AM65_ABS && AE->AM != AM65_ZP && (AE->AM != AM65_ZP_INDY || - strcmp (AE->ArgBase, "spc") != 0)) || + strcmp (AE->ArgBase, "c_sp") != 0)) || (AE->ArgOff == E->ArgOff && strcmp (AE->ArgBase, E->ArgBase) == 0)) { @@ -445,7 +445,7 @@ void PrepairLoadRegInfoForArgCheck (CodeSeg* S, LoadRegInfo* LRI, CodeEntry* E) /* These insns are replaceable only if they are not modified later */ LRI->Flags |= LI_CHECK_ARG | LI_CHECK_Y; } else if ((E->AM == AM65_ZP_INDY) && - strcmp (E->Arg, "spc") == 0) { + strcmp (E->Arg, "c_sp") == 0) { /* A load from the stack with known offset is also ok, but in this ** case we must reload the index register later. Please note that ** a load indirect via other zero page locations is not ok, since @@ -556,7 +556,7 @@ unsigned int TrackLoads (LoadInfo* LI, CodeSeg* S, int I) /* These insns are replaceable only if they are not modified later */ LRI->Flags |= LI_CHECK_ARG | LI_CHECK_Y; } else if (E->AM == AM65_ZP_INDY && - strcmp (E->Arg, "spc") == 0) { + strcmp (E->Arg, "c_sp") == 0) { /* A load from the stack with known offset is also ok, but in this ** case we must reload the index register later. Please note that ** a load indirect via other zero page locations is not ok, since @@ -839,7 +839,7 @@ void AdjustStackOffset (StackOpData* D, unsigned Offs) if (E->OPC != OP65_JSR) { /* Check against some things that should not happen */ CHECK (E->AM == AM65_ZP_INDY && E->RI->In.RegY >= (short) Offs); - CHECK (strcmp (E->Arg, "spc") == 0); + CHECK (strcmp (E->Arg, "c_sp") == 0); /* We need to correct this one */ Correction = 2; @@ -1056,8 +1056,8 @@ void AddOpLow (StackOpData* D, opc_t OPC, LoadInfo* LI) InsertEntry (D, X, D->IP++); if (LI->A.LoadEntry->OPC == OP65_JSR) { - /* opc (spc),y */ - X = NewCodeEntry (OPC, AM65_ZP_INDY, "spc", 0, D->OpEntry->LI); + /* opc (c_sp),y */ + X = NewCodeEntry (OPC, AM65_ZP_INDY, "c_sp", 0, D->OpEntry->LI); } else { /* opc src,y */ X = NewCodeEntry (OPC, LI->A.LoadEntry->AM, LI->A.LoadEntry->Arg, 0, D->OpEntry->LI); @@ -1119,8 +1119,8 @@ void AddOpHigh (StackOpData* D, opc_t OPC, LoadInfo* LI, int KeepResult) InsertEntry (D, X, D->IP++); if (LI->X.LoadEntry->OPC == OP65_JSR) { - /* opc (spc),y */ - X = NewCodeEntry (OPC, AM65_ZP_INDY, "spc", 0, D->OpEntry->LI); + /* opc (c_sp),y */ + X = NewCodeEntry (OPC, AM65_ZP_INDY, "c_sp", 0, D->OpEntry->LI); } else { /* opc src,y */ X = NewCodeEntry (OPC, LI->X.LoadEntry->AM, LI->X.LoadEntry->Arg, 0, D->OpEntry->LI); @@ -1310,10 +1310,10 @@ const char* GetZPName (unsigned ZPLoc) return "save+1"; } if ((ZPLoc & REG_SP_LO) != 0) { - return "spc"; + return "c_sp"; } if ((ZPLoc & REG_SP_HI) != 0) { - return "spc+1"; + return "c_sp+1"; } return 0; diff --git a/src/cc65/coptadd.c b/src/cc65/coptadd.c index 5af9c1079..3636e0e20 100644 --- a/src/cc65/coptadd.c +++ b/src/cc65/coptadd.c @@ -62,15 +62,15 @@ unsigned OptAdd1 (CodeSeg* S) ** and replace it by: ** ** ldy #xx-1 -** lda (spc),y +** lda (c_sp),y ** ldy #yy-3 ** clc -** adc (spc),y +** adc (c_sp),y ** pha ** ldy #xx -** lda (spc),y +** lda (c_sp),y ** ldy #yy-2 -** adc (spc),y +** adc (c_sp),y ** tax ** pla */ @@ -104,8 +104,8 @@ unsigned OptAdd1 (CodeSeg* S) /* Correct the stack of the first Y register load */ CE_SetNumArg (L[0], L[0]->Num - 1); - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+1); /* ldy #yy-3 */ @@ -117,8 +117,8 @@ unsigned OptAdd1 (CodeSeg* S) X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[5]->LI); CS_InsertEntry (S, X, I+3); - /* adc (spc),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "spc", 0, L[5]->LI); + /* adc (c_sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "c_sp", 0, L[5]->LI); CS_InsertEntry (S, X, I+4); /* pha */ @@ -130,8 +130,8 @@ unsigned OptAdd1 (CodeSeg* S) X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[1]->LI); CS_InsertEntry (S, X, I+6); - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+7); /* ldy #yy-2 */ @@ -139,8 +139,8 @@ unsigned OptAdd1 (CodeSeg* S) X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[4]->LI); CS_InsertEntry (S, X, I+8); - /* adc (spc),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "spc", 0, L[5]->LI); + /* adc (c_sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "c_sp", 0, L[5]->LI); CS_InsertEntry (S, X, I+9); /* tax */ @@ -181,16 +181,16 @@ unsigned OptAdd2 (CodeSeg* S) ** and replace it by: ** ** ldy #xx-1 -** lda (spc),y +** lda (c_sp),y ** ldy #yy ** clc -** adc (spc),y -** sta (spc),y +** adc (c_sp),y +** sta (c_sp),y ** ldy #xx -** lda (spc),y +** lda (c_sp),y ** ldy #yy+1 -** adc (spc),y -** sta (spc),y +** adc (c_sp),y +** sta (c_sp),y ** ** provided that a/x is not used later. */ @@ -226,8 +226,8 @@ unsigned OptAdd2 (CodeSeg* S) X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[0]->LI); CS_InsertEntry (S, X, I+4); - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+5); /* ldy #yy */ @@ -238,20 +238,20 @@ unsigned OptAdd2 (CodeSeg* S) X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); CS_InsertEntry (S, X, I+7); - /* adc (spc),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "spc", 0, L[3]->LI); + /* adc (c_sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "c_sp", 0, L[3]->LI); CS_InsertEntry (S, X, I+8); - /* sta (spc),y */ - X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "spc", 0, L[3]->LI); + /* sta (c_sp),y */ + X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "c_sp", 0, L[3]->LI); CS_InsertEntry (S, X, I+9); /* ldy #xx */ X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); CS_InsertEntry (S, X, I+10); - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+11); /* ldy #yy+1 */ @@ -259,12 +259,12 @@ unsigned OptAdd2 (CodeSeg* S) X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[2]->LI); CS_InsertEntry (S, X, I+12); - /* adc (spc),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "spc", 0, L[3]->LI); + /* adc (c_sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "c_sp", 0, L[3]->LI); CS_InsertEntry (S, X, I+13); - /* sta (spc),y */ - X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "spc", 0, L[3]->LI); + /* sta (c_sp),y */ + X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "c_sp", 0, L[3]->LI); CS_InsertEntry (S, X, I+14); /* Delete the old code */ diff --git a/src/cc65/coptadd.h b/src/cc65/coptadd.h index 2598f726d..d29783305 100644 --- a/src/cc65/coptadd.h +++ b/src/cc65/coptadd.h @@ -55,14 +55,14 @@ unsigned OptAdd1 (CodeSeg* S); ** jsr pushax ** ldy xxx ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** jsr tosaddax ** ** and replace it by: ** ** ldy xxx-2 ** clc -** adc (spc),y +** adc (c_sp),y ** bcc L ** inx ** L: @@ -72,26 +72,26 @@ unsigned OptAdd2 (CodeSeg* S); /* Search for the sequence ** ** ldy #xx -** lda (spc),y +** lda (c_sp),y ** tax ** dey -** lda (spc),y +** lda (c_sp),y ** ldy #$yy ** jsr addeqysp ** ** and replace it by: ** ** ldy #xx-1 -** lda (spc),y +** lda (c_sp),y ** ldy #yy ** clc -** adc (spc),y -** sta (spc),y +** adc (c_sp),y +** sta (c_sp),y ** ldy #xx -** lda (spc),y +** lda (c_sp),y ** ldy #yy+1 -** adc (spc),y -** sta (spc),y +** adc (c_sp),y +** sta (c_sp),y ** ** provided that a/x is not used later. */ diff --git a/src/cc65/coptbool.c b/src/cc65/coptbool.c index c5a54f9be..e0a79238e 100644 --- a/src/cc65/coptbool.c +++ b/src/cc65/coptbool.c @@ -743,9 +743,9 @@ unsigned OptBNegAX2 (CodeSeg* S) ** and replace it by ** ** ldy #xx -** lda (spc),y +** lda (c_sp),y ** dey -** ora (spc),y +** ora (c_sp),y ** jeq/jne ... */ { @@ -772,16 +772,16 @@ unsigned OptBNegAX2 (CodeSeg* S) CodeEntry* X; - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+1); /* dey */ X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, L[1]->LI); CS_InsertEntry (S, X, I+2); - /* ora (spc),y */ - X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + /* ora (c_sp),y */ + X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+3); /* Invert the branch */ diff --git a/src/cc65/coptcmp.c b/src/cc65/coptcmp.c index 0148e87f9..eb138e78d 100644 --- a/src/cc65/coptcmp.c +++ b/src/cc65/coptcmp.c @@ -431,22 +431,22 @@ unsigned OptCmp5 (CodeSeg* S) /* The value is zero, we may use the simple code version: ** ldy #o-1 - ** lda (spc),y + ** lda (c_sp),y ** ldy #o - ** ora (spc),y + ** ora (c_sp),y ** jne/jeq ... */ sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); CS_InsertEntry (S, X, I+1); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+2); X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); CS_InsertEntry (S, X, I+3); - X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+4); CS_DelEntries (S, I+5, 3); /* cpx/bne/cmp */ @@ -461,18 +461,18 @@ unsigned OptCmp5 (CodeSeg* S) ** of the low byte after the first branch if possible: ** ** ldy #o - ** lda (spc),y + ** lda (c_sp),y ** cmp #a ** bne L1 ** ldy #o-1 - ** lda (spc),y + ** lda (c_sp),y ** cmp #b ** jne/jeq ... */ X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); CS_InsertEntry (S, X, I+3); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+4); X = NewCodeEntry (OP65_CMP, L[2]->AM, L[2]->Arg, 0, L[2]->LI); @@ -482,7 +482,7 @@ unsigned OptCmp5 (CodeSeg* S) X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); CS_InsertEntry (S, X, I+7); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[1]->LI); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+8); CS_DelEntries (S, I, 3); /* ldy/jsr/cpx */ diff --git a/src/cc65/coptcmp.h b/src/cc65/coptcmp.h index 222892679..98e75715b 100644 --- a/src/cc65/coptcmp.h +++ b/src/cc65/coptcmp.h @@ -113,10 +113,10 @@ unsigned OptCmp5 (CodeSeg* S); /* Optimize compares of local variables: ** ** ldy #o -** lda (spc),y +** lda (c_sp),y ** tax ** dey -** lda (spc),y +** lda (c_sp),y ** cpx #a ** bne L1 ** cmp #b diff --git a/src/cc65/coptmisc.c b/src/cc65/coptmisc.c index 323e0e7bc..6560ccc26 100644 --- a/src/cc65/coptmisc.c +++ b/src/cc65/coptmisc.c @@ -492,9 +492,9 @@ unsigned OptGotoSPAdj (CodeSeg* S) L[1]->AM == AM65_ABS && L[2]->OPC == OP65_CLC && L[3]->OPC == OP65_ADC && - strcmp (L[3]->Arg, "spc") == 0 && + strcmp (L[3]->Arg, "c_sp") == 0 && L[6]->OPC == OP65_ADC && - strcmp (L[6]->Arg, "spc+1") == 0 && + strcmp (L[6]->Arg, "c_sp+1") == 0 && L[9]->OPC == OP65_JMP) { adjustment = FindSPAdjustment (L[1]->Arg); @@ -617,7 +617,7 @@ unsigned OptLoad1 (CodeSeg* S) CS_InsertEntry (S, X, I+1); /* Load from stack */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, E->LI); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, E->LI); CS_InsertEntry (S, X, I+2); /* Now remove the call to the subroutine */ @@ -673,8 +673,8 @@ unsigned OptLoad2 (CodeSeg* S) ** later */ - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[0]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[0]->LI); CS_InsertEntry (S, X, I+3); /* sta abs */ @@ -685,8 +685,8 @@ unsigned OptLoad2 (CodeSeg* S) X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, L[0]->LI); CS_InsertEntry (S, X, I+5); - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[0]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[0]->LI); CS_InsertEntry (S, X, I+6); /* sta abs */ @@ -700,8 +700,8 @@ unsigned OptLoad2 (CodeSeg* S) /* Standard replacement */ - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[0]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[0]->LI); CS_InsertEntry (S, X, I+1); /* tax */ @@ -712,8 +712,8 @@ unsigned OptLoad2 (CodeSeg* S) X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, L[0]->LI); CS_InsertEntry (S, X, I+3); - /* lda (spc),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "spc", 0, L[0]->LI); + /* lda (c_sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "c_sp", 0, L[0]->LI); CS_InsertEntry (S, X, I+4); /* Now remove the call to the subroutine */ diff --git a/src/cc65/coptptrload.c b/src/cc65/coptptrload.c index 26aa37a2e..e28bf5d39 100644 --- a/src/cc65/coptptrload.c +++ b/src/cc65/coptptrload.c @@ -359,7 +359,7 @@ unsigned OptPtrLoad4 (CodeSeg* S) ** ldx #>(label+0) ** ldy #$xx ** clc -** adc (spc),y +** adc (c_sp),y ** bcc L ** inx ** L: ldy #$00 @@ -368,7 +368,7 @@ unsigned OptPtrLoad4 (CodeSeg* S) ** and replace it by: ** ** ldy #$xx -** lda (spc),y +** lda (c_sp),y ** tay ** ldx #$00 ** lda label,y @@ -553,7 +553,7 @@ unsigned OptPtrLoad6 (CodeSeg* S) ** jsr pushax ** ldy #xxx ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** jsr tosaddax ** ldy #$00 ** jsr ldauidx @@ -563,7 +563,7 @@ unsigned OptPtrLoad6 (CodeSeg* S) ** sta ptr1 ** stx ptr1+1 ** ldy #xxx-2 -** lda (spc),y +** lda (c_sp),y ** tay ** ldx #$00 ** lda (ptr1),y @@ -613,7 +613,7 @@ unsigned OptPtrLoad6 (CodeSeg* S) X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[1]->LI); CS_InsertEntry (S, X, I+9); - /* lda (spc),y */ + /* lda (c_sp),y */ X = NewCodeEntry (OP65_LDA, L[3]->AM, L[3]->Arg, 0, L[3]->LI); CS_InsertEntry (S, X, I+10); diff --git a/src/cc65/coptptrload.h b/src/cc65/coptptrload.h index f8aee9b1a..259d1587b 100644 --- a/src/cc65/coptptrload.h +++ b/src/cc65/coptptrload.h @@ -127,7 +127,7 @@ unsigned OptPtrLoad4 (CodeSeg* S); ** ldx #>(label+0) ** ldy #$xx ** clc -** adc (spc),y +** adc (c_sp),y ** bcc L ** inx ** L: ldy #$00 @@ -136,7 +136,7 @@ unsigned OptPtrLoad4 (CodeSeg* S); ** and replace it by: ** ** ldy #$xx -** lda (spc),y +** lda (c_sp),y ** tay ** ldx #$00 ** lda label,y @@ -166,7 +166,7 @@ unsigned OptPtrLoad6 (CodeSeg* S); ** jsr pushax ** ldy xxx ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** jsr tosaddax ** ldy #$00 ** jsr ldauidx @@ -176,7 +176,7 @@ unsigned OptPtrLoad6 (CodeSeg* S); ** sta ptr1 ** stx ptr1+1 ** ldy xxx -** lda (spc),y +** lda (c_sp),y ** tay ** lda (ptr1),y */ diff --git a/src/cc65/coptptrstore.c b/src/cc65/coptptrstore.c index 558c12859..6891d8353 100644 --- a/src/cc65/coptptrstore.c +++ b/src/cc65/coptptrstore.c @@ -396,7 +396,7 @@ unsigned OptPtrStore2 (CodeSeg* S) ** L: jsr pushax ** ldy yyy ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy #$00 ** jsr staspidx ** @@ -406,7 +406,7 @@ unsigned OptPtrStore2 (CodeSeg* S) ** stx ptr1+1 ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta (ptr1),y ** @@ -414,7 +414,7 @@ unsigned OptPtrStore2 (CodeSeg* S) ** ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta (zp),y ** @@ -422,7 +422,7 @@ unsigned OptPtrStore2 (CodeSeg* S) ** ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta label,y ** @@ -430,7 +430,7 @@ unsigned OptPtrStore2 (CodeSeg* S) ** ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta $xxxx,y ** @@ -468,7 +468,7 @@ unsigned OptPtrStore2 (CodeSeg* S) L[6]->OPC == OP65_LDX && L[7]->OPC == OP65_LDA && L[7]->AM == AM65_ZP_INDY && - strcmp (L[7]->Arg, "spc") == 0 && + strcmp (L[7]->Arg, "c_sp") == 0 && L[8]->OPC == OP65_LDY && (L[8]->AM == AM65_ABS || L[8]->AM == AM65_ZP || diff --git a/src/cc65/coptptrstore.h b/src/cc65/coptptrstore.h index 77e73649a..fd36eddba 100644 --- a/src/cc65/coptptrstore.h +++ b/src/cc65/coptptrstore.h @@ -105,7 +105,7 @@ unsigned OptPtrStore2 (CodeSeg* S); ** L: jsr pushax ** ldy yyy ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy #$00 ** jsr staspidx ** @@ -115,7 +115,7 @@ unsigned OptPtrStore2 (CodeSeg* S); ** stx ptr1+1 ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta (ptr1),y ** @@ -123,7 +123,7 @@ unsigned OptPtrStore2 (CodeSeg* S); ** ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta (zp),y ** @@ -131,7 +131,7 @@ unsigned OptPtrStore2 (CodeSeg* S); ** ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta label,y ** @@ -139,7 +139,7 @@ unsigned OptPtrStore2 (CodeSeg* S); ** ** ldy yyy-2 ** ldx #$00 -** lda (spc),y +** lda (c_sp),y ** ldy xxx ** sta $xxxx,y ** diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index e14e049c6..aa30e2038 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -1292,10 +1292,10 @@ static unsigned Opt_a_tosicmp (StackOpData* D) } InsertEntry (D, X, D->IP++); - /* cmp src,y OR cmp (spc),y */ + /* cmp src,y OR cmp (c_sp),y */ if (D->Rhs.A.LoadEntry->OPC == OP65_JSR) { - /* opc (spc),y */ - X = NewCodeEntry (OP65_CMP, AM65_ZP_INDY, "spc", 0, D->OpEntry->LI); + /* opc (c_sp),y */ + X = NewCodeEntry (OP65_CMP, AM65_ZP_INDY, "c_sp", 0, D->OpEntry->LI); } else { /* opc src,y */ X = NewCodeEntry (OP65_CMP, D->Rhs.A.LoadEntry->AM, D->Rhs.A.LoadEntry->Arg, 0, D->OpEntry->LI); diff --git a/src/cc65/coptstore.c b/src/cc65/coptstore.c index a3458835b..2fc83b5fb 100644 --- a/src/cc65/coptstore.c +++ b/src/cc65/coptstore.c @@ -48,7 +48,7 @@ static void InsertStore (CodeSeg* S, unsigned* IP, LineInfo* LI) { - CodeEntry* X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "spc", 0, LI); + CodeEntry* X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "c_sp", 0, LI); CS_InsertEntry (S, X, (*IP)++); } diff --git a/src/cc65/locals.c b/src/cc65/locals.c index 98ba16d3b..08fe83b75 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -269,7 +269,7 @@ static void ParseAutoDecl (Declarator* Decl) Sym->V.Offs = F_ReserveLocalSpace (CurrentFunc, Size); /* Next, allocate the space on the stack. This means that the - ** variable is now located at offset 0 from the current spc. + ** variable is now located at offset 0 from the current c_sp. */ F_AllocLocalSpace (CurrentFunc); diff --git a/src/cc65/stdfunc.c b/src/cc65/stdfunc.c index f22bb314e..6a2bcd2de 100644 --- a/src/cc65/stdfunc.c +++ b/src/cc65/stdfunc.c @@ -370,7 +370,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldy #$%02X", (unsigned char) (Offs + Arg3.Expr.IVal - 1)); g_defcodelabel (Label); AddCodeLine ("lda %s,y", ED_GetLabelName (&Arg2.Expr, -Offs)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("dey"); AddCodeLine ("bpl %s", LocalLabelName (Label)); } else { @@ -378,7 +378,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldy #$%02X", (unsigned char) (Offs + Arg3.Expr.IVal - 1)); g_defcodelabel (Label); AddCodeLine ("lda %s,x", ED_GetLabelName (&Arg2.Expr, 0)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("dey"); AddCodeLine ("dex"); AddCodeLine ("bpl %s", LocalLabelName (Label)); @@ -390,7 +390,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldy #$%02X", (unsigned char) Offs); g_defcodelabel (Label); AddCodeLine ("lda %s,y", ED_GetLabelName (&Arg2.Expr, -Offs)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCmpCodeIfSizeNot256 ("cpy #$%02X", Offs + Arg3.Expr.IVal); AddCodeLine ("bne %s", LocalLabelName (Label)); @@ -399,7 +399,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldy #$%02X", (unsigned char) Offs); g_defcodelabel (Label); AddCodeLine ("lda %s,x", ED_GetLabelName (&Arg2.Expr, 0)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCodeLine ("inx"); AddCmpCodeIfSizeNot256 ("cpx #$%02X", Arg3.Expr.IVal); @@ -447,7 +447,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) if (Offs == 0) { AddCodeLine ("ldy #$%02X", (unsigned char) (Arg3.Expr.IVal - 1)); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta %s,y", ED_GetLabelName (&Arg1.Expr, 0)); AddCodeLine ("dey"); AddCodeLine ("bpl %s", LocalLabelName (Label)); @@ -455,7 +455,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldx #$%02X", (unsigned char) (Arg3.Expr.IVal-1)); AddCodeLine ("ldy #$%02X", (unsigned char) (Offs + Arg3.Expr.IVal - 1)); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta %s,x", ED_GetLabelName (&Arg1.Expr, 0)); AddCodeLine ("dey"); AddCodeLine ("dex"); @@ -467,7 +467,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) if (Offs == 0 || AllowOneIndex) { AddCodeLine ("ldy #$%02X", (unsigned char) Offs); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta %s,y", ED_GetLabelName (&Arg1.Expr, -Offs)); AddCodeLine ("iny"); AddCmpCodeIfSizeNot256 ("cpy #$%02X", Offs + Arg3.Expr.IVal); @@ -476,7 +476,7 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldx #$00"); AddCodeLine ("ldy #$%02X", (unsigned char) Offs); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta %s,x", ED_GetLabelName (&Arg1.Expr, 0)); AddCodeLine ("iny"); AddCodeLine ("inx"); @@ -511,14 +511,14 @@ static void StdFunc_memcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) if (Arg3.Expr.IVal <= 129) { AddCodeLine ("ldy #$%02X", (unsigned char) (Arg3.Expr.IVal - 1)); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta (ptr1),y"); AddCodeLine ("dey"); AddCodeLine ("bpl %s", LocalLabelName (Label)); } else { AddCodeLine ("ldy #$00"); g_defcodelabel (Label); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta (ptr1),y"); AddCodeLine ("iny"); AddCmpCodeIfSizeNot256 ("cpy #$%02X", Arg3.Expr.IVal); @@ -702,7 +702,7 @@ static void StdFunc_memset (FuncDesc* F attribute ((unused)), ExprDesc* Expr) AddCodeLine ("ldy #$%02X", (unsigned char) Offs); AddCodeLine ("lda #$%02X", (unsigned char) Arg2.Expr.IVal); g_defcodelabel (Label); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); AddCodeLine ("iny"); AddCmpCodeIfSizeNot256 ("cpy #$%02X", Offs + Arg3.Expr.IVal); AddCodeLine ("bne %s", LocalLabelName (Label)); @@ -856,7 +856,7 @@ static void StdFunc_strcmp (FuncDesc* F attribute ((unused)), ExprDesc* Expr) /* Generate code */ AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("ldx #$00"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); } else if (IsArray && ED_IsLocConst (&Arg1.Expr)) { /* Drop the generated code */ RemoveCode (&Arg1.Load); @@ -1089,14 +1089,14 @@ static void StdFunc_strcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) if (Offs == 0 || AllowOneIndex) { g_defcodelabel (L1); AddCodeLine ("iny"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta %s,y", ED_GetLabelName (&Arg1.Expr, -Offs)); } else { AddCodeLine ("ldx #$FF"); g_defcodelabel (L1); AddCodeLine ("iny"); AddCodeLine ("inx"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("sta %s,x", ED_GetLabelName (&Arg1.Expr, 0)); } AddCodeLine ("bne %s", LocalLabelName (L1)); @@ -1137,14 +1137,14 @@ static void StdFunc_strcpy (FuncDesc* F attribute ((unused)), ExprDesc* Expr) g_defcodelabel (L1); AddCodeLine ("iny"); AddCodeLine ("lda %s,y", ED_GetLabelName (&Arg2.Expr, -Offs)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); } else { AddCodeLine ("ldx #$FF"); g_defcodelabel (L1); AddCodeLine ("iny"); AddCodeLine ("inx"); AddCodeLine ("lda %s,x", ED_GetLabelName (&Arg2.Expr, 0)); - AddCodeLine ("sta (spc),y"); + AddCodeLine ("sta (c_sp),y"); } AddCodeLine ("bne %s", LocalLabelName (L1)); @@ -1284,7 +1284,7 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)), ExprDesc* Expr) g_defcodelabel (L); AddCodeLine ("inx"); AddCodeLine ("iny"); - AddCodeLine ("lda (spc),y"); + AddCodeLine ("lda (c_sp),y"); AddCodeLine ("bne %s", LocalLabelName (L)); AddCodeLine ("txa"); AddCodeLine ("ldx #$00"); diff --git a/src/dbginfo/dbgsh.c b/src/dbginfo/dbgsh.c index 23a943c3b..280221fc9 100644 --- a/src/dbginfo/dbgsh.c +++ b/src/dbginfo/dbgsh.c @@ -458,7 +458,7 @@ static unsigned FindIdType (const char* TypeName) { "segment", SegmentId }, { "source", SourceId }, { "src", SourceId }, - { "spc", SpanId }, + { "c_sp", SpanId }, { "span", SpanId }, { "sym", SymbolId }, { "symbol", SymbolId }, diff --git a/src/sim65/main.c b/src/sim65/main.c index 98b33dacb..3cc9581b5 100644 --- a/src/sim65/main.c +++ b/src/sim65/main.c @@ -230,7 +230,7 @@ static unsigned char ReadProgramFile (void) } } - /* Get the address of spc from the file header */ + /* Get the address of c_sp from the file header */ if ((Val = fgetc(F)) != EOF) { SPAddr = Val; } diff --git a/targettest/atari/mem.c b/targettest/atari/mem.c index b72866ee9..f063d1e46 100644 --- a/targettest/atari/mem.c +++ b/targettest/atari/mem.c @@ -41,7 +41,7 @@ int main(void) printf(" data: $%04X (data)\n", &data); printf(" _dos_type: $%04X (bss)\n", &_dos_type); printf(" allocmem: $%04X (dyn. data)\n", allocmem); - printf(" spc: $%04X (stack ptr)\n", getsp()); + printf(" c_sp: $%04X (stack ptr)\n", getsp()); if (allocmem) free(allocmem); if (doesclrscrafterexit()) cgetc(); diff --git a/targettest/ft.c b/targettest/ft.c index ecaf72519..a28795f2b 100644 --- a/targettest/ft.c +++ b/targettest/ft.c @@ -10,7 +10,7 @@ ** got one from argv). I then opens the file, ** reads the first 16 bytes and displays them ** (as hex values). -** The values of spc (cc65 runtime stack pointer) +** The values of c_sp (cc65 runtime stack pointer) ** are displayed at some places. The displayed ** value should always be the same. */ @@ -64,16 +64,16 @@ int main(int argc,char **argv) } printf("using filename \"%s\"\n",filename); csp = getsp(); - printf("now opening file... spc = %d\n",csp); + printf("now opening file... c_sp = %d\n",csp); fd = open(filename,O_RDONLY); csp = getsp(); if (fd == -1) { char x1 = _oserror; - printf("open failed: os: %d,\n\terrno: %d, spc = %d\n",x1,errno,csp); + printf("open failed: os: %d,\n\terrno: %d, c_sp = %d\n",x1,errno,csp); cgetc(); return(0); } - printf("open success -- handle = $%x, spc = %d\n",fd,csp); + printf("open success -- handle = $%x, c_sp = %d\n",fd,csp); #ifdef __ATARI__ printf("fd_index:\n "); for (i=0; i<12; i++) printf("%02X ",__fd_index[i]); @@ -88,7 +88,7 @@ int main(int argc,char **argv) lr = read(fd,buf,16); /* read first 16 bytes */ csp = getsp(); if (lr == -1) { - printf("read failed: %d (spc = %d)\n",errno,csp); + printf("read failed: %d (c_sp = %d)\n",errno,csp); cgetc(); return(0); } @@ -99,7 +99,7 @@ int main(int argc,char **argv) return(0); } csp = getsp(); - printf("\n\nThe data read: (%d bytes, spc = %d)\n",lr,csp); + printf("\n\nThe data read: (%d bytes, c_sp = %d)\n",lr,csp); for (i=0; i