]> git.sur5r.net Git - cc65/blob - libsrc/runtime/swap.s
Minor style fix.
[cc65] / libsrc / runtime / swap.s
1 ;
2 ; Ullrich von Bassewitz, 06.08.1998
3 ; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
4 ;
5 ; CC65 runtime: swap ax with TOS
6 ;
7
8         .export         swapstk
9         .importzp       sp, ptr4
10
11         .macpack        cpu
12
13 swapstk:
14         sta     ptr4
15         stx     ptr4+1
16         ldy     #1              ; index
17         lda     (sp),y
18         tax
19         lda     ptr4+1
20         sta     (sp),y
21 .if (.cpu .bitand ::CPU_ISET_65SC02)
22         lda     (sp)
23         tay
24         lda     ptr4
25         sta     (sp)
26         tya    
27 .else        
28         dey
29         lda     (sp),y
30         pha
31         lda     ptr4
32         sta     (sp),y
33         pla
34 .endif        
35         rts                     ; whew!