1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-28 10:51:14 +00:00
C02/include/fileio.h02

134 lines
4.2 KiB
Plaintext
Raw Normal View History

2018-01-28 18:30:49 +00:00
/******************************************
* 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) */
2018-01-28 18:30:49 +00:00
char fopen();
/* File Close *
2018-01-28 18:30:49 +00:00
* Closes File Opened to File Pointer *
* Args: fp - file pointer */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
char ferror();
/* Flush File Buffer *
* Flush File Output Buffer *
* Args: fp - file pointer *
* Returns: platform specific error number *
* (0 if no error) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
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) */
2018-01-28 18:30:49 +00:00
char fwrite();