Merge pull request #2674 from GorillaSapiens/c_sp

rename "sp" to "c_sp", avoid conflict with 4510 opcodes
This commit is contained in:
Bob Andrews
2025-06-24 17:44:13 +02:00
committed by GitHub
204 changed files with 915 additions and 912 deletions

View File

@@ -8,7 +8,7 @@
; by the compiler, ready for usage in asm code.
.globalzp sp, sreg, regsave
.globalzp c_sp, sreg, regsave
.globalzp ptr1, ptr2, ptr3, ptr4
.globalzp tmp1, tmp2, tmp3, tmp4
.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.
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 c_sp.
<sect1>Upgrading from an older cc65 version<p>

View File

@@ -5016,17 +5016,17 @@ bit. Using
<tscreen><verb>
.if (.cpu .bitand CPU_ISET_65SC02)
lda (sp)
lda (c_sp)
.else
ldy #$00
lda (sp),y
lda (c_sp),y
.endif
</verb></tscreen>
it is possible to determine if the
<tscreen><verb>
lda (sp)
lda (c_sp)
</verb></tscreen>
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,
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/c_sp/ 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
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:
;
ldy #2 ; Offset of high byte of bar
lda (sp),y ; High byte now in A
lda (c_sp),y ; High byte now in A
tax ; High byte now in X
dey ; Offset of low byte of bar
lda (sp),y ; Low byte now in A
lda (c_sp),y ; Low byte now in A
</verb></tscreen>
<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
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/c_sp/ 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
(e.g. using the <tt/runtime/ function <tt/popa/),
or it could adjust <tt/sp/ directly.
or it could adjust <tt/c_sp/ directly.
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/c_sp/ to restore its
original state.
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
LDA #&lt;(__RAM_START__ + __RAM_SIZE__)
STA sp
STA c_sp
LDA #&gt;(__RAM_START__ + __RAM_SIZE__)
STA sp+1
STA c_sp+1
; ---------------------------------------------------------------------------
; 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/sp address/: the zero page address of the C parameter stack pointer <tt/sp/ used by the paravirtualization functions
<item>1 byte <bf/c_sp address/: the zero page address of the C parameter stack pointer <tt/c_sp/ used by the paravirtualization functions
<item>1 word <bf/load address/: where to load the data from the file into memory (default: <tt/$0200/)

View File

@@ -31,7 +31,7 @@ exit:
bpl :-
ldx #zpspace-1
: lda zpsave,x
sta sp,x
sta c_sp,x
dex
bpl :-
ldx #$FF
@@ -44,7 +44,7 @@ exit:
init:
ldx #zpspace-1
: lda sp,x
: lda c_sp,x
sta zpsave,x
dex
bpl :-
@@ -57,8 +57,8 @@ init:
lda HIMEM
ldx HIMEM+1
sta sp
stx sp+1
sta c_sp
stx c_sp+1
ldx #<_exit
lda #>_exit
jsr reset

View File

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

View File

@@ -43,7 +43,7 @@
; Save the zero-page locations that we need.
init: ldx #zpspace-1
: lda sp,x
: lda c_sp,x
sta zpsave,x
dex
bpl :-
@@ -82,8 +82,8 @@ basic: lda HIMEM
ldx HIMEM+1
; Set up the C stack.
: sta sp
stx sp+1
: sta c_sp
stx c_sp+1
; ProDOS TechRefMan, chapter 5.3.5:
; "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
; especially as _we_ rely on it in mainargs.s for argv[0]
ldy #$00
lda (sp),y
lda (c_sp),y
tay
: lda (sp),y
: lda (c_sp),y
sta $0280,y
dey
bpl :-

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -59,8 +59,8 @@ start:
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp
stx sp+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 sp ; 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 sp+1 ; set up runtime stack part 2
sta c_sp+1 ; set up runtime stack part 2
.endif

View File

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

View File

@@ -6,7 +6,7 @@
.include "atari.inc"
.include "fd.inc"
.importzp tmp1,tmp2,tmp3,ptr4,sp
.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 (sp),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

View File

