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
|
Note: Calls internal routine isaln, which in turn
|
||||||
calls internal routines isdgt and isalp.
|
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.
|
b = isalph(c); Returns TRUE if c is alphabetic, otherwise FALSE.
|
||||||
|
|
||||||
An alphabetic character is a letter (A-Z or a-z).
|
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).
|
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,
|
This library instead uses a series of comparisons in the internal routines,
|
||||||
which leave the accumulator unmodified, and occupies approximately 128 bytes
|
which leave the accumulator unmodified, and generates approximately 128 bytes
|
||||||
of memory.
|
of machine code.
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
SUBROUTINE CTYPE
|
SUBROUTINE CTYPE
|
||||||
|
|
||||||
;Character Test Functions - Set Accumulator
|
;Character Test Functions - Set Accumulator
|
||||||
|
ISALNU: JSR ISANU ;Is Alphanumunder
|
||||||
|
BVC .ISBTF
|
||||||
ISALNM: JSR ISALN ;Is Alphanumeric Character
|
ISALNM: JSR ISALN ;Is Alphanumeric Character
|
||||||
BVC .ISBTF
|
BVC .ISBTF
|
||||||
ISALPH: JSR ISALP ;Is Alphabetic Character
|
ISALPH: JSR ISALP ;Is Alphabetic Character
|
||||||
@ -55,6 +57,9 @@ TOUPPR: JSR ISLWR ;If Char IS Not Lower Case
|
|||||||
RTS ; and Return
|
RTS ; and Return
|
||||||
|
|
||||||
;Machine Language Subroutines - Set/Clear Carry, Preserve Accumulator
|
;Machine Language Subroutines - Set/Clear Carry, Preserve Accumulator
|
||||||
|
ISANU: CMP #$5F ;If Char = '_'
|
||||||
|
BEQ .ISSEC ; Return Carry Set
|
||||||
|
;Else
|
||||||
ISALN: JSR ISDGT ;If Char IS Digit
|
ISALN: JSR ISDGT ;If Char IS Digit
|
||||||
BCS .ISRTS ; Return Carry Set
|
BCS .ISRTS ; Return Carry Set
|
||||||
;Else
|
;Else
|
||||||
|
@ -8,6 +8,12 @@
|
|||||||
* Returns: TRUE or FALSE */
|
* Returns: TRUE or FALSE */
|
||||||
char isalnm();
|
char isalnm();
|
||||||
|
|
||||||
|
/* Check for Alphanumunder Character *
|
||||||
|
* (Alphabetic, Digit, or '_') *
|
||||||
|
* Args: c - Character to Check *
|
||||||
|
* Returns: TRUE or FALSE */
|
||||||
|
char isalnu();
|
||||||
|
|
||||||
/* Checks for Alphabetic Character *
|
/* Checks for Alphabetic Character *
|
||||||
* (Upper Case or Lower Case) *
|
* (Upper Case or Lower Case) *
|
||||||
* Args: c - Character to Check *
|
* Args: c - Character to Check *
|
||||||
|
@ -21,6 +21,7 @@ head:
|
|||||||
putchr('L'); //Lower Case
|
putchr('L'); //Lower Case
|
||||||
putchr('A'); //Alphabetic
|
putchr('A'); //Alphabetic
|
||||||
putchr('N'); //Alphanumeric
|
putchr('N'); //Alphanumeric
|
||||||
|
putchr('M'); //Alphanumunder
|
||||||
putchr('G'); //Graphic
|
putchr('G'); //Graphic
|
||||||
putchr('R'); //Printable
|
putchr('R'); //Printable
|
||||||
putchr('B'); //Binary
|
putchr('B'); //Binary
|
||||||
@ -43,6 +44,7 @@ loop:
|
|||||||
c = islowr(i) & $0A | $20; putchr(c);
|
c = islowr(i) & $0A | $20; putchr(c);
|
||||||
c = isalph(i) & $0A | $20; putchr(c);
|
c = isalph(i) & $0A | $20; putchr(c);
|
||||||
c = isalnm(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 = isgrph(i) & $0A | $20; putchr(c);
|
||||||
c = isprnt(i) & $0A | $20; putchr(c);
|
c = isprnt(i) & $0A | $20; putchr(c);
|
||||||
c = isbdgt(i) & $0A | $20; putchr(c);
|
c = isbdgt(i) & $0A | $20; putchr(c);
|
||||||
@ -51,6 +53,6 @@ loop:
|
|||||||
if (i == 0) goto exit;
|
if (i == 0) goto exit;
|
||||||
if (i & $0F <> 0) goto loop;
|
if (i & $0F <> 0) goto loop;
|
||||||
newlin();
|
newlin();
|
||||||
c = getkey();
|
c = getchr();
|
||||||
if (c == $1B) goto exit;
|
if (c == $1B) goto exit;
|
||||||
goto head;
|
goto head;
|
||||||
|
Loading…
Reference in New Issue
Block a user