mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
b23a7ec407
It's not because Y must equal zero on rts that we should'nt spare one byte and one cycle.
42 lines
1.1 KiB
ArmAsm
42 lines
1.1 KiB
ArmAsm
;
|
|
; Ullrich von Bassewitz, 26.10.2000
|
|
;
|
|
; CC65 runtime: Push value in a/x onto the stack
|
|
;
|
|
|
|
.export push0, pusha0, pushax
|
|
.importzp sp
|
|
|
|
.macpack cpu
|
|
|
|
push0: lda #0
|
|
pusha0: ldx #0
|
|
|
|
; This function is used *a lot*, so don't call any subroutines here.
|
|
; Beware: The value in ax must not be changed by this function!
|
|
; Beware^2: The optimizer knows about the value of Y after the function
|
|
; returns!
|
|
|
|
.proc pushax
|
|
|
|
pha ; (3)
|
|
lda sp ; (6)
|
|
sec ; (8)
|
|
sbc #2 ; (10)
|
|
sta sp ; (13)
|
|
bcs @L1 ; (17)
|
|
dec sp+1 ; (+5)
|
|
@L1: ldy #1 ; (19)
|
|
txa ; (21)
|
|
sta (sp),y ; (27)
|
|
pla ; (31)
|
|
dey ; (33)
|
|
.if (.cpu .bitand ::CPU_ISET_65SC02)
|
|
sta (sp) ; (37)
|
|
.else
|
|
sta (sp),y ; (38)
|
|
.endif
|
|
rts ; (44/43)
|
|
|
|
.endproc
|