1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-04-08 09:38:09 +00:00

Updated File I O (markdown)

David Schmenk 2017-12-05 20:44:02 -08:00
parent 4e52f6c2d0
commit bdf96ddcda

@ -12,7 +12,7 @@ import fileio
// Memory alocate bitmap
const MEMTABL = $BF58
//
// File I/O error codes
// SOS/ProDOS error codes
//
const FILE_ERR_OK = $00
const FILE_ERR_BAD_CALL_NUM = $01
@ -20,10 +20,6 @@ import fileio
const FILE_ERR_INT_TBL_FULL = $25
const FILE_ERR_IO = $27
//
// System I/O buffer for PLASMA. Used when loading modules, free otherwise
//
const sysbuf = $0800
//
// File info struc
struc t_fileinfo
byte file_access
@ -39,15 +35,39 @@ import fileio
//
// File functions
//
predef getpfx, setpfx, getfileinfo
predef open, close, read, write, create, destroy, newline
//
// Block level I/O functions
//
predef readblock, writeblock
struc t_fileio
word getpfx
word setpfx
word getfileinfo
word open
word close
word read
word write
word create
word destroy
word newline
word readblock
word writeblock
end
word fileio
//
// Globally accessible error code
//
byte perr
end
```
## The API:
```
fileio:getpfx(path)
fileio:setpfx(path)
fileio:getfileinfo(path, fileinfo)
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)
```