Added "popptr1" which is of common use to save some bytes.

This commit is contained in:
IrgendwerA8
2018-05-20 15:30:18 +02:00
parent 3a6430b13d
commit c95ed4b8b5
35 changed files with 113 additions and 151 deletions

29
libsrc/runtime/popptr1.s Normal file
View File

@@ -0,0 +1,29 @@
;
; Christian Kruger, 20-May-2018
;
; CC65 runtime: Pop registers on stack to ptr1 or ptr2 and 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,
ldy #1
lda (sp),y ; get hi byte
sta ptr+1 ; into ptr hi
dey ; note: apply even for 65C02 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

View File

@@ -6,7 +6,7 @@
.export steaxspidx
.import popax
.import popptr1
.importzp sreg, ptr1, tmp1, tmp2, tmp3
@@ -15,9 +15,7 @@
sta tmp1
stx tmp2
sty tmp3
jsr popax ; get the pointer
sta ptr1
stx ptr1+1
jsr popptr1 ; get the pointer
ldy tmp3
lda tmp1
sta (ptr1),y