;
.export decsp2
- .importzp sp
+ .importzp sp
.proc decsp2
- ldy sp
- beq @L1
- dey
- beq @L2
- dey
- sty sp
- rts
-
-@L1: dey
-@L2: dey
- sty sp
- dec sp+1
+ lda sp
+ sec
+ sbc #2
+ sta sp
+ bcc @L1
+ rts
+
+@L1: dec sp+1
rts
.endproc
-
-
+
+
;
.export decsp3
- .import subysp
+ .importzp sp
.proc decsp3
- ldy #3
- jmp subysp
+ lda sp
+ sec
+ sbc #3
+ sta sp
+ bcc @L1
+ rts
+
+@L1: dec sp+1
+ rts
.endproc
-
+
;
.export decsp4
- .import subysp
+ .importzp sp
.proc decsp4
- ldy #4
- jmp subysp
+ lda sp
+ sec
+ sbc #4
+ sta sp
+ bcc @L1
+ rts
+
+@L1: dec sp+1
+ rts
.endproc
-
+
;
.export decsp5
- .import subysp
+ .importzp sp
.proc decsp5
- ldy #5
- jmp subysp
+ lda sp
+ sec
+ sbc #5
+ sta sp
+ bcc @L1
+ rts
+
+@L1: dec sp+1
+ rts
.endproc
-
+
;
.export decsp6
- .import subysp
+ .importzp sp
.proc decsp6
- ldy #6
- jmp subysp
+ lda sp
+ sec
+ sbc #6
+ sta sp
+ bcc @L1
+ rts
+
+@L1: dec sp+1
+ rts
.endproc
-
+
;
.export decsp7
- .import subysp
+ .importzp sp
.proc decsp7
- ldy #7
- jmp subysp
+ lda sp
+ sec
+ sbc #7
+ sta sp
+ bcc @L1
+ rts
-.endproc
+@L1: dec sp+1
+ rts
+.endproc
-
.proc subysp
- pha ; Save A
sty tmp1 ; Save the value
lda sp ; Get lo byte
sec
sta sp ; Put result back
bcs @L1
dec sp+1
-@L1: pla ; Restore A
- rts ; Done
+@L1: rts ; Done
.endproc
-
+