@@ -8,7 +8,7 @@
;
.include "atari.inc"
.importzp sp
.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 sp accordingly
sta sp
; use top of memory and lower c_sp accordingly
sta c_sp
sta MOUSE_PM_BASE
lda sp+1
lda c_sp+1
and #7 ; offset within 2K
cmp #3 + MOUSE_PM_RAW + 1 ; can we use it?
bcc @decr ; no
lda sp+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 sp+1
sta c_sp+1
bne @cont ; jump always
@decr: lda sp+1
@decr: lda c_sp+1
and #$F8
sbc #8 - 1 ; CF is clear, subtracts 8
bcs @set ; jump always

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@
.include "atari.inc"
.import findfreeiocb
.importzp tmp4, sp, 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 (sp),y
sta (c_sp),y
beq copyend
iny
bne con
copyend:lda #$20 ; space
sta (sp),y
sta (c_sp),y
iny
tya ; get current offset (beyond old name)
clc
adc sp
adc c_sp
sta ptr3
lda sp+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 sp
lda c_sp
sta ICBAL,x
lda sp+1
lda c_sp+1
sta ICBAH,x
lda #RENAME
sta ICCOM,x
@@ -160,13 +160,13 @@ copend2:ldx tmp4
; clean up stack
lda sp
lda c_sp
clc
adc sspc
sta sp
lda sp+1
sta c_sp
lda c_sp+1
adc sspc+1
sta sp+1
sta c_sp+1
; handle status

View File

@@ -24,7 +24,7 @@
.importzp tmp2
.import __defdev
.endif
.importzp tmp3,ptr4,sp
.importzp tmp3,ptr4,c_sp
.import subysp,addysp
.export ucase_fn
@@ -63,13 +63,13 @@ hasdev:
ldy #0
loop2: lda (ptr4),y
sta (sp),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 (sp),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 (sp),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 sp
ldx sp+1
lda c_sp
ldx c_sp+1
clc ; indicate success
rts

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -51,7 +51,7 @@ _exit: jsr donelib
ldx #zpspace - 1
L2: lda zpsave,x
sta sp,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 sp,x
L1: lda c_sp,x
sta zpsave,x
dex
bpl L1
@@ -85,8 +85,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
sta sp
stx sp+1 ; Set argument stack ptr
sta c_sp
stx c_sp+1 ; Set argument stack ptr
; Call the module constructors.

View File

@@ -39,7 +39,7 @@ Start:
; Save the zero-page locations that we need.
ldx #zpspace-1
L1: lda sp,x
L1: lda c_sp,x
sta zpsave,x
dex
bpl L1
@@ -58,8 +58,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp
stx sp+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 sp,x
sta c_sp,x
dex
bpl L2

View File

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

View File

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

View File

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

View File

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

View File

@@ -24,7 +24,7 @@ Start:
; Save the zero-page locations that we need.
ldx #zpspace-1
L1: lda sp,x
L1: lda c_sp,x
sta zpsave,x
dex
bpl L1
@@ -49,8 +49,8 @@ L1: lda sp,x
bcc MemOk
ldy #$80
ldx #$00
MemOk: stx sp
sty sp+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 sp,x
sta c_sp,x
dex
bpl L2

View File

@@ -55,7 +55,7 @@ _exit: pha ; Save the return code on stack
ldx #zpspace-1
L2: lda zpsave,x
sta sp,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 sp,x
L1: lda c_sp,x
sta zpsave,x
dex
bpl L1
@@ -94,8 +94,8 @@ L1: lda sp,x
lda #<(__MAIN_START__ + __MAIN_SIZE__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
sta sp
stx sp+1 ; Set argument stack ptr
sta c_sp
stx c_sp+1 ; Set argument stack ptr
; Switch to the second charset.

View File

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

View File

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

View File

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

View File

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

View File

@@ -44,10 +44,10 @@ __dirread:
; Replace dir by dir->fd
ldy #2
lda (sp),y
lda (c_sp),y
sta ptr1
iny
lda (sp),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 (sp),y
sta (c_sp),y
pla
iny
sta (sp),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

View File

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

View File

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

View File

