From 5e7e3d4b8109945cb18f3a98a578cb45f8738552 Mon Sep 17 00:00:00 2001 From: cuz Date: Thu, 11 Oct 2001 07:57:20 +0000 Subject: [PATCH] Removed the switch routines git-svn-id: svn://svn.cc65.org/cc65/trunk@1020 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/runtime/Makefile | 2 - libsrc/runtime/lswitch.s | 87 --------------------------------------- libsrc/runtime/switch.s | 88 ---------------------------------------- 3 files changed, 177 deletions(-) delete mode 100644 libsrc/runtime/lswitch.s delete mode 100644 libsrc/runtime/switch.s diff --git a/libsrc/runtime/Makefile b/libsrc/runtime/Makefile index 7b2f4732d..fdb7fc650 100644 --- a/libsrc/runtime/Makefile +++ b/libsrc/runtime/Makefile @@ -117,7 +117,6 @@ OBJS = add.o \ lsubeq.o \ lsubeqsp.o \ lswap.o \ - lswitch.o \ lt.o \ ltest.o \ ludiv.o \ @@ -181,7 +180,6 @@ OBJS = add.o \ subeqsp.o \ subysp.o \ swap.o \ - switch.o \ test.o \ tosint.o \ toslong.o \ diff --git a/libsrc/runtime/lswitch.s b/libsrc/runtime/lswitch.s deleted file mode 100644 index 5c069451a..000000000 --- a/libsrc/runtime/lswitch.s +++ /dev/null @@ -1,87 +0,0 @@ -; -; Ullrich von Bassewitz, 17.08.1998 -; -; CC65 runtime: switch statement with long selector -; - -; Subroutine to handle a switch statement with an long selector. The table -; is located at the return address from the function. It contains the negative -; of the case label count as first word, followed by three words for each case -; label, the first two being the value, and the last one the label to jump -; to in case of a match. The default case is located at the end of the table. - - .export lswitch - .importzp sreg, ptr1, ptr2, ptr3 - -lswitch: - sta ptr1 - stx ptr1+1 ; Save AX - clc - pla - adc #1 - sta ptr2 - pla - adc #0 - sta ptr2+1 ; Get pointer to table - - ldy #0 - lda (ptr2),y - sta ptr3 - iny - lda (ptr2),y - sta ptr3+1 ; Remember the count of labels - - clc ; Skip the label count - lda ptr2 - adc #2 - sta ptr2 - bcc L2 - inc ptr2+1 - bne L2 ; Branch always - -; Search for the label - -L0: ldy #0 - lda (ptr2),y - cmp ptr1 - bne L1 - iny - lda (ptr2),y - cmp ptr1+1 - bne L1 - iny - lda (ptr2),y - cmp sreg - bne L1 - iny - lda (ptr2),y - cmp sreg+1 - beq L3 -L1: clc - lda ptr2 - adc #6 ; Skip table entry - sta ptr2 - bcc L2 - inc ptr2+1 - -; Check if there are any labels left - -L2: inc ptr3 - bne L0 - inc ptr3+1 - bne L0 - -; Out of labels - - jmp (ptr2) - -; Label found - -L3: ldy #4 ; Jump label offset - lda (ptr2),y - sta ptr3 - iny - lda (ptr2),y - sta ptr3+1 - jmp (ptr3) - diff --git a/libsrc/runtime/switch.s b/libsrc/runtime/switch.s deleted file mode 100644 index 22dc4b7f3..000000000 --- a/libsrc/runtime/switch.s +++ /dev/null @@ -1,88 +0,0 @@ -; -; Ullrich von Bassewitz, 17.08.1998 -; -; CC65 runtime: switch statement with int selector -; - -; Subroutine to handle a switch statement with an int selector. The table -; is located at the return address from the function. It contains the negative -; of the case label count as first word, followed by two words for each case -; label, the first one being the value, and the second one the label to jump -; to in case of a match. The default case is located at the end of the table. - - .export switch - .importzp ptr1, ptr2, ptr3 - -switch: sta ptr1 - stx ptr1+1 ; Save AX - clc - pla - adc #1 - sta ptr2 - pla - adc #0 - sta ptr2+1 ; Get pointer to table - - ldy #0 - lda (ptr2),y - sta ptr3 - iny - lda (ptr2),y - sta ptr3+1 ; Remember the count of labels - - ldy #0 - clc ; Skip the label count - lda ptr2 - adc #2 - sta ptr2 - bcc L2 - inc ptr2+1 - bne L2 ; Branch always - -; Search for the label - -L0: lda (ptr2),y - iny - cmp ptr1 - beq L4 -L1: iny - iny - iny ; Overflow only here - bne L2 - inc ptr2+1 ; Bump high byte - -; Check if there are any labels left - -L2: inc ptr3 - bne L0 - inc ptr3+1 - bne L0 - -; Out of labels - - tya - clc - adc ptr2 - sta ptr2 - bcc L3 - inc ptr2+1 -L3: jmp (ptr2) - - -; Check high byte - -L4: lda (ptr2),y - cmp ptr1+1 - bne L1 - -; Label found - - iny - lda (ptr2),y - sta ptr3 - iny - lda (ptr2),y - sta ptr3+1 - jmp (ptr3) - - -- 2.39.5