]> git.sur5r.net Git - cc65/blob - libsrc/runtime/staxspi.s
Made the code that logs indirect-goto referals be a little more efficient.
[cc65] / libsrc / runtime / staxspi.s
1 ;
2 ; Ullrich von Bassewitz, 26.10.2000
3 ; Christian Krueger, 12-Mar-2017, added 65SC02 optimization
4 ;
5 ; CC65 runtime: Store a/x indirect into address at top of stack with index
6 ;
7
8         .export         staxspidx
9         .import         incsp2
10         .importzp       sp, tmp1, ptr1
11
12         .macpack        cpu
13
14 .proc   staxspidx
15
16         sty     tmp1            ; Save Y
17         pha                     ; Save A
18         ldy     #1
19         lda     (sp),y
20         sta     ptr1+1
21 .if (.cpu .bitand ::CPU_ISET_65SC02)
22         lda     (sp)
23 .else
24         dey
25         lda     (sp),y
26 .endif
27         sta     ptr1            ; Address now in ptr1
28         ldy     tmp1            ; Restore Y
29         iny                     ; Address high byte
30         txa                     ; Get high byte
31         sta     (ptr1),y        ; Store high byte
32         dey                     ; Address low byte
33         pla                     ; Restore low byte into A
34         sta     (ptr1),y        ; Store low byte
35         jmp     incsp2          ; Drop address
36
37 .endproc
38
39