@@ -117,7 +117,7 @@ entry: php
tya
sec
sbc #7
sta $1FF ; Save new sp
sta $1FF ; Save new c_sp
tay
tsx
@@ -145,7 +145,7 @@ entry: php
iny
sta (sysp1),y
ldy $1FF ; Restore sp 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 sp.
; 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 sp
sta c_sp
lda #.hibyte(callbank15::entry)
sta sp+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 sp
lda (sysp1),y ; Load system bank c_sp
tax
iny ; Y = 0
lda #$58 ; CLI opcode

View File

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

View File

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

View File

@@ -115,7 +115,7 @@ entry: php
tya
sec
sbc #7
sta $1FF ; Save new sp
sta $1FF ; Save new c_sp
tay
tsx
@@ -143,7 +143,7 @@ entry: php
iny
sta (sysp1),y
ldy $1FF ; Restore sp 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 sp.
; 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 sp
sta c_sp
lda #.hibyte(callbank15::entry)
sta sp+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 sp
lda (sysp1),y ; Load system bank c_sp
tax
iny ; Y = 0
lda #$58 ; CLI opcode

View File

@@ -9,7 +9,7 @@
.import _open
.import pushax, incsp4, return0
.importzp sp, ptr1
.importzp c_sp, ptr1
.include "errno.inc"
@@ -28,10 +28,10 @@
; Get a pointer to the mode string
ldy #1
lda (sp),y
lda (c_sp),y
sta ptr1+1
dey
lda (sp),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 (sp),y
sta (c_sp),y
tya
iny
sta (sp),y
sta (c_sp),y
ldy #4 ; Size of arguments in bytes
jsr _open ; Will cleanup the stack

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@
.export _fprintf
.import addysp, decsp4, _vfprintf
.importzp sp, ptr1
.importzp c_sp, ptr1
.macpack generic
@@ -38,9 +38,9 @@ _fprintf:
; Calculate a pointer to the Format argument
lda ParamSize
add sp
add c_sp
sta ptr1
ldx sp+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 (sp),y
sta (c_sp),y
dey
bpl @L2

View File

@@ -14,7 +14,7 @@
.import pushwysp
.import tosumulax, tosudivax
.importzp ptr1, sp
.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 (sp)
lda (c_sp)
sta ptr1
add #1
sta (sp)
sta (c_sp)
ldy #1
.else
ldy #0
lda (sp),y
lda (c_sp),y
sta ptr1
add #1
sta (sp),y
sta (c_sp),y
iny
.endif
lda (sp),y
lda (c_sp),y
sta ptr1+1
adc #0
sta (sp),y ; ptr1 = buf++;
sta (c_sp),y ; ptr1 = buf++;
; Get the buffered character and place it as first character into the read
; buffer.

View File

@@ -6,7 +6,7 @@
.export _fscanf
.import addysp, decsp4, _vfscanf
.importzp sp, ptr1
.importzp c_sp, ptr1
.macpack generic
@@ -50,9 +50,9 @@ _fscanf:
; Calculate a pointer to the Format argument
lda ParamSize
add sp
add c_sp
sta ptr1
ldx sp+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 (sp),y
sta (c_sp),y
dey
bpl @L2

View File

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

View File

@@ -8,7 +8,7 @@
.export _itoa, _utoa
.import addysp1
.import __hextab
.importzp sp, 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 (sp),y
lda (c_sp),y
sta ptr2
sta ptr3
iny
lda (sp),y
lda (c_sp),y
sta ptr2+1
sta ptr3+1
iny
lda (sp),y
lda (c_sp),y
sta sreg
iny
lda (sp),y
lda (c_sp),y
sta sreg+1
jmp addysp1 ; Bump stack pointer

View File

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

View File

@@ -61,7 +61,7 @@
; }
; }
.importzp sp, 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

View File

@@ -12,7 +12,7 @@
.export _memcpy, memcpy_upwards, memcpy_getparams
.import popax, popptr1
.importzp sp, 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 (sp),y
lda (c_sp),y
tax
stx ptr2+1 ; save high byte of ptr2
dey ; Y = 0
lda (sp),y ; Get ptr2 low
lda (c_sp),y ; Get ptr2 low
sta ptr2
rts

View File

