mirror of
https://github.com/cc65/cc65.git
synced 2025-02-21 20:29:17 +00:00
More module splits
git-svn-id: svn://svn.cc65.org/cc65/trunk@393 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
e3a8e6bbe4
commit
dd0ddc94e3
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
OBJS = add.o \
|
OBJS = add.o \
|
||||||
addeqsp.o \
|
addeqsp.o \
|
||||||
|
addysp.o \
|
||||||
and.o \
|
and.o \
|
||||||
aslax1.o \
|
aslax1.o \
|
||||||
aslax2.o \
|
aslax2.o \
|
||||||
@ -33,6 +34,14 @@ OBJS = add.o \
|
|||||||
call.o \
|
call.o \
|
||||||
compl.o \
|
compl.o \
|
||||||
dec.o \
|
dec.o \
|
||||||
|
decsp1.o \
|
||||||
|
decsp2.o \
|
||||||
|
decsp3.o \
|
||||||
|
decsp4.o \
|
||||||
|
decsp5.o \
|
||||||
|
decsp6.o \
|
||||||
|
decsp7.o \
|
||||||
|
decsp8.o \
|
||||||
div.o \
|
div.o \
|
||||||
enter.o \
|
enter.o \
|
||||||
eq.o \
|
eq.o \
|
||||||
@ -40,6 +49,14 @@ OBJS = add.o \
|
|||||||
gt.o \
|
gt.o \
|
||||||
icmp.o \
|
icmp.o \
|
||||||
inc.o \
|
inc.o \
|
||||||
|
incsp1.o \
|
||||||
|
incsp2.o \
|
||||||
|
incsp3.o \
|
||||||
|
incsp4.o \
|
||||||
|
incsp5.o \
|
||||||
|
incsp6.o \
|
||||||
|
incsp7.o \
|
||||||
|
incsp8.o \
|
||||||
ladd.o \
|
ladd.o \
|
||||||
laddeq.o \
|
laddeq.o \
|
||||||
laddeqsp.o \
|
laddeqsp.o \
|
||||||
@ -84,7 +101,7 @@ OBJS = add.o \
|
|||||||
lsubeqsp.o \
|
lsubeqsp.o \
|
||||||
lswap.o \
|
lswap.o \
|
||||||
lswitch.o \
|
lswitch.o \
|
||||||
lt.o \
|
lt.o \
|
||||||
ltest.o \
|
ltest.o \
|
||||||
ludiv.o \
|
ludiv.o \
|
||||||
luge.o \
|
luge.o \
|
||||||
@ -96,15 +113,18 @@ OBJS = add.o \
|
|||||||
makebool.o \
|
makebool.o \
|
||||||
mod.o \
|
mod.o \
|
||||||
mul.o \
|
mul.o \
|
||||||
ne.o \
|
ne.o \
|
||||||
neg.o \
|
neg.o \
|
||||||
or.o \
|
or.o \
|
||||||
|
popa.o \
|
||||||
popsreg.o \
|
popsreg.o \
|
||||||
push.o \
|
push.o \
|
||||||
pushb.o \
|
pushb.o \
|
||||||
pushbsp.o \
|
pushbsp.o \
|
||||||
pushw.o \
|
pushw.o \
|
||||||
pushwsp.o \
|
pushwsp.o \
|
||||||
|
return0.o \
|
||||||
|
return1.o \
|
||||||
rsub.o \
|
rsub.o \
|
||||||
runtime.o \
|
runtime.o \
|
||||||
shelp.o \
|
shelp.o \
|
||||||
@ -116,10 +136,13 @@ OBJS = add.o \
|
|||||||
shreax1.o \
|
shreax1.o \
|
||||||
shreax2.o \
|
shreax2.o \
|
||||||
shreax3.o \
|
shreax3.o \
|
||||||
|
staspp.o \
|
||||||
staxsp.o \
|
staxsp.o \
|
||||||
|
staxspp.o \
|
||||||
steaxsp.o \
|
steaxsp.o \
|
||||||
sub.o \
|
sub.o \
|
||||||
subeqsp.o \
|
subeqsp.o \
|
||||||
|
subysp.o \
|
||||||
swap.o \
|
swap.o \
|
||||||
switch.o \
|
switch.o \
|
||||||
test.o \
|
test.o \
|
||||||
@ -136,6 +159,6 @@ OBJS = add.o \
|
|||||||
all: $(OBJS)
|
all: $(OBJS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -f *~ $(COBJS:.o=.s) $(OBJS) $(LOBJS)
|
@rm -f *~ $(COBJS:.o=.s) $(OBJS)
|
||||||
|
|
||||||
|
|
||||||
|
21
libsrc/runtime/addysp.s
Normal file
21
libsrc/runtime/addysp.s
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by value in y
|
||||||
|
;
|
||||||
|
|
||||||
|
.export addysp1, addysp
|
||||||
|
.importzp sp
|
||||||
|
|
||||||
|
addysp1:
|
||||||
|
iny
|
||||||
|
addysp: pha ; Save A
|
||||||
|
clc
|
||||||
|
tya ; Get the value
|
||||||
|
adc sp ; Add low byte
|
||||||
|
sta sp ; Put it back
|
||||||
|
bcc @L1 ; If no carry, we're done
|
||||||
|
inc sp+1 ; Inc high byte
|
||||||
|
@L1: pla ; Restore A
|
||||||
|
rts
|
||||||
|
|
23
libsrc/runtime/decsp1.s
Normal file
23
libsrc/runtime/decsp1.s
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 1
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp1
|
||||||
|
.importzp sp
|
||||||
|
|
||||||
|
.proc decsp1
|
||||||
|
|
||||||
|
ldy sp
|
||||||
|
bne @L1
|
||||||
|
dec sp+1
|
||||||
|
@L1: dec sp
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
31
libsrc/runtime/decsp2.s
Normal file
31
libsrc/runtime/decsp2.s
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 2
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp2
|
||||||
|
.importzp sp
|
||||||
|
|
||||||
|
.proc decsp2
|
||||||
|
|
||||||
|
ldy sp
|
||||||
|
beq @L1
|
||||||
|
dey
|
||||||
|
beq @L2
|
||||||
|
dey
|
||||||
|
sty sp
|
||||||
|
rts
|
||||||
|
|
||||||
|
@L1: dey
|
||||||
|
@L2: dey
|
||||||
|
sty sp
|
||||||
|
dec sp+1
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/decsp3.s
Normal file
20
libsrc/runtime/decsp3.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 3
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp3
|
||||||
|
.import subysp
|
||||||
|
|
||||||
|
.proc decsp3
|
||||||
|
|
||||||
|
ldy #3
|
||||||
|
jmp subysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/decsp4.s
Normal file
20
libsrc/runtime/decsp4.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 4
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp4
|
||||||
|
.import subysp
|
||||||
|
|
||||||
|
.proc decsp4
|
||||||
|
|
||||||
|
ldy #4
|
||||||
|
jmp subysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/decsp5.s
Normal file
20
libsrc/runtime/decsp5.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 5
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp5
|
||||||
|
.import subysp
|
||||||
|
|
||||||
|
.proc decsp5
|
||||||
|
|
||||||
|
ldy #5
|
||||||
|
jmp subysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/decsp6.s
Normal file
20
libsrc/runtime/decsp6.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 6
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp6
|
||||||
|
.import subysp
|
||||||
|
|
||||||
|
.proc decsp6
|
||||||
|
|
||||||
|
ldy #6
|
||||||
|
jmp subysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/decsp7.s
Normal file
20
libsrc/runtime/decsp7.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 7
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp7
|
||||||
|
.import subysp
|
||||||
|
|
||||||
|
.proc decsp7
|
||||||
|
|
||||||
|
ldy #7
|
||||||
|
jmp subysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/decsp8.s
Normal file
20
libsrc/runtime/decsp8.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by 8
|
||||||
|
;
|
||||||
|
|
||||||
|
.export decsp8
|
||||||
|
.import subysp
|
||||||
|
|
||||||
|
.proc decsp8
|
||||||
|
|
||||||
|
ldy #8
|
||||||
|
jmp subysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
22
libsrc/runtime/incsp1.s
Normal file
22
libsrc/runtime/incsp1.s
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 1
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp1
|
||||||
|
.importzp sp
|
||||||
|
|
||||||
|
.proc incsp1
|
||||||
|
|
||||||
|
inc sp
|
||||||
|
bne @L1
|
||||||
|
inc sp+1
|
||||||
|
@L1: rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
44
libsrc/runtime/incsp2.s
Normal file
44
libsrc/runtime/incsp2.s
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 2. For performance reasons,
|
||||||
|
; this modules does also contain the popax function.
|
||||||
|
|
||||||
|
.export popax, incsp2
|
||||||
|
.importzp sp
|
||||||
|
|
||||||
|
; Pop a/x from stack. This function will run directly into incsp2
|
||||||
|
|
||||||
|
.proc popax
|
||||||
|
|
||||||
|
ldy #1
|
||||||
|
lda (sp),y ; get hi byte
|
||||||
|
tax ; into x
|
||||||
|
dey
|
||||||
|
lda (sp),y ; get lo byte
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.proc incsp2
|
||||||
|
|
||||||
|
ldy sp ; 3
|
||||||
|
iny ; 2
|
||||||
|
beq @L1 ; 2
|
||||||
|
iny ; 2
|
||||||
|
beq @L2 ; 2
|
||||||
|
sty sp ; 3
|
||||||
|
rts
|
||||||
|
|
||||||
|
@L1: iny ; 2
|
||||||
|
@L2: sty sp ; 3
|
||||||
|
inc sp+1 ; 5
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/incsp3.s
Normal file
20
libsrc/runtime/incsp3.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 3
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp3
|
||||||
|
.import addysp
|
||||||
|
|
||||||
|
.proc incsp3
|
||||||
|
|
||||||
|
ldy #3
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/incsp4.s
Normal file
20
libsrc/runtime/incsp4.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 4
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp4
|
||||||
|
.import addysp
|
||||||
|
|
||||||
|
.proc incsp4
|
||||||
|
|
||||||
|
ldy #4
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/incsp5.s
Normal file
20
libsrc/runtime/incsp5.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 5
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp5
|
||||||
|
.import addysp
|
||||||
|
|
||||||
|
.proc incsp5
|
||||||
|
|
||||||
|
ldy #5
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/incsp6.s
Normal file
20
libsrc/runtime/incsp6.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 6
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp6
|
||||||
|
.import addysp
|
||||||
|
|
||||||
|
.proc incsp6
|
||||||
|
|
||||||
|
ldy #6
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/incsp7.s
Normal file
20
libsrc/runtime/incsp7.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 7
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp7
|
||||||
|
.import addysp
|
||||||
|
|
||||||
|
.proc incsp7
|
||||||
|
|
||||||
|
ldy #7
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
17
libsrc/runtime/incsp8.s
Normal file
17
libsrc/runtime/incsp8.s
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Increment the stackpointer by 8
|
||||||
|
;
|
||||||
|
|
||||||
|
.export incsp8
|
||||||
|
.import addysp
|
||||||
|
|
||||||
|
.proc incsp8
|
||||||
|
|
||||||
|
ldy #8
|
||||||
|
jmp addysp
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
21
libsrc/runtime/popa.s
Normal file
21
libsrc/runtime/popa.s
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Pop a from stack
|
||||||
|
;
|
||||||
|
|
||||||
|
.export popa
|
||||||
|
.importzp sp
|
||||||
|
|
||||||
|
.proc popa
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
lda (sp),y ; Read byte
|
||||||
|
inc sp
|
||||||
|
bne @L1
|
||||||
|
inc sp+1
|
||||||
|
@L1: rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/return0.s
Normal file
20
libsrc/runtime/return0.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Return 0 in a/x
|
||||||
|
;
|
||||||
|
|
||||||
|
.export return0
|
||||||
|
|
||||||
|
.proc return0
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
tax
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
libsrc/runtime/return1.s
Normal file
20
libsrc/runtime/return1.s
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Return 1 in a/x
|
||||||
|
;
|
||||||
|
|
||||||
|
.export return1
|
||||||
|
|
||||||
|
.proc return1
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
lda #1
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3,164 +3,10 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
.import ldai, ldaxi, pushax
|
.import popax
|
||||||
.importzp sp, tmp1, tmp2, tmp3, ptr1, ptr4
|
.importzp tmp1, tmp2, tmp3, ptr4
|
||||||
|
|
||||||
|
|
||||||
; Pop a from stack
|
|
||||||
.export popa
|
|
||||||
|
|
||||||
popa: ldy #0
|
|
||||||
lda (sp),y ; Read byte
|
|
||||||
inc sp
|
|
||||||
bne *+4
|
|
||||||
inc sp+1
|
|
||||||
rts
|
|
||||||
|
|
||||||
;
|
|
||||||
; pop a from stack and load x with zero
|
|
||||||
;
|
|
||||||
|
|
||||||
.export popa0
|
|
||||||
|
|
||||||
popa0: ldy #0
|
|
||||||
lda (sp),y ; load low byte
|
|
||||||
ldx #0
|
|
||||||
beq incsp2
|
|
||||||
|
|
||||||
;
|
|
||||||
; pop a/x from stack. This function will run directly into incsp2
|
|
||||||
;
|
|
||||||
|
|
||||||
.export popax ; pop stack into AX
|
|
||||||
|
|
||||||
popax: ldy #1
|
|
||||||
lda (sp),y ; get hi byte
|
|
||||||
tax ; into x
|
|
||||||
dey
|
|
||||||
lda (sp),y ; get lo byte
|
|
||||||
|
|
||||||
;
|
|
||||||
; routines for inc/dec'ing sp
|
|
||||||
;
|
|
||||||
|
|
||||||
.export addysp, addysp1
|
|
||||||
.export incsp1, incsp2, incsp3, incsp4
|
|
||||||
.export incsp5, incsp6, incsp7, incsp8
|
|
||||||
|
|
||||||
; do this by hand, cause it gets used a lot
|
|
||||||
|
|
||||||
incsp2: ldy sp ; 3
|
|
||||||
iny ; 2
|
|
||||||
beq @L1 ; 2
|
|
||||||
iny ; 2
|
|
||||||
beq @L2 ; 2
|
|
||||||
sty sp ; 3
|
|
||||||
rts
|
|
||||||
|
|
||||||
@L1: iny ; 2
|
|
||||||
@L2: sty sp ; 3
|
|
||||||
inc sp+1 ; 5
|
|
||||||
rts
|
|
||||||
|
|
||||||
; Hand optimize this one also...
|
|
||||||
|
|
||||||
incsp1: inc sp
|
|
||||||
bne *+4
|
|
||||||
inc sp+1
|
|
||||||
rts
|
|
||||||
|
|
||||||
incsp3: ldy #3
|
|
||||||
bne addysp
|
|
||||||
|
|
||||||
incsp4: ldy #4
|
|
||||||
bne addysp
|
|
||||||
|
|
||||||
incsp5: ldy #5
|
|
||||||
bne addysp
|
|
||||||
|
|
||||||
incsp6: ldy #6
|
|
||||||
bne addysp
|
|
||||||
|
|
||||||
incsp7: ldy #7
|
|
||||||
bne addysp
|
|
||||||
|
|
||||||
incsp8: ldy #8
|
|
||||||
bne addysp
|
|
||||||
|
|
||||||
addysp1:
|
|
||||||
iny
|
|
||||||
addysp: pha ; save A
|
|
||||||
clc
|
|
||||||
tya ; get the value
|
|
||||||
adc sp ; add lo byte
|
|
||||||
sta sp ; put it back
|
|
||||||
bcc addysp_1 ; if no carry, we're done
|
|
||||||
inc sp+1 ; inc hi byte
|
|
||||||
addysp_1:
|
|
||||||
pla ; get A back
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
;
|
|
||||||
.export subysp ; sub Y from SP
|
|
||||||
.export decsp1, decsp2, decsp3, decsp4
|
|
||||||
.export decsp5, decsp6, decsp7, decsp8
|
|
||||||
|
|
||||||
; Do this one by hand, cause it gets used a lot
|
|
||||||
|
|
||||||
decsp2: ldy sp
|
|
||||||
beq @L1
|
|
||||||
dey
|
|
||||||
beq @L2
|
|
||||||
dey
|
|
||||||
sty sp
|
|
||||||
rts
|
|
||||||
|
|
||||||
@L1: dey
|
|
||||||
@L2: dey
|
|
||||||
sty sp
|
|
||||||
dec sp+1
|
|
||||||
rts
|
|
||||||
|
|
||||||
; Decrement by 1 also done as fast as possible
|
|
||||||
|
|
||||||
decsp1: ldy sp
|
|
||||||
bne *+4
|
|
||||||
dec sp+1
|
|
||||||
dec sp
|
|
||||||
rts
|
|
||||||
|
|
||||||
decsp3: ldy #3
|
|
||||||
bne subysp
|
|
||||||
|
|
||||||
decsp4: ldy #4
|
|
||||||
bne subysp
|
|
||||||
|
|
||||||
decsp5: ldy #5
|
|
||||||
bne subysp
|
|
||||||
|
|
||||||
decsp6: ldy #6
|
|
||||||
bne subysp
|
|
||||||
|
|
||||||
decsp7: ldy #7
|
|
||||||
bne subysp
|
|
||||||
|
|
||||||
decsp8: ldy #8
|
|
||||||
; bne subysp
|
|
||||||
|
|
||||||
subysp: pha ; save A
|
|
||||||
sty tmp1 ; save the value
|
|
||||||
lda sp ; get lo byte
|
|
||||||
sec
|
|
||||||
sbc tmp1 ; sub y val
|
|
||||||
sta sp ; put it back
|
|
||||||
bcs *+4
|
|
||||||
dec sp+1
|
|
||||||
pla ; get A back
|
|
||||||
rts ; done
|
|
||||||
|
|
||||||
;
|
;
|
||||||
; Various kinds of store operators
|
; Various kinds of store operators
|
||||||
;
|
;
|
||||||
@ -193,73 +39,3 @@ staspic:
|
|||||||
sta (ptr4),y
|
sta (ptr4),y
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; ax --> (sp),y
|
|
||||||
|
|
||||||
|
|
||||||
.export staxspp ; store AX thru (sp), and pop
|
|
||||||
staxspp:
|
|
||||||
ldy #0
|
|
||||||
pha
|
|
||||||
lda (sp),y
|
|
||||||
sta ptr1
|
|
||||||
iny
|
|
||||||
lda (sp),y
|
|
||||||
sta ptr1+1
|
|
||||||
txa
|
|
||||||
sta (ptr1),y
|
|
||||||
pla
|
|
||||||
dey
|
|
||||||
sta (ptr1),y
|
|
||||||
jmp incsp2 ; Drop address
|
|
||||||
|
|
||||||
|
|
||||||
.export staspp ; store A thru (sp), and pop
|
|
||||||
staspp:
|
|
||||||
ldy #1
|
|
||||||
pha
|
|
||||||
lda (sp),y
|
|
||||||
sta ptr1+1
|
|
||||||
dey
|
|
||||||
lda (sp),y
|
|
||||||
sta ptr1
|
|
||||||
pla
|
|
||||||
sta (ptr1),y
|
|
||||||
jmp incsp2 ; Drop address
|
|
||||||
|
|
||||||
|
|
||||||
;
|
|
||||||
; Boolean function return entries.
|
|
||||||
;
|
|
||||||
|
|
||||||
.export return0, return1
|
|
||||||
|
|
||||||
return1:
|
|
||||||
ldx #0
|
|
||||||
lda #1
|
|
||||||
rts
|
|
||||||
|
|
||||||
return0:
|
|
||||||
lda #0
|
|
||||||
tax
|
|
||||||
rts
|
|
||||||
|
|
||||||
;
|
|
||||||
; random stuff
|
|
||||||
;
|
|
||||||
|
|
||||||
; (a/x) 16--> (--sp)
|
|
||||||
|
|
||||||
.export pushwaxi
|
|
||||||
pushwaxi: ; push word at (ax)
|
|
||||||
jsr ldaxi
|
|
||||||
jmp pushax
|
|
||||||
|
|
||||||
; (a/x) 8--> (--sp)
|
|
||||||
|
|
||||||
.export pushbaxi ; push byte at (ax)
|
|
||||||
pushbaxi:
|
|
||||||
jsr ldai
|
|
||||||
jmp pushax
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
26
libsrc/runtime/staspp.s
Normal file
26
libsrc/runtime/staspp.s
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Store a indirect into address at top of stack
|
||||||
|
;
|
||||||
|
|
||||||
|
.export staspp
|
||||||
|
.import incsp2
|
||||||
|
.importzp sp, ptr1
|
||||||
|
|
||||||
|
.proc staspp
|
||||||
|
|
||||||
|
ldy #1
|
||||||
|
pha
|
||||||
|
lda (sp),y
|
||||||
|
sta ptr1+1
|
||||||
|
dey
|
||||||
|
lda (sp),y
|
||||||
|
sta ptr1
|
||||||
|
pla
|
||||||
|
sta (ptr1),y
|
||||||
|
jmp incsp2 ; Drop address
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
29
libsrc/runtime/staxspp.s
Normal file
29
libsrc/runtime/staxspp.s
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Store a/x indirect into address at top of stack
|
||||||
|
;
|
||||||
|
|
||||||
|
.export staxspp
|
||||||
|
.import incsp2
|
||||||
|
.importzp sp, ptr1
|
||||||
|
|
||||||
|
.proc staxspp
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
pha
|
||||||
|
lda (sp),y
|
||||||
|
sta ptr1
|
||||||
|
iny
|
||||||
|
lda (sp),y
|
||||||
|
sta ptr1+1
|
||||||
|
txa
|
||||||
|
sta (ptr1),y
|
||||||
|
pla
|
||||||
|
dey
|
||||||
|
sta (ptr1),y
|
||||||
|
jmp incsp2 ; Drop address
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
28
libsrc/runtime/subysp.s
Normal file
28
libsrc/runtime/subysp.s
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 25.10.2000
|
||||||
|
;
|
||||||
|
; CC65 runtime: Decrement the stackpointer by value in y
|
||||||
|
;
|
||||||
|
|
||||||
|
.export subysp
|
||||||
|
.importzp sp, tmp1
|
||||||
|
|
||||||
|
.proc subysp
|
||||||
|
|
||||||
|
pha ; Save A
|
||||||
|
sty tmp1 ; Save the value
|
||||||
|
lda sp ; Get lo byte
|
||||||
|
sec
|
||||||
|
sbc tmp1 ; Subtract y value
|
||||||
|
sta sp ; Put result back
|
||||||
|
bcs @L1
|
||||||
|
dec sp+1
|
||||||
|
@L1: pla ; Restore A
|
||||||
|
rts ; Done
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user