2000-05-28 13:40:48 +00:00
|
|
|
;
|
2009-02-22 15:39:19 +00:00
|
|
|
; Ullrich von Bassewitz, 1998-08-21, 2009-02-22
|
2000-05-28 13:40:48 +00:00
|
|
|
;
|
|
|
|
; CC65 runtime: Pop TOS into sreg
|
|
|
|
;
|
|
|
|
|
2013-05-09 11:56:54 +00:00
|
|
|
.export popsreg
|
|
|
|
.import incsp2
|
|
|
|
.importzp sp, sreg
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2009-02-22 15:39:19 +00:00
|
|
|
.macpack cpu
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
popsreg:
|
2013-05-09 11:56:54 +00:00
|
|
|
pha ; save A
|
|
|
|
ldy #1
|
|
|
|
lda (sp),y ; get hi byte
|
|
|
|
sta sreg+1 ; store it
|
2009-02-22 15:39:19 +00:00
|
|
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
2013-05-09 11:56:54 +00:00
|
|
|
lda (sp) ; get lo byte
|
2009-02-22 15:39:19 +00:00
|
|
|
.else
|
2013-05-09 11:56:54 +00:00
|
|
|
dey
|
|
|
|
lda (sp),y ; get lo byte
|
2009-02-22 15:39:19 +00:00
|
|
|
.endif
|
2013-05-09 11:56:54 +00:00
|
|
|
sta sreg ; store it
|
|
|
|
pla ; get A back
|
|
|
|
jmp incsp2 ; bump stack and return
|
2000-05-28 13:40:48 +00:00
|
|
|
|