rename "sp" to "spc", avoid conflict with 4510 opcodes

This commit is contained in:
Gorilla Sapiens
2025-06-04 02:06:40 +00:00
parent 58171691d0
commit 3d118dc6e5
204 changed files with 908 additions and 908 deletions

View File

@@ -8,7 +8,7 @@
; by the compiler, ready for usage in asm code. ; by the compiler, ready for usage in asm code.
.globalzp sp, sreg, regsave .globalzp spc, sreg, regsave
.globalzp ptr1, ptr2, ptr3, ptr4 .globalzp ptr1, ptr2, ptr3, ptr4
.globalzp tmp1, tmp2, tmp3, tmp4 .globalzp tmp1, tmp2, tmp3, tmp4
.globalzp regbank .globalzp regbank

View File

@@ -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. 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 common/_heap.s defines the location of the heap and atari/crt0.s
defines the location of the stack by initializing sp. defines the location of the stack by initializing spc.
<sect1>Upgrading from an older cc65 version<p> <sect1>Upgrading from an older cc65 version<p>

View File

@@ -4788,17 +4788,17 @@ bit. Using
<tscreen><verb> <tscreen><verb>
.if (.cpu .bitand CPU_ISET_65SC02) .if (.cpu .bitand CPU_ISET_65SC02)
lda (sp) lda (spc)
.else .else
ldy #$00 ldy #$00
lda (sp),y lda (spc),y
.endif .endif
</verb></tscreen> </verb></tscreen>
it is possible to determine if the it is possible to determine if the
<tscreen><verb> <tscreen><verb>
lda (sp) lda (spc)
</verb></tscreen> </verb></tscreen>
instruction is supported, which is the case for the 65SC02, 65C02 and 65816 instruction is supported, which is the case for the 65SC02, 65C02 and 65816

View File

@@ -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, 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. and multi-byte parameters will have their least significant byte at the lower address.
The <tt/sp/ pseudo-register is a zeropage pointer to the base of the C-stack. The <tt/spc/ pseudo-register is a zeropage pointer to the base of the C-stack.
If the function is variadic, the <tt/Y/ register will contain the number of If the function is variadic, the <tt/Y/ register will contain the number of
bytes pushed to the stack for this function. bytes pushed to the stack for this function.
@@ -153,10 +153,10 @@ void cdecl foo(unsigned bar, unsigned char baz);
; Example code for accessing bar. The variable is in A/X after this code snippet: ; Example code for accessing bar. The variable is in A/X after this code snippet:
; ;
ldy #2 ; Offset of high byte of bar ldy #2 ; Offset of high byte of bar
lda (sp),y ; High byte now in A lda (spc),y ; High byte now in A
tax ; High byte now in X tax ; High byte now in X
dey ; Offset of low byte of bar dey ; Offset of low byte of bar
lda (sp),y ; Low byte now in A lda (spc),y ; Low byte now in A
</verb></tscreen> </verb></tscreen>
<sect1>Epilogue, after the function call<p> <sect1>Epilogue, after the function call<p>
@@ -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 If the function has a void return type, the compiler will not depend on the result
of <tt>A/X/sreg</tt>, so these may be clobbered by the function. of <tt>A/X/sreg</tt>, so these may be clobbered by the function.
The C-stack pointer <tt/sp/ must be restored by the function to its value before the The C-stack pointer <tt/spc/ must be restored by the function to its value before the
function call prologue. It may pop all of its parameters from the C-stack function call prologue. It may pop all of its parameters from the C-stack
(e.g. using the <tt/runtime/ function <tt/popa/), (e.g. using the <tt/runtime/ function <tt/popa/),
or it could adjust <tt/sp/ directly. or it could adjust <tt/spc/ directly.
If the function is variadic, the <tt/Y/ register contains the number of bytes If the function is variadic, the <tt/Y/ register contains the number of bytes
pushed to the stack on entry, which may be added to <tt/sp/ to restore its pushed to the stack on entry, which may be added to <tt/spc/ to restore its
original state. original state.
The internal pseudo-register <tt/regbank/ must not be changed by the function. The internal pseudo-register <tt/regbank/ must not be changed by the function.

View File

@@ -193,9 +193,9 @@ _init: LDX #$FF ; Initialize stack pointer to $01FF
; Set cc65 argument stack pointer ; Set cc65 argument stack pointer
LDA #&lt;(__RAM_START__ + __RAM_SIZE__) LDA #&lt;(__RAM_START__ + __RAM_SIZE__)
STA sp STA spc
LDA #&gt;(__RAM_START__ + __RAM_SIZE__) LDA #&gt;(__RAM_START__ + __RAM_SIZE__)
STA sp+1 STA spc+1
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Initialize memory storage ; Initialize memory storage

View File

@@ -209,7 +209,7 @@ Internally, the binary program file has a 12 byte header provided by the library
<item>1 byte <bf/CPU type/: <tt/0/ = 6502, <tt/1/ = 65C02 <item>1 byte <bf/CPU type/: <tt/0/ = 6502, <tt/1/ = 65C02
<item>1 byte <bf/sp address/: the zero page address of the C parameter stack pointer <tt/sp/ used by the paravirtualization functions <item>1 byte <bf/spc address/: the zero page address of the C parameter stack pointer <tt/spc/ used by the paravirtualization functions
<item>1 word <bf/load address/: where to load the data from the file into memory (default: <tt/$0200/) <item>1 word <bf/load address/: where to load the data from the file into memory (default: <tt/$0200/)

View File

@@ -54,7 +54,7 @@ exit: ldx #$02
; Copy back the zero-page stuff. ; Copy back the zero-page stuff.
ldx #zpspace-1 ldx #zpspace-1
: lda zpsave,x : lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl :- bpl :-

View File

@@ -43,7 +43,7 @@
; Save the zero-page locations that we need. ; Save the zero-page locations that we need.
init: ldx #zpspace-1 init: ldx #zpspace-1
: lda sp,x : lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl :- bpl :-
@@ -81,8 +81,8 @@ basic: lda HIMEM
ldx HIMEM+1 ldx HIMEM+1
; Set up the C stack. ; Set up the C stack.
: sta sp : sta spc
stx sp+1 stx spc+1
; ProDOS TechRefMan, chapter 5.3.5: ; ProDOS TechRefMan, chapter 5.3.5:
; "Your system program should place in the RESET vector the ; "Your system program should place in the RESET vector the

View File

@@ -42,9 +42,9 @@ _exec:
; binary programs so we should do the same too in any case ; binary programs so we should do the same too in any case
; especially as _we_ rely on it in mainargs.s for argv[0] ; especially as _we_ rely on it in mainargs.s for argv[0]
ldy #$00 ldy #$00
lda (sp),y lda (spc),y
tay tay
: lda (sp),y : lda (spc),y
sta $0280,y sta $0280,y
dey dey
bpl :- bpl :-

View File

@@ -34,8 +34,8 @@ pushname:
sta mliparam + MLI::ON_LINE::UNIT_NUM sta mliparam + MLI::ON_LINE::UNIT_NUM
; Use allocated pathname buffer ; Use allocated pathname buffer
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::ON_LINE::DATA_BUFFER sta mliparam + MLI::ON_LINE::DATA_BUFFER
stx mliparam + MLI::ON_LINE::DATA_BUFFER+1 stx mliparam + MLI::ON_LINE::DATA_BUFFER+1
@@ -46,16 +46,16 @@ pushname:
bcs addsp65 bcs addsp65
; Get volume name length ; Get volume name length
lda (sp),y lda (spc),y
and #15 ; Max volume name length and #15 ; Max volume name length
; Bracket volume name with slashes to form prefix ; Bracket volume name with slashes to form prefix
sta tmp1 sta tmp1
lda #'/' lda #'/'
sta (sp),y sta (spc),y
ldy tmp1 ldy tmp1
iny ; Leading slash iny ; Leading slash
sta (sp),y sta (spc),y
iny ; Trailing slash iny ; Trailing slash
; Adjust source pointer for copy ; Adjust source pointer for copy
@@ -69,7 +69,7 @@ pushname:
; Copy source to allocated pathname buffer ; Copy source to allocated pathname buffer
copy: lda (ptr1),y copy: lda (ptr1),y
sta (sp),y sta (spc),y
beq setlen beq setlen
iny iny
cpy #FILENAME_MAX cpy #FILENAME_MAX
@@ -86,7 +86,7 @@ addsp65:ldy #FILENAME_MAX
setlen: tya setlen: tya
jsr decsp1 ; Preserves A jsr decsp1 ; Preserves A
ldy #$00 ldy #$00
sta (sp),y sta (spc),y
; Return success ; Return success
tya tya

