]> git.sur5r.net Git - cc65/blob - libsrc/runtime/popsreg.s
goto.c warning fix for implicit truncation
[cc65] / libsrc / runtime / popsreg.s
1 ;
2 ; Ullrich von Bassewitz, 1998-08-21, 2009-02-22
3 ;
4 ; CC65 runtime: Pop TOS into sreg
5 ;
6
7         .export         popsreg
8         .import         incsp2
9         .importzp       sp, sreg
10
11         .macpack        cpu
12
13 popsreg:
14         pha                     ; save A
15         ldy     #1
16         lda     (sp),y          ; get hi byte
17         sta     sreg+1          ; store it
18 .if (.cpu .bitand ::CPU_ISET_65SC02)
19         lda     (sp)            ; get lo byte
20 .else
21         dey
22         lda     (sp),y          ; get lo byte
23 .endif
24         sta     sreg            ; store it
25         pla                     ; get A back
26         jmp     incsp2          ; bump stack and return
27