1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-22 12:30:41 +00:00

Removed __cdiff. Since the assembler does character set translation for

some time now, it is no longer needed.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1573 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2002-11-22 00:53:46 +00:00
parent 195a49a6cf
commit d7a5fbeb1a
8 changed files with 29 additions and 59 deletions

View File

@ -8,16 +8,6 @@
.rodata .rodata
; Value that must be added to an upper case char to make it lower case
; char (example: for ASCII, this must be $E0).
.export __cdiff
__cdiff:
.byte $E0
; The following 256 byte wide table specifies attributes for the isxxx type ; The following 256 byte wide table specifies attributes for the isxxx type
; of functions. Doing it by a table means some overhead in space, but it ; of functions. Doing it by a table means some overhead in space, but it
; has major advantages: ; has major advantages:

View File

@ -10,16 +10,6 @@
.rodata .rodata
; Value that must be added to an upper case char to make it lower case
; char (example: for ASCII, this must be $E0).
.export __cdiff
__cdiff:
.byte $E0
; The following 256 byte wide table specifies attributes for the isxxx type ; The following 256 byte wide table specifies attributes for the isxxx type
; of functions. Doing it by a table means some overhead in space, but it ; of functions. Doing it by a table means some overhead in space, but it
; has major advantages: ; has major advantages:

View File

@ -8,16 +8,6 @@
.rodata .rodata
; Value that must be added to a lower case char to make it an upper case
; char (example: for ASCII, this must be $E0).
.export __cdiff
__cdiff:
.byte $80
; The following 256 byte wide table specifies attributes for the isxxx type ; The following 256 byte wide table specifies attributes for the isxxx type
; of functions. Doing it by a table means some overhead in space, but it ; of functions. Doing it by a table means some overhead in space, but it
; has major advantages: ; has major advantages:

View File

@ -7,27 +7,27 @@
.export _stricmp, _strcasecmp .export _stricmp, _strcasecmp
.import popax .import popax
.import __ctype, __cdiff .import __ctype
.importzp ptr1, ptr2, tmp1 .importzp ptr1, ptr2, tmp1
_stricmp: _stricmp:
_strcasecmp: _strcasecmp:
sta ptr2 ; Save s2 sta ptr2 ; Save s2
stx ptr2+1 stx ptr2+1
jsr popax ; get s1 jsr popax ; get s1
sta ptr1 sta ptr1
stx ptr1+1 stx ptr1+1
ldy #0 ldy #0
loop: lda (ptr2),y ; get char from second string loop: lda (ptr2),y ; get char from second string
tax tax
lda __ctype,x ; get character classification lda __ctype,x ; get character classification
and #$01 ; lower case char? and #$01 ; lower case char?
beq L1 ; jump if no beq L1 ; jump if no
txa ; get character back txa ; get character back
clc clc
adc __cdiff ; make upper case char adc #<('A'-'a') ; make upper case char
tax ; tax ;
L1: stx tmp1 ; remember upper case equivalent L1: stx tmp1 ; remember upper case equivalent
@ -38,7 +38,7 @@ L1: stx tmp1 ; remember upper case equivalent
beq L2 ; jump if no beq L2 ; jump if no
txa ; get character back txa ; get character back
clc clc
adc __cdiff ; make upper case char adc #<('A'-'a') ; make upper case char
tax tax
L2: cpx tmp1 ; compare characters L2: cpx tmp1 ; compare characters

View File

@ -9,27 +9,27 @@
.export _strlower, _strlwr .export _strlower, _strlwr
.import popax .import popax
.import __ctype, __cdiff .import __ctype
.importzp ptr1, ptr2 .importzp ptr1, ptr2
_strlower: _strlower:
_strlwr: _strlwr:
sta ptr1 ; Save s (working copy) sta ptr1 ; Save s (working copy)
stx ptr1+1 stx ptr1+1
sta ptr2 sta ptr2
sta ptr2+2 ; save function result sta ptr2+2 ; save function result
ldy #0 ldy #0
loop: lda (ptr1),y ; get character loop: lda (ptr1),y ; get character
beq L9 ; jump if done beq L9 ; jump if done
tax tax
lda __ctype,x ; get character classification lda __ctype,x ; get character classification
and #$02 ; upper case char? and #$02 ; upper case char?
beq L1 ; jump if no beq L1 ; jump if no
txa ; get character back into accu txa ; get character back into accu
sec sec
sbc __cdiff ; make lower case char sbc #<('A'-'a') ; make lower case char
sta (ptr1),y ; store back sta (ptr1),y ; store back
L1: iny ; next char L1: iny ; next char
bne loop bne loop
inc ptr1+1 ; handle offset overflow inc ptr1+1 ; handle offset overflow

View File

@ -9,13 +9,13 @@
.export _strupper, _strupr .export _strupper, _strupr
.import popax .import popax
.import __ctype, __cdiff .import __ctype
.importzp ptr1, ptr2 .importzp ptr1, ptr2
_strupper: _strupper:
_strupr: _strupr:
sta ptr1 ; Save s (working copy) sta ptr1 ; Save s (working copy)
stx ptr1+1 stx ptr1+1
sta ptr2 sta ptr2
sta ptr2+2 ; save function result sta ptr2+2 ; save function result
ldy #0 ldy #0
@ -28,7 +28,7 @@ loop: lda (ptr1),y ; get character
beq L1 ; jump if no beq L1 ; jump if no
txa ; get character back into accu txa ; get character back into accu
clc clc
adc __cdiff ; make upper case char adc #<('A'-'a') ; make upper case char
sta (ptr1),y ; store back sta (ptr1),y ; store back
L1: iny ; next char L1: iny ; next char
bne loop bne loop

View File

@ -5,7 +5,7 @@
; ;
.export _tolower .export _tolower
.import __ctype, __cdiff .import __ctype
_tolower: _tolower:
cpx #$00 ; Outside valid range? cpx #$00 ; Outside valid range?
@ -16,6 +16,6 @@ _tolower:
lsr a ; Get bit 1 (upper case char) into carry lsr a ; Get bit 1 (upper case char) into carry
tya ; Get char back into A tya ; Get char back into A
bcc L9 ; Jump if no upper case char bcc L9 ; Jump if no upper case char
sbc __cdiff ; Make lower case char (carry already set) sbc #<('A'-'a') ; Make lower case char (carry already set)
L9: rts L9: rts

View File

@ -5,7 +5,7 @@
; ;
.export _toupper .export _toupper
.import __ctype, __cdiff .import __ctype
_toupper: _toupper:
cpx #$00 ; Outside valid range? cpx #$00 ; Outside valid range?
@ -16,6 +16,6 @@ _toupper:
tya ; Get C back into A tya ; Get C back into A
bcc L9 ; Jump if not lower char bcc L9 ; Jump if not lower char
clc clc
adc __cdiff ; make upper case char adc #<('A'-'a') ; make upper case char
L9: rts ; CC are set L9: rts ; CC are set