View File

@@ -11,8 +11,8 @@
; Returns with carry set on error, and sets errno ; Returns with carry set on error, and sets errno
mli_file_info_direct: mli_file_info_direct:
; Set pushed name ; Set pushed name
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::INFO::PATHNAME sta mliparam + MLI::INFO::PATHNAME
stx mliparam + MLI::INFO::PATHNAME+1 stx mliparam + MLI::INFO::PATHNAME+1

View File

@@ -341,10 +341,10 @@ MOVE:
ldy #$00 ; Start at top of stack ldy #$00 ; Start at top of stack
; Set x ; Set x
lda (sp),y lda (spc),y
iny iny
sta pos1_lo,x sta pos1_lo,x
lda (sp),y lda (spc),y
sta pos1_hi,x sta pos1_hi,x
; Update cursor ; Update cursor

View File

@@ -101,8 +101,8 @@ found: tya
bne oserr1 bne oserr1
; Set pushed name ; Set pushed name
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::OPEN::PATHNAME sta mliparam + MLI::OPEN::PATHNAME
stx mliparam + MLI::OPEN::PATHNAME+1 stx mliparam + MLI::OPEN::PATHNAME+1

View File

@@ -17,8 +17,8 @@ __syschdir:
bne oserr bne oserr
; Set pushed name ; Set pushed name
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::PREFIX::PATHNAME sta mliparam + MLI::PREFIX::PATHNAME
stx mliparam + MLI::PREFIX::PATHNAME+1 stx mliparam + MLI::PREFIX::PATHNAME+1

View File

@@ -23,8 +23,8 @@ __sysmkdir:
bne oserr bne oserr
; Set pushed name ; Set pushed name
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::CREATE::PATHNAME sta mliparam + MLI::CREATE::PATHNAME
stx mliparam + MLI::CREATE::PATHNAME+1 stx mliparam + MLI::CREATE::PATHNAME+1

View File

@@ -16,8 +16,8 @@ __sysremove:
bne oserr bne oserr
; Set pushed name ; Set pushed name
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::DESTROY::PATHNAME sta mliparam + MLI::DESTROY::PATHNAME
stx mliparam + MLI::DESTROY::PATHNAME+1 stx mliparam + MLI::DESTROY::PATHNAME+1

View File

@@ -22,8 +22,8 @@ __sysrename:
bne oserr1 bne oserr1
; Save pushed oldname ; Save pushed oldname
lda sp lda spc
ldx sp+1 ldx spc+1
sta ptr3 sta ptr3
stx ptr3+1 stx ptr3+1
@@ -40,8 +40,8 @@ __sysrename:
stx mliparam + MLI::RENAME::PATHNAME+1 stx mliparam + MLI::RENAME::PATHNAME+1
; Set pushed newname ; Set pushed newname
lda sp lda spc
ldx sp+1 ldx spc+1
sta mliparam + MLI::RENAME::NEW_PATHNAME sta mliparam + MLI::RENAME::NEW_PATHNAME
stx mliparam + MLI::RENAME::NEW_PATHNAME+1 stx mliparam + MLI::RENAME::NEW_PATHNAME+1

View File

@@ -59,8 +59,8 @@ start:
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
.else .else
@@ -75,11 +75,11 @@ start:
lda MEMTOP lda MEMTOP
sbc #<__RESERVED_MEMORY__ sbc #<__RESERVED_MEMORY__
sta APPMHI ; initialize our APPMHI value sta APPMHI ; initialize our APPMHI value
sta sp ; set up runtime stack part 1 sta spc ; set up runtime stack part 1
lda MEMTOP+1 lda MEMTOP+1
sbc #>__RESERVED_MEMORY__ sbc #>__RESERVED_MEMORY__
sta APPMHI+1 sta APPMHI+1
sta sp+1 ; set up runtime stack part 2 sta spc+1 ; set up runtime stack part 2
.endif .endif

View File

@@ -16,7 +16,7 @@
.export sectsizetab .export sectsizetab
.import ___oserror, __sio_call, _dio_read .import ___oserror, __sio_call, _dio_read
.import pushax, addysp, subysp .import pushax, addysp, subysp
.importzp ptr2, sp .importzp ptr2, spc
.include "atari.inc" .include "atari.inc"
@@ -78,10 +78,10 @@ _dio_open:
ldy #128 ldy #128
jsr subysp ; allocate buffer on the stack jsr subysp ; allocate buffer on the stack
lda sp lda spc
pha pha
lda sp+1 lda spc+1
pha ; save sp (buffer address) on processor stack pha ; save spc (buffer address) on processor stack
lda ptr2 lda ptr2
ldx ptr2+1 ldx ptr2+1

View File

@@ -6,7 +6,7 @@
.include "atari.inc" .include "atari.inc"
.include "fd.inc" .include "fd.inc"
.importzp tmp1,tmp2,tmp3,ptr4,sp .importzp tmp1,tmp2,tmp3,ptr4,spc
.import fd_table,fd_index .import fd_table,fd_index
.import fdt_to_fdi .import fdt_to_fdi
.export clriocb .export clriocb
@@ -229,7 +229,7 @@ freefnd:txa
beq l2 beq l2
l1: ldy #0 l1: ldy #0
lda (sp),y ; get device lda (spc),y ; get device
l2: sta fd_table+ft_dev,x ; set device l2: sta fd_table+ft_dev,x ; set device
lda #1 lda #1
sta fd_table+ft_usa,x ; set usage counter sta fd_table+ft_usa,x ; set usage counter

View File

@@ -8,7 +8,7 @@
; ;
.include "atari.inc" .include "atari.inc"
.importzp sp .importzp spc
.export _mouse_pm_callbacks .export _mouse_pm_callbacks
.constructor pm_init, 27 .constructor pm_init, 27
.destructor pm_down .destructor pm_down
@@ -193,22 +193,22 @@ pm_init:
.else .else
; use top of memory and lower sp accordingly ; use top of memory and lower spc accordingly
sta sp sta spc
sta MOUSE_PM_BASE sta MOUSE_PM_BASE
lda sp+1 lda spc+1
and #7 ; offset within 2K and #7 ; offset within 2K
cmp #3 + MOUSE_PM_RAW + 1 ; can we use it? cmp #3 + MOUSE_PM_RAW + 1 ; can we use it?
bcc @decr ; no bcc @decr ; no
lda sp+1 lda spc+1
and #$F8 and #$F8
@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3 @set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3
sta MOUSE_PM_BASE+1 sta MOUSE_PM_BASE+1
sta sp+1 sta spc+1
bne @cont ; jump always bne @cont ; jump always
@decr: lda sp+1 @decr: lda spc+1
and #$F8 and #$F8
sbc #8 - 1 ; CF is clear, subtracts 8 sbc #8 - 1 ; CF is clear, subtracts 8
bcs @set ; jump always bcs @set ; jump always

View File

