1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-22 01:31:33 +00:00

Added isalud() to ctype module

This commit is contained in:
Curtis F Kaylor 2022-07-09 18:25:34 -04:00
parent 122e4fcc00
commit b2820d2549
5 changed files with 64 additions and 11 deletions

View File

@ -12,6 +12,13 @@ passed a high ASCII character (127 - 255).
The following functions are defined: The following functions are defined:
b = isalph(c); Returns TRUE if c is alphabetic, otherwise FALSE.
An alphabetic character is a letter (A-Z or a-z).
Note: Call internal routine isalp, which in turn
calls internal routines isupr and islwr.
b = isalnm(c); Returns TRUE if c is alphanumeric, otherwise FALSE. b = isalnm(c); Returns TRUE if c is alphanumeric, otherwise FALSE.
An alphanumeric character is a letter (A-Z or a-z), An alphanumeric character is a letter (A-Z or a-z),
@ -28,12 +35,13 @@ The following functions are defined:
Note: Calls internal routine isalu, which in turn Note: Calls internal routine isalu, which in turn
calls internal routines isdgt and isalp. calls internal routines isdgt and isalp.
b = isalph(c); Returns TRUE if c is alphabetic, otherwise FALSE. b = isalud(c); Returns TRUE if c is an alphanumundOT, otherwise FALSE.
An alphabetic character is a letter (A-Z or a-z). An alphanumundot character is a letter (A-Z or a-z),
a digit (0-9), an underline (_), or a dot (.).
Note: Call internal routine isalp, which in turn Note: Calls internal routine isalu, which in turn
calls internal routines isupr and islwr. calls internal routines isdgt and isalp.
b = isbdgt(c); Returns TRUE if c is a binary digit, otherwise FALSE. b = isbdgt(c); Returns TRUE if c is a binary digit, otherwise FALSE.

View File

