Hardware Reference
In-Depth Information
Before returning, all the entered characters are converted to uppercase. GetCmdLine()
always returns an error code of noErr.
We can use this function to request the user to enter a string from the keyboard when run-
ning programs on a demo board with the D-Bug12 monitor. Usually, the program would output
a message so that the user knows when to enter the string. The following instruction sequence
will ask the user to enter a string from the keyboard:
printf
equ
$EE88
GetCmdLine
equ
$EE8A
cmdlinelen
equ
100
CR
equ
$0D
LF
equ
$0A
prompt
db
“Please enter a string: “,CR,LF,0
inbuf
ds.b
100
ldd
#prompt
; output a prompt to remind the user to
jsr
[printf,PCR]
; enter a string
ldd
#cmdlinelen
; push the CmdLineLen
pshd
;
ldd
#inbuf
call
[GetCmdLine,PCR]
; read a string from the keyboard
puld
; clean up the stack
char * far sscanhex(char *HexStr, unsigned int *BinNum);
Pointer address: $EE8E
The sscanhex() function is used to convert a hex string to a binary number. The hex string
pointed to by HexStr may contain any number of ASCII hex characters. However, the converted
value must be no greater than $FFFF. The string must be terminated by either a space or a
NULL character.
Suppose one has entered an ASCII string that represents a number, then the following
instruction sequence will convert it into a hex number (or binary number):
sscanhex
equ
$EE8E
HexStr
ds.b
10
; input buffer to hold a hex string
BinNum
ds.b
2
; to hold the converted number
ldd
#BinNum
pshd
ldd
#HexStr
call
[sscanhex,PCR]
leas
2,sp
; deallocates space used by outgoing parameters
int isxdigit(int c);
Pointer address: $EE92
The isxdigit() function tests the character passed in c for membership in the character set
[0..9, a..f, A..F]. If the character c is in this set, the function returns a nonzero (true) value.
 
Search WWH ::




Custom Search