]> git.sur5r.net Git - cc65/commitdiff
Rewrite the decsp and subysp functions now since they are used more often.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 24 Mar 2001 16:15:01 +0000 (16:15 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 24 Mar 2001 16:15:01 +0000 (16:15 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@665 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/runtime/decsp2.s
libsrc/runtime/decsp3.s
libsrc/runtime/decsp4.s
libsrc/runtime/decsp5.s
libsrc/runtime/decsp6.s
libsrc/runtime/decsp7.s
libsrc/runtime/subysp.s

index 86536c83ddb7ab6c94334b0af1591545fd2aefe2..c92da4d31d9fbe6427a8cfe925f7db6145db996a 100644 (file)
@@ -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
-       
 
 
 
-       
+
+
index 0b81bea7c43a2510b26fd4ddad93a7f103cf6026..9401c3dc538fa731bcf29d98fbd2a48b0d09a22c 100644 (file)
@@ -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
 
 
 
 
-       
+
index e2220bf7424e06489cc6d136add4020c6542032c..8513390723778b2dce9e66e184f03a04c92e9d95 100644 (file)
@@ -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
 
 
 
 
-       
+
index bece7415c80e60aec3575cfdb9bde48562b98f44..0519bf480f874613aca211c13b23fce86c8229b1 100644 (file)
@@ -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
 
 
 
 
-       
+
index 964320b40e2937ec519258247d22fe5c3d1ea5b5..31d6ec9dc44df5d0836d04c287e3d52d1487bbfc 100644 (file)
@@ -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
 
 
 
 
-       
+
index 080c9b0c5774adf1c8d1125133b85a7c7686cb1c..249b00baa9442821452a398d02a8bd5b875ab1c1 100644 (file)
@@ -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
 
 
 
-       
index b173daf69298fb8cfaa20217d5ae23895f79c890..e2bbd5fc6d73ee9a2a515eca476816e713c721fb 100644 (file)
@@ -9,7 +9,6 @@
 
 .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
 
 
 
 
-       
+