@@ -241,11 +241,11 @@ MOVE: php
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -399,12 +399,12 @@ MOVE: php
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
sta XPosWrk+1 sta XPosWrk+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
sta XPosWrk sta XPosWrk
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -236,11 +236,11 @@ MOVE: php
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -6,7 +6,7 @@
.include "atari.inc" .include "atari.inc"
.import findfreeiocb .import findfreeiocb
.importzp tmp4, sp, ptr2, ptr3 .importzp tmp4, spc, ptr2, ptr3
.import incsp2, subysp, addysp, popax .import incsp2, subysp, addysp, popax
.ifdef UCASE_FILENAME .ifdef UCASE_FILENAME
.importzp tmp3 .importzp tmp3
@@ -118,19 +118,19 @@ L1: jsr subysp ; make room on the stack
; copy old name ; copy old name
ldy #0 ldy #0
con: lda (ptr3),y con: lda (ptr3),y
sta (sp),y sta (spc),y
beq copyend beq copyend
iny iny
bne con bne con
copyend:lda #$20 ; space copyend:lda #$20 ; space
sta (sp),y sta (spc),y
iny iny
tya ; get current offset (beyond old name) tya ; get current offset (beyond old name)
clc clc
adc sp adc spc
sta ptr3 sta ptr3
lda sp+1 lda spc+1
adc #0 adc #0
sta ptr3+1 ; ptr3 now contains pointer to space for new filename sta ptr3+1 ; ptr3 now contains pointer to space for new filename
@@ -143,9 +143,9 @@ cnn: lda (ptr2),y
bne cnn bne cnn
copend2:ldx tmp4 copend2:ldx tmp4
lda sp lda spc
sta ICBAL,x sta ICBAL,x
lda sp+1 lda spc+1
sta ICBAH,x sta ICBAH,x
lda #RENAME lda #RENAME
sta ICCOM,x sta ICCOM,x
@@ -160,13 +160,13 @@ copend2:ldx tmp4
; clean up stack ; clean up stack
lda sp lda spc
clc clc
adc sspc adc sspc
sta sp sta spc
lda sp+1 lda spc+1
adc sspc+1 adc sspc+1
sta sp+1 sta spc+1
; handle status ; handle status

View File

@@ -24,7 +24,7 @@
.importzp tmp2 .importzp tmp2
.import __defdev .import __defdev
.endif .endif
.importzp tmp3,ptr4,sp .importzp tmp3,ptr4,spc
.import subysp,addysp .import subysp,addysp
.export ucase_fn .export ucase_fn
@@ -63,13 +63,13 @@ hasdev:
ldy #0 ldy #0
loop2: lda (ptr4),y loop2: lda (ptr4),y
sta (sp),y sta (spc),y
beq copy_end beq copy_end
bmi L1 ; Not lowercase (also, invalid, should reject) bmi L1 ; Not lowercase (also, invalid, should reject)
cmp #'a' cmp #'a'
bcc L1 ; Not lowercase bcc L1 ; Not lowercase
and #$DF ; make upper case char, assume ASCII chars and #$DF ; make upper case char, assume ASCII chars
sta (sp),y ; store back sta (spc),y ; store back
L1: L1:
iny iny
bpl loop2 ; bpl: this way we only support a max. length of 127 bpl loop2 ; bpl: this way we only support a max. length of 127
@@ -93,15 +93,15 @@ copy_end:
jsr subysp ; adjust stack pointer jsr subysp ; adjust stack pointer
dey dey
cpdev: lda __defdev,y cpdev: lda __defdev,y
sta (sp),y ; insert device name, number and ':' sta (spc),y ; insert device name, number and ':'
dey dey
bpl cpdev bpl cpdev
hasdev2: hasdev2:
.endif .endif
; leave A and X pointing to the modified filename ; leave A and X pointing to the modified filename
lda sp lda spc
ldx sp+1 ldx spc+1
clc ; indicate success clc ; indicate success
rts rts

View File

@@ -35,8 +35,8 @@ clearLoop:
; Initialize C stack pointer ; Initialize C stack pointer
lda #<(__RAM_START__ + __RAM_SIZE__) lda #<(__RAM_START__ + __RAM_SIZE__)
ldx #>(__RAM_START__ + __RAM_SIZE__) ldx #>(__RAM_START__ + __RAM_SIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; Call main ; Call main
jsr _main jsr _main

View File

@@ -27,8 +27,8 @@ start:
lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__) lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__) ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
sta sp sta spc
stx sp+1 ; Set argument stack ptr stx spc+1 ; Set argument stack ptr
; Call the module constructors. ; Call the module constructors.

View File

@@ -30,9 +30,9 @@ start:
; Set up parameter stack ; Set up parameter stack
lda #<(__RAM3_START__ + __RAM3_SIZE__) lda #<(__RAM3_START__ + __RAM3_SIZE__)
sta sp sta spc
lda #>(__RAM3_START__ + __RAM3_SIZE__) lda #>(__RAM3_START__ + __RAM3_SIZE__)
sta sp+1 sta spc+1
jsr copydata jsr copydata
jsr zerobss jsr zerobss

View File

@@ -27,7 +27,7 @@
.constructor mono_init_cursor .constructor mono_init_cursor
.interruptor mono_blink_cursor .interruptor mono_blink_cursor
.importzp sp .importzp spc
.import _zonecounter .import _zonecounter
.import _mono_zones .import _mono_zones
.import cursor .import cursor

View File

@@ -27,7 +27,7 @@
.constructor init_cursor .constructor init_cursor
.interruptor blink_cursor .interruptor blink_cursor
.importzp sp .importzp spc
.import _zonecounter .import _zonecounter
.import _zones .import _zones
.import cursor .import cursor

View File

@@ -51,7 +51,7 @@ _exit: jsr donelib
ldx #zpspace - 1 ldx #zpspace - 1
L2: lda zpsave,x L2: lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl L2 bpl L2
@@ -68,7 +68,7 @@ L2: lda zpsave,x
; Save the zero-page area that we're about to use. ; Save the zero-page area that we're about to use.
init: ldx #zpspace - 1 init: ldx #zpspace - 1
L1: lda sp,x L1: lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -85,8 +85,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__)
sta sp sta spc
stx sp+1 ; Set argument stack ptr stx spc+1 ; Set argument stack ptr
; Call the module constructors. ; Call the module constructors.

View File

@@ -39,7 +39,7 @@ Start:
; Save the zero-page locations that we need. ; Save the zero-page locations that we need.
ldx #zpspace-1 ldx #zpspace-1
L1: lda sp,x L1: lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -58,8 +58,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 ; Set argument stack ptr stx spc+1 ; Set argument stack ptr
; Call the module constructors. ; Call the module constructors.
@@ -85,7 +85,7 @@ _exit: pha ; Save the return code on stack
ldx #zpspace-1 ldx #zpspace-1
L2: lda zpsave,x L2: lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl L2 bpl L2

View File

@@ -296,11 +296,11 @@ MOVE: sei ; No interrupts
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -323,10 +323,10 @@ MOVE: sei ; No interrupts
jsr MoveY jsr MoveY
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
tax tax
dey dey
lda (sp),y lda (spc),y
jsr MoveX ; Move the cursor jsr MoveX ; Move the cursor
cli ; Allow interrupts cli ; Allow interrupts

View File

@@ -297,11 +297,11 @@ MOVE: sei ; No interrupts
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -297,11 +297,11 @@ MOVE: sei ; No interrupts
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -24,7 +24,7 @@ Start:
; Save the zero-page locations that we need. ; Save the zero-page locations that we need.
ldx #zpspace-1 ldx #zpspace-1
L1: lda sp,x L1: lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -49,8 +49,8 @@ L1: lda sp,x
bcc MemOk bcc MemOk
ldy #$80 ldy #$80
ldx #$00 ldx #$00
MemOk: stx sp MemOk: stx spc
sty sp+1 ; set argument stack ptr sty spc+1 ; set argument stack ptr
; Call the module constructors. ; Call the module constructors.
@@ -69,7 +69,7 @@ _exit: pha ; Save the return code on stack
ldx #zpspace-1 ldx #zpspace-1
L2: lda zpsave,x L2: lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl L2 bpl L2

View File

@@ -55,7 +55,7 @@ _exit: pha ; Save the return code on stack
ldx #zpspace-1 ldx #zpspace-1
L2: lda zpsave,x L2: lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl L2 bpl L2
@@ -85,7 +85,7 @@ init:
; Save the zero-page locations that we need. ; Save the zero-page locations that we need.
ldx #zpspace-1 ldx #zpspace-1
L1: lda sp,x L1: lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -94,8 +94,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__)
sta sp sta spc
stx sp+1 ; Set argument stack ptr stx spc+1 ; Set argument stack ptr
; Switch to the second charset. ; Switch to the second charset.

View File

@@ -239,11 +239,11 @@ MOVE: sei ; No interrupts
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -249,10 +249,10 @@ MOVE: sei ; No interrupts
jsr MoveY jsr MoveY
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
tax tax
dey dey
lda (sp),y lda (spc),y
jsr MoveX ; Move the cursor jsr MoveX ; Move the cursor
cli ; Allow interrupts cli ; Allow interrupts

View File

