1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-01 08:29:37 +00:00
cc65/libsrc/runtime/pushax.s
cuz 4a7642e98c Splitted the push.s module
git-svn-id: svn://svn.cc65.org/cc65/trunk@397 b7a2c559-68d2-44c3-8de9-860c34a00d81
2000-10-26 20:43:54 +00:00

39 lines
774 B
ArmAsm

;
; Ullrich von Bassewitz, 26.10.2000
;
; CC65 runtime: Push value in a/x onto the stack
;
.export push0, pusha0, pushax
.importzp sp
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!
pushax: ldy sp
beq @L1
dey
beq @L2
dey
@L0: sty sp
ldy #0 ; get index
sta (sp),y ; store lo byte
pha ; save it
txa ; get hi byte
iny ; bump idx
sta (sp),y ; store hi byte
pla ; get A back
rts ; done
@L1: dey
@L2: dey
dec sp+1
jmp @L0