]> git.sur5r.net Git - cc65/blob - libsrc/runtime/pushwsp.s
New pushwysp implementation
[cc65] / libsrc / runtime / pushwsp.s
1 ;
2 ; Ullrich von Bassewitz, 31.08.1998
3 ;
4 ; CC65 runtime: Load word from stack slot and push
5 ;
6
7         .export         pushwysp, pushw0sp
8         .import         pushax
9         .importzp       sp
10
11         .macpack        generic
12
13 pushw0sp:
14         ldy     #2
15 pushwysp:
16         lda     sp              ; 3
17         sub     #2              ; 4
18         sta     sp              ; 3
19         bcs     @L1             ; 3(+1)
20         dec     sp+1            ; (5)
21 @L1:    lda     (sp),y          ; 5 =16
22         tax                     ; 2
23         dey                     ; 2
24         lda     (sp),y          ; 5
25         ldy     #$00            ; 2
26         sta     (sp),y          ; 5
27         iny                     ; 2
28         txa                     ; 2
29         sta     (sp),y          ; 5
30         rts
31