Hardware Reference
In-Depth Information
Otherwise, a value of zero is returned. The following instruction sequence illustrates the use
of this function:
isxdigit
equ
$EE92
c_buf
ds.b
20
; buffer that holds data to be validated
clra
; clear accumulator A
ldab
c_buf
; get one character
jsr
[isxdigit,PCR]
int toupper(int c);
Pointer address: $EE94
If c is a lowercase character, toupper() will return the corresponding uppercase letter. If the
character is in uppercase, it simply returns c. The following instruction utilizes this function to
convert a character contained in B to uppercase:
toupper
equ
$EE94
c_buf
ds.b
20
; buffer that contains string to be converted to
; uppercase
ldab
c_buf
; get one character to convert
clra
jsr
[toupper,PCR]
int isalpha(int c);
Pointer address: $EE96
This function tests the character passed in c for membership in the character set [a..z, A..Z].
If the character c is in this set, the function returns a nonzero value. Otherwise, it returns a
zero. This function would also be useful for validating an input string. The following instruc-
tion sequence illustrates the use of this function:
isalpha
equ
$EE96
c_buf
ds.b
20
ldab
c_buf
clra
jsr
[isalpha,PCR]
; check whether the character in B is alphabetic
unsigned int strlen(const char *cs);
Pointer address: $EE98
The strlen() function returns the length of the string pointed to by cs . The following instruc-
tion sequence counts the number of characters contained in the string pointed to by cs:
strlen
equ
$ EE98
cs
db
“…..”
 
Search WWH ::




Custom Search