]> git.sur5r.net Git - cc65/blobdiff - libsrc/runtime/pushax.s
Add interrupt handling code from Stefan Haubenthal
[cc65] / libsrc / runtime / pushax.s
index 077c52ca8c4e1f933287795c1a12a827e1c97fd1..d9efe7c0e636f4b52000c472b9ca410b66f04152 100644 (file)
@@ -15,24 +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
-       ldy     #0              ; get index
-       sta     (sp),y          ; store lo byte
-       pha                     ; save it
-       txa                     ; get hi byte
-       iny                     ; bump idx
-       sta     (sp),y          ; store hi byte
-       pla                     ; get A back
-       rts                     ; done
+.proc  pushax
 
-@L1:   dey
-@L2:   dey
-       dec     sp+1
-       jmp     @L0
+       pha                     ; (3)
+       lda     sp              ; (6)
+       sec                     ; (8)
+       sbc     #2              ; (10)
+       sta     sp              ; (13)
+       bcs     @L1             ; (17)
+       dec     sp+1            ; (+5)
+@L1:   ldy     #1              ; (19)
+       txa                     ; (21)
+       sta     (sp),y          ; (27)
+       pla                     ; (31)
+       dey                     ; (33)
+       sta     (sp),y          ; (38)
+       rts                     ; (44)     
 
-                   
+.endproc