Technical Notes
OverviewSee Appendices B, C, and D for a complete list of supported keystrokes and key codes.
The functions in this unit ignore DOS errors, even under redirection.
_get_chr and _get_chre read characters from STDIN. Extended characters (F1, F2, etc.) are indicated by a zero return value; the function must be called again to obtain the code for the extended keystroke. Normal (ASCII) characters and ALT-keypad characters are returned on the first call.
The _get_chra and _get_chrae functions are functionally equivalent to _get_chr and _get_chre except that all of the character information is returned in a single call-even for extended characters. _get_chra and _get_chrae return -1 if the keystroke was an extended character and 0 if the keystroke was a normal (ASCII) character or ALT-keypad character. The code for the keystroke is placed in a parameter that is passed on the stack. _get_chr and _get_chra do not echo input characters; _get_chre and _get_chrae echo normal characters to the STDOUT device if they are in the range 0x20 to 0x7E.
_put_chr writes a character to STDOUT. The special characters BEL, BS, TAB, CR, and LF receive special handling by the STDOUT device; all other characters are written to the output device without any special intervention. _put_beep and _put_newline write a BEL and a CR/LF pair to STDOUT, respectively.
_get_str reads characters from STDIN into an input buffer. Simple editing of the input string may be performed using the backspace key. The system speaker sounds a tone if an attempt is made to read too many keys into the input buffer. Input terminates when a CR is encountered (i.e., when the Enter key is pressed), at which time a CR/LF pair is echoed to STDOUT and the function returns. The resulting string is NULL terminated.
_put_str and _fput_str write an ASCIIZ string to the STDOUT device. All characters except the terminating NULL are written. _fput_str is a far version of _put_str which always accepts a far string pointer in small data models.
Caution needs to be exercised when redirecting STDIN. If the last character in the file is a NULL, it will be interpreted as an extended character flag and the input function will wait indefinitely for the second half of the extended character to become available.