]> git.sur5r.net Git - cc65/commitdiff
Squeeze one cycle and several bytes out of the pushax routine.
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 24 Mar 2001 16:25:08 +0000 (16:25 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 24 Mar 2001 16:25:08 +0000 (16:25 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@666 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/runtime/pushax.s

index 24029fe6b21be45e5b914ec5ba0a069772956dd8..22b71e0596794d8c4f9cf1594b00264665c6ff1e 100644 (file)
@@ -15,33 +15,21 @@ pusha0:     ldx     #0
 ; Beware^2: The optimizer knows about the value of Y after the function
 ;           returns!
 
-pushax:        ldy     sp
-               beq     @L1
-               dey
-               beq     @L2
-               dey
-@L0:   sty     sp
-.ifpc02
-       sta     (sp)            ; 65C02 version - saves 2 cycles and one byte
-       ldy     #1              ; get hi index
-.else
-       ldy     #0              ; get index
-       sta     (sp),y          ; store lo byte
-       iny                     ; bump idx
-.endif
-       pha                     ; save it
-       txa                     ; get hi byte
-       sta     (sp),y          ; store hi byte
-       pla                     ; get A back
-       rts                     ; done
-
-@L1:   dey
-@L2:   dey
-       dec     sp+1
-.ifpc02
-       bra     @L0
-.else
-       jmp     @L0
-.endif
+.proc  pushax
 
+       pha
+       lda     sp
+       sec
+       sbc     #2
+       sta     sp              ; (13)
+       bcs     @L1
+       dec     sp+1
+@L1:   ldy     #1
+       txa                     ; (20)
+       sta     (sp),y
+       pla
+       dey
+       sta     (sp),y          ; (38)
+       rts
 
+.endproc