mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 15:29:46 +00:00
Changes resulting from code review.
This commit is contained in:
parent
ce80624f62
commit
002d1801ec
@ -9,6 +9,8 @@
|
||||
;
|
||||
; Definitions for the character type tables
|
||||
;
|
||||
; Ullrich von Bassewitz, 08.09.2001
|
||||
;
|
||||
|
||||
; Define bitmapped constants for the table entries
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
.include "ctype.inc"
|
||||
.export __ctype
|
||||
|
||||
; This data is a table of possible ctype combinations, possible during
|
||||
; Table definition covering all possible ctype combinations
|
||||
|
||||
.rodata
|
||||
__ctype:
|
||||
|
@ -54,10 +54,11 @@ L3: iny
|
||||
L5: stx tmp1 ; remember sign flag
|
||||
|
||||
L6: lda (ptr1),y ; get next char
|
||||
; get character classification
|
||||
jsr ctype_preprocessor_no_check
|
||||
and #CT_DIGIT ; digit?
|
||||
beq L8 ; done
|
||||
sec ; check if char is in digit space
|
||||
sbc #'0' ; so subtract lower limit
|
||||
tax ; remember this numeric value
|
||||
cmp #10 ; and check if upper limit is not crossed
|
||||
bcs L8 ; done
|
||||
|
||||
; 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
|
||||
|
||||
lda (ptr1),y ; fetch char again
|
||||
sec
|
||||
sbc #'0' ; make numeric value
|
||||
txa ; restore numeric value back to accu
|
||||
clc
|
||||
adc ptr2
|
||||
sta ptr2
|
||||
|
@ -13,15 +13,12 @@
|
||||
.export _isascii
|
||||
|
||||
_isascii:
|
||||
cpx #$00 ; Char range ok?
|
||||
bne @L1 ; Jump if no
|
||||
|
||||
tay
|
||||
bmi @L1
|
||||
|
||||
inx
|
||||
asl a ; high-bit to carry
|
||||
txa ; check range of input param
|
||||
bne @L1 ; out-of bounds?
|
||||
adc #$FF ; calculate return value based on carry
|
||||
rts
|
||||
|
||||
@L1: lda #$00 ; Return false
|
||||
@L1: lda #$00 ; return false
|
||||
tax
|
||||
rts
|
||||
|
@ -28,9 +28,8 @@ loop: lda (ptr1),y ; get character
|
||||
jsr ctype_preprocessor_no_check
|
||||
and #CT_UPPER ; upper case char?
|
||||
beq L1 ; jump if no
|
||||
lda (ptr1),y ; fetch character again
|
||||
sec
|
||||
sbc #<('A'-'a') ; make lower case char
|
||||
lda (ptr1),y ; fetch character again
|
||||
adc #<('a'-'A') ; make lower case char (ctype_preprocessor_no_check ensures carry clear)
|
||||
sta (ptr1),y ; store back
|
||||
L1: iny ; next char
|
||||
bne loop
|
||||
|
@ -28,8 +28,7 @@ loop: lda (ptr1),y ; get character
|
||||
and #CT_LOWER ; lower case char?
|
||||
beq L1 ; jump if no
|
||||
lda (ptr1),y ; fetch character again
|
||||
clc
|
||||
adc #<('A'-'a') ; make upper case char
|
||||
adc #<('A'-'a') ; make upper case char (ctype_preprocessor_no_check ensures carry clear)
|
||||
sta (ptr1),y ; store back
|
||||
L1: iny ; next char
|
||||
bne loop
|
||||
|
Loading…
Reference in New Issue
Block a user