mirror of
https://github.com/RevCurtisP/C02.git
synced 2025-02-19 19:31:04 +00:00
Updated stdio and stdiox headers and documentation
This commit is contained in:
parent
53845bcb7c
commit
75d6cb3c9a
@ -10,11 +10,11 @@ The following functions are defined:
|
|||||||
c = getc(); Waits for a keypress and returns the cleaned
|
c = getc(); Waits for a keypress and returns the cleaned
|
||||||
ASCII value corresponding to the pressed key.
|
ASCII value corresponding to the pressed key.
|
||||||
|
|
||||||
Note: Aliased to getkey() from system library.
|
Note: Aliased to getchr() from system library.
|
||||||
|
|
||||||
putc(c); Writes character c to the screen.
|
putc(c); Writes character c to the screen.
|
||||||
|
|
||||||
Note: Aliased to prchr() from system library.
|
Note: Aliased to putchr() from system library.
|
||||||
|
|
||||||
r = gets(&s); Reads a maximum of 128 characters from keyboard
|
r = gets(&s); Reads a maximum of 128 characters from keyboard
|
||||||
until the Return/Enter key is pressed, storing the
|
until the Return/Enter key is pressed, storing the
|
||||||
@ -28,7 +28,7 @@ The following functions are defined:
|
|||||||
Returns number of characters entered, or 255
|
Returns number of characters entered, or 255
|
||||||
if entry was aborted.
|
if entry was aborted.
|
||||||
|
|
||||||
Note: Calls getchr() in a loop and uses constants
|
Note: Calls getc() in a loop and uses constants
|
||||||
DELKEY, RTNKEY, and ESCKEY from the system library.
|
DELKEY, RTNKEY, and ESCKEY from the system library.
|
||||||
|
|
||||||
r = puts(&s): Writes up to 128 characters of null-terminated
|
r = puts(&s): Writes up to 128 characters of null-terminated
|
||||||
@ -36,14 +36,14 @@ The following functions are defined:
|
|||||||
|
|
||||||
Returns position of null terminator in string.
|
Returns position of null terminator in string.
|
||||||
|
|
||||||
Note: Calls outsub(0, &s).
|
Note: Calls putsub(0, &s).
|
||||||
|
|
||||||
r = putsub(n, &s): Writes up to 128 characters of null-terminated
|
r = putsub(n, &s): Writes up to 128 characters of null-terminated
|
||||||
string s to the screen, starting at position n.
|
string s to the screen, starting at position n.
|
||||||
|
|
||||||
Returns position of null terminator in string.
|
Returns position of null terminator in string.
|
||||||
|
|
||||||
Note: Calls putchr() in a loop.
|
Note: Calls putc() in a loop.
|
||||||
|
|
||||||
r = putln(&s): Writes up to 128 characters of null-terminated
|
r = putln(&s): Writes up to 128 characters of null-terminated
|
||||||
string s to the screen and advances the cursor to
|
string s to the screen and advances the cursor to
|
||||||
@ -51,7 +51,7 @@ The following functions are defined:
|
|||||||
|
|
||||||
Returns number of characters printed.
|
Returns number of characters printed.
|
||||||
|
|
||||||
Note: Calls outstr(&s) followed by newlin().
|
Note: Calls puts(&s) followed by newlin().
|
||||||
|
|
||||||
Note: This library expects the following functions to be defined:
|
Note: This library expects the following functions to be defined:
|
||||||
|
|
||||||
@ -61,9 +61,9 @@ Note: This library expects the following functions to be defined:
|
|||||||
newlin(); Advance cursor to beginning of next line
|
newlin(); Advance cursor to beginning of next line
|
||||||
setsrc(&s); Set source string pointer and initialize index
|
setsrc(&s); Set source string pointer and initialize index
|
||||||
|
|
||||||
along with the zero page variable pairs
|
along with the zero page word
|
||||||
|
|
||||||
srclo,srchi: Source string pointer
|
srcptr Source string pointer
|
||||||
|
|
||||||
and the assembler constants
|
and the assembler constants
|
||||||
|
|
||||||
|
190
doc/stdiox.txt
190
doc/stdiox.txt
@ -4,32 +4,42 @@ At the beginning of the program use the directives
|
|||||||
|
|
||||||
#include <stddef.h02>
|
#include <stddef.h02>
|
||||||
#include <stdlib.h02>
|
#include <stdlib.h02>
|
||||||
|
#include <intlib.h02>
|
||||||
#include <stdiox.h02>
|
#include <stdiox.h02>
|
||||||
|
|
||||||
The following functions are defined:
|
The following functions are defined:
|
||||||
|
|
||||||
c = getprc(&s); Writes the string s, waits for a key to be pressed.
|
c = getcpr(s); Writes the string s to the screen, waits for a key
|
||||||
then writes blank line
|
to be pressed, then writes a blank line line.
|
||||||
|
|
||||||
Returns the ASCII value of the key that was
|
Returns the ASCII value of the key that was
|
||||||
pressed.
|
pressed.
|
||||||
|
|
||||||
Note: Calls the puts function, the newlin
|
Note: Calls the puts() function, the newlin()
|
||||||
function twice, then the getc function.
|
function twice, then the getc function.
|
||||||
|
|
||||||
c = anykey(); Writes the string "Press any key to continue...",
|
c = anykey(); Writes the string "Press any key to continue...",
|
||||||
followed by a blank line, to the screen, then waits
|
followed by a blank line to the screen, then waits
|
||||||
for a key to be pressed.
|
for a key to be pressed.
|
||||||
|
|
||||||
Returns the ASCII value of the key that was
|
Returns the ASCII value of the key that was
|
||||||
pressed.
|
pressed.
|
||||||
|
|
||||||
Note: Calls the getprc function, with a hard
|
Note: Calls the getprc() function, with a hard
|
||||||
coded string.
|
coded string.
|
||||||
|
|
||||||
putspc(b); Writes a space character to the screen.
|
putspc(b); Writes a space character to the screen.
|
||||||
|
|
||||||
Note: Used by the putdel and putder functions.
|
Note: Used by the putdel(), putder(), and putinj()
|
||||||
|
functions.
|
||||||
|
|
||||||
|
putrpt(c,n); Writes character c to the screen n times.
|
||||||
|
|
||||||
|
Note: Repeatedly calls putc().
|
||||||
|
|
||||||
|
putrps(n); Writes a space to the screen n times.
|
||||||
|
|
||||||
|
Note: Calls putrpt() with a space character.
|
||||||
|
|
||||||
putdec(b); Writes the decimal representation of byte b to the
|
putdec(b); Writes the decimal representation of byte b to the
|
||||||
screen. The output will be between one and three
|
screen. The output will be between one and three
|
||||||
@ -38,38 +48,122 @@ The following functions are defined:
|
|||||||
Note: Calls part of the ctoa routine from stdlib
|
Note: Calls part of the ctoa routine from stdlib
|
||||||
which leaves the binary values of the ones, tens,
|
which leaves the binary values of the ones, tens,
|
||||||
and hundreds digits in variables temp0, temp1, and
|
and hundreds digits in variables temp0, temp1, and
|
||||||
temp2, respectively.
|
temp2, respectively. Called by printf() when
|
||||||
|
processing the %D formatting tag.
|
||||||
|
|
||||||
putdel(b); Writes the decimal representation of byte b to the
|
putdel(b); Writes the decimal representation of byte b to the
|
||||||
screen. The output is left justified by appending it
|
screen. The output is left justified by appending it
|
||||||
with 1 space if b is between 10 and 99, or two spaces
|
with 1 space if b is between 10 and 99, or two spaces
|
||||||
if b is less than 10.
|
if b is less than 10.
|
||||||
|
|
||||||
Note: Calls putdec and putspc. Leaves the value
|
Note: Calls putdec() and putspc(). Leaves the value
|
||||||
of b in varible temp3.
|
of b in variable temp3. Called by printf() when
|
||||||
|
processing the %L formatting tag.
|
||||||
|
|
||||||
putder(b); Writes the decimal representation of byte b to the
|
putder(b); Writes the decimal representation of byte b to
|
||||||
screen. The output is right justified by prepending it
|
the screen. The output is right justified by left
|
||||||
with 1 space if b is between 10 and 99, or two spaces
|
padding it with 1 space if b is between 10 and 99,
|
||||||
if b is less than 10.
|
or two spaces if b is less than 10.
|
||||||
|
|
||||||
Note: Calls putdec and putspc. Leaves the value
|
Note: Calls putdec() and putspc(). Leaves the value
|
||||||
of b in varible temp3.
|
of b in variable temp3. Called by printf() when
|
||||||
|
processing the %R formatting tag.
|
||||||
|
|
||||||
|
putdez(b); Writes the decimal representation of byte b to the
|
||||||
|
screen. The output is always three digits, including
|
||||||
|
leading zeros.
|
||||||
|
|
||||||
|
Note: Calls part of the ctoa() routine from stdlib
|
||||||
|
which leaves the binary values of the ones, tens,
|
||||||
|
and hundreds digits in variables temp0, temp1, and
|
||||||
|
temp2, respectively. Called by printf() when
|
||||||
|
processing the %Z formatting tag.
|
||||||
|
|
||||||
|
putdeh(b); Writes the decimal representation of byte b, modulo
|
||||||
|
100, to the screen. The output is always two digits,
|
||||||
|
the ten's digit and the one's digit.
|
||||||
|
|
||||||
|
Note: Calls part of the ctoa routine from stdlib
|
||||||
|
which leaves the binary values of the ones, tens,
|
||||||
|
and hundreds digits in variables temp0, temp1, and
|
||||||
|
temp2, respectively. Called by printf() when
|
||||||
|
processing the %H formatting tag.
|
||||||
|
|
||||||
|
putbin(b); Writes the binary representation of byte b to the
|
||||||
|
screen. The output is always eight binary digits
|
||||||
|
(0 or 1).
|
||||||
|
|
||||||
|
Note: Calls putmsk() with a mask of $FF. Called
|
||||||
|
by printf() when processing the %B formatting tag.
|
||||||
|
|
||||||
|
putexh(b,i); Writes the hexadecimal representation of a 24-bit
|
||||||
|
number to the screen, where b is the high byte and
|
||||||
|
i is the middle and low bytes. The output is always
|
||||||
|
six hex digits, with leading zeros if b is less than
|
||||||
|
$10.
|
||||||
|
|
||||||
|
Note: Calls savrxy(), saving the X and Y registers
|
||||||
|
to temp1 and temp2, respectively, then calls puthex()
|
||||||
|
to print the highest byte and putwrd() to print the
|
||||||
|
middle and low bytes.
|
||||||
|
|
||||||
puthex(b); Writes the hexadecimal representation of byte b to the
|
puthex(b); Writes the hexadecimal representation of byte b to the
|
||||||
screen. The output is always two hex digits, the first
|
screen. The output is always two hex digits, the first
|
||||||
being a leading 0 if b is less than 16.
|
being a leading 0 if b is less than 16. Called by
|
||||||
|
printf() when processing the %X formatting tag.
|
||||||
|
|
||||||
Note: Aliased to the prbyte routine.
|
Note: Aliased to the prbyte() routine.
|
||||||
|
|
||||||
putwrd(&d); Writes the hexadecimal representation of address &d to
|
putint(i); Writes the decimal representation of integer i to the
|
||||||
|
screen. The output will be one to five decimal digits,
|
||||||
|
with no leading zeros or padding.
|
||||||
|
|
||||||
|
Note: Calls cvibcd, then calls upbcdi for each digit
|
||||||
|
to be printed. Called by printf() when processing
|
||||||
|
the %I formatting tag.
|
||||||
|
|
||||||
|
putinr(i); Writes the decimal representation of integer i to the
|
||||||
|
screen. The output is always five charactes. right
|
||||||
|
justified by left padding it with spaces.
|
||||||
|
|
||||||
|
Note: Calls putint(). Called by printf() when
|
||||||
|
processing the %J formatting tag.
|
||||||
|
|
||||||
|
putnyb(b); Writes the hexadecimal representation of the low
|
||||||
|
nybble of byte b to the screen. The output is always
|
||||||
|
one hex digit (0-F).
|
||||||
|
|
||||||
|
Note: Aliased to the prhex() routine. Called by
|
||||||
|
printf() when processing the %W formatting tag.
|
||||||
|
|
||||||
|
putmsk(b,m); Writes the binary representation of each of the bits
|
||||||
|
in byte b for which the corresponding bit of m is set.
|
||||||
|
The output will be between 0 and 8 binary digits,
|
||||||
|
depending on how many bits of m are set.
|
||||||
|
|
||||||
|
putmsk(b,$0F); //Print Low Nybble as Binary Number
|
||||||
|
putmsk(b,$81); //Print Highest and Lowest Bits
|
||||||
|
|
||||||
|
putsqb(i); Writes the hexadecimal representation of the twelve
|
||||||
|
lowest bits of i (a sesquibyte) to the screen. The
|
||||||
|
output is always three hex digits, with leading
|
||||||
|
zeros if i is less than $0100.
|
||||||
|
|
||||||
|
Note: Calls savrxy(), saving the X and Y registers to
|
||||||
|
temp1 and temp2, respectively, then calls putnyb for
|
||||||
|
the most significant byte and puthex() for the least
|
||||||
|
significant byte. Called by printf() when processing
|
||||||
|
the %Q formatting tag.
|
||||||
|
|
||||||
|
putwrd(i); Writes the hexadecimal representation of integer i to
|
||||||
the screen. The output is always four hex digits, with
|
the screen. The output is always four hex digits, with
|
||||||
leading zeros if b is less than $1000.
|
leading zeros if i is less than $1000.
|
||||||
|
|
||||||
Note: Calls savrxy, saving the X and Y registers to
|
Note: Calls savrxy(), saving the X and Y registers to
|
||||||
temp1 and temp2, respectively, then calls puthex, once
|
temp1 and temp2, respectively, then calls puthex, once
|
||||||
for the most significant byte and again for the least
|
for the most significant byte and again for the least
|
||||||
significant byte.
|
significant byte. Called by printf() when processing
|
||||||
|
the %W formatting tag.
|
||||||
|
|
||||||
putdst(); Prints the destination string set by the setdst or
|
putdst(); Prints the destination string set by the setdst or
|
||||||
setstr functions.
|
setstr functions.
|
||||||
@ -78,36 +172,51 @@ The following functions are defined:
|
|||||||
call that stores it's result in the destination string,
|
call that stores it's result in the destination string,
|
||||||
such as strcat, strcpy, and strcut in string,
|
such as strcat, strcpy, and strcut in string,
|
||||||
|
|
||||||
Note: calls putc and is called by printf when
|
Note: calls putc. Called by printf() when processing
|
||||||
processing a %S formatting tag.
|
the %S formatting tag.
|
||||||
|
|
||||||
r = printf(b, &s): Writes the value of byte b to screen, formatting
|
r = printf(b, &s): Writes the value of byte b to screen, formatting
|
||||||
the output according the contents of string s.
|
the output according the contents of string s.
|
||||||
|
|
||||||
The output consists of the characters in s, but with
|
The output consists of the characters in s, but
|
||||||
any formatting tags replaced with an ASCII
|
with any formatting tags (which may be upper or
|
||||||
representation of the value of b.
|
lower case) replaced with an ASCII representation
|
||||||
|
of the value of b.
|
||||||
|
|
||||||
The recognized formatting tags are:
|
The recognized formatting tags are:
|
||||||
|
%B - output b as an eight-digit binary number
|
||||||
%C - output the ASCII character represented by b
|
%C - output the ASCII character represented by b
|
||||||
%D - output b as a an unjustified decimal number
|
%D - output b as a an unjustified decimal number
|
||||||
%H - output b as a two-digit hexadecimal number
|
%H - output b as a modulo-100 decimal number
|
||||||
%L - output b as a left justified decimal number
|
%L - output b as a left justified decimal number
|
||||||
%R - output b as a right justified decimal number
|
%R - output b as a right justified decimal number
|
||||||
%% - output a single % character
|
%X - output b as a two-digit hexadecimal number
|
||||||
|
%Y - output low nybble of b as a hexadecimal digit
|
||||||
Unlike the printf function in standard C, only
|
%Z - output b as a zero-filled decimal number
|
||||||
|
|
||||||
|
Unlike the printf() function in standard C, only
|
||||||
one value argument may be passed and that value is
|
one value argument may be passed and that value is
|
||||||
used for each formatting tag in the format string.
|
used for each formatting tag in the format string.
|
||||||
|
|
||||||
Two additional formatting tag are supported:
|
Two special function tags are supported:
|
||||||
|
%% - output a single % character
|
||||||
|
%N - generate a newline
|
||||||
|
|
||||||
|
Four additional formatting tags operate on the
|
||||||
|
destination pointer:
|
||||||
%S - output the destination string
|
%S - output the destination string
|
||||||
|
%I - output the destination address as a
|
||||||
|
as a one to five digit decimal number
|
||||||
|
%J - output the destination address as a
|
||||||
|
right justified decimal number
|
||||||
|
%Q - output the destination address as a
|
||||||
|
as a three-digit hexadecimal number
|
||||||
%W - output the destination address as a
|
%W - output the destination address as a
|
||||||
as a four-digit hexadecimal number
|
as a four-digit hexadecimal number
|
||||||
|
|
||||||
The destination string and/or address is set using
|
The destination string and/or address is set using
|
||||||
the setdst or strdst function (from the "string"
|
the setdst or strdst function (from the "string"
|
||||||
library) before calling printf. Multiple occurances
|
library) before calling printf. Multiple occurrences
|
||||||
of the %S or %w tag will cause the destination string
|
of the %S or %w tag will cause the destination string
|
||||||
and/or address to be repeated.
|
and/or address to be repeated.
|
||||||
|
|
||||||
@ -121,21 +230,24 @@ The following functions are defined:
|
|||||||
lower case with either a 0 or 1 in the high bit.
|
lower case with either a 0 or 1 in the high bit.
|
||||||
Unrecognized formatting tags are interpreted as %C.
|
Unrecognized formatting tags are interpreted as %C.
|
||||||
|
|
||||||
Note: Calls putdec, putdel, putder, puthex, putwrd,
|
Note: Calls putdec, putdel, putder, puthex, putint,
|
||||||
or putdst depending on which formatting tags are
|
putwrd, or putdst depending on which formatting tags
|
||||||
used. The value of b is left in variable temp3.
|
are used. The value of b is left in variable temp3.
|
||||||
|
|
||||||
Note: This library expects the following functions to be defined:
|
Note: This library expects the following functions to be defined:
|
||||||
|
|
||||||
cubcd(); Convert byte to BCD and unpack into three bytes
|
cubcd(); Convert byte to BCD and unpack into three bytes
|
||||||
|
cvibcd(); Convert Integer to Binary Coded Decimal
|
||||||
prbyte(); Print byte to screen as hexadecimal number
|
prbyte(); Print byte to screen as hexadecimal number
|
||||||
prchr(c); Print ASCII character to screen
|
prchr(); Print ASCII character to screen
|
||||||
savrxy(); Save X and Y registers.
|
savrxy()(); Save X and Y registers.
|
||||||
setsrc(&s); Set source string pointer and initialize index
|
setsrc(); Set source string pointer and initialize index
|
||||||
|
upbcdi(); Unpack digit from Binary Coded Decimal Integer
|
||||||
|
|
||||||
along with the zero page variable pairs:
|
along with the zero page variable pairs:
|
||||||
|
|
||||||
srclo,srchi: Source string pointer
|
srclo,srchi: Source Pointer
|
||||||
|
dstlo,dsthi: Destination Pointer
|
||||||
|
|
||||||
and the temporary variables
|
and the temporary variables
|
||||||
|
|
||||||
|
@ -14,16 +14,22 @@ char getc();
|
|||||||
void putc();
|
void putc();
|
||||||
|
|
||||||
/* Get String
|
/* Get String
|
||||||
* Reads String from Keyboard, up *
|
* Reads String from Keyboard, up *
|
||||||
* to 128 characters until the Return *
|
* to 128 characters until the Return *
|
||||||
* key is pressed. If the Escape key *
|
* key is pressed. If the Escape key *
|
||||||
* is pressed, input is aborted and *
|
* is pressed, input is aborted. *
|
||||||
* the string is set to "" *
|
* Args: int &s - string to read *
|
||||||
* Args: int &s - string to read *
|
* Returns: char n - Length of String *
|
||||||
* Returns: char n - Length of String *
|
* $FF = Escape Pressed */
|
||||||
* $FF = Escape Pressed */
|
|
||||||
char gets();
|
char gets();
|
||||||
|
|
||||||
|
/* Put Line *
|
||||||
|
* Prints String on Screen and moves *
|
||||||
|
* cursor to beginning of next line *
|
||||||
|
* Args: int &s - String to Print *
|
||||||
|
* Returns: char n - Characters Printed */
|
||||||
|
char putln();
|
||||||
|
|
||||||
/* Put String
|
/* Put String
|
||||||
* Prints String on Screen *
|
* Prints String on Screen *
|
||||||
* Args: int &s - String to Print *
|
* Args: int &s - String to Print *
|
||||||
@ -37,10 +43,3 @@ char puts();
|
|||||||
* int &s - String to Print *
|
* int &s - String to Print *
|
||||||
* Returns: char e - Ending Position */
|
* Returns: char e - Ending Position */
|
||||||
char putsub();
|
char putsub();
|
||||||
|
|
||||||
/* Put Line *
|
|
||||||
* Prints String on Screen and moves *
|
|
||||||
* cursor to beginning of next line *
|
|
||||||
* Args: int &s - String to Print *
|
|
||||||
* Returns: char n - Characters Printed */
|
|
||||||
char putln();
|
|
||||||
|
@ -78,6 +78,13 @@ void putexh();
|
|||||||
* Args: char b - Byte to Print */
|
* Args: char b - Byte to Print */
|
||||||
void puthex();
|
void puthex();
|
||||||
|
|
||||||
|
/* Put Integer Right Justified *
|
||||||
|
* Prints word as decimal number *
|
||||||
|
* left-padded with spaces for *
|
||||||
|
* a total of five charcaters *
|
||||||
|
* Args: int w - Word to Print */
|
||||||
|
void putinr();
|
||||||
|
|
||||||
/* Put Integer *
|
/* Put Integer *
|
||||||
* Prints word as decimal number *
|
* Prints word as decimal number *
|
||||||
* Args: int w - Word to Print */
|
* Args: int w - Word to Print */
|
||||||
@ -96,6 +103,17 @@ void putmsk();
|
|||||||
* Args: char b - Byte to Print */
|
* Args: char b - Byte to Print */
|
||||||
void putnyb();
|
void putnyb();
|
||||||
|
|
||||||
|
/* Put Repeated Spaces *
|
||||||
|
* Prints multiple space characters *
|
||||||
|
* Args: char n - Number of Spaces */
|
||||||
|
void putrps();
|
||||||
|
|
||||||
|
/* Put Repeated Character *
|
||||||
|
* Prints character multiple times *
|
||||||
|
* Args: char c - Character to Print *
|
||||||
|
* char n - Repeat Count */
|
||||||
|
void putrpt();
|
||||||
|
|
||||||
/* Put Space *
|
/* Put Space *
|
||||||
* Prints a space character */
|
* Prints a space character */
|
||||||
void putspc();
|
void putspc();
|
||||||
@ -111,4 +129,3 @@ void putsqb();
|
|||||||
* hexadecimal number *
|
* hexadecimal number *
|
||||||
* Args: int w - Word to Print */
|
* Args: int w - Word to Print */
|
||||||
void putwrd();
|
void putwrd();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user