@@ -245,11 +245,11 @@ MOVE: sei ; No interrupts
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -230,11 +230,11 @@ MOVE: sei ; No interrupts
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -44,10 +44,10 @@ __dirread:
; Replace dir by dir->fd ; Replace dir by dir->fd
ldy #2 ldy #2
lda (sp),y lda (spc),y
sta ptr1 sta ptr1
iny iny
lda (sp),y lda (spc),y
sta ptr1+1 sta ptr1+1
ldy #DIR::fd+1 ldy #DIR::fd+1
lda (ptr1),y lda (ptr1),y
@@ -55,10 +55,10 @@ __dirread:
dey dey
lda (ptr1),y lda (ptr1),y
ldy #2 ldy #2
sta (sp),y sta (spc),y
pla pla
iny iny
sta (sp),y sta (spc),y
; Get count, save it again, clear the high byte and call read(). By the ; 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 ; previous actions, the stack frame is as read() needs it, and read() will

View File

@@ -12,7 +12,7 @@
.import opencmdchannel, closecmdchannel, readdiskerror .import opencmdchannel, closecmdchannel, readdiskerror
.import fnunit, fnisfile .import fnunit, fnisfile
.import _close .import _close
.importzp sp, tmp2, tmp3 .importzp spc, tmp2, tmp3
.include "errno.inc" .include "errno.inc"
.include "fcntl.inc" .include "fcntl.inc"

View File

@@ -8,7 +8,7 @@
.constructor initstdout .constructor initstdout
.import rwcommon .import rwcommon
.importzp sp, ptr1, ptr2, ptr3 .importzp spc, ptr1, ptr2, ptr3
.include "cbm.inc" .include "cbm.inc"
.include "errno.inc" .include "errno.inc"

View File

@@ -117,7 +117,7 @@ entry: php
tya tya
sec sec
sbc #7 sbc #7
sta $1FF ; Save new sp sta $1FF ; Save new spc
tay tay
tsx tsx
@@ -145,7 +145,7 @@ entry: php
iny iny
sta (sysp1),y sta (sysp1),y
ldy $1FF ; Restore sp in bank 15 ldy $1FF ; Restore spc in bank 15
lda #.hibyte(expull-1) lda #.hibyte(expull-1)
sta (sysp1),y sta (sysp1),y
@@ -245,7 +245,7 @@ L1: lda extzp,x
dex dex
bpl L1 bpl L1
; Save the old stack pointer from the system bank; and, set up our hw sp. ; Save the old stack pointer from the system bank; and, set up our hw spc.
tsx tsx
txa txa
@@ -279,9 +279,9 @@ L3: lda vectors,x
; Set up the C stack. ; Set up the C stack.
lda #.lobyte(callbank15::entry) lda #.lobyte(callbank15::entry)
sta sp sta spc
lda #.hibyte(callbank15::entry) lda #.hibyte(callbank15::entry)
sta sp+1 sta spc+1
; Set up the subroutine and jump vector table that redirects Kernal calls to ; Set up the subroutine and jump vector table that redirects Kernal calls to
; the system bank. ; 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. ; Set up the welcome code at the stack bottom in the system bank.
ldy #$FF ldy #$FF
lda (sysp1),y ; Load system bank sp lda (sysp1),y ; Load system bank spc
tax tax
iny ; Y = 0 iny ; Y = 0
lda #$58 ; CLI opcode lda #$58 ; CLI opcode

View File

@@ -256,10 +256,10 @@ MOVE: sei ; No interrupts
jsr MoveY jsr MoveY
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
tax tax
dey dey
lda (sp),y lda (spc),y
jsr MoveX ; Move the cursor jsr MoveX ; Move the cursor
cli ; Allow interrupts cli ; Allow interrupts

View File

@@ -225,11 +225,11 @@ MOVE: sei ; No interrupts
jsr MoveY ; Set new y position jsr MoveY ; Set new y position
ldy #1 ldy #1
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
jsr MoveX ; Move the pointer jsr MoveX ; Move the pointer
cli ; Allow interrupts cli ; Allow interrupts

View File

@@ -115,7 +115,7 @@ entry: php
tya tya
sec sec
sbc #7 sbc #7
sta $1FF ; Save new sp sta $1FF ; Save new spc
tay tay
tsx tsx
@@ -143,7 +143,7 @@ entry: php
iny iny
sta (sysp1),y sta (sysp1),y
ldy $1FF ; Restore sp in bank 15 ldy $1FF ; Restore spc in bank 15
lda #.hibyte(expull-1) lda #.hibyte(expull-1)
sta (sysp1),y sta (sysp1),y
@@ -243,7 +243,7 @@ L1: lda extzp,x
dex dex
bpl L1 bpl L1
; Save the old stack pointer from the system bank; and, set up our hw sp. ; Save the old stack pointer from the system bank; and, set up our hw spc.
tsx tsx
txa txa
@@ -277,9 +277,9 @@ L3: lda vectors,x
; Set up the C stack. ; Set up the C stack.
lda #.lobyte(callbank15::entry) lda #.lobyte(callbank15::entry)
sta sp sta spc
lda #.hibyte(callbank15::entry) lda #.hibyte(callbank15::entry)
sta sp+1 sta spc+1
; Set up the subroutine and jump vector table that redirects Kernal calls to ; Set up the subroutine and jump vector table that redirects Kernal calls to
; the system bank. ; 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. ; Set up the welcome code at the stack bottom in the system bank.
ldy #$FF ldy #$FF
lda (sysp1),y ; Load system bank sp lda (sysp1),y ; Load system bank spc
tax tax
iny ; Y = 0 iny ; Y = 0
lda #$58 ; CLI opcode lda #$58 ; CLI opcode

View File

@@ -9,7 +9,7 @@
.import _open .import _open
.import pushax, incsp4, return0 .import pushax, incsp4, return0
.importzp sp, ptr1 .importzp spc, ptr1
.include "errno.inc" .include "errno.inc"
@@ -28,10 +28,10 @@
; Get a pointer to the mode string ; Get a pointer to the mode string
ldy #1 ldy #1
lda (sp),y lda (spc),y
sta ptr1+1 sta ptr1+1
dey dey
lda (sp),y lda (spc),y
sta ptr1 sta ptr1
; Look at the first character in mode ; Look at the first character in mode
@@ -78,10 +78,10 @@ invmode:
modeok: ldy #$00 modeok: ldy #$00
txa ; Mode -> A txa ; Mode -> A
sta (sp),y sta (spc),y
tya tya
iny iny
sta (sp),y sta (spc),y
ldy #4 ; Size of arguments in bytes ldy #4 ; Size of arguments in bytes
jsr _open ; Will cleanup the stack jsr _open ; Will cleanup the stack

View File

@@ -6,7 +6,7 @@
.constructor initheap, 24 .constructor initheap, 24
.import __BSS_RUN__, __BSS_SIZE__, __STACKSIZE__ .import __BSS_RUN__, __BSS_SIZE__, __STACKSIZE__
.importzp sp .importzp spc
.include "_heap.inc" .include "_heap.inc"
@@ -31,10 +31,10 @@ ___heaplast:
initheap: initheap:
sec sec
lda sp lda spc
sbc #<__STACKSIZE__ sbc #<__STACKSIZE__
sta ___heapend sta ___heapend
lda sp+1 lda spc+1
sbc #>__STACKSIZE__ sbc #>__STACKSIZE__
sta ___heapend+1 sta ___heapend+1
rts rts

View File

@@ -20,17 +20,17 @@
; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent. ; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent.
ldy #3 ldy #3
@L1: lda (sp),y @L1: lda (spc),y
sta ptr1,y sta ptr1,y
dey dey
bpl @L1 bpl @L1
lda #4 lda #4
clc clc
adc sp adc spc
sta sp sta spc
bcc @L2 bcc @L2
inc sp+1 inc spc+1
@L2: pla ; Old rhs @L2: pla ; Old rhs
jmp idiv32by16r16 jmp idiv32by16r16

View File

