mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-22 01:31:33 +00:00
Added alphanumunder to ctype module
This commit is contained in:
parent
c1d9389a39
commit
4958e3c432
@ -20,6 +20,14 @@ The following functions are defined:
|
||||
Note: Calls internal routine isaln, which in turn
|
||||
calls internal routines isdgt and isalp.
|
||||
|
||||
b = isalnu(c); Returns TRUE if c is an alphanumunder, otherwise FALSE.
|
||||
|
||||
An alphanumunder character is a letter (A-Z or a-z),
|
||||
a digit (0-9), or an underline (_).
|
||||
|
||||
Note: Calls internal routine isalu, which in turn
|
||||
calls internal routines isdgt and isalp.
|
||||
|
||||
b = isalph(c); Returns TRUE if c is alphabetic, otherwise FALSE.
|
||||
|
||||
An alphabetic character is a letter (A-Z or a-z).
|
||||
@ -116,6 +124,6 @@ Implementation: The standard method of implementing the ctype library is to
|
||||
use a bit mask table of 128 bytes (one for each standard ASCII character).
|
||||
|
||||
This library instead uses a series of comparisons in the internal routines,
|
||||
which leave the accumulator unmodified, and occupies approximately 128 bytes
|
||||
of memory.
|
||||
which leave the accumulator unmodified, and generates approximately 128 bytes
|
||||
of machine code.
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
SUBROUTINE CTYPE
|
||||
|
||||
;Character Test Functions - Set Accumulator
|
||||
ISALNU: JSR ISANU ;Is Alphanumunder
|
||||
BVC .ISBTF
|
||||
ISALNM: JSR ISALN ;Is Alphanumeric Character
|
||||
BVC .ISBTF
|
||||
ISALPH: JSR ISALP ;Is Alphabetic Character
|
||||
@ -55,10 +57,13 @@ TOUPPR: JSR ISLWR ;If Char IS Not Lower Case
|
||||
RTS ; and Return
|
||||
|
||||
;Machine Language Subroutines - Set/Clear Carry, Preserve Accumulator
|
||||
ISALN: JSR ISDGT ;If Char IS Digit
|
||||
ISANU: CMP #$5F ;If Char = '_'
|
||||
BEQ .ISSEC ; Return Carry Set
|
||||
;Else
|
||||
ISALN: JSR ISDGT ;If Char IS Digit
|
||||
BCS .ISRTS ; Return Carry Set
|
||||
;Else
|
||||
ISALP: JSR ISUPR ;If Char IS Upper Case
|
||||
ISALP: JSR ISUPR ;If Char IS Upper Case
|
||||
BCS .ISRTS ; Return Carry Set
|
||||
;Else
|
||||
ISLWR: CMP #$61 ;If Char < 'a'
|
||||
|
@ -8,6 +8,12 @@
|
||||
* Returns: TRUE or FALSE */
|
||||
char isalnm();
|
||||
|
||||
/* Check for Alphanumunder Character *
|
||||
* (Alphabetic, Digit, or '_') *
|
||||
* Args: c - Character to Check *
|
||||
* Returns: TRUE or FALSE */
|
||||
char isalnu();
|
||||
|
||||
/* Checks for Alphabetic Character *
|
||||
* (Upper Case or Lower Case) *
|
||||
* Args: c - Character to Check *
|
||||
|
@ -21,6 +21,7 @@ head:
|
||||
putchr('L'); //Lower Case
|
||||
putchr('A'); //Alphabetic
|
||||
putchr('N'); //Alphanumeric
|
||||
putchr('M'); //Alphanumunder
|
||||
putchr('G'); //Graphic
|
||||
putchr('R'); //Printable
|
||||
putchr('B'); //Binary
|
||||
@ -43,6 +44,7 @@ loop:
|
||||
c = islowr(i) & $0A | $20; putchr(c);
|
||||
c = isalph(i) & $0A | $20; putchr(c);
|
||||
c = isalnm(i) & $0A | $20; putchr(c);
|
||||
c = isalnu(i) & $0A | $20; putchr(c);
|
||||
c = isgrph(i) & $0A | $20; putchr(c);
|
||||
c = isprnt(i) & $0A | $20; putchr(c);
|
||||
c = isbdgt(i) & $0A | $20; putchr(c);
|
||||
@ -51,6 +53,6 @@ loop:
|
||||
if (i == 0) goto exit;
|
||||
if (i & $0F <> 0) goto loop;
|
||||
newlin();
|
||||
c = getkey();
|
||||
c = getchr();
|
||||
if (c == $1B) goto exit;
|
||||
goto head;
|
||||
|
Loading…
Reference in New Issue
Block a user