]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/pushwsp.s
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / libsrc / runtime / pushwsp.s
index 1c940e03836952667d9bb8fd613cb698ecc61e63..f5ebe0d7ec5647485d4cc0ac409ec92113fe7e92 100644 (file)
@@ -1,20 +1,31 @@
 ;
-; Ullrich von Bassewitz, 31.08.1998
+; Ullrich von Bassewitz, 24.10.2001
 ;
 ; CC65 runtime: Load word from stack slot and push
 ;
 
-               .export         pushwysp, pushw0sp
-       .import         pushax
-       .importzp       sp
+        .export         pushwysp, pushw0sp
+        .importzp       sp
+
+        .macpack        generic
 
 pushw0sp:
-       ldy     #1
+        ldy     #3
 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