ORCA-C/C.Samples/Text.Samples/Key2.Funcs
Stephen Heumann ab975b611c Add C samples.
These are the samples from ORCA/C 2.1.0, converted to LF line endings.
2023-04-23 18:34:34 -05:00

44 lines
986 B
Plaintext

/*****************************************************************
*
* This file contains the functions for KEY2.CC. See that file
* for detailed comments.
*
*******************************************************************/
#pragma keep "Funcs"
/****************************************************************
*
* KeyPress - Check if a key has been pressed
*
****************************************************************/
int KeyPress(void)
{
char *keyboard;
keyboard = (char *) 0x00C000;
return ((*keyboard) & 0x80) != 0;
}
/****************************************************************
*
* ReadChar - Returns the last character typed on the keyboard.
* Note: Returns a character whether or not one has
* been typed!
*
****************************************************************/
char ReadChar(void)
{
char *keyboard, *strobe;
keyboard = (char *) 0x00C000;
strobe = (char *) 0x00C010;
*strobe = 0;
return *keyboard & 0x7F;
}