]> git.sur5r.net Git - cc65/commitdiff
New pushwysp implementation
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 24 Oct 2001 20:44:54 +0000 (20:44 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 24 Oct 2001 20:44:54 +0000 (20:44 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1071 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/runtime/pushwsp.s

index 1c940e03836952667d9bb8fd613cb698ecc61e63..d6baf9933f4dbadfffe9cf57ab849302649318e0 100644 (file)
@@ -8,13 +8,24 @@
        .import         pushax
        .importzp       sp
 
+       .macpack        generic
+
 pushw0sp:
-       ldy     #1
+       ldy     #2
 pushwysp:
-       lda     (sp),y          ; get hi byte
-       tax
-       dey
-       lda     (sp),y          ; get lo byte
-               jmp     pushax          ; push that
-
+       lda     sp              ; 3
+               sub     #2              ; 4
+       sta     sp              ; 3
+       bcs     @L1             ; 3(+1)
+       dec     sp+1            ; (5)
+@L1:   lda     (sp),y          ; 5 =16
+       tax                     ; 2
+       dey                     ; 2
+       lda     (sp),y          ; 5
+       ldy     #$00            ; 2
+       sta     (sp),y          ; 5
+       iny                     ; 2
+       txa                     ; 2
+       sta     (sp),y          ; 5
+       rts