CHAPTER 5
Again, both functions wait until a key is pressed and
then return the ASCII character and scan code. Atari docu
mentation indicates there is slight difference between these
functions in that Crawcin() is supposed to pass all control
codes, and Cnecin() is supposed to act on control codes like
Control-S, Control-Q, and Control-C. This is meant to mirror
MS-DOS where DOS function 8 checks for the Control-Break
key combination. In the current version of TOS, however,
both of these functions pass all control codes without acting
on them.
The other character device input command is used to
read characters from the AUX: device, which is the RS-232
serial port. This function waits until a character is completely
received before it returns, but does not echo the character to
the screen. The function Cauxin() is called like this:
char ch;
ch = Cauxin( );
where ch is the ASCII character received.
One of the problems with using these input functions is
that if no character is available from the device, the function
will not return until one is available. This leaves your program
stuck until the input is received, and if that input doesn't
come, it remains stuck forever, forcing you to turn off the
computer to regain control. To prevent this situation, the
GEMDOS includes status functions that let you determine
whether there's a character waiting to be received. These
functions are Cconis() and Cauxis(), and their syntax is
int status;
status = Cconis();
int status;
status = Cauxis();
where status is a flag that indicates whether there is a charac
ter waiting. The value returned in status is a 0 if there are no
characters waiting, and $FFFF (-1 ) if there is at least one
character ready to be received. By calling the status func
tions, it's possible to determine whether the input functions
will return immediately. If the call to the status function
shows there are no characters ready, your program may omit
the input call, go on to do something else, and then check
the input device again later.
GEMDOS also contains a number of functions for writ-