Save two bytes in pushax and popptr1

It's not because Y must equal zero on rts that we should'nt spare one byte
and one cycle.
This commit is contained in:
Colin Leroy-Mira
2024-01-19 21:14:47 +01:00
parent 166a4b25f7
commit b23a7ec407
2 changed files with 14 additions and 2 deletions

View File

@@ -8,12 +8,18 @@
.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 ; no optimization for 65C02 here to have Y=0 at exit!
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