2018-05-20 13:30:18 +00:00
|
|
|
;
|
|
|
|
; Christian Kruger, 20-May-2018
|
|
|
|
;
|
2018-05-21 12:41:12 +00:00
|
|
|
; CC65 runtime: Pop 2 bytes from stack to ptr1.
|
2018-05-20 13:30:18 +00:00
|
|
|
; X is untouched, low byte in A, Y is defined to be 0!
|
|
|
|
|
|
|
|
.export popptr1
|
2018-05-20 13:38:48 +00:00
|
|
|
.import incsp2
|
2018-05-20 13:30:18 +00:00
|
|
|
.importzp sp, ptr1
|
|
|
|
|
2018-07-26 12:35:26 +00:00
|
|
|
.proc popptr1 ; 14 bytes (four usages = at least 2 bytes saved)
|
2018-05-20 13:30:18 +00:00
|
|
|
ldy #1
|
|
|
|
lda (sp),y ; get hi byte
|
2018-05-20 13:38:48 +00:00
|
|
|
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!
|
2018-05-20 13:30:18 +00:00
|
|
|
lda (sp),y ; get lo byte
|
2018-05-20 13:38:48 +00:00
|
|
|
sta ptr1 ; to ptr lo
|
|
|
|
jmp incsp2
|
2018-05-20 13:30:18 +00:00
|
|
|
.endproc
|