@@ -17,7 +17,7 @@
.export _memset, _bzero, ___bzero
.import popax
.importzp sp, 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 (sp),y
lda (c_sp),y
sta ptr1+1 ; save high byte of ptr
dey ; Y = 0
lda (sp),y ; Get ptr
lda (c_sp),y ; Get ptr
sta ptr1
lsr ptr3+1 ; divide number of

View File

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

View File

@@ -4,7 +4,7 @@
; 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, c_sp
.import _malloc, _memcpy, _free
.import pushax, popptr1, return0
.import incsp2, decsp2

View File

@@ -8,7 +8,7 @@
.export _scanf
.import _stdin, pushax, addysp, _vfscanf
.import sp: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 sp
ldx sp+1
lda c_sp
ldx c_sp+1
add ArgSize
bcc @L1
inx

View File

@@ -8,7 +8,7 @@
.export ___setjmp
.import return0
.importzp sp, 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 sp
lda c_sp
sta (ptr1),y
iny
lda sp+1
lda c_sp+1
sta (ptr1),y
iny

View File

@@ -6,7 +6,7 @@
.export _snprintf
.import pushax, addysp, decsp6, _vsnprintf
.importzp sp, ptr1
.importzp c_sp, ptr1
.macpack generic
@@ -38,9 +38,9 @@ _snprintf:
; Calculate a pointer to the Format argument
lda ParamSize
add sp
add c_sp
sta ptr1
ldx sp+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 (sp),y
sta (c_sp),y
dey
bpl @L2

View File

@@ -6,7 +6,7 @@
.export _sprintf
.import pushax, addysp, decsp4, _vsprintf
.importzp sp, ptr1
.importzp c_sp, ptr1
.macpack generic
@@ -38,9 +38,9 @@ _sprintf:
; Calculate a pointer to the Format argument
lda ParamSize
add sp
add c_sp
sta ptr1
ldx sp+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 (sp),y
sta (c_sp),y
dey
bpl @L2

View File

@@ -6,7 +6,7 @@
.export _sscanf
.import addysp, decsp4, _vsscanf
.importzp sp, ptr1
.importzp c_sp, ptr1
.macpack generic
@@ -51,9 +51,9 @@ _sscanf:
; Calculate a pointer to the fixed parameters
lda ParamSize
add sp
add c_sp
sta ptr1
ldx sp+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 (sp),y
sta (c_sp),y
dey
bpl @L2

View File

@@ -8,7 +8,7 @@
.export _vfprintf
.import push1, pushwysp, incsp6
.import _fwrite, __printf
.importzp sp, 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 (sp),y ; Low byte of f
lda (c_sp),y ; Low byte of f
sta ptr
lda #<outdesc
sta (sp),y
sta (c_sp),y
iny
lda (sp),y ; High byte of f
lda (c_sp),y ; High byte of f
sta ptr+1
lda #>outdesc
sta (sp),y
sta (c_sp),y
; 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
ldy #2 ; Offset of f on the stack
lda (sp),y
lda (c_sp),y
sta d + SCANFDATA::DATA
lda #<d
sta (sp),y
sta (c_sp),y
iny ; High byte
lda (sp),y
lda (c_sp),y
sta d + SCANFDATA::DATA + 1
lda #>d
sta (sp),y
sta (c_sp),y
; Restore the low byte of ap, and call the _scanf function

View File

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

View File

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

View File

@@ -8,7 +8,7 @@
.export _vsnprintf, vsnprintf
.import ldaxysp, popax, incsp2, incsp6
.import _memcpy, __printf
.importzp sp, ptr1
.importzp c_sp, ptr1
.include "errno.inc"
@@ -55,19 +55,19 @@ vsnprintf:
; be formatted and counted.
ldy #2
lda (sp),y
lda (c_sp),y
sta ptr1
lda #<outdesc
sta (sp),y
sta (c_sp),y
iny
lda (sp),y
lda (c_sp),y
bmi L9 ; More than $7FFF
sta ptr1+1
lda #>outdesc
sta (sp),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 (sp),y
sta (c_sp),y
lda bufptr+1
adc ccount+1
iny
sta (sp),y
sta (c_sp),y
; Get Count from stack

View File

