1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-28 22:30:12 +00:00
cc65/libsrc/runtime/popptr1.s

20 lines
638 B
ArmAsm
Raw Normal View History

;
; Christian Kruger, 20-May-2018
;
2018-05-21 12:41:12 +00:00
; 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 sp, ptr1
2018-07-26 12:35:26 +00:00
.proc popptr1 ; 14 bytes (four usages = at least 2 bytes saved)
ldy #1
lda (sp),y ; get hi byte
sta ptr1+1 ; into ptr hi
2018-07-26 12:35:26 +00:00
dey ; no optimization for 65C02 here to have Y=0 at exit!
lda (sp),y ; get lo byte
sta ptr1 ; to ptr lo
jmp incsp2
.endproc