mirror of
https://github.com/cc65/cc65.git
synced 2024-07-05 21:29:03 +00:00
Squeeze one cycle and several bytes out of the pushax routine.
git-svn-id: svn://svn.cc65.org/cc65/trunk@666 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
1e1199cb2b
commit
d1530bc0a2
@ -15,33 +15,21 @@ pusha0: ldx #0
|
|||||||
; Beware^2: The optimizer knows about the value of Y after the function
|
; Beware^2: The optimizer knows about the value of Y after the function
|
||||||
; returns!
|
; returns!
|
||||||
|
|
||||||
pushax: ldy sp
|
.proc pushax
|
||||||
beq @L1
|
|
||||||
dey
|
|
||||||
beq @L2
|
|
||||||
dey
|
|
||||||
@L0: sty sp
|
|
||||||
.ifpc02
|
|
||||||
sta (sp) ; 65C02 version - saves 2 cycles and one byte
|
|
||||||
ldy #1 ; get hi index
|
|
||||||
.else
|
|
||||||
ldy #0 ; get index
|
|
||||||
sta (sp),y ; store lo byte
|
|
||||||
iny ; bump idx
|
|
||||||
.endif
|
|
||||||
pha ; save it
|
|
||||||
txa ; get hi byte
|
|
||||||
sta (sp),y ; store hi byte
|
|
||||||
pla ; get A back
|
|
||||||
rts ; done
|
|
||||||
|
|
||||||
@L1: dey
|
pha
|
||||||
@L2: dey
|
lda sp
|
||||||
|
sec
|
||||||
|
sbc #2
|
||||||
|
sta sp ; (13)
|
||||||
|
bcs @L1
|
||||||
dec sp+1
|
dec sp+1
|
||||||
.ifpc02
|
@L1: ldy #1
|
||||||
bra @L0
|
txa ; (20)
|
||||||
.else
|
sta (sp),y
|
||||||
jmp @L0
|
pla
|
||||||
.endif
|
dey
|
||||||
|
sta (sp),y ; (38)
|
||||||
|
rts
|
||||||
|
|
||||||
|
.endproc
|
||||||
|
Loading…
Reference in New Issue
Block a user