@@ -338,25 +338,25 @@ MainLoop:
jsr decsp6 ; 3 args jsr decsp6 ; 3 args
ldy #5 ldy #5
lda OutData+1 lda OutData+1
sta (sp),y sta (spc),y
dey dey
lda OutData lda OutData
sta (sp),y sta (spc),y
dey dey
lda FSave+1 lda FSave+1
sta (sp),y sta (spc),y
dey dey
lda FSave lda FSave
sta (sp),y sta (spc),y
dey dey
lda FCount+1 lda FCount+1
sta (sp),y sta (spc),y
dey dey
lda FCount lda FCount
.if (.cpu .bitand ::CPU_ISET_65SC02) .if (.cpu .bitand ::CPU_ISET_65SC02)
sta (sp) sta (spc)
.else .else
sta (sp),y sta (spc),y
.endif .endif
jsr CallOutFunc ; Call the output function jsr CallOutFunc ; Call the output function

View File

@@ -21,17 +21,17 @@
; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent. ; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent.
ldy #3 ldy #3
@L1: lda (sp),y @L1: lda (spc),y
sta ptr1,y sta ptr1,y
dey dey
bpl @L1 bpl @L1
lda #4 lda #4
clc clc
adc sp adc spc
sta sp sta spc
bcc @L2 bcc @L2
inc sp+1 inc spc+1
@L2: jmp udiv32by16r16m @L2: jmp udiv32by16r16m

View File

@@ -6,7 +6,7 @@
.export _fprintf .export _fprintf
.import addysp, decsp4, _vfprintf .import addysp, decsp4, _vfprintf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -38,9 +38,9 @@ _fprintf:
; Calculate a pointer to the Format argument ; Calculate a pointer to the Format argument
lda ParamSize lda ParamSize
add sp add spc
sta ptr1 sta ptr1
ldx sp+1 ldx spc+1
bcc @L1 bcc @L1
inx inx
@L1: stx ptr1+1 @L1: stx ptr1+1
@@ -49,7 +49,7 @@ _fprintf:
ldy #4-1 ldy #4-1
@L2: lda (ptr1),y @L2: lda (ptr1),y
sta (sp),y sta (spc),y
dey dey
bpl @L2 bpl @L2

View File

@@ -14,7 +14,7 @@
.import pushwysp .import pushwysp
.import tosumulax, tosudivax .import tosumulax, tosudivax
.importzp ptr1, sp .importzp ptr1, spc
.include "errno.inc" .include "errno.inc"
.include "_file.inc" .include "_file.inc"
@@ -136,23 +136,23 @@
; to read() by one, so read() starts to store data at buf+1. ; to read() by one, so read() starts to store data at buf+1.
.if (.cpu .bitand ::CPU_ISET_65SC02) .if (.cpu .bitand ::CPU_ISET_65SC02)
lda (sp) lda (spc)
sta ptr1 sta ptr1
add #1 add #1
sta (sp) sta (spc)
ldy #1 ldy #1
.else .else
ldy #0 ldy #0
lda (sp),y lda (spc),y
sta ptr1 sta ptr1
add #1 add #1
sta (sp),y sta (spc),y
iny iny
.endif .endif
lda (sp),y lda (spc),y
sta ptr1+1 sta ptr1+1
adc #0 adc #0
sta (sp),y ; ptr1 = buf++; sta (spc),y ; ptr1 = buf++;
; Get the buffered character and place it as first character into the read ; Get the buffered character and place it as first character into the read
; buffer. ; buffer.

View File

@@ -6,7 +6,7 @@
.export _fscanf .export _fscanf
.import addysp, decsp4, _vfscanf .import addysp, decsp4, _vfscanf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -50,9 +50,9 @@ _fscanf:
; Calculate a pointer to the Format argument ; Calculate a pointer to the Format argument
lda ParamSize lda ParamSize
add sp add spc
sta ptr1 sta ptr1
ldx sp+1 ldx spc+1
bcc @L1 bcc @L1
inx inx
@L1: stx ptr1+1 @L1: stx ptr1+1
@@ -61,7 +61,7 @@ _fscanf:
ldy #4-1 ldy #4-1
@L2: lda (ptr1),y @L2: lda (ptr1),y
sta (sp),y sta (spc),y
dey dey
bpl @L2 bpl @L2

View File

@@ -93,8 +93,8 @@ zpsave: .res zpsavespace
; Set C level interrupt stack ; Set C level interrupt stack
lda irqsp lda irqsp
ldx irqsp+1 ldx irqsp+1
sta sp sta spc
stx sp+1 stx spc+1
; Call C level interrupt request handler ; Call C level interrupt request handler
jsr irqvec jsr irqvec

View File

@@ -8,7 +8,7 @@
.export _itoa, _utoa .export _itoa, _utoa
.import addysp1 .import addysp1
.import __hextab .import __hextab
.importzp sp, sreg, ptr2, ptr3, tmp1 .importzp spc, sreg, ptr2, ptr3, tmp1
.rodata .rodata
specval: specval:
@@ -21,18 +21,18 @@ specval:
dopop: sta tmp1 ; will lose high byte dopop: sta tmp1 ; will lose high byte
ldy #0 ldy #0
lda (sp),y lda (spc),y
sta ptr2 sta ptr2
sta ptr3 sta ptr3
iny iny
lda (sp),y lda (spc),y
sta ptr2+1 sta ptr2+1
sta ptr3+1 sta ptr3+1
iny iny
lda (sp),y lda (spc),y
sta sreg sta sreg
iny iny
lda (sp),y lda (spc),y
sta sreg+1 sta sreg+1
jmp addysp1 ; Bump stack pointer jmp addysp1 ; Bump stack pointer

View File

@@ -7,7 +7,7 @@
.export _longjmp .export _longjmp
.import popptr1 .import popptr1
.importzp sp, ptr1, ptr2 .importzp spc, ptr1, ptr2
_longjmp: _longjmp:
sta ptr2 ; Save retval sta ptr2 ; Save retval
@@ -23,10 +23,10 @@ _longjmp:
lda (ptr1),y lda (ptr1),y
iny iny
sta sp sta spc
lda (ptr1),y lda (ptr1),y
iny iny
sta sp+1 sta spc+1
; Get the old stack pointer ; Get the old stack pointer

View File

@@ -61,7 +61,7 @@
; } ; }
; } ; }
.importzp sp, sreg, regsave, regbank .importzp spc, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4 .importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch .macpack longbranch
.import memcpy_upwards,pushax,popax .import memcpy_upwards,pushax,popax

View File

@@ -12,7 +12,7 @@
.export _memcpy, memcpy_upwards, memcpy_getparams .export _memcpy, memcpy_upwards, memcpy_getparams
.import popax, popptr1 .import popax, popptr1
.importzp sp, ptr1, ptr2, ptr3 .importzp spc, ptr1, ptr2, ptr3
; ---------------------------------------------------------------------- ; ----------------------------------------------------------------------
_memcpy: _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... iny ; Y=0 guaranteed by popptr1, we need '1' here...
; (direct stack access is three cycles faster ; (direct stack access is three cycles faster
; (total cycle count with return)) ; (total cycle count with return))
lda (sp),y lda (spc),y
tax tax
stx ptr2+1 ; save high byte of ptr2 stx ptr2+1 ; save high byte of ptr2
dey ; Y = 0 dey ; Y = 0
lda (sp),y ; Get ptr2 low lda (spc),y ; Get ptr2 low
sta ptr2 sta ptr2
rts rts

View File

@@ -17,7 +17,7 @@
.export _memset, _bzero, ___bzero .export _memset, _bzero, ___bzero
.import popax .import popax
.importzp sp, ptr1, ptr2, ptr3 .importzp spc, ptr1, ptr2, ptr3
_bzero: _bzero:
___bzero: ___bzero:
@@ -36,10 +36,10 @@ _memset:
common: ; Fill value is in X! common: ; Fill value is in X!
ldy #1 ldy #1
lda (sp),y lda (spc),y
sta ptr1+1 ; save high byte of ptr sta ptr1+1 ; save high byte of ptr
dey ; Y = 0 dey ; Y = 0
lda (sp),y ; Get ptr lda (spc),y ; Get ptr
sta ptr1 sta ptr1
lsr ptr3+1 ; divide number of lsr ptr3+1 ; divide number of

View File

