mirror of
https://github.com/cc65/cc65.git
synced 2025-02-21 20:29:17 +00:00
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:
parent
826a9545e4
commit
4a7642e98c
@ -118,9 +118,21 @@ OBJS = add.o \
|
||||
or.o \
|
||||
popa.o \
|
||||
popsreg.o \
|
||||
push.o \
|
||||
push1.o \
|
||||
push2.o \
|
||||
push3.o \
|
||||
push4.o \
|
||||
push5.o \
|
||||
push6.o \
|
||||
push7.o \
|
||||
pusha.o \
|
||||
pushaff.o \
|
||||
pushax.o \
|
||||
pushb.o \
|
||||
pushbsp.o \
|
||||
pushc0.o \
|
||||
pushc1.o \
|
||||
pushc2.o \
|
||||
pushw.o \
|
||||
pushwsp.o \
|
||||
return0.o \
|
||||
|
@ -1,83 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 05.08.1998
|
||||
;
|
||||
; CC65 runtime: Push ints onto the stack
|
||||
;
|
||||
|
||||
;
|
||||
; push/pop things on stack
|
||||
;
|
||||
.export push0, push1, push2, push3, push4, push5
|
||||
.export push6, push7, pusha0, pushaFF, pushax
|
||||
.export pusha, pushaysp, pushc0, pushc1, pushc2
|
||||
.importzp sp
|
||||
|
||||
pushaFF:
|
||||
ldx #$FF
|
||||
bne pushax
|
||||
|
||||
push7: lda #7
|
||||
bne pusha0
|
||||
push6: lda #6
|
||||
bne pusha0
|
||||
push5: lda #5
|
||||
bne pusha0
|
||||
push4: lda #4
|
||||
bne pusha0
|
||||
push3: lda #3
|
||||
bne pusha0
|
||||
push2: lda #2
|
||||
bne pusha0
|
||||
push1: lda #1
|
||||
bne pusha0
|
||||
push0: lda #0
|
||||
; beq pusha0
|
||||
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
|
||||
bne @L0 ; Branch always
|
||||
|
||||
; Push for chars, same warning as above: The optimizer expects the value
|
||||
; 0 in the Y register after this function.
|
||||
|
||||
pushc2: lda #2
|
||||
bne pusha
|
||||
pushc1: lda #1
|
||||
bne pusha
|
||||
pushc0: lda #0
|
||||
beq pusha
|
||||
pushaysp:
|
||||
lda (sp),y
|
||||
pusha: ldy sp
|
||||
beq @L1
|
||||
dec sp
|
||||
ldy #0
|
||||
sta (sp),y
|
||||
rts
|
||||
|
||||
@L1: dec sp+1
|
||||
dec sp
|
||||
sta (sp),y
|
||||
rts
|
19
libsrc/runtime/push1.s
Normal file
19
libsrc/runtime/push1.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)1 onto the stack
|
||||
;
|
||||
|
||||
.export push1
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push1
|
||||
|
||||
lda #1
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/push2.s
Normal file
19
libsrc/runtime/push2.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)2 onto the stack
|
||||
;
|
||||
|
||||
.export push2
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push2
|
||||
|
||||
lda #2
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/push3.s
Normal file
19
libsrc/runtime/push3.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)3 onto the stack
|
||||
;
|
||||
|
||||
.export push3
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push3
|
||||
|
||||
lda #3
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/push4.s
Normal file
19
libsrc/runtime/push4.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)4 onto the stack
|
||||
;
|
||||
|
||||
.export push4
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push4
|
||||
|
||||
lda #4
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/push5.s
Normal file
19
libsrc/runtime/push5.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)5 onto the stack
|
||||
;
|
||||
|
||||
.export push5
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push5
|
||||
|
||||
lda #5
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/push6.s
Normal file
19
libsrc/runtime/push6.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)6 onto the stack
|
||||
;
|
||||
|
||||
.export push6
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push6
|
||||
|
||||
lda #6
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/push7.s
Normal file
19
libsrc/runtime/push7.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (int)7 onto the stack
|
||||
;
|
||||
|
||||
.export push7
|
||||
.import pusha0
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc push7
|
||||
|
||||
lda #7
|
||||
jmp pusha0
|
||||
|
||||
.endproc
|
||||
|
||||
|
25
libsrc/runtime/pusha.s
Normal file
25
libsrc/runtime/pusha.s
Normal file
@ -0,0 +1,25 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push value in a onto the stack
|
||||
;
|
||||
|
||||
.export pushaysp, pusha
|
||||
.importzp sp
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
pushaysp:
|
||||
lda (sp),y
|
||||
pusha: ldy sp
|
||||
beq @L1
|
||||
dec sp
|
||||
ldy #0
|
||||
sta (sp),y
|
||||
rts
|
||||
|
||||
@L1: dec sp+1
|
||||
dec sp
|
||||
sta (sp),y
|
||||
rts
|
||||
|
20
libsrc/runtime/pushaff.s
Normal file
20
libsrc/runtime/pushaff.s
Normal file
@ -0,0 +1,20 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push a extended with FF onto the stack
|
||||
;
|
||||
|
||||
.export pushaFF
|
||||
.import pushax
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc pushaFF
|
||||
|
||||
ldx #$FF
|
||||
jmp pushax
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
38
libsrc/runtime/pushax.s
Normal file
38
libsrc/runtime/pushax.s
Normal 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
|
||||
|
||||
|
19
libsrc/runtime/pushc0.s
Normal file
19
libsrc/runtime/pushc0.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (char)0 onto the stack
|
||||
;
|
||||
|
||||
.export pushc0
|
||||
.import pusha
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc pushc0
|
||||
|
||||
lda #0
|
||||
jmp pusha
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/pushc1.s
Normal file
19
libsrc/runtime/pushc1.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (char)1 onto the stack
|
||||
;
|
||||
|
||||
.export pushc1
|
||||
.import pusha
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc pushc1
|
||||
|
||||
lda #1
|
||||
jmp pusha
|
||||
|
||||
.endproc
|
||||
|
||||
|
19
libsrc/runtime/pushc2.s
Normal file
19
libsrc/runtime/pushc2.s
Normal file
@ -0,0 +1,19 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; CC65 runtime: Push (char)2 onto the stack
|
||||
;
|
||||
|
||||
.export pushc2
|
||||
.import pusha
|
||||
|
||||
; Beware: The optimizer knows about this function!
|
||||
|
||||
.proc pushc2
|
||||
|
||||
lda #2
|
||||
jmp pusha
|
||||
|
||||
.endproc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user