[Coco] [Color Computer] Inkey for Microware C Compiler

KnudsenMJ at aol.com KnudsenMJ at aol.com
Sat Dec 6 22:54:07 EST 2003


In a message dated 12/6/03 6:54:27 PM Eastern Standard Time, 
mannequin at primary.net writes:

> Does anyone know of a way to use Inkey (or make one) that can be used
>  with Microware's C Compiler v1.00.00?

It's very simple, no asm needed, and I can post the code tomorrow.
1. Call getstt() to read the number of chars in the input buffer (channel 0). 
 You can find the proper args in the manual.  You can do it all in C, using a 
defined struct that represents the 6809's registers.  See the _os9() function.
2. If 0, return 0 or whatever code you choose for null char.
3. Otherwise, read one character with read(0, 1, &charvar) and return 
charvar.  This read() call won't block, since you've pre-tested for at least one char 
present.

BTW, the existence of the stat call in step (1) is a major superiority of 
OS-9 over UNIX or Linux in this regard, where a paragraph of garbage code is 
required to do a non-blocking read.  That's probably why the standard C I/O lib 
lacks such a call.
--Mike K.




More information about the Coco mailing list