mirror of
https://github.com/cc65/cc65.git
synced 2024-12-22 12:30:41 +00:00
b23a7ec407
It's not because Y must equal zero on rts that we should'nt spare one byte and one cycle.
26 lines
760 B
ArmAsm
26 lines
760 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 sp, ptr1
|
|
|
|
.macpack cpu
|
|
|
|
.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
|
|
dey ; dey even for for 65C02 here to have Y=0 at exit!
|
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
|
lda (sp) ; get lo byte
|
|
.else
|
|
lda (sp),y ; get lo byte
|
|
.endif
|
|
sta ptr1 ; to ptr lo
|
|
jmp incsp2
|
|
.endproc
|