1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-18 21:07:28 +00:00
C02/doc/stdio.txt
2018-02-02 16:33:57 -05:00

72 lines
2.9 KiB
Plaintext

Standard Input/Output Functions for C02 Programs
At the beginning of the program use the directives
#include <stdio.h02>
The following functions are defined:
c = getc(); Waits for a keypress and returns the cleaned
ASCII value corresponding to the pressed key.
Note: Aliased to getkey() from system library.
putc(c); Writes character c to the screen.
Note: Aliased to prchr() from system library.
r = gets(&s); Reads a maximum of 128 characters from keyboard
until the Return/Enter key is pressed, storing the
entered characters as null-terminated string s.
Allows corrections using Backspace/Delete.
Pressing the Escape/Abort key terminates entry,
leaving the string in an undefined state.
Returns number of characters entered, or 255
if entry was aborted.
Note: Calls getchr() in a loop and uses constants
DELKEY, RTNKEY, and ESCKEY from the system library.
r = puts(&s): Writes up to 128 characters of null-terminated
string s to the screen.
Returns position of null terminator in string.
Note: Calls outsub(0, &s).
r = putsub(n, &s): Writes up to 128 characters of null-terminated
string s to the screen, starting at position n.
Returns position of null terminator in string.
Note: Calls putchr() in a loop.
r = putln(&s): Writes up to 128 characters of null-terminated
string s to the screen and advances the cursor to
the beginning of the next line.
Returns number of characters printed.
Note: Calls outstr(&s) followed by newlin().
Note: This library expects the following functions to be defined:
getkey(); Wait for and read ASCII character from keyboard
prchr(c); Print ASCII character to screen
delchr(); Backspace and delete previous character on screen
newlin(); Advance cursor to beginning of next line
setsrc(&s); Set source string pointer and initialize index
along with the zero page variable pairs
srclo,srchi: Source string pointer
and the assembler constants
DELKEY Delete/Backspace key ASCII code (usually DEL or BS)
ESCKEY Escape/Abort key ASCII code (usually ESC)
RTNKEY Return/Enter key ASCII code (usually CR)