File I O
4am edited this page Jul 10, 2020
·
17 revisions
A library to interface to either SOS on the Apple /// or ProDOS on the Apple II.
Compatibility: 1*, II, ///
* Apple 1 only supports reading of entire file at once
Usage: include "inc/fileio.plh"
Values:
//
// Useful ProDOS values
//
// MACHID is defined in cmdsys.plh
// Which slot has a ROM
const SLTBYT = $BF99
// Prefix active
const PFIXPTR = $BF9A
// Memory alocate bitmap
const MEMTABL = $BF58
//
// SOS/ProDOS error codes
//
const FILE_ERR_OK = $00
const FILE_ERR_BAD_CALL_NUM = $01
const FILE_ERR_BAD_PARAM_CNT = $04
const FILE_ERR_INT_TBL_FULL = $25
const FILE_ERR_IO = $27
//
// File info struc
//
struc t_fileinfo
byte file_access
byte file_type
word aux_type
byte storage_type
word blocks_used
word mod_date
word mod_time
word create_date
word create_time
end
//
// Globally accessible error code
//
byte perr
API:
fileio:getpfx(path)
fileio:setpfx(path)
fileio:getfileinfo(path, fileinfo)
fileio:geteof(refnum)
fileio:open(path)
fileio:close(refnum)
fileio:read(refnum, buf, len)
fileio:write(refnum, buf, len)
fileio:create(path, type, aux)
fileio:destroy(path)
fileio:newline(refnum, emask, nlchar)
fileio:readblock(unit, buf, block)
fileio:writeblock(unit, buf, block)
Source Code: fileio.pla