From: cuz Date: Sat, 24 Mar 2001 16:15:01 +0000 (+0000) Subject: Rewrite the decsp and subysp functions now since they are used more often. X-Git-Tag: V2.12.0~2897 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1e1199cb2b29cd600689075b13fc3f0d8c6cdd4d;p=cc65 Rewrite the decsp and subysp functions now since they are used more often. git-svn-id: svn://svn.cc65.org/cc65/trunk@665 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/runtime/decsp2.s b/libsrc/runtime/decsp2.s index 86536c83d..c92da4d31 100644 --- a/libsrc/runtime/decsp2.s +++ b/libsrc/runtime/decsp2.s @@ -5,27 +5,23 @@ ; .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 - - + + diff --git a/libsrc/runtime/decsp3.s b/libsrc/runtime/decsp3.s index 0b81bea7c..9401c3dc5 100644 --- a/libsrc/runtime/decsp3.s +++ b/libsrc/runtime/decsp3.s @@ -5,16 +5,23 @@ ; .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 - + diff --git a/libsrc/runtime/decsp4.s b/libsrc/runtime/decsp4.s index e2220bf74..851339072 100644 --- a/libsrc/runtime/decsp4.s +++ b/libsrc/runtime/decsp4.s @@ -5,16 +5,23 @@ ; .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 - + diff --git a/libsrc/runtime/decsp5.s b/libsrc/runtime/decsp5.s index bece7415c..0519bf480 100644 --- a/libsrc/runtime/decsp5.s +++ b/libsrc/runtime/decsp5.s @@ -5,16 +5,23 @@ ; .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 - + diff --git a/libsrc/runtime/decsp6.s b/libsrc/runtime/decsp6.s index 964320b40..31d6ec9dc 100644 --- a/libsrc/runtime/decsp6.s +++ b/libsrc/runtime/decsp6.s @@ -5,16 +5,23 @@ ; .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 - + diff --git a/libsrc/runtime/decsp7.s b/libsrc/runtime/decsp7.s index 080c9b0c5..249b00baa 100644 --- a/libsrc/runtime/decsp7.s +++ b/libsrc/runtime/decsp7.s @@ -5,16 +5,21 @@ ; .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 - diff --git a/libsrc/runtime/subysp.s b/libsrc/runtime/subysp.s index b173daf69..e2bbd5fc6 100644 --- a/libsrc/runtime/subysp.s +++ b/libsrc/runtime/subysp.s @@ -9,7 +9,6 @@ .proc subysp - pha ; Save A sty tmp1 ; Save the value lda sp ; Get lo byte sec @@ -17,12 +16,11 @@ sta sp ; Put result back bcs @L1 dec sp+1 -@L1: pla ; Restore A - rts ; Done +@L1: rts ; Done .endproc - +