@@ -9,7 +9,7 @@
.export _vsscanf
.import popax, __scanf
.importzp sp, 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 (sp),y
lda (c_sp),y
sta sd + SSCANFDATA::STR
lda #<d
sta (sp),y
sta (c_sp),y
iny
lda (sp),y
lda (c_sp),y
sta sd + SSCANFDATA::STR+1
lda #>d
sta (sp),y
sta (c_sp),y
lda #$00
sta sd + SSCANFDATA::INDEX

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
.export _vcprintf
.import pushax, popax, popptr1
.import __printf, _cputc
.importzp sp, 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 (sp),y
lda (c_sp),y
tax
dey
lda (sp),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 (sp),y
sta (c_sp),y
iny
lda #>outdesc
sta (sp),y
sta (c_sp),y
; Restore ap and call _printf

View File

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

View File

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

View File

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

View File

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

View File

@@ -36,9 +36,9 @@ DbgBreak:
jsr DbgSwapZP ; Swap stuff
lda #<DbgStack ; Set new stack
sta sp
sta c_sp
lda #>DbgStack
sta sp+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 ; sp
_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 sp,y
sta c_sp,y
dey
bpl Swap1
rts

View File

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

View File

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

View File

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

View File

@@ -26,9 +26,9 @@ _init: cld ; Clear decimal mode
; Set cc65 argument stack pointer
lda #<(__RAM_START__ + __RAM_SIZE__)
sta sp
sta c_sp
lda #>(__RAM_START__ + __RAM_SIZE__)
sta sp+1
sta c_sp+1
; 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__)
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
sta sp
stx sp+1
sta c_sp
stx c_sp+1
; Init Mickey.

View File

@@ -11,7 +11,7 @@
;
; off_t __fastcall__ lseek(int fd, off_t offset, int whence);
.importzp sp, 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

View File

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

View File

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

View File

@@ -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 sp
stx sp+1
sta c_sp
stx c_sp+1
; ---------------------------------------------------------------------------
; Initialize memory storage

View File

@@ -329,22 +329,22 @@ MainLoop:
jsr decsp6 ; 3 args
ldy #5
lda OutData+1
sta (sp),y
sta (c_sp),y
dey
lda OutData
sta (sp),y
sta (c_sp),y
dey
lda FSave+1
sta (sp),y
sta (c_sp),y
dey
lda FSave
sta (sp),y
sta (c_sp),y
dey
lda FCount+1
sta (sp),y
sta (c_sp),y
dey
lda FCount
sta (sp),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.

View File

@@ -13,7 +13,7 @@
.import initlib, donelib
.import push0, _main
.import IRQStub, __nmi
.importzp sp
.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 sp
stx sp+1
sta c_sp
stx c_sp+1
; Call the module constructors.
jsr initlib

View File

@@ -18,7 +18,7 @@
.export memcpy_increment, memcpy_transfer, memcpy_getparams
.import incsp2, popax, popptr1
.importzp sp, 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 (sp),y ; get high byte
lda (c_sp),y ; get high byte
tax
lda (sp) ; get low byte
lda (c_sp) ; get low byte
sta ptr2
stx ptr2+1
rts ; return dest address (for memmove)

View File

@@ -23,7 +23,7 @@ Start:
; Save the zero-page locations that we need.
ldx #zpspace-1
L1: lda sp,x
L1: lda c_sp,x
sta zpsave,x
dex
bpl L1
@@ -52,9 +52,9 @@ L1: lda sp,x
stx spsave ; Save the system stack ptr
lda MEMSIZE
sta sp
sta c_sp
lda MEMSIZE+1
sta sp+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 sp,x
sta c_sp,x
dex
bpl L2

View File

@@ -33,7 +33,7 @@ Start:
sei ; No interrupts since we're banking out the ROM
sta ENABLE_RAM
ldx #zpspace-1
L1: lda sp,x
L1: lda c_sp,x
sta zpsave,x
dex
bpl L1
@@ -53,8 +53,8 @@ L1: lda sp,x
lda #<__HIMEM__
ldx #>__HIMEM__
sta sp
stx sp+1
sta c_sp
stx c_sp+1
; Set up the IRQ vector in the banked RAM; and, switch off the ROM.
@@ -114,7 +114,7 @@ _exit: pha ; Save the return code
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
sta c_sp,x
dex
bpl L2

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