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