1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-06-28 19:29:39 +00:00
C02/include/fileio.h02
2019-03-29 19:06:12 -04:00

134 lines
4.2 KiB
Plaintext

/******************************************
* file - Standard File Functions for C02 *
******************************************/
/* Device List */
enum {CASST1, MODEM1, PRNTR1, PRNTR2,
DRIVE1, DRIVE2, DRIVE3, DRIVE4};
/* File Open Modes */
#define MWRITE $80 //Open File for Write
#define MREAD $00 //Open File for Read
/* File Load Modes */
#define MRELCT $00 //Relocate (Load at Specified Address)
#define MABSLT $80 //Absolute (Load at Address in File Header)
/* File Load *
* Loads File into Memory *
* Args: d - Options | DeviceID *
^ &n - Filename *
* Returns: Error Code (0=None) *
* Load Address */
char fload();
/* File Save *
* Save File from Memory *
* Args: d - Options | DeviceID *
^ &n - Filename *
* Returns: Error Code (0=None) */
char fsave();
/* File Open *
* Opens File Specified by Name *
* Args: d - Options | DeviceID *
^ &n - Filename *
* Returns: File Pointer (0=Error) *
Error Code (0=None) */
char fopen();
/* File Close *
* Closes File Opened to File Pointer *
* Args: fp - file pointer */
char fclose();
/* End of File *
* Check for End of File Condition *
* Args: fp - file pointer *
* Returns: EOF Indicator *
* (0 if not at end of file *
* 255 if not implemented *
* or non-zero EOF value) */
char feof();
/* File Error *
* Check File Error Indicator *
* Args: fp - file pointer *
* &s - string for error text *
* Returns: platform specific error number *
* (0 if no error *
* 255 if not implemented) */
char ferror();
/* Flush File Buffer *
* Flush File Output Buffer *
* Args: fp - file pointer *
* Returns: platform specific error number *
* (0 if no error) */
char fflush();
/* Read Character from File *
* Args: fp - file pointer *
* Returns: ASCII value of character, *
* platform specific error number *
* (0 if no error *
* 255 if not implemented) */
char fgetc();
/* Write Character to File *
* Args: fp - file pointer *
* c - ASCII character to write *
* Returns: platform specific error *
* (0 if no error *
* 255 if not implemented) */
char fputc();
/* Read String from File *
* Buffers up to 128 characters *
* until C/R is pressed *
* Args: fp - file pointer *
* &s - string read from file *
* Returns: number of characters read, *
* platform specific error *
* (0 if no error *
* 255 if not implemented) */
char fgets();
/* Write String to File *
* Writes up to 128 characters of a *
* null terminated string *
* Args: fp - file pointer *
* &s - string to print from *
* Returns: platform specific error *
* (0 if no error *
* 255 if not implemented) */
char fputs();
/* Write Line to File *
* Write String to File followed by C/R *
* Args: fp - file pointer *
* &s - string to print from *
* Returns: ending position in string *
* 255 if error during write */
char fputln();
/* Read Bytes from File *
* Reads until EOF is reached *
* Args: fp - file pointer *
* n - number of bytes to read *
* Returns: number of bytes read, *
* platform specific error *
* (0 if no error *
* 255 if not implemented) */
char fread();
/* Write Bytes to File *
* Args: fp - file pointer *
* n - number of bytes to write *
* Returns: number of bytes written, *
* platform specific error *
* (0 if no error *
* 255 if not implemented) */
char fwrite();