changed "spc" to "c_sp"
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
; by the compiler, ready for usage in asm code.
|
||||
|
||||
|
||||
.globalzp spc, sreg, regsave
|
||||
.globalzp c_sp, sreg, regsave
|
||||
.globalzp ptr1, ptr2, ptr3, ptr4
|
||||
.globalzp tmp1, tmp2, tmp3, tmp4
|
||||
.globalzp regbank
|
||||
|
||||
@@ -1121,7 +1121,7 @@ If BSS and/or the stack shouldn't stay at the end of the program,
|
||||
some parts of the cc65 runtime lib need to be replaced/modified.
|
||||
|
||||
common/_heap.s defines the location of the heap and atari/crt0.s
|
||||
defines the location of the stack by initializing spc.
|
||||
defines the location of the stack by initializing c_sp.
|
||||
|
||||
|
||||
<sect1>Upgrading from an older cc65 version<p>
|
||||
|
||||
@@ -4788,17 +4788,17 @@ bit. Using
|
||||
|
||||
<tscreen><verb>
|
||||
.if (.cpu .bitand CPU_ISET_65SC02)
|
||||
lda (spc)
|
||||
lda (c_sp)
|
||||
.else
|
||||
ldy #$00
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
.endif
|
||||
</verb></tscreen>
|
||||
|
||||
it is possible to determine if the
|
||||
|
||||
<tscreen><verb>
|
||||
lda (spc)
|
||||
lda (c_sp)
|
||||
</verb></tscreen>
|
||||
|
||||
instruction is supported, which is the case for the 65SC02, 65C02 and 65816
|
||||
|
||||
@@ -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/spc/ 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 (spc),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 (spc),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/spc/ 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/spc/ 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/spc/ 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.
|
||||
|
||||
@@ -193,9 +193,9 @@ _init: LDX #$FF ; Initialize stack pointer to $01FF
|
||||
; Set cc65 argument stack pointer
|
||||
|
||||
LDA #<(__RAM_START__ + __RAM_SIZE__)
|
||||
STA spc
|
||||
STA c_sp
|
||||
LDA #>(__RAM_START__ + __RAM_SIZE__)
|
||||
STA spc+1
|
||||
STA c_sp+1
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Initialize memory storage
|
||||
|
||||
@@ -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/spc address/: the zero page address of the C parameter stack pointer <tt/spc/ 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/)
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ exit: ldx #$02
|
||||
; Copy back the zero-page stuff.
|
||||
ldx #zpspace-1
|
||||
: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl :-
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
; Save the zero-page locations that we need.
|
||||
init: ldx #zpspace-1
|
||||
: lda spc,x
|
||||
: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl :-
|
||||
@@ -81,8 +81,8 @@ basic: lda HIMEM
|
||||
ldx HIMEM+1
|
||||
|
||||
; Set up the C stack.
|
||||
: sta spc
|
||||
stx spc+1
|
||||
: sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.3.5:
|
||||
; "Your system program should place in the RESET vector the
|
||||
|
||||
@@ -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 (spc),y
|
||||
lda (c_sp),y
|
||||
tay
|
||||
: lda (spc),y
|
||||
: lda (c_sp),y
|
||||
sta $0280,y
|
||||
dey
|
||||
bpl :-
|
||||
|
||||
@@ -34,8 +34,8 @@ pushname:
|
||||
sta mliparam + MLI::ON_LINE::UNIT_NUM
|
||||
|
||||
; Use allocated pathname buffer
|
||||
lda spc
|
||||
ldx spc+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 (spc),y
|
||||
lda (c_sp),y
|
||||
and #15 ; Max volume name length
|
||||
|
||||
; Bracket volume name with slashes to form prefix
|
||||
sta tmp1
|
||||
lda #'/'
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
ldy tmp1
|
||||
iny ; Leading slash
|
||||
sta (spc),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 (spc),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 (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Return success
|
||||
tya
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
; Returns with carry set on error, and sets errno
|
||||
mli_file_info_direct:
|
||||
; Set pushed name
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::INFO::PATHNAME
|
||||
stx mliparam + MLI::INFO::PATHNAME+1
|
||||
|
||||
|
||||
@@ -341,10 +341,10 @@ MOVE:
|
||||
ldy #$00 ; Start at top of stack
|
||||
|
||||
; Set x
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
iny
|
||||
sta pos1_lo,x
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta pos1_hi,x
|
||||
|
||||
; Update cursor
|
||||
|
||||
@@ -101,8 +101,8 @@ found: tya
|
||||
bne oserr1
|
||||
|
||||
; Set pushed name
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::OPEN::PATHNAME
|
||||
stx mliparam + MLI::OPEN::PATHNAME+1
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ __syschdir:
|
||||
bne oserr
|
||||
|
||||
; Set pushed name
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::PREFIX::PATHNAME
|
||||
stx mliparam + MLI::PREFIX::PATHNAME+1
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ __sysmkdir:
|
||||
bne oserr
|
||||
|
||||
; Set pushed name
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::CREATE::PATHNAME
|
||||
stx mliparam + MLI::CREATE::PATHNAME+1
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ __sysremove:
|
||||
bne oserr
|
||||
|
||||
; Set pushed name
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::DESTROY::PATHNAME
|
||||
stx mliparam + MLI::DESTROY::PATHNAME+1
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ __sysrename:
|
||||
bne oserr1
|
||||
|
||||
; Save pushed oldname
|
||||
lda spc
|
||||
ldx spc+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 spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
sta mliparam + MLI::RENAME::NEW_PATHNAME
|
||||
stx mliparam + MLI::RENAME::NEW_PATHNAME+1
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ start:
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
.else
|
||||
|
||||
@@ -75,11 +75,11 @@ start:
|
||||
lda MEMTOP
|
||||
sbc #<__RESERVED_MEMORY__
|
||||
sta APPMHI ; initialize our APPMHI value
|
||||
sta spc ; set up runtime stack part 1
|
||||
sta c_sp ; set up runtime stack part 1
|
||||
lda MEMTOP+1
|
||||
sbc #>__RESERVED_MEMORY__
|
||||
sta APPMHI+1
|
||||
sta spc+1 ; set up runtime stack part 2
|
||||
sta c_sp+1 ; set up runtime stack part 2
|
||||
|
||||
.endif
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.export sectsizetab
|
||||
.import ___oserror, __sio_call, _dio_read
|
||||
.import pushax, addysp, subysp
|
||||
.importzp ptr2, spc
|
||||
.importzp ptr2, c_sp
|
||||
.include "atari.inc"
|
||||
|
||||
|
||||
@@ -78,10 +78,10 @@ _dio_open:
|
||||
ldy #128
|
||||
jsr subysp ; allocate buffer on the stack
|
||||
|
||||
lda spc
|
||||
lda c_sp
|
||||
pha
|
||||
lda spc+1
|
||||
pha ; save spc (buffer address) on processor stack
|
||||
lda c_sp+1
|
||||
pha ; save c_sp (buffer address) on processor stack
|
||||
|
||||
lda ptr2
|
||||
ldx ptr2+1
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.include "atari.inc"
|
||||
.include "fd.inc"
|
||||
.importzp tmp1,tmp2,tmp3,ptr4,spc
|
||||
.importzp tmp1,tmp2,tmp3,ptr4,c_sp
|
||||
.import fd_table,fd_index
|
||||
.import fdt_to_fdi
|
||||
.export clriocb
|
||||
@@ -229,7 +229,7 @@ freefnd:txa
|
||||
beq l2
|
||||
|
||||
l1: ldy #0
|
||||
lda (spc),y ; get device
|
||||
lda (c_sp),y ; get device
|
||||
l2: sta fd_table+ft_dev,x ; set device
|
||||
lda #1
|
||||
sta fd_table+ft_usa,x ; set usage counter
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
;
|
||||
|
||||
.include "atari.inc"
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
.export _mouse_pm_callbacks
|
||||
.constructor pm_init, 27
|
||||
.destructor pm_down
|
||||
@@ -193,22 +193,22 @@ pm_init:
|
||||
|
||||
.else
|
||||
|
||||
; use top of memory and lower spc accordingly
|
||||
sta spc
|
||||
; use top of memory and lower c_sp accordingly
|
||||
sta c_sp
|
||||
sta MOUSE_PM_BASE
|
||||
lda spc+1
|
||||
lda c_sp+1
|
||||
and #7 ; offset within 2K
|
||||
cmp #3 + MOUSE_PM_RAW + 1 ; can we use it?
|
||||
bcc @decr ; no
|
||||
|
||||
lda spc+1
|
||||
lda c_sp+1
|
||||
and #$F8
|
||||
@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3
|
||||
sta MOUSE_PM_BASE+1
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
bne @cont ; jump always
|
||||
|
||||
@decr: lda spc+1
|
||||
@decr: lda c_sp+1
|
||||
and #$F8
|
||||
sbc #8 - 1 ; CF is clear, subtracts 8
|
||||
bcs @set ; jump always
|
||||
|
||||
@@ -241,11 +241,11 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
|
||||
@@ -399,12 +399,12 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
sta XPosWrk+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
sta XPosWrk
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -236,11 +236,11 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.include "atari.inc"
|
||||
.import findfreeiocb
|
||||
.importzp tmp4, spc, ptr2, ptr3
|
||||
.importzp tmp4, c_sp, ptr2, ptr3
|
||||
.import incsp2, subysp, addysp, popax
|
||||
.ifdef UCASE_FILENAME
|
||||
.importzp tmp3
|
||||
@@ -118,19 +118,19 @@ L1: jsr subysp ; make room on the stack
|
||||
; copy old name
|
||||
ldy #0
|
||||
con: lda (ptr3),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
beq copyend
|
||||
iny
|
||||
bne con
|
||||
|
||||
copyend:lda #$20 ; space
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
tya ; get current offset (beyond old name)
|
||||
clc
|
||||
adc spc
|
||||
adc c_sp
|
||||
sta ptr3
|
||||
lda spc+1
|
||||
lda c_sp+1
|
||||
adc #0
|
||||
sta ptr3+1 ; ptr3 now contains pointer to space for new filename
|
||||
|
||||
@@ -143,9 +143,9 @@ cnn: lda (ptr2),y
|
||||
bne cnn
|
||||
|
||||
copend2:ldx tmp4
|
||||
lda spc
|
||||
lda c_sp
|
||||
sta ICBAL,x
|
||||
lda spc+1
|
||||
lda c_sp+1
|
||||
sta ICBAH,x
|
||||
lda #RENAME
|
||||
sta ICCOM,x
|
||||
@@ -160,13 +160,13 @@ copend2:ldx tmp4
|
||||
|
||||
; clean up stack
|
||||
|
||||
lda spc
|
||||
lda c_sp
|
||||
clc
|
||||
adc sspc
|
||||
sta spc
|
||||
lda spc+1
|
||||
sta c_sp
|
||||
lda c_sp+1
|
||||
adc sspc+1
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
; handle status
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
.importzp tmp2
|
||||
.import __defdev
|
||||
.endif
|
||||
.importzp tmp3,ptr4,spc
|
||||
.importzp tmp3,ptr4,c_sp
|
||||
.import subysp,addysp
|
||||
.export ucase_fn
|
||||
|
||||
@@ -63,13 +63,13 @@ hasdev:
|
||||
ldy #0
|
||||
|
||||
loop2: lda (ptr4),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
beq copy_end
|
||||
bmi L1 ; Not lowercase (also, invalid, should reject)
|
||||
cmp #'a'
|
||||
bcc L1 ; Not lowercase
|
||||
and #$DF ; make upper case char, assume ASCII chars
|
||||
sta (spc),y ; store back
|
||||
sta (c_sp),y ; store back
|
||||
L1:
|
||||
iny
|
||||
bpl loop2 ; bpl: this way we only support a max. length of 127
|
||||
@@ -93,15 +93,15 @@ copy_end:
|
||||
jsr subysp ; adjust stack pointer
|
||||
dey
|
||||
cpdev: lda __defdev,y
|
||||
sta (spc),y ; insert device name, number and ':'
|
||||
sta (c_sp),y ; insert device name, number and ':'
|
||||
dey
|
||||
bpl cpdev
|
||||
hasdev2:
|
||||
.endif
|
||||
|
||||
; leave A and X pointing to the modified filename
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
clc ; indicate success
|
||||
rts
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ clearLoop:
|
||||
; Initialize C stack pointer
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Call main
|
||||
jsr _main
|
||||
|
||||
@@ -27,8 +27,8 @@ start:
|
||||
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
|
||||
ldx #>(__RAM_START__ + __RAM_SIZE__ - __RESERVED_MEMORY__)
|
||||
sta spc
|
||||
stx spc+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@ start:
|
||||
|
||||
; Set up parameter stack
|
||||
lda #<(__RAM3_START__ + __RAM3_SIZE__)
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda #>(__RAM3_START__ + __RAM3_SIZE__)
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
jsr copydata
|
||||
jsr zerobss
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
.constructor mono_init_cursor
|
||||
.interruptor mono_blink_cursor
|
||||
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
.import _zonecounter
|
||||
.import _mono_zones
|
||||
.import cursor
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
.constructor init_cursor
|
||||
.interruptor blink_cursor
|
||||
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
.import _zonecounter
|
||||
.import _zones
|
||||
.import cursor
|
||||
|
||||
@@ -51,7 +51,7 @@ _exit: jsr donelib
|
||||
|
||||
ldx #zpspace - 1
|
||||
L2: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
@@ -68,7 +68,7 @@ L2: lda zpsave,x
|
||||
; Save the zero-page area that we're about to use.
|
||||
|
||||
init: ldx #zpspace - 1
|
||||
L1: lda spc,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -85,8 +85,8 @@ L1: lda spc,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta spc
|
||||
stx spc+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ Start:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda spc,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -58,8 +58,8 @@ L1: lda spc,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
@@ -85,7 +85,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
|
||||
@@ -296,11 +296,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -323,10 +323,10 @@ MOVE: sei ; No interrupts
|
||||
jsr MoveY
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
jsr MoveX ; Move the cursor
|
||||
|
||||
cli ; Allow interrupts
|
||||
|
||||
@@ -297,11 +297,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -297,11 +297,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -24,7 +24,7 @@ Start:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda spc,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -49,8 +49,8 @@ L1: lda spc,x
|
||||
bcc MemOk
|
||||
ldy #$80
|
||||
ldx #$00
|
||||
MemOk: stx spc
|
||||
sty spc+1 ; set argument stack ptr
|
||||
MemOk: stx c_sp
|
||||
sty c_sp+1 ; set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
@@ -69,7 +69,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
@@ -85,7 +85,7 @@ init:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda spc,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -94,8 +94,8 @@ L1: lda spc,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta spc
|
||||
stx spc+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Switch to the second charset.
|
||||
|
||||
|
||||
@@ -239,11 +239,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -249,10 +249,10 @@ MOVE: sei ; No interrupts
|
||||
jsr MoveY
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
jsr MoveX ; Move the cursor
|
||||
|
||||
cli ; Allow interrupts
|
||||
|
||||
@@ -245,11 +245,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -230,11 +230,11 @@ MOVE: sei ; No interrupts
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
@@ -44,10 +44,10 @@ __dirread:
|
||||
; Replace dir by dir->fd
|
||||
|
||||
ldy #2
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1+1
|
||||
ldy #DIR::fd+1
|
||||
lda (ptr1),y
|
||||
@@ -55,10 +55,10 @@ __dirread:
|
||||
dey
|
||||
lda (ptr1),y
|
||||
ldy #2
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
pla
|
||||
iny
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Get count, save it again, clear the high byte and call read(). By the
|
||||
; previous actions, the stack frame is as read() needs it, and read() will
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
.import opencmdchannel, closecmdchannel, readdiskerror
|
||||
.import fnunit, fnisfile
|
||||
.import _close
|
||||
.importzp spc, tmp2, tmp3
|
||||
.importzp c_sp, tmp2, tmp3
|
||||
|
||||
.include "errno.inc"
|
||||
.include "fcntl.inc"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.constructor initstdout
|
||||
|
||||
.import rwcommon
|
||||
.importzp spc, ptr1, ptr2, ptr3
|
||||
.importzp c_sp, ptr1, ptr2, ptr3
|
||||
|
||||
.include "cbm.inc"
|
||||
.include "errno.inc"
|
||||
|
||||
@@ -117,7 +117,7 @@ entry: php
|
||||
tya
|
||||
sec
|
||||
sbc #7
|
||||
sta $1FF ; Save new spc
|
||||
sta $1FF ; Save new c_sp
|
||||
tay
|
||||
|
||||
tsx
|
||||
@@ -145,7 +145,7 @@ entry: php
|
||||
iny
|
||||
sta (sysp1),y
|
||||
|
||||
ldy $1FF ; Restore spc in bank 15
|
||||
ldy $1FF ; Restore c_sp in bank 15
|
||||
|
||||
lda #.hibyte(expull-1)
|
||||
sta (sysp1),y
|
||||
@@ -245,7 +245,7 @@ L1: lda extzp,x
|
||||
dex
|
||||
bpl L1
|
||||
|
||||
; Save the old stack pointer from the system bank; and, set up our hw spc.
|
||||
; Save the old stack pointer from the system bank; and, set up our hw c_sp.
|
||||
|
||||
tsx
|
||||
txa
|
||||
@@ -279,9 +279,9 @@ L3: lda vectors,x
|
||||
; Set up the C stack.
|
||||
|
||||
lda #.lobyte(callbank15::entry)
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda #.hibyte(callbank15::entry)
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
; Set up the subroutine and jump vector table that redirects Kernal calls to
|
||||
; the system bank.
|
||||
@@ -495,7 +495,7 @@ _exit: pha ; Save the return code on stack
|
||||
; Set up the welcome code at the stack bottom in the system bank.
|
||||
|
||||
ldy #$FF
|
||||
lda (sysp1),y ; Load system bank spc
|
||||
lda (sysp1),y ; Load system bank c_sp
|
||||
tax
|
||||
iny ; Y = 0
|
||||
lda #$58 ; CLI opcode
|
||||
|
||||
@@ -256,10 +256,10 @@ MOVE: sei ; No interrupts
|
||||
jsr MoveY
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
jsr MoveX ; Move the cursor
|
||||
|
||||
cli ; Allow interrupts
|
||||
|
||||
@@ -225,11 +225,11 @@ MOVE: sei ; No interrupts
|
||||
jsr MoveY ; Set new y position
|
||||
|
||||
ldy #1
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
jsr MoveX ; Move the pointer
|
||||
|
||||
cli ; Allow interrupts
|
||||
|
||||
@@ -115,7 +115,7 @@ entry: php
|
||||
tya
|
||||
sec
|
||||
sbc #7
|
||||
sta $1FF ; Save new spc
|
||||
sta $1FF ; Save new c_sp
|
||||
tay
|
||||
|
||||
tsx
|
||||
@@ -143,7 +143,7 @@ entry: php
|
||||
iny
|
||||
sta (sysp1),y
|
||||
|
||||
ldy $1FF ; Restore spc in bank 15
|
||||
ldy $1FF ; Restore c_sp in bank 15
|
||||
|
||||
lda #.hibyte(expull-1)
|
||||
sta (sysp1),y
|
||||
@@ -243,7 +243,7 @@ L1: lda extzp,x
|
||||
dex
|
||||
bpl L1
|
||||
|
||||
; Save the old stack pointer from the system bank; and, set up our hw spc.
|
||||
; Save the old stack pointer from the system bank; and, set up our hw c_sp.
|
||||
|
||||
tsx
|
||||
txa
|
||||
@@ -277,9 +277,9 @@ L3: lda vectors,x
|
||||
; Set up the C stack.
|
||||
|
||||
lda #.lobyte(callbank15::entry)
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda #.hibyte(callbank15::entry)
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
; Set up the subroutine and jump vector table that redirects Kernal calls to
|
||||
; the system bank.
|
||||
@@ -400,7 +400,7 @@ _exit: pha ; Save the return code
|
||||
; Set up the welcome code at the stack bottom in the system bank.
|
||||
|
||||
ldy #$FF
|
||||
lda (sysp1),y ; Load system bank spc
|
||||
lda (sysp1),y ; Load system bank c_sp
|
||||
tax
|
||||
iny ; Y = 0
|
||||
lda #$58 ; CLI opcode
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
.import _open
|
||||
.import pushax, incsp4, return0
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
|
||||
.include "errno.inc"
|
||||
@@ -28,10 +28,10 @@
|
||||
; Get a pointer to the mode string
|
||||
|
||||
ldy #1
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1+1
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1
|
||||
|
||||
; Look at the first character in mode
|
||||
@@ -78,10 +78,10 @@ invmode:
|
||||
|
||||
modeok: ldy #$00
|
||||
txa ; Mode -> A
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
tya
|
||||
iny
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
ldy #4 ; Size of arguments in bytes
|
||||
jsr _open ; Will cleanup the stack
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.constructor initheap, 24
|
||||
.import __BSS_RUN__, __BSS_SIZE__, __STACKSIZE__
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
|
||||
.include "_heap.inc"
|
||||
|
||||
@@ -31,10 +31,10 @@ ___heaplast:
|
||||
|
||||
initheap:
|
||||
sec
|
||||
lda spc
|
||||
lda c_sp
|
||||
sbc #<__STACKSIZE__
|
||||
sta ___heapend
|
||||
lda spc+1
|
||||
lda c_sp+1
|
||||
sbc #>__STACKSIZE__
|
||||
sta ___heapend+1
|
||||
rts
|
||||
|
||||
@@ -20,17 +20,17 @@
|
||||
; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent.
|
||||
|
||||
ldy #3
|
||||
@L1: lda (spc),y
|
||||
@L1: lda (c_sp),y
|
||||
sta ptr1,y
|
||||
dey
|
||||
bpl @L1
|
||||
|
||||
lda #4
|
||||
clc
|
||||
adc spc
|
||||
sta spc
|
||||
adc c_sp
|
||||
sta c_sp
|
||||
bcc @L2
|
||||
inc spc+1
|
||||
inc c_sp+1
|
||||
|
||||
@L2: pla ; Old rhs
|
||||
jmp idiv32by16r16
|
||||
|
||||
@@ -338,25 +338,25 @@ MainLoop:
|
||||
jsr decsp6 ; 3 args
|
||||
ldy #5
|
||||
lda OutData+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda OutData
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FSave+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FSave
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FCount+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FCount
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
sta (spc)
|
||||
sta (c_sp)
|
||||
.else
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
.endif
|
||||
jsr CallOutFunc ; Call the output function
|
||||
|
||||
|
||||
@@ -21,17 +21,17 @@
|
||||
; Copy from stack to zeropage. This assumes ptr1 and ptr2 are adjacent.
|
||||
|
||||
ldy #3
|
||||
@L1: lda (spc),y
|
||||
@L1: lda (c_sp),y
|
||||
sta ptr1,y
|
||||
dey
|
||||
bpl @L1
|
||||
|
||||
lda #4
|
||||
clc
|
||||
adc spc
|
||||
sta spc
|
||||
adc c_sp
|
||||
sta c_sp
|
||||
bcc @L2
|
||||
inc spc+1
|
||||
inc c_sp+1
|
||||
|
||||
@L2: jmp udiv32by16r16m
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _fprintf
|
||||
.import addysp, decsp4, _vfprintf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -38,9 +38,9 @@ _fprintf:
|
||||
; Calculate a pointer to the Format argument
|
||||
|
||||
lda ParamSize
|
||||
add spc
|
||||
add c_sp
|
||||
sta ptr1
|
||||
ldx spc+1
|
||||
ldx c_sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
@@ -49,7 +49,7 @@ _fprintf:
|
||||
|
||||
ldy #4-1
|
||||
@L2: lda (ptr1),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
bpl @L2
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
.import pushwysp
|
||||
.import tosumulax, tosudivax
|
||||
|
||||
.importzp ptr1, spc
|
||||
.importzp ptr1, c_sp
|
||||
|
||||
.include "errno.inc"
|
||||
.include "_file.inc"
|
||||
@@ -136,23 +136,23 @@
|
||||
; to read() by one, so read() starts to store data at buf+1.
|
||||
|
||||
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
||||
lda (spc)
|
||||
lda (c_sp)
|
||||
sta ptr1
|
||||
add #1
|
||||
sta (spc)
|
||||
sta (c_sp)
|
||||
ldy #1
|
||||
.else
|
||||
ldy #0
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1
|
||||
add #1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
.endif
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1+1
|
||||
adc #0
|
||||
sta (spc),y ; ptr1 = buf++;
|
||||
sta (c_sp),y ; ptr1 = buf++;
|
||||
|
||||
; Get the buffered character and place it as first character into the read
|
||||
; buffer.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _fscanf
|
||||
.import addysp, decsp4, _vfscanf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -50,9 +50,9 @@ _fscanf:
|
||||
; Calculate a pointer to the Format argument
|
||||
|
||||
lda ParamSize
|
||||
add spc
|
||||
add c_sp
|
||||
sta ptr1
|
||||
ldx spc+1
|
||||
ldx c_sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
@@ -61,7 +61,7 @@ _fscanf:
|
||||
|
||||
ldy #4-1
|
||||
@L2: lda (ptr1),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
bpl @L2
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ zpsave: .res zpsavespace
|
||||
; Set C level interrupt stack
|
||||
lda irqsp
|
||||
ldx irqsp+1
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Call C level interrupt request handler
|
||||
jsr irqvec
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.export _itoa, _utoa
|
||||
.import addysp1
|
||||
.import __hextab
|
||||
.importzp spc, sreg, ptr2, ptr3, tmp1
|
||||
.importzp c_sp, sreg, ptr2, ptr3, tmp1
|
||||
|
||||
.rodata
|
||||
specval:
|
||||
@@ -21,18 +21,18 @@ specval:
|
||||
|
||||
dopop: sta tmp1 ; will lose high byte
|
||||
ldy #0
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr2
|
||||
sta ptr3
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr2+1
|
||||
sta ptr3+1
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta sreg
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta sreg+1
|
||||
jmp addysp1 ; Bump stack pointer
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
.export _longjmp
|
||||
.import popptr1
|
||||
.importzp spc, ptr1, ptr2
|
||||
.importzp c_sp, ptr1, ptr2
|
||||
|
||||
_longjmp:
|
||||
sta ptr2 ; Save retval
|
||||
@@ -23,10 +23,10 @@ _longjmp:
|
||||
|
||||
lda (ptr1),y
|
||||
iny
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda (ptr1),y
|
||||
iny
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
; Get the old stack pointer
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
; }
|
||||
; }
|
||||
|
||||
.importzp spc, sreg, regsave, regbank
|
||||
.importzp c_sp, sreg, regsave, regbank
|
||||
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
|
||||
.macpack longbranch
|
||||
.import memcpy_upwards,pushax,popax
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
.export _memcpy, memcpy_upwards, memcpy_getparams
|
||||
.import popax, popptr1
|
||||
.importzp spc, ptr1, ptr2, ptr3
|
||||
.importzp c_sp, ptr1, ptr2, ptr3
|
||||
|
||||
; ----------------------------------------------------------------------
|
||||
_memcpy:
|
||||
@@ -70,10 +70,10 @@ memcpy_getparams: ; IMPORTANT! Function has to leave with Y=0!
|
||||
iny ; Y=0 guaranteed by popptr1, we need '1' here...
|
||||
; (direct stack access is three cycles faster
|
||||
; (total cycle count with return))
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
stx ptr2+1 ; save high byte of ptr2
|
||||
dey ; Y = 0
|
||||
lda (spc),y ; Get ptr2 low
|
||||
lda (c_sp),y ; Get ptr2 low
|
||||
sta ptr2
|
||||
rts
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
.export _memset, _bzero, ___bzero
|
||||
.import popax
|
||||
.importzp spc, ptr1, ptr2, ptr3
|
||||
.importzp c_sp, ptr1, ptr2, ptr3
|
||||
|
||||
_bzero:
|
||||
___bzero:
|
||||
@@ -36,10 +36,10 @@ _memset:
|
||||
|
||||
common: ; Fill value is in X!
|
||||
ldy #1
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1+1 ; save high byte of ptr
|
||||
dey ; Y = 0
|
||||
lda (spc),y ; Get ptr
|
||||
lda (c_sp),y ; Get ptr
|
||||
sta ptr1
|
||||
|
||||
lsr ptr3+1 ; divide number of
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _printf
|
||||
.import _stdout, pushax, addysp, _vfprintf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -43,8 +43,8 @@ _printf:
|
||||
|
||||
; Now calculate the va_list pointer, which does points to Format
|
||||
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
add ParamSize
|
||||
bcc @L1
|
||||
inx
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
; void* __fastcall__ realloc (void* block, register size_t size)
|
||||
;
|
||||
|
||||
.importzp ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, tmp4, spc
|
||||
.importzp ptr1, ptr2, ptr3, ptr4, tmp1, tmp2, tmp3, tmp4, c_sp
|
||||
.import _malloc, _memcpy, _free
|
||||
.import pushax, popptr1, return0
|
||||
.import incsp2, decsp2
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.export _scanf
|
||||
|
||||
.import _stdin, pushax, addysp, _vfscanf
|
||||
.import spc:zp, ptr1:zp
|
||||
.import c_sp:zp, ptr1:zp
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -34,8 +34,8 @@ _scanf:
|
||||
|
||||
; Now, calculate the va_list pointer, which does point to Format.
|
||||
|
||||
lda spc
|
||||
ldx spc+1
|
||||
lda c_sp
|
||||
ldx c_sp+1
|
||||
add ArgSize
|
||||
bcc @L1
|
||||
inx
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.export ___setjmp
|
||||
|
||||
.import return0
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
___setjmp:
|
||||
sta ptr1 ; Save buf
|
||||
@@ -17,10 +17,10 @@ ___setjmp:
|
||||
|
||||
; The parameter stack is now empty, put it into buf
|
||||
|
||||
lda spc
|
||||
lda c_sp
|
||||
sta (ptr1),y
|
||||
iny
|
||||
lda spc+1
|
||||
lda c_sp+1
|
||||
sta (ptr1),y
|
||||
iny
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _snprintf
|
||||
.import pushax, addysp, decsp6, _vsnprintf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -38,9 +38,9 @@ _snprintf:
|
||||
; Calculate a pointer to the Format argument
|
||||
|
||||
lda ParamSize
|
||||
add spc
|
||||
add c_sp
|
||||
sta ptr1
|
||||
ldx spc+1
|
||||
ldx c_sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
@@ -49,7 +49,7 @@ _snprintf:
|
||||
|
||||
ldy #6-1
|
||||
@L2: lda (ptr1),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
bpl @L2
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _sprintf
|
||||
.import pushax, addysp, decsp4, _vsprintf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -38,9 +38,9 @@ _sprintf:
|
||||
; Calculate a pointer to the Format argument
|
||||
|
||||
lda ParamSize
|
||||
add spc
|
||||
add c_sp
|
||||
sta ptr1
|
||||
ldx spc+1
|
||||
ldx c_sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
@@ -49,7 +49,7 @@ _sprintf:
|
||||
|
||||
ldy #4-1
|
||||
@L2: lda (ptr1),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
bpl @L2
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _sscanf
|
||||
.import addysp, decsp4, _vsscanf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -51,9 +51,9 @@ _sscanf:
|
||||
; Calculate a pointer to the fixed parameters
|
||||
|
||||
lda ParamSize
|
||||
add spc
|
||||
add c_sp
|
||||
sta ptr1
|
||||
ldx spc+1
|
||||
ldx c_sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
@@ -62,7 +62,7 @@ _sscanf:
|
||||
|
||||
ldy #4-1
|
||||
@L2: lda (ptr1),y
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
bpl @L2
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.export _vfprintf
|
||||
.import push1, pushwysp, incsp6
|
||||
.import _fwrite, __printf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -121,15 +121,15 @@ _vfprintf:
|
||||
; exactly as _printf expects it. Parameters will get dropped by _printf.
|
||||
|
||||
ldy #2
|
||||
lda (spc),y ; Low byte of f
|
||||
lda (c_sp),y ; Low byte of f
|
||||
sta ptr
|
||||
lda #<outdesc
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
lda (spc),y ; High byte of f
|
||||
lda (c_sp),y ; High byte of f
|
||||
sta ptr+1
|
||||
lda #>outdesc
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Restore low byte of ap and call _printf
|
||||
|
||||
|
||||
@@ -61,16 +61,16 @@ _vfscanf:
|
||||
; Swap f against &d on the stack, placing f into d.data
|
||||
|
||||
ldy #2 ; Offset of f on the stack
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta d + SCANFDATA::DATA
|
||||
lda #<d
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
iny ; High byte
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta d + SCANFDATA::DATA + 1
|
||||
lda #>d
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Restore the low byte of ap, and call the _scanf function
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.export _vprintf
|
||||
.import _vfprintf, _stdout
|
||||
.import decsp2
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
|
||||
|
||||
.proc _vprintf
|
||||
@@ -23,20 +23,20 @@
|
||||
; Move the format parameter down and store stdout in it's place
|
||||
|
||||
ldy #2
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
ldy #0
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
ldy #3
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
ldy #1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
iny
|
||||
lda _stdout
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
lda _stdout+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Restore A
|
||||
|
||||
|
||||
@@ -31,22 +31,22 @@ _vscanf:
|
||||
; Move the format down
|
||||
|
||||
ldy #2
|
||||
lda (spc),y ; Load byte of format
|
||||
lda (c_sp),y ; Load byte of format
|
||||
ldy #0
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
ldy #3
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
ldy #1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Store stdin into the stack frame
|
||||
|
||||
iny
|
||||
lda _stdin
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
lda _stdin+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Restore the low byte of ap and jump to vfscanf, which will cleanup the stack
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
.export _vsnprintf, vsnprintf
|
||||
.import ldaxysp, popax, incsp2, incsp6
|
||||
.import _memcpy, __printf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.include "errno.inc"
|
||||
|
||||
@@ -55,19 +55,19 @@ vsnprintf:
|
||||
; be formatted and counted.
|
||||
|
||||
ldy #2
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr1
|
||||
|
||||
lda #<outdesc
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
bmi L9 ; More than $7FFF
|
||||
sta ptr1+1
|
||||
|
||||
lda #>outdesc
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Write size-1 to outdesc.uns. It will be -1 if there is no buffer.
|
||||
|
||||
@@ -178,12 +178,12 @@ out:
|
||||
clc
|
||||
adc ccount+0
|
||||
ldy #4
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
lda bufptr+1
|
||||
adc ccount+1
|
||||
iny
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Get Count from stack
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
.export _vsscanf
|
||||
|
||||
.import popax, __scanf
|
||||
.importzp spc, ptr1, ptr2
|
||||
.importzp c_sp, ptr1, ptr2
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -165,15 +165,15 @@ d: .addr get
|
||||
; to d
|
||||
|
||||
ldy #2 ; Stack offset of str
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta sd + SSCANFDATA::STR
|
||||
lda #<d
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta sd + SSCANFDATA::STR+1
|
||||
lda #>d
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
lda #$00
|
||||
sta sd + SSCANFDATA::INDEX
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
.export _cprintf
|
||||
.import pushax, addysp, _vcprintf
|
||||
.importzp spc, ptr1
|
||||
.importzp c_sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
|
||||
@@ -31,9 +31,9 @@ _cprintf:
|
||||
dey
|
||||
dey ; Sub size of Format
|
||||
tya
|
||||
add spc
|
||||
add c_sp
|
||||
sta ptr1
|
||||
ldx spc+1
|
||||
ldx c_sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
|
||||
@@ -23,8 +23,8 @@ _cscanf:
|
||||
|
||||
; Now, calculate the va_list pointer -- which points to format.
|
||||
|
||||
ldx spc+1
|
||||
add spc
|
||||
ldx c_sp+1
|
||||
add c_sp
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: sta ptr1
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.export _vcprintf
|
||||
.import pushax, popax, popptr1
|
||||
.import __printf, _cputc
|
||||
.importzp spc, ptr1, ptr2, ptr3, tmp1
|
||||
.importzp c_sp, ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.macpack generic
|
||||
.macpack cpu
|
||||
@@ -138,10 +138,10 @@ _vcprintf:
|
||||
; Get the format parameter and push it again
|
||||
|
||||
ldy #1
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
jsr pushax
|
||||
|
||||
; Replace the passed format parameter on the stack by &d - this creates
|
||||
@@ -150,10 +150,10 @@ _vcprintf:
|
||||
|
||||
ldy #2 ; Low byte of d
|
||||
lda #<outdesc
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
iny
|
||||
lda #>outdesc
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
|
||||
; Restore ap and call _printf
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ entry:
|
||||
; Setup the argument stack ptr
|
||||
lda #<(__ZP_LAST__ + __STACKSIZE__)
|
||||
ldx #>(__ZP_LAST__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Call module constructors
|
||||
jsr initlib
|
||||
|
||||
@@ -80,8 +80,8 @@ init:
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta spc
|
||||
stx spc+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Switch to the lower/UPPER PetSCII charset.
|
||||
|
||||
|
||||
@@ -238,11 +238,11 @@ MOVE: php
|
||||
jsr CMOVEY ; Set it
|
||||
|
||||
ldy #$01
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos+1
|
||||
tax
|
||||
dey
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta XPos ; New X position
|
||||
jsr CMOVEX ; Move the cursor
|
||||
|
||||
|
||||
@@ -7,23 +7,23 @@
|
||||
.export _DbgMemDump
|
||||
.import addysp1
|
||||
.import __hextab
|
||||
.importzp spc, tmp2, tmp3, tmp4, ptr3, ptr4
|
||||
.importzp c_sp, tmp2, tmp3, tmp4, ptr3, ptr4
|
||||
|
||||
_DbgMemDump:
|
||||
ldy #0
|
||||
lda (spc),y ; Get length
|
||||
lda (c_sp),y ; Get length
|
||||
sta tmp4
|
||||
iny
|
||||
lda (spc),y ; Get the string buffer
|
||||
lda (c_sp),y ; Get the string buffer
|
||||
sta ptr3
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr3+1
|
||||
iny
|
||||
lda (spc),y ; Get the address
|
||||
lda (c_sp),y ; Get the address
|
||||
sta ptr4
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta ptr4+1
|
||||
jsr addysp1 ; Drop the parameters
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ DbgBreak:
|
||||
|
||||
jsr DbgSwapZP ; Swap stuff
|
||||
lda #<DbgStack ; Set new stack
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda #>DbgStack
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
jsr ResetDbgBreaks ; Reset temporary breakpoints
|
||||
jsr _DbgEntry ; Call C code
|
||||
jsr SetDbgBreaks ; Set temporary breakpoints
|
||||
@@ -61,7 +61,7 @@ DbgStack:
|
||||
; Swap space for the C temporaries
|
||||
|
||||
CTemp:
|
||||
_DbgCS: .res 2 ; spc
|
||||
_DbgCS: .res 2 ; c_sp
|
||||
_DbgHI: .res 2 ; sreg
|
||||
.res (zpsavespace-4) ; Other stuff
|
||||
|
||||
@@ -78,7 +78,7 @@ Swap1: ldx CTemp,y
|
||||
lda <__ZP_START__,y
|
||||
sta CTemp,y
|
||||
txa
|
||||
sta spc,y
|
||||
sta c_sp,y
|
||||
dey
|
||||
bpl Swap1
|
||||
rts
|
||||
|
||||
@@ -34,8 +34,8 @@ Start:
|
||||
; Set up the stack
|
||||
lda #<(__RAM_START__+__RAM_SIZE__)
|
||||
ldx #>(__RAM_START__+__RAM_SIZE__)
|
||||
sta spc
|
||||
stx spc + 1
|
||||
sta c_sp
|
||||
stx c_sp + 1
|
||||
|
||||
; Call module constructors
|
||||
jsr initlib
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
.export _mouse_move, _mouse_buttons
|
||||
|
||||
.import popsreg, addysp1
|
||||
.importzp spc, sreg, ptr1
|
||||
.importzp c_sp, sreg, ptr1
|
||||
|
||||
.include "const.inc"
|
||||
.include "jumptab.inc"
|
||||
@@ -87,22 +87,22 @@ _mouse_box:
|
||||
|
||||
sta mouseBottom
|
||||
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta mouseRight
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta mouseRight+1 ; maxx
|
||||
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta mouseTop
|
||||
iny ; Skip high byte
|
||||
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta mouseLeft
|
||||
iny
|
||||
lda (spc),y
|
||||
lda (c_sp),y
|
||||
sta mouseLeft+1 ; minx
|
||||
|
||||
jmp addysp1 ; Drop params, return
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
.import initlib, donelib
|
||||
.import callmain
|
||||
.import zerobss
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
|
||||
.include "jumptab.inc"
|
||||
.include "geossym.inc"
|
||||
@@ -48,8 +48,8 @@
|
||||
|
||||
lda #<(__STACKADDR__ + __STACKSIZE__)
|
||||
ldx #>(__STACKADDR__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ _init: cld ; Clear decimal mode
|
||||
; Set cc65 argument stack pointer
|
||||
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda #>(__RAM_START__ + __RAM_SIZE__)
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
; Initialize memory storage
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$2
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Init Mickey.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
;
|
||||
; off_t __fastcall__ lseek(int fd, off_t offset, int whence);
|
||||
|
||||
.importzp spc, sreg, regsave, regbank, tmp1, ptr1, ptr2
|
||||
.importzp c_sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
|
||||
.macpack longbranch
|
||||
.export _lseek
|
||||
.import addysp, stax0sp, tosand0ax, pusheax, asreax2
|
||||
|
||||
@@ -107,8 +107,8 @@ start:
|
||||
|
||||
lda #<(__SRAM_START__ + __SRAM_SIZE__)
|
||||
ldx #>(__SRAM_START__ + __SRAM_SIZE__)
|
||||
sta spc
|
||||
stx spc+1 ; Set argument stack ptr
|
||||
sta c_sp
|
||||
stx c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
lda #<__STACKSTART__
|
||||
ldx #>__STACKSTART__
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
jsr zerobss
|
||||
jsr initlib
|
||||
jsr _main
|
||||
|
||||
@@ -34,8 +34,8 @@ _init: ldx #$FF ; Initialize stack pointer to $01FF
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Initialize memory storage
|
||||
|
||||
@@ -329,22 +329,22 @@ MainLoop:
|
||||
jsr decsp6 ; 3 args
|
||||
ldy #5
|
||||
lda OutData+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda OutData
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FSave+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FSave
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FCount+1
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
dey
|
||||
lda FCount
|
||||
sta (spc),y
|
||||
sta (c_sp),y
|
||||
jsr CallOutFunc ; Call the output function
|
||||
|
||||
; We're back from out(), or we didn't call it. Check for end of string.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
.import initlib, donelib
|
||||
.import push0, _main
|
||||
.import IRQStub, __nmi
|
||||
.importzp spc
|
||||
.importzp c_sp
|
||||
|
||||
; Linker-generated
|
||||
.import __CARTSIZE__
|
||||
@@ -86,8 +86,8 @@ start: sei
|
||||
; Set up the stack
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Call the module constructors.
|
||||
jsr initlib
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
.export memcpy_increment, memcpy_transfer, memcpy_getparams
|
||||
|
||||
.import incsp2, popax, popptr1
|
||||
.importzp spc, ptr1, ptr2, ptr3
|
||||
.importzp c_sp, ptr1, ptr2, ptr3
|
||||
|
||||
|
||||
; The structure of the transfer instructions
|
||||
@@ -86,9 +86,9 @@ memcpy_getparams:
|
||||
; (Direct stack access is six cycles faster [total cycle count].)
|
||||
|
||||
iny ; (Y=0 by popptr1, need '1' here) save dest
|
||||
lda (spc),y ; get high byte
|
||||
lda (c_sp),y ; get high byte
|
||||
tax
|
||||
lda (spc) ; get low byte
|
||||
lda (c_sp) ; get low byte
|
||||
sta ptr2
|
||||
stx ptr2+1
|
||||
rts ; return dest address (for memmove)
|
||||
|
||||
@@ -23,7 +23,7 @@ Start:
|
||||
; Save the zero-page locations that we need.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda spc,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -52,9 +52,9 @@ L1: lda spc,x
|
||||
stx spsave ; Save the system stack ptr
|
||||
|
||||
lda MEMSIZE
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda MEMSIZE+1
|
||||
sta spc+1 ; Set argument stack ptr
|
||||
sta c_sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
@@ -73,7 +73,7 @@ _exit: pha ; Save the return code on stack
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ Start:
|
||||
sei ; No interrupts since we're banking out the ROM
|
||||
sta ENABLE_RAM
|
||||
ldx #zpspace-1
|
||||
L1: lda spc,x
|
||||
L1: lda c_sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
@@ -54,8 +54,8 @@ L1: lda spc,x
|
||||
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||
sta spc
|
||||
stx spc+1
|
||||
sta c_sp
|
||||
stx c_sp+1
|
||||
|
||||
; Set up the IRQ vector in the banked RAM; and, switch off the ROM.
|
||||
|
||||
@@ -99,7 +99,7 @@ _exit: pha ; Save the return code
|
||||
|
||||
ldx #zpspace-1
|
||||
L2: lda zpsave,x
|
||||
sta spc,x
|
||||
sta c_sp,x
|
||||
dex
|
||||
bpl L2
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ _init:
|
||||
|
||||
; Set cc65 argument stack pointer
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||
sta spc
|
||||
sta c_sp
|
||||
lda #>(__RAM_START__ + __RAM_SIZE__)
|
||||
sta spc+1
|
||||
sta c_sp+1
|
||||
|
||||
; Initialize memory storage
|
||||
jsr zerobss ; Clear BSS segment
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user