@@ -6,7 +6,7 @@
.export _printf .export _printf
.import _stdout, pushax, addysp, _vfprintf .import _stdout, pushax, addysp, _vfprintf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -43,8 +43,8 @@ _printf:
; Now calculate the va_list pointer, which does points to Format ; Now calculate the va_list pointer, which does points to Format
lda sp lda spc
ldx sp+1 ldx spc+1
add ParamSize add ParamSize
bcc @L1 bcc @L1
inx inx

View File

@@ -4,7 +4,7 @@
; void* __fastcall__ realloc (void* block, register size_t size) ; void* __fastcall__ realloc (void* block, register size_t size)
; ;
.importzp ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, tmp4, sp .importzp ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, tmp4, spc
.import _malloc, _memcpy, _free .import _malloc, _memcpy, _free
.import pushax, popptr1, return0 .import pushax, popptr1, return0
.import incsp2, decsp2 .import incsp2, decsp2

View File

@@ -8,7 +8,7 @@
.export _scanf .export _scanf
.import _stdin, pushax, addysp, _vfscanf .import _stdin, pushax, addysp, _vfscanf
.import sp:zp, ptr1:zp .import spc:zp, ptr1:zp
.macpack generic .macpack generic
@@ -34,8 +34,8 @@ _scanf:
; Now, calculate the va_list pointer, which does point to Format. ; Now, calculate the va_list pointer, which does point to Format.
lda sp lda spc
ldx sp+1 ldx spc+1
add ArgSize add ArgSize
bcc @L1 bcc @L1
inx inx

View File

@@ -8,7 +8,7 @@
.export ___setjmp .export ___setjmp
.import return0 .import return0
.importzp sp, ptr1 .importzp spc, ptr1
___setjmp: ___setjmp:
sta ptr1 ; Save buf sta ptr1 ; Save buf
@@ -17,10 +17,10 @@ ___setjmp:
; The parameter stack is now empty, put it into buf ; The parameter stack is now empty, put it into buf
lda sp lda spc
sta (ptr1),y sta (ptr1),y
iny iny
lda sp+1 lda spc+1
sta (ptr1),y sta (ptr1),y
iny iny

View File

@@ -6,7 +6,7 @@
.export _snprintf .export _snprintf
.import pushax, addysp, decsp6, _vsnprintf .import pushax, addysp, decsp6, _vsnprintf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -38,9 +38,9 @@ _snprintf:
; Calculate a pointer to the Format argument ; Calculate a pointer to the Format argument
lda ParamSize lda ParamSize
add sp add spc
sta ptr1 sta ptr1
ldx sp+1 ldx spc+1
bcc @L1 bcc @L1
inx inx
@L1: stx ptr1+1 @L1: stx ptr1+1
@@ -49,7 +49,7 @@ _snprintf:
ldy #6-1 ldy #6-1
@L2: lda (ptr1),y @L2: lda (ptr1),y
sta (sp),y sta (spc),y
dey dey
bpl @L2 bpl @L2

View File

@@ -6,7 +6,7 @@
.export _sprintf .export _sprintf
.import pushax, addysp, decsp4, _vsprintf .import pushax, addysp, decsp4, _vsprintf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -38,9 +38,9 @@ _sprintf:
; Calculate a pointer to the Format argument ; Calculate a pointer to the Format argument
lda ParamSize lda ParamSize
add sp add spc
sta ptr1 sta ptr1
ldx sp+1 ldx spc+1
bcc @L1 bcc @L1
inx inx
@L1: stx ptr1+1 @L1: stx ptr1+1
@@ -49,7 +49,7 @@ _sprintf:
ldy #4-1 ldy #4-1
@L2: lda (ptr1),y @L2: lda (ptr1),y
sta (sp),y sta (spc),y
dey dey
bpl @L2 bpl @L2

View File

@@ -6,7 +6,7 @@
.export _sscanf .export _sscanf
.import addysp, decsp4, _vsscanf .import addysp, decsp4, _vsscanf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -51,9 +51,9 @@ _sscanf:
; Calculate a pointer to the fixed parameters ; Calculate a pointer to the fixed parameters
lda ParamSize lda ParamSize
add sp add spc
sta ptr1 sta ptr1
ldx sp+1 ldx spc+1
bcc @L1 bcc @L1
inx inx
@L1: stx ptr1+1 @L1: stx ptr1+1
@@ -62,7 +62,7 @@ _sscanf:
ldy #4-1 ldy #4-1
@L2: lda (ptr1),y @L2: lda (ptr1),y
sta (sp),y sta (spc),y
dey dey
bpl @L2 bpl @L2

View File

@@ -8,7 +8,7 @@
.export _vfprintf .export _vfprintf
.import push1, pushwysp, incsp6 .import push1, pushwysp, incsp6
.import _fwrite, __printf .import _fwrite, __printf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -121,15 +121,15 @@ _vfprintf:
; exactly as _printf expects it. Parameters will get dropped by _printf. ; exactly as _printf expects it. Parameters will get dropped by _printf.
ldy #2 ldy #2
lda (sp),y ; Low byte of f lda (spc),y ; Low byte of f
sta ptr sta ptr
lda #<outdesc lda #<outdesc
sta (sp),y sta (spc),y
iny iny
lda (sp),y ; High byte of f lda (spc),y ; High byte of f
sta ptr+1 sta ptr+1
lda #>outdesc lda #>outdesc
sta (sp),y sta (spc),y
; Restore low byte of ap and call _printf ; Restore low byte of ap and call _printf

View File

@@ -61,16 +61,16 @@ _vfscanf:
; Swap f against &d on the stack, placing f into d.data ; Swap f against &d on the stack, placing f into d.data
ldy #2 ; Offset of f on the stack ldy #2 ; Offset of f on the stack
lda (sp),y lda (spc),y
sta d + SCANFDATA::DATA sta d + SCANFDATA::DATA
lda #<d lda #<d
sta (sp),y sta (spc),y
iny ; High byte iny ; High byte
lda (sp),y lda (spc),y
sta d + SCANFDATA::DATA + 1 sta d + SCANFDATA::DATA + 1
lda #>d lda #>d
sta (sp),y sta (spc),y
; Restore the low byte of ap, and call the _scanf function ; Restore the low byte of ap, and call the _scanf function

View File

@@ -7,7 +7,7 @@
.export _vprintf .export _vprintf
.import _vfprintf, _stdout .import _vfprintf, _stdout
.import decsp2 .import decsp2
.importzp sp .importzp spc
.proc _vprintf .proc _vprintf
@@ -23,20 +23,20 @@
; Move the format parameter down and store stdout in it's place ; Move the format parameter down and store stdout in it's place
ldy #2 ldy #2
lda (sp),y lda (spc),y
ldy #0 ldy #0
sta (sp),y sta (spc),y
ldy #3 ldy #3
lda (sp),y lda (spc),y
ldy #1 ldy #1
sta (sp),y sta (spc),y
iny iny
lda _stdout lda _stdout
sta (sp),y sta (spc),y
iny iny
lda _stdout+1 lda _stdout+1
sta (sp),y sta (spc),y
; Restore A ; Restore A

View File

@@ -31,22 +31,22 @@ _vscanf:
; Move the format down ; Move the format down
ldy #2 ldy #2
lda (sp),y ; Load byte of format lda (spc),y ; Load byte of format
ldy #0 ldy #0
sta (sp),y sta (spc),y
ldy #3 ldy #3
lda (sp),y lda (spc),y
ldy #1 ldy #1
sta (sp),y sta (spc),y
; Store stdin into the stack frame ; Store stdin into the stack frame
iny iny
lda _stdin lda _stdin
sta (sp),y sta (spc),y
iny iny
lda _stdin+1 lda _stdin+1
sta (sp),y sta (spc),y
; Restore the low byte of ap and jump to vfscanf, which will cleanup the stack ; Restore the low byte of ap and jump to vfscanf, which will cleanup the stack

View File