@ -19,6 +19,7 @@ blkstr block Block String Search block for segment beginning with
blkswp block Block Swap Swap bytes of array with the current segment. blkswp block Block Swap Swap bytes of array with the current segment.
blksrt block Block Sort Sort segments in block by initial string. blksrt block Block Sort Sort segments in block by initial string.
button paddle Button Read paddle button controller status. button paddle Button Read paddle button controller status.
char stdlib Char from integer Convert Integer to Character
chdir direct Change Directory Change to specified directory chdir direct Change Directory Change to specified directory
chdrv direct Change Drive Change to specified drive chdrv direct Change Drive Change to specified drive
ctoa stdlib Character to ASCII Convert byte to numeric string. ctoa stdlib Character to ASCII Convert byte to numeric string.
@ -44,18 +45,30 @@ fsinit fileio File System Init Initialize file system.
fsname fileio File Set Name Set filename for fopen, fsave, or fload. fsname fileio File Set Name Set filename for fopen, fsave, or fload.
fwrite fileio File Write Write bytes to file. fwrite fileio File Write Write bytes to file.
getc stdio Get Character Read character from keyboard. getc stdio Get Character Read character from keyboard.
getcpr stdiox Get Char Prompt Display prompt and wait for keypress.
getcwd direct Get CWD Return current working directory getcwd direct Get CWD Return current working directory
getdrv direct Get Drive Return current drive identifier getdrv direct Get Drive Return current drive identifier
getdst stddef Get Destination Get address in Destination Pointer. getdst stddef Get Destination Get address in Destination Pointer.
getprc stdiox Get Prompt Character Display prompt and wait for key press.
gets stdio Get String Read string from keyboard. gets stdio Get String Read string from keyboard.
getsrc stddef Get Source Get address in Source Pointer. getsrc stddef Get Source Get address in Source Pointer.
iabs intlib Integer Absolute Return absolute value of integer. iabs intlib Integer Absolute Return absolute value of integer.
iacc intlib Integer Accumulator Set integer accumulator.
iadd intlib Integer Add Add two integer values.
iaddc intlib Integer Add Character Add character and integer value.
icmp intlib Integer Compare Compare two integer values.
idiv intlib Integer Divide Divide integer values by integer value.
imax intlib Integer Maximum Return greater of two integers. imax intlib Integer Maximum Return greater of two integers.
imin intlib Integer Minimum Return lesser of two integers. imin intlib Integer Minimum Return lesser of two integers.
imod intlib Integer Modulo Return modulus of two integer values.
imult intlib Integer Multiply Multiply two integer values.
imultc intlib Integer Multiply Char Multiply character and integer value.
ineg intlib Integer Negate Return Negative of integer value.
int stdlib Int from character Convert Character to Integer
intay stdlib Int from A,Y Convert Character Pair to Integer
isalnm ctype Is Alphanumeric Return TRUE if character is A-Z, a-z, or 0-9. isalnm ctype Is Alphanumeric Return TRUE if character is A-Z, a-z, or 0-9.
isalnu ctype Is Alphanumunder Return TRUE if character is A-Z, a-z, 0-9, or _. isalnu ctype Is Alphanumunder Return TRUE if character is A-Z, a-z, 0-9, or _.
isalph ctype Is Alphabetic Return TRUE if character is A-Z or a-z. isalph ctype Is Alphabetic Return TRUE if character is A-Z or a-z.
isalud ctype Is Alphanumundot Return TRUE if character is A-Z, a-z, 0-9, ., or _.
isbdgt ctype Is Binary Digit Return TRUE if character is 0 or 1. isbdgt ctype Is Binary Digit Return TRUE if character is 0 or 1.
isctrl ctype is Control Return TRUE if ASCII code is 0-31 or 127. isctrl ctype is Control Return TRUE if ASCII code is 0-31 or 127.
isdigt ctype Is Digit Return TRUE if character is 0-9. isdigt ctype Is Digit Return TRUE if character is 0-9.
@ -67,6 +80,7 @@ islowr ctype Is Lowercase Return TRUE if character is a-z.
ispnct ctype Is Punctuation Return TRUE if Graphical and not Alphanumeric. ispnct ctype Is Punctuation Return TRUE if Graphical and not Alphanumeric.
isprnt ctype Is Printable Return TRUE if ASCII code is 32-126. isprnt ctype Is Printable Return TRUE if ASCII code is 32-126.
isspce ctype Is white Space Return TRUE if ASCII code is 9-13 or 32. isspce ctype Is white Space Return TRUE if ASCII code is 9-13 or 32.
isub intlib Integer Subtract Subtract two integer values.
isuppr ctype Is Uppercase Return TRUE if character is A-Z. isuppr ctype Is Uppercase Return TRUE if character is A-Z.
itoa intlib Integer to ASCII Convert Integer to String. itoa intlib Integer to ASCII Convert Integer to String.
joystk joystk Joystick Read Atari style joystick controller status. joystk joystk Joystick Read Atari style joystick controller status.
@ -77,7 +91,7 @@ mclose memio Memory Close Close memory file.
memdst memory Memory Destination Set destination array for subsequent functions. memdst memory Memory Destination Set destination array for subsequent functions.
memset memory Memory Set File bytes in array with byte. memset memory Memory Set File bytes in array with byte.
memchr memory Memory Character Search for byte in array. memchr memory Memory Character Search for byte in array.
memclr memory Memory Cllear File bytes in array with $00. memclr memory Memory Clear File bytes in array with $00.
memcmp memory Memory Compare Compare bytes in array against destination array. memcmp memory Memory Compare Compare bytes in array against destination array.
memcpy memory Memory Copy Copy bytes from array to destination array. memcpy memory Memory Copy Copy bytes from array to destination array.
memswp memory Memory Swap Swap bytes in array with destination array. memswp memory Memory Swap Swap bytes in array with destination array.
@ -110,17 +124,27 @@ ptrsav pointer Pointer Save Save pointer into two-byte array.
ptrrst pointer Pointer Restore Restore pointer from two-byte array. ptrrst pointer Pointer Restore Restore pointer from two-byte array.
printf stdiox Print Formatted Write formatted byte and/or string/address to screen. printf stdiox Print Formatted Write formatted byte and/or string/address to screen.
putadr test Put Address Write "address=" and hexadecimal address to screen. putadr test Put Address Write "address=" and hexadecimal address to screen.
putbin stdiox Put Binary Write byte to screen as binary number.
putc stdio Put Character Write character to screen. putc stdio Put Character Write character to screen.
putdec stdiox Put Decimal Write byte to screen as decimal number. putdec stdiox Put Decimal Write byte to screen as decimal number.
putdeh stdiox Put Decimal Hundred Write byte mod 100, zero-filled to screen.
putdel stdiox Put Decimal Left Write byte to screen as left-justified decimal. putdel stdiox Put Decimal Left Write byte to screen as left-justified decimal.
putder stdiox Put Decimal Right Write byte to screen as right-justified decimal. putder stdiox Put Decimal Right Write byte to screen as right-justified decimal.
putdst stdios Put Destination Write destination string to screen. putdez stdiox Put Decimal Zero``` Write byte zero-filled to screen.
putdst stdiox Put Destination Write destination string to screen.
putexh stdiox Put Extended Hex Write 24 bit number to screen as hexadecimal number.
puthex stdiox Put Hexadecimal Write byte to screen as hexadecimal number. puthex stdiox Put Hexadecimal Write byte to screen as hexadecimal number.
putinr stdiox Put Integer Right Write integer to screen as right justified decimal number.
putint stdiox Put Integer Write integer to screen as decimal number.
putln stdio Put Line Write string plus newline to screen. putln stdio Put Line Write string plus newline to screen.
putnyb stdiox Put Nybble Write low nybble to screen as hexadecimal digit.
puts stdio Put String Write string to screen. puts stdio Put String Write string to screen.
putmsk stdiox Put Mask Write bit masked byte to screen as binary number.
putrpc stdiox Put Repeated Char Write character multiple times to screen.
putrps stdiox Put Repeated Spaces Write multiple spaces to screen.
putspc stdiox Put Space Write space character to screen. putspc stdiox Put Space Write space character to screen.
putsub stdio Put Substring Write substring to screen. putsub stdio Put Substring Write substring to screen.
putwrd stdiox Put Word Write address to screen as hexadecimal number. putwrd stdiox Put Word Write integer to screen as hexadecimal number.
rand stdlib Random Generate pseudorandom number. rand stdlib Random Generate pseudorandom number.
rands stdlib Random Seed Seed random number generator. rands stdlib Random Seed Seed random number generator.
rddir dirent Read Directory Read Directory Entry rddir dirent Read Directory Read Directory Entry
@ -158,15 +182,23 @@ strapd string String Append Append character to string.
strcat string String Concatenate Concatenate string to destination string. strcat string String Concatenate Concatenate string to destination string.
strchr string String Character Search for character in string. strchr string String Character Search for character in string.
strcmp string String Compare Compare string contents against destination string. strcmp string String Compare Compare string contents against destination string.
strcms string String Compare Source Compare source string against destination string.
strcps string String Copy Source Copy source string to destination string.
strcpy string String Copy Copy string contents to destination string. strcpy string String Copy Copy string contents to destination string.
strcsp stringx String Char Span Return length of span in destination not in string. strcsp stringx String Char Span Return length of span in destination not in string.
strcut string String Cut Copy substring to destination string. strcut string String Cut Copy substring to destination string.
strget stringl String Get Read entry from string list.
strlen string String Length Calculate length of string. strlen string String Length Calculate length of string.
strlln stringl String List Length Calculate number of entries in string list
strlwr stringm String Lower Convert string to lowercase.
strpbk stringx String Pointer Break Find first character in destination found in string. strpbk stringx String Pointer Break Find first character in destination found in string.
strpad stringm String Pad Pad or truncate string.
strppd string String Prepend Prepend character to string. strppd string String Prepend Prepend character to string.
strput stringl String Put Write entry to string list.
strrch string String Reverse Char Search for character from end of string. strrch string String Reverse Char Search for character from end of string.
strspn stringx String Span Return length of span in destination found in string. strspn stringx String Span Return length of span in destination found in string.
strstr string String String Search for string in destination string. strstr string String String Search for string in destination string.
strupr stringm String Upper Convert string to uppercase.
swap bitlib Swap nybbles Swaps left and right nybbles in byte. swap bitlib Swap nybbles Swaps left and right nybbles in byte.
tolowr ctype To Lowercase Convert character to lowercase. tolowr ctype To Lowercase Convert character to lowercase.
touppr ctype To Uppercase Convert character to uppercase. touppr ctype To Uppercase Convert character to uppercase.

View File

@ -6,15 +6,17 @@
; toxxxx set Carry if character is converted, otherwise clear Carry ; toxxxx set Carry if character is converted, otherwise clear Carry
;Machine Language Subroutines modify Flags but not Accumulator ;Machine Language Subroutines modify Flags but not Accumulator
; Carry will be Set if True and Cleared if False ; Carry will be Set if True and Cleared if False
;Index Registers X an Y are not modified by any routines ;Index Registers X and Y are not modified by any routines
SUBROUTINE CTYPE SUBROUTINE CTYPE
;Character Test Functions - Set Accumulator ;Character Test Functions - Set Accumulator
ISALNU: JSR ISANU ;Is Alphanumunder ISALUD: JSR ISAUD ;Is Alphanumunder or Dot
BVC .ISBTF BVC .ISBTF
ISALNM: JSR ISALN ;Is Alphanumeric Character ISALNM: JSR ISALN ;Is Alphanumeric Character
BVC .ISBTF BVC .ISBTF
ISALNU: JSR ISANU ;Is Alphanumunder
BVC .ISBTF
ISALPH: JSR ISALP ;Is Alphabetic Character ISALPH: JSR ISALP ;Is Alphabetic Character
BVC .ISBTF BVC .ISBTF
ISBDGT: JSR ISBIN ;Is Binary Digit ISBDGT: JSR ISBIN ;Is Binary Digit
@ -57,6 +59,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
ISAUD: CMP #$2E ;If Char = '.'
BEQ .ISSEC ; Return Carry Set
;Else
ISANU: CMP #$5F ;If Char = '_' ISANU: CMP #$5F ;If Char = '_'
BEQ .ISSEC ; Return Carry Set BEQ .ISSEC ; Return Carry Set
;Else ;Else

View File

@ -20,6 +20,12 @@ char isalnu();
* Returns: TRUE or FALSE */ * Returns: TRUE or FALSE */
char isalph(); char isalph();
/* Check for Alphanumundot Character *
* (Alpha, Digit, '.', or '_') *
* Args: c - Character to Check *
* Returns: TRUE or FALSE */
char isalud();
/* Checks for Control Character * /* Checks for Control Character *
* (Less than Space or Delete) * * (Less than Space or Delete) *
* Args: c - Character to Check * * Args: c - Character to Check *

View File

@ -22,6 +22,7 @@ head:
putchr('A'); //Alphabetic putchr('A'); //Alphabetic
putchr('N'); //Alphanumeric putchr('N'); //Alphanumeric
putchr('M'); //Alphanumunder putchr('M'); //Alphanumunder
putchr('T'); //Alphanumundots
putchr('G'); //Graphic putchr('G'); //Graphic
putchr('R'); //Printable putchr('R'); //Printable
putchr('B'); //Binary putchr('B'); //Binary
@ -45,6 +46,7 @@ loop:
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 = isalnu(i) & $0A | $20; putchr(c);
c = isalud(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);