Splitted the push.s module

git-svn-id: svn://svn.cc65.org/cc65/trunk@397 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2000-10-26 20:43:54 +00:00
parent 826a9545e4
commit 4a7642e98c
15 changed files with 286 additions and 84 deletions

38
libsrc/runtime/pushax.s Normal file
View File

@@ -0,0 +1,38 @@
;
; 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