@@ -8,7 +8,7 @@
.export _vsnprintf, vsnprintf .export _vsnprintf, vsnprintf
.import ldaxysp, popax, incsp2, incsp6 .import ldaxysp, popax, incsp2, incsp6
.import _memcpy, __printf .import _memcpy, __printf
.importzp sp, ptr1 .importzp spc, ptr1
.include "errno.inc" .include "errno.inc"
@@ -55,19 +55,19 @@ vsnprintf:
; be formatted and counted. ; be formatted and counted.
ldy #2 ldy #2
lda (sp),y lda (spc),y
sta ptr1 sta ptr1
lda #<outdesc lda #<outdesc
sta (sp),y sta (spc),y
iny iny
lda (sp),y lda (spc),y
bmi L9 ; More than $7FFF bmi L9 ; More than $7FFF
sta ptr1+1 sta ptr1+1
lda #>outdesc lda #>outdesc
sta (sp),y sta (spc),y
; Write size-1 to outdesc.uns. It will be -1 if there is no buffer. ; Write size-1 to outdesc.uns. It will be -1 if there is no buffer.
@@ -178,12 +178,12 @@ out:
clc clc
adc ccount+0 adc ccount+0
ldy #4 ldy #4
sta (sp),y sta (spc),y
lda bufptr+1 lda bufptr+1
adc ccount+1 adc ccount+1
iny iny
sta (sp),y sta (spc),y
; Get Count from stack ; Get Count from stack

View File

@@ -9,7 +9,7 @@
.export _vsscanf .export _vsscanf
.import popax, __scanf .import popax, __scanf
.importzp sp, ptr1, ptr2 .importzp spc, ptr1, ptr2
.macpack generic .macpack generic
@@ -165,15 +165,15 @@ d: .addr get
; to d ; to d
ldy #2 ; Stack offset of str ldy #2 ; Stack offset of str
lda (sp),y lda (spc),y
sta sd + SSCANFDATA::STR sta sd + SSCANFDATA::STR
lda #<d lda #<d
sta (sp),y sta (spc),y
iny iny
lda (sp),y lda (spc),y
sta sd + SSCANFDATA::STR+1 sta sd + SSCANFDATA::STR+1
lda #>d lda #>d
sta (sp),y sta (spc),y
lda #$00 lda #$00
sta sd + SSCANFDATA::INDEX sta sd + SSCANFDATA::INDEX

View File

@@ -6,7 +6,7 @@
.export _cprintf .export _cprintf
.import pushax, addysp, _vcprintf .import pushax, addysp, _vcprintf
.importzp sp, ptr1 .importzp spc, ptr1
.macpack generic .macpack generic
@@ -31,9 +31,9 @@ _cprintf:
dey dey
dey ; Sub size of Format dey ; Sub size of Format
tya tya
add sp add spc
sta ptr1 sta ptr1
ldx sp+1 ldx spc+1
bcc @L1 bcc @L1
inx inx
@L1: stx ptr1+1 @L1: stx ptr1+1

View File

@@ -23,8 +23,8 @@ _cscanf:
; Now, calculate the va_list pointer -- which points to format. ; Now, calculate the va_list pointer -- which points to format.
ldx sp+1 ldx spc+1
add sp add spc
bcc @L1 bcc @L1
inx inx
@L1: sta ptr1 @L1: sta ptr1

View File

@@ -7,7 +7,7 @@
.export _vcprintf .export _vcprintf
.import pushax, popax, popptr1 .import pushax, popax, popptr1
.import __printf, _cputc .import __printf, _cputc
.importzp sp, ptr1, ptr2, ptr3, tmp1 .importzp spc, ptr1, ptr2, ptr3, tmp1
.macpack generic .macpack generic
.macpack cpu .macpack cpu
@@ -138,10 +138,10 @@ _vcprintf:
; Get the format parameter and push it again ; Get the format parameter and push it again
ldy #1 ldy #1
lda (sp),y lda (spc),y
tax tax
dey dey
lda (sp),y lda (spc),y
jsr pushax jsr pushax
; Replace the passed format parameter on the stack by &d - this creates ; Replace the passed format parameter on the stack by &d - this creates
@@ -150,10 +150,10 @@ _vcprintf:
ldy #2 ; Low byte of d ldy #2 ; Low byte of d
lda #<outdesc lda #<outdesc
sta (sp),y sta (spc),y
iny iny
lda #>outdesc lda #>outdesc
sta (sp),y sta (spc),y
; Restore ap and call _printf ; Restore ap and call _printf

View File

@@ -40,8 +40,8 @@ entry:
; Setup the argument stack ptr ; Setup the argument stack ptr
lda #<(__ZP_LAST__ + __STACKSIZE__) lda #<(__ZP_LAST__ + __STACKSIZE__)
ldx #>(__ZP_LAST__ + __STACKSIZE__) ldx #>(__ZP_LAST__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; Call module constructors ; Call module constructors
jsr initlib jsr initlib

View File

@@ -80,8 +80,8 @@ init:
lda #<(__MAIN_START__ + __MAIN_SIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__)
sta sp sta spc
stx sp+1 ; Set argument stack ptr stx spc+1 ; Set argument stack ptr
; Switch to the lower/UPPER PetSCII charset. ; Switch to the lower/UPPER PetSCII charset.

View File

@@ -238,11 +238,11 @@ MOVE: php
jsr CMOVEY ; Set it jsr CMOVEY ; Set it
ldy #$01 ldy #$01
lda (sp),y lda (spc),y
sta XPos+1 sta XPos+1
tax tax
dey dey
lda (sp),y lda (spc),y
sta XPos ; New X position sta XPos ; New X position
jsr CMOVEX ; Move the cursor jsr CMOVEX ; Move the cursor

View File

@@ -7,23 +7,23 @@
.export _DbgMemDump .export _DbgMemDump
.import addysp1 .import addysp1
.import __hextab .import __hextab
.importzp sp, tmp2, tmp3, tmp4, ptr3, ptr4 .importzp spc, tmp2, tmp3, tmp4, ptr3, ptr4
_DbgMemDump: _DbgMemDump:
ldy #0 ldy #0
lda (sp),y ; Get length lda (spc),y ; Get length
sta tmp4 sta tmp4
iny iny
lda (sp),y ; Get the string buffer lda (spc),y ; Get the string buffer
sta ptr3 sta ptr3
iny iny
lda (sp),y lda (spc),y
sta ptr3+1 sta ptr3+1
iny iny
lda (sp),y ; Get the address lda (spc),y ; Get the address
sta ptr4 sta ptr4
iny iny
lda (sp),y lda (spc),y
sta ptr4+1 sta ptr4+1
jsr addysp1 ; Drop the parameters jsr addysp1 ; Drop the parameters

View File

@@ -36,9 +36,9 @@ DbgBreak:
jsr DbgSwapZP ; Swap stuff jsr DbgSwapZP ; Swap stuff
lda #<DbgStack ; Set new stack lda #<DbgStack ; Set new stack
sta sp sta spc
lda #>DbgStack lda #>DbgStack
sta sp+1 sta spc+1
jsr ResetDbgBreaks ; Reset temporary breakpoints jsr ResetDbgBreaks ; Reset temporary breakpoints
jsr _DbgEntry ; Call C code jsr _DbgEntry ; Call C code
jsr SetDbgBreaks ; Set temporary breakpoints jsr SetDbgBreaks ; Set temporary breakpoints
@@ -61,7 +61,7 @@ DbgStack:
; Swap space for the C temporaries ; Swap space for the C temporaries
CTemp: CTemp:
_DbgCS: .res 2 ; sp _DbgCS: .res 2 ; spc
_DbgHI: .res 2 ; sreg _DbgHI: .res 2 ; sreg
.res (zpsavespace-4) ; Other stuff .res (zpsavespace-4) ; Other stuff
@@ -78,7 +78,7 @@ Swap1: ldx CTemp,y
lda <__ZP_START__,y lda <__ZP_START__,y
sta CTemp,y sta CTemp,y
txa txa
sta sp,y sta spc,y
dey dey
bpl Swap1 bpl Swap1
rts rts

View File

@@ -34,8 +34,8 @@ Start:
; Set up the stack ; Set up the stack
lda #<(__RAM_START__+__RAM_SIZE__) lda #<(__RAM_START__+__RAM_SIZE__)
ldx #>(__RAM_START__+__RAM_SIZE__) ldx #>(__RAM_START__+__RAM_SIZE__)
sta sp sta spc
stx sp + 1 stx spc + 1
; Call module constructors ; Call module constructors
jsr initlib jsr initlib

View File

