1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-26 05:29:30 +00:00

Changes resulting from code review.

This commit is contained in:
IrgendwerA8 2020-01-05 15:57:44 +01:00 committed by Oliver Schmidt
parent ce80624f62
commit 002d1801ec
6 changed files with 17 additions and 21 deletions

View File

@ -9,6 +9,8 @@
; ;
; Definitions for the character type tables ; Definitions for the character type tables
; ;
; Ullrich von Bassewitz, 08.09.2001
;
; Define bitmapped constants for the table entries ; Define bitmapped constants for the table entries

View File

@ -13,7 +13,7 @@
.include "ctype.inc" .include "ctype.inc"
.export __ctype .export __ctype
; This data is a table of possible ctype combinations, possible during ; Table definition covering all possible ctype combinations
.rodata .rodata
__ctype: __ctype:

View File

@ -54,10 +54,11 @@ L3: iny
L5: stx tmp1 ; remember sign flag L5: stx tmp1 ; remember sign flag
L6: lda (ptr1),y ; get next char L6: lda (ptr1),y ; get next char
; get character classification sec ; check if char is in digit space
jsr ctype_preprocessor_no_check sbc #'0' ; so subtract lower limit
and #CT_DIGIT ; digit? tax ; remember this numeric value
beq L8 ; done cmp #10 ; and check if upper limit is not crossed
bcs L8 ; done
; Multiply ptr2 (the converted value) by 10 ; Multiply ptr2 (the converted value) by 10
@ -91,9 +92,7 @@ L6: lda (ptr1),y ; get next char
; Get the character back and add it ; Get the character back and add it
lda (ptr1),y ; fetch char again txa ; restore numeric value back to accu
sec
sbc #'0' ; make numeric value
clc clc
adc ptr2 adc ptr2
sta ptr2 sta ptr2

View File

@ -13,15 +13,12 @@
.export _isascii .export _isascii
_isascii: _isascii:
cpx #$00 ; Char range ok? asl a ; high-bit to carry
bne @L1 ; Jump if no txa ; check range of input param
bne @L1 ; out-of bounds?
tay adc #$FF ; calculate return value based on carry
bmi @L1
inx
rts rts
@L1: lda #$00 ; Return false @L1: lda #$00 ; return false
tax tax
rts rts

View File

@ -28,9 +28,8 @@ loop: lda (ptr1),y ; get character
jsr ctype_preprocessor_no_check jsr ctype_preprocessor_no_check
and #CT_UPPER ; upper case char? and #CT_UPPER ; upper case char?
beq L1 ; jump if no beq L1 ; jump if no
lda (ptr1),y ; fetch character again lda (ptr1),y ; fetch character again
sec adc #<('a'-'A') ; make lower case char (ctype_preprocessor_no_check ensures carry clear)
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

View File

@ -28,8 +28,7 @@ loop: lda (ptr1),y ; get character
and #CT_LOWER ; lower case char? and #CT_LOWER ; lower case char?
beq L1 ; jump if no beq L1 ; jump if no
lda (ptr1),y ; fetch character again lda (ptr1),y ; fetch character again
clc adc #<('A'-'a') ; make upper case char (ctype_preprocessor_no_check ensures carry clear)
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