]> git.sur5r.net Git - cc65/blob - libsrc/runtime/lpush.s
Merge pull request #663 from IrgendwerA8/more_popptr1_adaptations
[cc65] / libsrc / runtime / lpush.s
1 ;
2 ; Ullrich von Bassewitz, 06.08.1998
3 ; Christian Krueger, 11-Mar-2017, added 65SC02 optimization
4 ;
5 ; CC65 runtime: long push
6 ;
7
8 ;
9 ; push eax on stack
10 ;
11         .export         pushl0, push0ax, pusheax
12         .import         decsp4
13         .importzp       sp, sreg
14
15         .macpack        cpu
16
17 pushl0:
18         lda     #0
19         tax
20 push0ax:
21 .if (.cpu .bitand ::CPU_ISET_65SC02)
22         stz     sreg
23         stz     sreg+1
24 .else
25         ldy     #$00
26         sty     sreg
27         sty     sreg+1
28 .endif
29 pusheax:
30         pha                     ; decsp will destroy A (but not X)
31         jsr     decsp4
32         ldy     #3
33         lda     sreg+1
34         sta     (sp),y
35         dey
36         lda     sreg
37         sta     (sp),y
38         dey
39         txa
40         sta     (sp),y
41         pla
42 .if (.cpu .bitand ::CPU_ISET_65SC02)
43         sta     (sp)
44 .else        
45         dey
46         sta     (sp),y
47 .endif        
48         rts
49