@@ -13,7 +13,7 @@
.export _mouse_move, _mouse_buttons .export _mouse_move, _mouse_buttons
.import popsreg, addysp1 .import popsreg, addysp1
.importzp sp, sreg, ptr1 .importzp spc, sreg, ptr1
.include "const.inc" .include "const.inc"
.include "jumptab.inc" .include "jumptab.inc"
@@ -87,22 +87,22 @@ _mouse_box:
sta mouseBottom sta mouseBottom
lda (sp),y lda (spc),y
sta mouseRight sta mouseRight
iny iny
lda (sp),y lda (spc),y
sta mouseRight+1 ; maxx sta mouseRight+1 ; maxx
iny iny
lda (sp),y lda (spc),y
sta mouseTop sta mouseTop
iny ; Skip high byte iny ; Skip high byte
iny iny
lda (sp),y lda (spc),y
sta mouseLeft sta mouseLeft
iny iny
lda (sp),y lda (spc),y
sta mouseLeft+1 ; minx sta mouseLeft+1 ; minx
jmp addysp1 ; Drop params, return jmp addysp1 ; Drop params, return

View File

@@ -11,7 +11,7 @@
.import initlib, donelib .import initlib, donelib
.import callmain .import callmain
.import zerobss .import zerobss
.importzp sp .importzp spc
.include "jumptab.inc" .include "jumptab.inc"
.include "geossym.inc" .include "geossym.inc"
@@ -48,8 +48,8 @@
lda #<(__STACKADDR__ + __STACKSIZE__) lda #<(__STACKADDR__ + __STACKSIZE__)
ldx #>(__STACKADDR__ + __STACKSIZE__) ldx #>(__STACKADDR__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; Call the module constructors. ; Call the module constructors.

View File

@@ -26,9 +26,9 @@ _init: cld ; Clear decimal mode
; Set cc65 argument stack pointer ; Set cc65 argument stack pointer
lda #<(__RAM_START__ + __RAM_SIZE__) lda #<(__RAM_START__ + __RAM_SIZE__)
sta sp sta spc
lda #>(__RAM_START__ + __RAM_SIZE__) lda #>(__RAM_START__ + __RAM_SIZE__)
sta sp+1 sta spc+1
; Initialize memory storage ; Initialize memory storage

View File

@@ -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__) lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; Init Mickey. ; Init Mickey.

View File

@@ -11,7 +11,7 @@
; ;
; off_t __fastcall__ lseek(int fd, off_t offset, int whence); ; off_t __fastcall__ lseek(int fd, off_t offset, int whence);
.importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 .importzp spc, sreg, regsave, regbank, tmp1, ptr1, ptr2
.macpack longbranch .macpack longbranch
.export _lseek .export _lseek
.import addysp, stax0sp, tosand0ax, pusheax, asreax2 .import addysp, stax0sp, tosand0ax, pusheax, asreax2

View File

@@ -107,8 +107,8 @@ start:
lda #<(__SRAM_START__ + __SRAM_SIZE__) lda #<(__SRAM_START__ + __SRAM_SIZE__)
ldx #>(__SRAM_START__ + __SRAM_SIZE__) ldx #>(__SRAM_START__ + __SRAM_SIZE__)
sta sp sta spc
stx sp+1 ; Set argument stack ptr stx spc+1 ; Set argument stack ptr
; Call the module constructors. ; Call the module constructors.

View File

@@ -10,8 +10,8 @@
lda #<__STACKSTART__ lda #<__STACKSTART__
ldx #>__STACKSTART__ ldx #>__STACKSTART__
sta sp sta spc
stx sp+1 stx spc+1
jsr zerobss jsr zerobss
jsr initlib jsr initlib
jsr _main jsr _main

View File

@@ -34,8 +34,8 @@ _init: ldx #$FF ; Initialize stack pointer to $01FF
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Initialize memory storage ; Initialize memory storage

View File

@@ -329,22 +329,22 @@ MainLoop:
jsr decsp6 ; 3 args jsr decsp6 ; 3 args
ldy #5 ldy #5
lda OutData+1 lda OutData+1
sta (sp),y sta (spc),y
dey dey
lda OutData lda OutData
sta (sp),y sta (spc),y
dey dey
lda FSave+1 lda FSave+1
sta (sp),y sta (spc),y
dey dey
lda FSave lda FSave
sta (sp),y sta (spc),y
dey dey
lda FCount+1 lda FCount+1
sta (sp),y sta (spc),y
dey dey
lda FCount lda FCount
sta (sp),y sta (spc),y
jsr CallOutFunc ; Call the output function jsr CallOutFunc ; Call the output function
; We're back from out(), or we didn't call it. Check for end of string. ; We're back from out(), or we didn't call it. Check for end of string.

View File

@@ -13,7 +13,7 @@
.import initlib, donelib .import initlib, donelib
.import push0, _main .import push0, _main
.import IRQStub, __nmi .import IRQStub, __nmi
.importzp sp .importzp spc
; Linker-generated ; Linker-generated
.import __CARTSIZE__ .import __CARTSIZE__
@@ -86,8 +86,8 @@ start: sei
; Set up the stack ; Set up the stack
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; Call the module constructors. ; Call the module constructors.
jsr initlib jsr initlib

View File

@@ -18,7 +18,7 @@
.export memcpy_increment, memcpy_transfer, memcpy_getparams .export memcpy_increment, memcpy_transfer, memcpy_getparams
.import incsp2, popax, popptr1 .import incsp2, popax, popptr1
.importzp sp, ptr1, ptr2, ptr3 .importzp spc, ptr1, ptr2, ptr3
; The structure of the transfer instructions ; The structure of the transfer instructions
@@ -86,9 +86,9 @@ memcpy_getparams:
; (Direct stack access is six cycles faster [total cycle count].) ; (Direct stack access is six cycles faster [total cycle count].)
iny ; (Y=0 by popptr1, need '1' here) save dest iny ; (Y=0 by popptr1, need '1' here) save dest
lda (sp),y ; get high byte lda (spc),y ; get high byte
tax tax
lda (sp) ; get low byte lda (spc) ; get low byte
sta ptr2 sta ptr2
stx ptr2+1 stx ptr2+1
rts ; return dest address (for memmove) rts ; return dest address (for memmove)

View File

@@ -23,7 +23,7 @@ Start:
; Save the zero-page locations that we need. ; Save the zero-page locations that we need.
ldx #zpspace-1 ldx #zpspace-1
L1: lda sp,x L1: lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -52,9 +52,9 @@ L1: lda sp,x
stx spsave ; Save the system stack ptr stx spsave ; Save the system stack ptr
lda MEMSIZE lda MEMSIZE
sta sp sta spc
lda MEMSIZE+1 lda MEMSIZE+1
sta sp+1 ; Set argument stack ptr sta spc+1 ; Set argument stack ptr
; Call the module constructors. ; Call the module constructors.
@@ -73,7 +73,7 @@ _exit: pha ; Save the return code on stack
ldx #zpspace-1 ldx #zpspace-1
L2: lda zpsave,x L2: lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl L2 bpl L2

View File

@@ -34,7 +34,7 @@ Start:
sei ; No interrupts since we're banking out the ROM sei ; No interrupts since we're banking out the ROM
sta ENABLE_RAM sta ENABLE_RAM
ldx #zpspace-1 ldx #zpspace-1
L1: lda sp,x L1: lda spc,x
sta zpsave,x sta zpsave,x
dex dex
bpl L1 bpl L1
@@ -54,8 +54,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__) ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp sta spc
stx sp+1 stx spc+1
; Set up the IRQ vector in the banked RAM; and, switch off the ROM. ; 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 ldx #zpspace-1
L2: lda zpsave,x L2: lda zpsave,x
sta sp,x sta spc,x
dex dex
bpl L2 bpl L2

View File

@@ -24,9 +24,9 @@ _init:
; Set cc65 argument stack pointer ; Set cc65 argument stack pointer
lda #<(__RAM_START__ + __RAM_SIZE__) lda #<(__RAM_START__ + __RAM_SIZE__)
sta sp sta spc
lda #>(__RAM_START__ + __RAM_SIZE__) lda #>(__RAM_START__ + __RAM_SIZE__)
sta sp+1 sta spc+1
; Initialize memory storage ; Initialize memory storage
jsr zerobss ; Clear BSS segment jsr zerobss ; Clear BSS segment

Some files were not shown because too many files have changed in this diff Show More