]> git.sur5r.net Git - cc65/commitdiff
More module splits
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 25 Oct 2000 19:53:22 +0000 (19:53 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Wed, 25 Oct 2000 19:53:22 +0000 (19:53 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@393 b7a2c559-68d2-44c3-8de9-860c34a00d81

25 files changed:
libsrc/runtime/Makefile
libsrc/runtime/addysp.s [new file with mode: 0644]
libsrc/runtime/decsp1.s [new file with mode: 0644]
libsrc/runtime/decsp2.s [new file with mode: 0644]
libsrc/runtime/decsp3.s [new file with mode: 0644]
libsrc/runtime/decsp4.s [new file with mode: 0644]
libsrc/runtime/decsp5.s [new file with mode: 0644]
libsrc/runtime/decsp6.s [new file with mode: 0644]
libsrc/runtime/decsp7.s [new file with mode: 0644]
libsrc/runtime/decsp8.s [new file with mode: 0644]
libsrc/runtime/incsp1.s [new file with mode: 0644]
libsrc/runtime/incsp2.s [new file with mode: 0644]
libsrc/runtime/incsp3.s [new file with mode: 0644]
libsrc/runtime/incsp4.s [new file with mode: 0644]
libsrc/runtime/incsp5.s [new file with mode: 0644]
libsrc/runtime/incsp6.s [new file with mode: 0644]
libsrc/runtime/incsp7.s [new file with mode: 0644]
libsrc/runtime/incsp8.s [new file with mode: 0644]
libsrc/runtime/popa.s [new file with mode: 0644]
libsrc/runtime/return0.s [new file with mode: 0644]
libsrc/runtime/return1.s [new file with mode: 0644]
libsrc/runtime/runtime.s
libsrc/runtime/staspp.s [new file with mode: 0644]
libsrc/runtime/staxspp.s [new file with mode: 0644]
libsrc/runtime/subysp.s [new file with mode: 0644]

index 6b7fc18a86b77273cd1465ea0c910f49709902aa..ebf386ba7044faa712b402e8cf2c5f682bc65549 100644 (file)
@@ -14,6 +14,7 @@
 
 OBJS =         add.o           \
                addeqsp.o       \
+       addysp.o        \
                and.o           \
                aslax1.o        \
                aslax2.o        \
@@ -33,6 +34,14 @@ OBJS =       add.o           \
                call.o          \
                compl.o         \
                dec.o           \
+       decsp1.o        \
+               decsp2.o        \
+       decsp3.o        \
+       decsp4.o        \
+       decsp5.o        \
+       decsp6.o        \
+       decsp7.o        \
+       decsp8.o        \
                div.o           \
                enter.o         \
                eq.o            \
@@ -40,6 +49,14 @@ OBJS =       add.o           \
                gt.o            \
                icmp.o          \
                inc.o           \
+       incsp1.o        \
+               incsp2.o        \
+       incsp3.o        \
+       incsp4.o        \
+       incsp5.o        \
+       incsp6.o        \
+       incsp7.o        \
+       incsp8.o        \
                ladd.o          \
                laddeq.o        \
                laddeqsp.o      \
@@ -84,7 +101,7 @@ OBJS =       add.o           \
                lsubeqsp.o      \
                lswap.o         \
                lswitch.o       \
-               lt.o            \
+               lt.o            \
                ltest.o         \
                ludiv.o         \
                luge.o          \
@@ -96,15 +113,18 @@ OBJS =     add.o           \
                makebool.o      \
                mod.o           \
                mul.o           \
-               ne.o            \
-               neg.o           \
-               or.o            \
+               ne.o            \
+               neg.o           \
+               or.o            \
+       popa.o          \
                popsreg.o       \
                push.o          \
                pushb.o         \
                pushbsp.o       \
                pushw.o         \
                pushwsp.o       \
+       return0.o       \
+       return1.o       \
                rsub.o          \
                runtime.o       \
                shelp.o         \
@@ -116,10 +136,13 @@ OBJS =    add.o           \
                shreax1.o       \
                shreax2.o       \
                shreax3.o       \
+       staspp.o        \
                staxsp.o        \
+       staxspp.o       \
                steaxsp.o       \
                sub.o           \
                subeqsp.o       \
+       subysp.o        \
                swap.o          \
                switch.o        \
                test.o          \
@@ -136,6 +159,6 @@ OBJS =      add.o           \
 all:           $(OBJS)
 
 clean:
-       @rm -f *~ $(COBJS:.o=.s) $(OBJS) $(LOBJS)
+       @rm -f *~ $(COBJS:.o=.s) $(OBJS)
 
 
diff --git a/libsrc/runtime/addysp.s b/libsrc/runtime/addysp.s
new file mode 100644 (file)
index 0000000..b5069f1
--- /dev/null
@@ -0,0 +1,21 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by value in y
+;
+
+               .export         addysp1, addysp
+       .importzp       sp
+
+addysp1:
+       iny
+addysp:        pha                     ; Save A
+       clc
+       tya                     ; Get the value
+       adc     sp              ; Add low byte
+       sta     sp              ; Put it back
+       bcc     @L1             ; If no carry, we're done
+       inc     sp+1            ; Inc high byte
+@L1:   pla                     ; Restore A
+       rts
+
diff --git a/libsrc/runtime/decsp1.s b/libsrc/runtime/decsp1.s
new file mode 100644 (file)
index 0000000..ab31a49
--- /dev/null
@@ -0,0 +1,23 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 1
+;
+
+               .export         decsp1
+       .importzp       sp
+
+.proc  decsp1
+
+       ldy     sp
+       bne     @L1
+       dec     sp+1
+@L1:   dec     sp
+       rts
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/decsp2.s b/libsrc/runtime/decsp2.s
new file mode 100644 (file)
index 0000000..86536c8
--- /dev/null
@@ -0,0 +1,31 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 2
+;
+
+               .export         decsp2
+       .importzp       sp
+
+.proc  decsp2
+
+       ldy     sp
+               beq     @L1
+               dey
+               beq     @L2
+               dey
+               sty     sp
+               rts
+
+@L1:   dey
+@L2:    dey
+               sty     sp
+               dec     sp+1
+       rts
+
+.endproc
+       
+
+
+
+       
diff --git a/libsrc/runtime/decsp3.s b/libsrc/runtime/decsp3.s
new file mode 100644 (file)
index 0000000..0b81bea
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 3
+;
+
+               .export         decsp3
+       .import         subysp
+
+.proc  decsp3
+
+       ldy     #3
+       jmp     subysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/decsp4.s b/libsrc/runtime/decsp4.s
new file mode 100644 (file)
index 0000000..e2220bf
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 4
+;
+
+               .export         decsp4
+       .import         subysp
+
+.proc  decsp4
+
+       ldy     #4
+       jmp     subysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/decsp5.s b/libsrc/runtime/decsp5.s
new file mode 100644 (file)
index 0000000..bece741
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 5
+;
+
+               .export         decsp5
+       .import         subysp
+
+.proc  decsp5
+
+       ldy     #5
+       jmp     subysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/decsp6.s b/libsrc/runtime/decsp6.s
new file mode 100644 (file)
index 0000000..964320b
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 6
+;
+
+               .export         decsp6
+       .import         subysp
+
+.proc  decsp6
+
+       ldy     #6
+       jmp     subysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/decsp7.s b/libsrc/runtime/decsp7.s
new file mode 100644 (file)
index 0000000..080c9b0
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 7
+;
+
+               .export         decsp7
+       .import         subysp
+
+.proc  decsp7
+
+       ldy     #7
+       jmp     subysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/decsp8.s b/libsrc/runtime/decsp8.s
new file mode 100644 (file)
index 0000000..54192fd
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by 8
+;
+
+               .export         decsp8
+       .import         subysp
+
+.proc  decsp8
+
+       ldy     #8
+       jmp     subysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp1.s b/libsrc/runtime/incsp1.s
new file mode 100644 (file)
index 0000000..a85092d
--- /dev/null
@@ -0,0 +1,22 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 1
+;
+
+               .export         incsp1
+       .importzp       sp
+
+.proc  incsp1
+
+       inc     sp
+       bne     @L1
+       inc     sp+1
+@L1:   rts
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp2.s b/libsrc/runtime/incsp2.s
new file mode 100644 (file)
index 0000000..9592943
--- /dev/null
@@ -0,0 +1,44 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 2. For performance reasons,
+;              this modules does also contain the popax function.
+
+               .export         popax, incsp2
+       .importzp       sp
+
+; Pop a/x from stack. This function will run directly into incsp2
+
+.proc  popax
+
+       ldy     #1
+       lda     (sp),y          ; get hi byte
+               tax                     ; into x
+       dey
+       lda     (sp),y          ; get lo byte
+
+.endproc
+
+
+
+.proc  incsp2
+
+       ldy     sp              ; 3
+               iny                     ; 2
+               beq     @L1             ; 2
+               iny                     ; 2
+               beq     @L2             ; 2
+               sty     sp              ; 3
+               rts
+
+@L1:           iny                     ; 2
+@L2:           sty     sp              ; 3
+               inc     sp+1            ; 5
+               rts
+
+.endproc
+
+
+
+
+
diff --git a/libsrc/runtime/incsp3.s b/libsrc/runtime/incsp3.s
new file mode 100644 (file)
index 0000000..90dca0b
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 3
+;
+
+               .export         incsp3
+       .import         addysp
+
+.proc  incsp3
+
+       ldy     #3
+       jmp     addysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp4.s b/libsrc/runtime/incsp4.s
new file mode 100644 (file)
index 0000000..125c533
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 4
+;
+
+               .export         incsp4
+       .import         addysp
+
+.proc  incsp4
+
+       ldy     #4
+       jmp     addysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp5.s b/libsrc/runtime/incsp5.s
new file mode 100644 (file)
index 0000000..df239cf
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 5
+;
+
+               .export         incsp5
+       .import         addysp
+
+.proc  incsp5
+
+       ldy     #5
+       jmp     addysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp6.s b/libsrc/runtime/incsp6.s
new file mode 100644 (file)
index 0000000..a7ab932
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 6
+;
+
+               .export         incsp6
+       .import         addysp
+
+.proc  incsp6
+
+       ldy     #6
+       jmp     addysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp7.s b/libsrc/runtime/incsp7.s
new file mode 100644 (file)
index 0000000..417700f
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 7
+;
+
+               .export         incsp7
+       .import         addysp
+
+.proc  incsp7
+
+       ldy     #7
+       jmp     addysp
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/incsp8.s b/libsrc/runtime/incsp8.s
new file mode 100644 (file)
index 0000000..3ec1520
--- /dev/null
@@ -0,0 +1,17 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Increment the stackpointer by 8
+;
+
+               .export         incsp8
+       .import         addysp
+
+.proc  incsp8
+
+       ldy     #8
+       jmp     addysp
+
+.endproc
+
+
diff --git a/libsrc/runtime/popa.s b/libsrc/runtime/popa.s
new file mode 100644 (file)
index 0000000..6c7c930
--- /dev/null
@@ -0,0 +1,21 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Pop a from stack
+;
+
+               .export         popa
+       .importzp       sp
+
+.proc  popa
+
+       ldy     #0
+       lda     (sp),y          ; Read byte
+       inc     sp
+       bne     @L1
+       inc     sp+1
+@L1:   rts
+
+.endproc
+
+
diff --git a/libsrc/runtime/return0.s b/libsrc/runtime/return0.s
new file mode 100644 (file)
index 0000000..37c2608
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Return 0 in a/x
+;
+
+               .export         return0
+
+.proc  return0
+
+       lda     #0
+       tax
+       rts
+
+.endproc
+
+
+
+
+       
diff --git a/libsrc/runtime/return1.s b/libsrc/runtime/return1.s
new file mode 100644 (file)
index 0000000..2987de3
--- /dev/null
@@ -0,0 +1,20 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Return 1 in a/x
+;
+
+               .export         return1
+
+.proc  return1
+
+       ldx     #0
+       lda     #1
+       rts
+
+.endproc
+
+
+
+
+       
index 095da258852aa8549398cf4da92a7526fcf5057e..db7137345efb6eab797b9daadb697f82f5b643ed 100644 (file)
 ;
 
 
-       .import         ldai, ldaxi, pushax
-       .importzp       sp, tmp1, tmp2, tmp3, ptr1, ptr4
+       .import         popax
+       .importzp       tmp1, tmp2, tmp3, ptr4
 
 
-; Pop a from stack
-       .export         popa
-
-popa:  ldy     #0
-       lda     (sp),y          ; Read byte
-       inc     sp
-       bne     *+4
-       inc     sp+1
-       rts
-
-;
-; pop a from stack and load x with zero
-;
-
-       .export         popa0
-
-popa0: ldy     #0
-       lda     (sp),y          ; load low byte
-       ldx     #0
-       beq     incsp2
-
-;
-; pop a/x from stack. This function will run directly into incsp2
-;
-
-       .export         popax           ; pop stack into AX
-
-popax: ldy     #1
-       lda     (sp),y          ; get hi byte
-               tax                     ; into x
-       dey
-       lda     (sp),y          ; get lo byte
-
-;
-; routines for inc/dec'ing sp
-;
-
-       .export         addysp, addysp1
-               .export         incsp1, incsp2, incsp3, incsp4
-       .export         incsp5, incsp6, incsp7, incsp8
-
-; do this by hand, cause it gets used a lot
-
-incsp2:        ldy     sp              ; 3
-               iny                     ; 2
-               beq     @L1             ; 2
-               iny                     ; 2
-               beq     @L2             ; 2
-               sty     sp              ; 3
-               rts
-
-@L1:           iny                     ; 2
-@L2:           sty     sp              ; 3
-               inc     sp+1            ; 5
-               rts
-
-; Hand optimize this one also...
-
-incsp1:        inc     sp
-       bne     *+4
-       inc     sp+1
-       rts
-
-incsp3:        ldy     #3
-       bne     addysp
-
-incsp4:        ldy     #4
-       bne     addysp
-
-incsp5:        ldy     #5
-       bne     addysp
-
-incsp6:        ldy     #6
-       bne     addysp
-
-incsp7:        ldy     #7
-       bne     addysp
-
-incsp8:        ldy     #8
-       bne     addysp
-
-addysp1:
-       iny
-addysp:        pha                     ; save A
-       clc
-       tya                     ; get the value
-       adc     sp              ; add lo byte
-       sta     sp              ; put it back
-       bcc     addysp_1        ; if no carry, we're done
-       inc     sp+1            ; inc hi byte
-addysp_1:
-       pla                     ; get A back
-       rts
-
-
-;
-;
-       .export         subysp          ; sub Y from SP
-       .export         decsp1, decsp2, decsp3, decsp4
-       .export         decsp5, decsp6, decsp7, decsp8
-
-; Do this one by hand, cause it gets used a lot
-
-decsp2:        ldy     sp
-               beq     @L1
-               dey
-               beq     @L2
-               dey
-               sty     sp
-               rts
-
-@L1:   dey
-@L2:    dey
-               sty     sp
-               dec     sp+1
-       rts
-
-; Decrement by 1 also done as fast as possible
-
-decsp1:        ldy     sp
-       bne     *+4
-       dec     sp+1
-       dec     sp
-       rts
-
-decsp3:        ldy     #3
-       bne     subysp
-
-decsp4:        ldy     #4
-       bne     subysp
-
-decsp5:        ldy     #5
-       bne     subysp
-
-decsp6:        ldy     #6
-       bne     subysp
-
-decsp7:        ldy     #7
-       bne     subysp
-
-decsp8:        ldy     #8
-;      bne     subysp
-
-subysp:        pha                     ; save A
-               sty     tmp1            ; save the value
-       lda     sp              ; get lo byte
-       sec
-       sbc     tmp1            ; sub y val
-       sta     sp              ; put it back
-       bcs     *+4
-       dec     sp+1
-       pla                     ; get A back
-       rts                     ; done
-
 ;
 ; Various kinds of store operators
 ;
@@ -193,73 +39,3 @@ staspic:
        sta     (ptr4),y
        rts
 
-; ax --> (sp),y
-
-
-       .export         staxspp         ; store AX thru (sp), and pop
-staxspp:
-       ldy     #0
-       pha
-       lda     (sp),y
-       sta     ptr1
-       iny
-       lda     (sp),y
-       sta     ptr1+1
-       txa
-       sta     (ptr1),y
-       pla
-       dey
-       sta     (ptr1),y
-       jmp     incsp2          ; Drop address
-
-
-       .export         staspp          ; store A thru (sp), and pop
-staspp:
-       ldy     #1
-       pha
-       lda     (sp),y
-       sta     ptr1+1
-       dey
-       lda     (sp),y
-       sta     ptr1
-       pla
-       sta     (ptr1),y
-               jmp     incsp2          ; Drop address
-
-
-;
-; Boolean function return entries.
-;
-
-       .export         return0, return1
-
-return1:
-       ldx     #0
-       lda     #1
-       rts
-
-return0:
-       lda     #0
-       tax
-       rts
-
-;
-; random stuff
-;
-
-; (a/x) 16--> (--sp)
-
-       .export         pushwaxi
-pushwaxi:                              ; push word at (ax)
-       jsr     ldaxi
-       jmp     pushax
-
-; (a/x) 8--> (--sp)
-
-       .export         pushbaxi        ; push byte at (ax)
-pushbaxi:
-       jsr     ldai
-       jmp     pushax
-
-
-
diff --git a/libsrc/runtime/staspp.s b/libsrc/runtime/staspp.s
new file mode 100644 (file)
index 0000000..a664dde
--- /dev/null
@@ -0,0 +1,26 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Store a indirect into address at top of stack
+;
+
+               .export         staspp
+       .import         incsp2
+       .importzp       sp, ptr1
+
+.proc  staspp
+
+       ldy     #1
+       pha
+       lda     (sp),y
+       sta     ptr1+1
+       dey
+       lda     (sp),y
+       sta     ptr1
+       pla
+       sta     (ptr1),y
+               jmp     incsp2          ; Drop address
+
+.endproc
+
+
diff --git a/libsrc/runtime/staxspp.s b/libsrc/runtime/staxspp.s
new file mode 100644 (file)
index 0000000..35926fd
--- /dev/null
@@ -0,0 +1,29 @@
+;      
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Store a/x indirect into address at top of stack
+;
+
+               .export         staxspp
+       .import         incsp2
+       .importzp       sp, ptr1
+
+.proc  staxspp
+
+       ldy     #0
+       pha
+       lda     (sp),y
+       sta     ptr1
+       iny
+       lda     (sp),y
+       sta     ptr1+1
+       txa
+       sta     (ptr1),y
+       pla
+       dey
+       sta     (ptr1),y
+       jmp     incsp2          ; Drop address
+
+.endproc
+
+
diff --git a/libsrc/runtime/subysp.s b/libsrc/runtime/subysp.s
new file mode 100644 (file)
index 0000000..b173daf
--- /dev/null
@@ -0,0 +1,28 @@
+;
+; Ullrich von Bassewitz, 25.10.2000
+;
+; CC65 runtime: Decrement the stackpointer by value in y
+;
+
+               .export         subysp
+       .importzp       sp, tmp1
+
+.proc  subysp
+
+       pha                     ; Save A
+               sty     tmp1            ; Save the value
+       lda     sp              ; Get lo byte
+       sec
+       sbc     tmp1            ; Subtract y value
+       sta     sp              ; Put result back
+       bcs     @L1
+       dec     sp+1
+@L1:   pla                     ; Restore A
+       rts                     ; Done
+
+.endproc
+
+
+
+
+