1
0
mirror of https://github.com/cc65/cc65.git synced 2026-03-12 14:42:08 +00:00
Files
cc65/libsrc/runtime/popptr1.s
2025-06-22 21:34:41 +00:00

26 lines
762 B
ArmAsm

;
; Christian Kruger, 20-May-2018
;
; CC65 runtime: Pop 2 bytes from stack to ptr1.
; X is untouched, low byte in A, Y is defined to be 0!
.export popptr1
.import incsp2
.importzp c_sp, ptr1
.macpack cpu
.proc popptr1 ; 14 bytes (four usages = at least 2 bytes saved)
ldy #1
lda (c_sp),y ; get hi byte
sta ptr1+1 ; into ptr hi
dey ; dey even for for 65C02 here to have Y=0 at exit!
.if (.cpu .bitand ::CPU_ISET_65SC02)
lda (c_sp) ; get lo byte
.else
lda (c_sp),y ; get lo byte
.endif
sta ptr1 ; to ptr lo
jmp incsp2
.endproc