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:
parent
195a49a6cf
commit
d7a5fbeb1a
@ -8,16 +8,6 @@
|
||||
|
||||
.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
|
||||
; of functions. Doing it by a table means some overhead in space, but it
|
||||
; has major advantages:
|
||||
|
@ -10,16 +10,6 @@
|
||||
|
||||
.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
|
||||
; of functions. Doing it by a table means some overhead in space, but it
|
||||
; has major advantages:
|
||||
|
@ -8,16 +8,6 @@
|
||||
|
||||
.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
|
||||
; of functions. Doing it by a table means some overhead in space, but it
|
||||
; has major advantages:
|
||||
|
@ -7,27 +7,27 @@
|
||||
|
||||
.export _stricmp, _strcasecmp
|
||||
.import popax
|
||||
.import __ctype, __cdiff
|
||||
.import __ctype
|
||||
.importzp ptr1, ptr2, tmp1
|
||||
|
||||
|
||||
_stricmp:
|
||||
_strcasecmp:
|
||||
sta ptr2 ; Save s2
|
||||
sta ptr2 ; Save s2
|
||||
stx ptr2+1
|
||||
jsr popax ; get s1
|
||||
jsr popax ; get s1
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
ldy #0
|
||||
|
||||
loop: lda (ptr2),y ; get char from second string
|
||||
loop: lda (ptr2),y ; get char from second string
|
||||
tax
|
||||
lda __ctype,x ; get character classification
|
||||
and #$01 ; lower case char?
|
||||
beq L1 ; jump if no
|
||||
txa ; get character back
|
||||
lda __ctype,x ; get character classification
|
||||
and #$01 ; lower case char?
|
||||
beq L1 ; jump if no
|
||||
txa ; get character back
|
||||
clc
|
||||
adc __cdiff ; make upper case char
|
||||
adc #<('A'-'a') ; make upper case char
|
||||
tax ;
|
||||
L1: stx tmp1 ; remember upper case equivalent
|
||||
|
||||
@ -38,7 +38,7 @@ L1: stx tmp1 ; remember upper case equivalent
|
||||
beq L2 ; jump if no
|
||||
txa ; get character back
|
||||
clc
|
||||
adc __cdiff ; make upper case char
|
||||
adc #<('A'-'a') ; make upper case char
|
||||
tax
|
||||
|
||||
L2: cpx tmp1 ; compare characters
|
||||
|
@ -9,27 +9,27 @@
|
||||
|
||||
.export _strlower, _strlwr
|
||||
.import popax
|
||||
.import __ctype, __cdiff
|
||||
.import __ctype
|
||||
.importzp ptr1, ptr2
|
||||
|
||||
_strlower:
|
||||
_strlwr:
|
||||
sta ptr1 ; Save s (working copy)
|
||||
stx ptr1+1
|
||||
sta ptr1 ; Save s (working copy)
|
||||
stx ptr1+1
|
||||
sta ptr2
|
||||
sta ptr2+2 ; save function result
|
||||
sta ptr2+2 ; save function result
|
||||
ldy #0
|
||||
|
||||
loop: lda (ptr1),y ; get character
|
||||
beq L9 ; jump if done
|
||||
loop: lda (ptr1),y ; get character
|
||||
beq L9 ; jump if done
|
||||
tax
|
||||
lda __ctype,x ; get character classification
|
||||
and #$02 ; upper case char?
|
||||
beq L1 ; jump if no
|
||||
txa ; get character back into accu
|
||||
lda __ctype,x ; get character classification
|
||||
and #$02 ; upper case char?
|
||||
beq L1 ; jump if no
|
||||
txa ; get character back into accu
|
||||
sec
|
||||
sbc __cdiff ; make lower case char
|
||||
sta (ptr1),y ; store back
|
||||
sbc #<('A'-'a') ; make lower case char
|
||||
sta (ptr1),y ; store back
|
||||
L1: iny ; next char
|
||||
bne loop
|
||||
inc ptr1+1 ; handle offset overflow
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
.export _strupper, _strupr
|
||||
.import popax
|
||||
.import __ctype, __cdiff
|
||||
.import __ctype
|
||||
.importzp ptr1, ptr2
|
||||
|
||||
_strupper:
|
||||
_strupr:
|
||||
sta ptr1 ; Save s (working copy)
|
||||
stx ptr1+1
|
||||
stx ptr1+1
|
||||
sta ptr2
|
||||
sta ptr2+2 ; save function result
|
||||
ldy #0
|
||||
@ -28,7 +28,7 @@ loop: lda (ptr1),y ; get character
|
||||
beq L1 ; jump if no
|
||||
txa ; get character back into accu
|
||||
clc
|
||||
adc __cdiff ; make upper case char
|
||||
adc #<('A'-'a') ; make upper case char
|
||||
sta (ptr1),y ; store back
|
||||
L1: iny ; next char
|
||||
bne loop
|
||||
|
@ -5,7 +5,7 @@
|
||||
;
|
||||
|
||||
.export _tolower
|
||||
.import __ctype, __cdiff
|
||||
.import __ctype
|
||||
|
||||
_tolower:
|
||||
cpx #$00 ; Outside valid range?
|
||||
@ -16,6 +16,6 @@ _tolower:
|
||||
lsr a ; Get bit 1 (upper case char) into carry
|
||||
tya ; Get char back into A
|
||||
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
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
;
|
||||
|
||||
.export _toupper
|
||||
.import __ctype, __cdiff
|
||||
.import __ctype
|
||||
|
||||
_toupper:
|
||||
cpx #$00 ; Outside valid range?
|
||||
@ -16,6 +16,6 @@ _toupper:
|
||||
tya ; Get C back into A
|
||||
bcc L9 ; Jump if not lower char
|
||||
clc
|
||||
adc __cdiff ; make upper case char
|
||||
adc #<('A'-'a') ; make upper case char
|
||||
L9: rts ; CC are set
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user