From: cuz Date: Thu, 26 Oct 2000 20:43:54 +0000 (+0000) Subject: Splitted the push.s module X-Git-Tag: V2.12.0~3129 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4a7642e98c404883e6757e5dabd36e3a9c8431a9;p=cc65 Splitted the push.s module git-svn-id: svn://svn.cc65.org/cc65/trunk@397 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/runtime/Makefile b/libsrc/runtime/Makefile index c96d55c7b..a9d5e2853 100644 --- a/libsrc/runtime/Makefile +++ b/libsrc/runtime/Makefile @@ -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 \ diff --git a/libsrc/runtime/push.s b/libsrc/runtime/push.s deleted file mode 100644 index 0f2ff3c05..000000000 --- a/libsrc/runtime/push.s +++ /dev/null @@ -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 diff --git a/libsrc/runtime/push1.s b/libsrc/runtime/push1.s new file mode 100644 index 000000000..d58509a73 --- /dev/null +++ b/libsrc/runtime/push1.s @@ -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 + + diff --git a/libsrc/runtime/push2.s b/libsrc/runtime/push2.s new file mode 100644 index 000000000..2bbf81548 --- /dev/null +++ b/libsrc/runtime/push2.s @@ -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 + + diff --git a/libsrc/runtime/push3.s b/libsrc/runtime/push3.s new file mode 100644 index 000000000..d55d1e4dc --- /dev/null +++ b/libsrc/runtime/push3.s @@ -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 + + diff --git a/libsrc/runtime/push4.s b/libsrc/runtime/push4.s new file mode 100644 index 000000000..0ceeeda2e --- /dev/null +++ b/libsrc/runtime/push4.s @@ -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 + + diff --git a/libsrc/runtime/push5.s b/libsrc/runtime/push5.s new file mode 100644 index 000000000..583486439 --- /dev/null +++ b/libsrc/runtime/push5.s @@ -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 + + diff --git a/libsrc/runtime/push6.s b/libsrc/runtime/push6.s new file mode 100644 index 000000000..7355aeada --- /dev/null +++ b/libsrc/runtime/push6.s @@ -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 + + diff --git a/libsrc/runtime/push7.s b/libsrc/runtime/push7.s new file mode 100644 index 000000000..2dfc994ff --- /dev/null +++ b/libsrc/runtime/push7.s @@ -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 + + diff --git a/libsrc/runtime/pusha.s b/libsrc/runtime/pusha.s new file mode 100644 index 000000000..d8e90ac3e --- /dev/null +++ b/libsrc/runtime/pusha.s @@ -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 + diff --git a/libsrc/runtime/pushaff.s b/libsrc/runtime/pushaff.s new file mode 100644 index 000000000..dd8dc8768 --- /dev/null +++ b/libsrc/runtime/pushaff.s @@ -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 + + + diff --git a/libsrc/runtime/pushax.s b/libsrc/runtime/pushax.s new file mode 100644 index 000000000..077c52ca8 --- /dev/null +++ b/libsrc/runtime/pushax.s @@ -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 + + diff --git a/libsrc/runtime/pushc0.s b/libsrc/runtime/pushc0.s new file mode 100644 index 000000000..fd7206400 --- /dev/null +++ b/libsrc/runtime/pushc0.s @@ -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 + + diff --git a/libsrc/runtime/pushc1.s b/libsrc/runtime/pushc1.s new file mode 100644 index 000000000..9997b566b --- /dev/null +++ b/libsrc/runtime/pushc1.s @@ -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 + + diff --git a/libsrc/runtime/pushc2.s b/libsrc/runtime/pushc2.s new file mode 100644 index 000000000..4539f30b4 --- /dev/null +++ b/libsrc/runtime/pushc2.s @@ -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 + +