]> git.sur5r.net Git - cc65/blob - libsrc/runtime/incsp2.s
Added mouse module from C64
[cc65] / libsrc / runtime / incsp2.s
1 ;
2 ; Ullrich von Bassewitz, 25.10.2000
3 ;
4 ; CC65 runtime: Increment the stackpointer by 2. For performance reasons,
5 ;               this modules does also contain the popax function.
6
7         .export         popax, incsp2
8         .importzp       sp
9
10 ; Pop a/x from stack. This function will run directly into incsp2
11
12 .proc   popax
13
14         ldy     #1
15         lda     (sp),y          ; get hi byte
16         tax                     ; into x
17 .ifpc02 
18         lda     (sp)            ; get lo byte
19 .else
20         dey
21         lda     (sp),y          ; get lo byte
22 .endif
23
24 .endproc
25
26
27
28 .proc   incsp2
29
30         ldy     sp              ; 3
31         iny                     ; 2
32         beq     @L1             ; 2
33         iny                     ; 2
34         beq     @L2             ; 2
35         sty     sp              ; 3
36         rts
37
38 @L1:    iny                     ; 2
39 @L2:    sty     sp              ; 3
40         inc     sp+1            ; 5
41         rts
42
43 .endproc
44
45
46
47
48