mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-25 06:31:25 +00:00
200 lines
6.0 KiB
Plaintext
200 lines
6.0 KiB
Plaintext
/*********************************************************
|
|
* fileio - Standard File Functions for run6502 emulator *
|
|
*********************************************************/
|
|
|
|
#define DRIVES 26 //Number of Disk Drives
|
|
const char drive[]; //Disk Drives
|
|
|
|
#define DISKS 1 //Number of Drives in Disk
|
|
const char disk[];
|
|
|
|
/* File Open Modes */
|
|
#define MREAD $00 //Open File for Read
|
|
#define MWRITE $40 //Open File for Write
|
|
#define MAPPND $80 //Open File for Append
|
|
#define MRECRD $C0 //Open File to Read/Write Records
|
|
|
|
/* File Open Types */
|
|
#define TTEXT $00 //Text File
|
|
#define TBNRY $20 //Binary File
|
|
|
|
/* File Load Modes */
|
|
#define MRELCT $00 //Relocate (Load at Specified Address)
|
|
#define MABSLT $80 //Absolute (Load at Address in File Header)
|
|
|
|
/* File Close *
|
|
* Closes File Opened on Channel *
|
|
* Args: char f - File Channel *
|
|
* Returns: char e - Error (0=None) */
|
|
char fclose();
|
|
|
|
/* End of File *
|
|
* Check for End of File Condition *
|
|
* Args: char f - File Channel *
|
|
* Returns: char e = EOF Indicator *
|
|
* (0 if not at end of file *
|
|
* 255 if at end of file *
|
|
* or non-zero Error code) */
|
|
char feof();
|
|
|
|
/* File Error *
|
|
* Check File Error Indicator *
|
|
* Args: char c - channel *
|
|
* int &s - error msg buffer *
|
|
* Returns: char l - Last Error *
|
|
* char e - Error (0=None) */
|
|
char ferror();
|
|
|
|
/* File Flush *
|
|
* Flush File Output Buffer *
|
|
* Args: char f - File Channel *
|
|
* Returns: char status (0=Succes) *
|
|
* char e - Error (0=None) */
|
|
char fflush();
|
|
|
|
/* File Get Character *
|
|
* Args: char f - File Channel *
|
|
* Read Character from File *
|
|
* Returns: char c - Character *
|
|
* char e - Error (0=None) */
|
|
char fgetc();
|
|
|
|
/* File Get String *
|
|
* Read line of up to 128 *
|
|
* characters from file *
|
|
* Args: char f - File Channel *
|
|
* int &s - String to Read *
|
|
* Returns: char n - Characters Read *
|
|
* char e - Error (0=None) */
|
|
char fgets();
|
|
|
|
/* File Get Word *
|
|
* Args: char f - File Channel *
|
|
* Read Integer from File *
|
|
* Returns: char e - Error (0=None) *
|
|
* int w - Word */
|
|
char fgetc();
|
|
|
|
/* File Load *
|
|
* Loads File into Memory *
|
|
* Setup: fsname(&filename) *
|
|
* fsaddr(address) *
|
|
* Args: char d - Options | Device *
|
|
* Returns: char e - Error (0=None) *
|
|
* int la - Load Address */
|
|
char fload();
|
|
|
|
/* File Open *
|
|
* Open Specified File *
|
|
* Args: char d - Options | Device *
|
|
^ int &n - Filename *
|
|
* Returns: char c - Channel (0=Error) *
|
|
char e - Error (0=None) */
|
|
char fopen();
|
|
|
|
/* File Put Character *
|
|
* Write Character to File *
|
|
* Args: char c - Character *
|
|
* char f - File Channel *
|
|
* Returns: char w - Character Written *
|
|
* char e - Error (0=None) */
|
|
char fputc();
|
|
|
|
/* File Put Line *
|
|
* Write string followed by *
|
|
* newline to file *
|
|
* Args: char f - File Channel *
|
|
* int &s - String to Write *
|
|
* Returns: char n - Characters Written *
|
|
* char e - Error (0=None) */
|
|
char fputln();
|
|
|
|
/* File Put String *
|
|
* Writes up to 128 characters *
|
|
* of string to file *
|
|
* Args: char f - File Channel *
|
|
* int &s - String to Write *
|
|
* Returns: char n - Characters Written *
|
|
* char e - Error (0=None) */
|
|
char fputs();
|
|
|
|
/* File Put Word *
|
|
* Writes up to 128 characters *
|
|
* of string to file *
|
|
* Args: char f - File Channel *
|
|
* int w - Word to Write *
|
|
* Returns: char e - Error (255=EOF) *
|
|
* int r - Word Written */
|
|
char fputw();
|
|
|
|
/* File Read *
|
|
* Read up to n bytes from file *
|
|
* Setup: fsaddr(&array) *
|
|
* Args: char f - File Channel *
|
|
* char n - Number of Bytes *
|
|
* Returns: char r - Bytes Read *
|
|
* char e - Error (0=None) */
|
|
char fread();
|
|
|
|
/* File Set Address *
|
|
* Set Buffer or Start Address *
|
|
* Args: int addr - Address */
|
|
char fsaddr();
|
|
|
|
/* File Save *
|
|
* Save File from Memory *
|
|
* Setup: fsname(&filename) *
|
|
* fsaddr(start) *
|
|
* Args: char d - Options | Device *
|
|
* int end - End Address *
|
|
* Returns: char e - Error (0=None) */
|
|
char fsave();
|
|
|
|
/* File System Command *
|
|
* Execute File Operation *
|
|
* Args: char cmd - Command Code *
|
|
* params - Parameter(s) *
|
|
* Returns: char cmd - Command *
|
|
* char err - Error *
|
|
* char res - Result */
|
|
char fscmd();
|
|
|
|
/* File Seek *
|
|
* Move to Position in File *
|
|
* Args: char f - File Channel *
|
|
* int p - Position in File *
|
|
* Returns: char e - Error (0=None) */
|
|
char fseek();
|
|
|
|
/* File System Init *
|
|
* Initialize File System */
|
|
char fsinit();
|
|
|
|
/* File Set Name *
|
|
* Set Filename Address *
|
|
* Args: int &name - Filename */
|
|
char fsname();
|
|
|
|
/* File Tell *
|
|
* Get Position in File *
|
|
* Args: char f - File Channel *
|
|
* Returns: char e - Error (0=None) *
|
|
* int r - Position *
|
|
* $FFFF = Failure */
|
|
char ftell();
|
|
|
|
/* File Write *
|
|
* Write n nytes to file *
|
|
* Setup: fsaddr(&array) *
|
|
* Args: char n - Number of Bytes *
|
|
* char f - File Channel *
|
|
* Returns: char n - Bytes Written *
|
|
* char e - Error (0=None) */
|
|
char fwrite();
|
|
|
|
/* Rewind file *
|
|
* Move to Beginning of File *
|
|
* Args: char f - File Channel *
|
|
* Returns: char e - Error (0=None) */
|
|
char rewind();
|