]> git.sur5r.net Git - cc65/commitdiff
Use named constants from ctype.inc instead of hard coded numeric values.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 10 Feb 2009 22:11:56 +0000 (22:11 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Tue, 10 Feb 2009 22:11:56 +0000 (22:11 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3929 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/atoi.s
libsrc/common/stricmp.s
libsrc/common/strlower.s
libsrc/common/strnicmp.s
libsrc/common/strupper.s

index cb2a72b48d5967f5ac21de758d78874599b568f0..6732755733e75757241d0e21ae4f2c83e461aebb 100644 (file)
@@ -9,6 +9,8 @@
                .import         __ctype
        .importzp       sreg, ptr1, ptr2, tmp1
 
+        .include        "ctype.inc"
+
 ;
 ; Conversion routine (32 bit)
 ;
@@ -27,7 +29,7 @@ _atol:        sta     ptr1            ; Store s
 L1:    lda     (ptr1),y
        tax
        lda     __ctype,x       ; get character classification
-       and     #$80            ; tab or space?
+               and     #CT_SPACE_TAB   ; tab or space?
        beq     L2              ; jump if no
        iny
        bne     L1
index 73cb580cbfc171a9cd56732aeb3338e8fc0a3da7..03638c8e2892befb39459cfdce1b329ebffb064f 100644 (file)
@@ -10,6 +10,7 @@
        .import         __ctype
        .importzp       ptr1, ptr2, tmp1
 
+        .include        "ctype.inc"
 
 _stricmp:
 _strcasecmp:
@@ -23,7 +24,7 @@ _strcasecmp:
 loop:          lda     (ptr2),y        ; get char from second string
        tax
        lda     __ctype,x       ; get character classification
-       and     #$01            ; lower case char?
+               and     #CT_LOWER       ; lower case char?
        beq     L1              ; jump if no
        txa                     ; get character back
        clc
@@ -34,13 +35,13 @@ L1: stx     tmp1            ; remember upper case equivalent
        lda     (ptr1),y        ; get character from first string
        tax
        lda     __ctype,x       ; get character classification
-       and     #$01            ; lower case char?
+       and     #CT_LOWER       ; lower case char?
                beq     L2              ; jump if no
        txa                     ; get character back
        clc
                adc     #<('A'-'a')     ; make upper case char
        tax
-
+                                
 L2:    cpx     tmp1            ; compare characters
        bne     L3
        txa                     ; end of strings?
index 858b8e181306aa627eec6574f3241527667dfbbe..b76133ce76da6de2e148ad11b177efc3283d1060 100644 (file)
@@ -12,6 +12,8 @@
        .import         __ctype
        .importzp       ptr1, ptr2
 
+        .include        "ctype.inc"
+
 _strlower:
 _strlwr:
        sta     ptr1            ; Save s (working copy)
@@ -24,7 +26,7 @@ loop: lda     (ptr1),y        ; get character
        beq     L9              ; jump if done
        tax
        lda     __ctype,x       ; get character classification
-       and     #$02            ; upper case char?
+               and     #CT_UPPER       ; upper case char?
        beq     L1              ; jump if no
        txa                     ; get character back into accu
        sec
index c3b89e4d87fed9e1940c231c0e8789d2a8345beb..38bd21c73f4a8bffceff05e383e04bc63d4087f2 100644 (file)
@@ -10,6 +10,7 @@
        .import         popax, __ctype
        .importzp       ptr1, ptr2, ptr3, tmp1
 
+        .include        "ctype.inc"
 
 _strnicmp:
 _strncasecmp:
@@ -49,27 +50,27 @@ Loop:       inc     ptr3
 Comp:  lda     (ptr2),y
        tax
        lda     __ctype,x       ; get character classification
-       and     #$01            ; lower case char?
+               and     #CT_LOWER       ; lower case char?
        beq     L1              ; jump if no
        txa                     ; get character back
        sec
        sbc     #<('a'-'A')     ; make upper case char
-       tax                     ;
+       tax                     ;
 L1:    stx     tmp1            ; remember upper case equivalent
 
-       lda     (ptr1),y        ; get character from first string
+       lda     (ptr1),y        ; get character from first string
        tax
        lda     __ctype,x       ; get character classification
-       and     #$01            ; lower case char?
-               beq     L2              ; jump if no
-       txa                     ; get character back
+       and     #CT_LOWER       ; lower case char?
+               beq     L2              ; jump if no
+       txa                     ; get character back
        sec
                sbc     #<('a'-'A')     ; make upper case char
        tax
 
-L2:    cpx     tmp1            ; compare characters
-               bne     NotEqual        ; Jump if strings different
-       txa                     ; End of strings?
+L2:    cpx     tmp1            ; compare characters
+               bne     NotEqual        ; Jump if strings different
+       txa                     ; End of strings?
                beq     Equal1          ; Jump if EOS reached, a/x == 0
 
 ; Increment the pointers
index b330ab8c1c7e0db94532faaf8a86ed0573cb7b31..70b593fab61201936c16f518aa9c004522e36b93 100644 (file)
@@ -12,6 +12,8 @@
        .import         __ctype
        .importzp       ptr1, ptr2
 
+        .include        "ctype.inc"
+
 _strupper:
 _strupr:
        sta     ptr1            ; Save s (working copy)
@@ -24,7 +26,7 @@ loop: lda     (ptr1),y        ; get character
        beq     L9              ; jump if done
        tax
        lda     __ctype,x       ; get character classification
-       and     #$01            ; lower case char?
+               and     #CT_LOWER       ; lower case char?
        beq     L1              ; jump if no
        txa                     ; get character back into accu
        clc