Millfork: a middle-level programming language targeting 6502- and Z80-based microcomputers and home consoles
This project is maintained by KarolS
This module provides basic support for issuing ProDOS calls. It assumes ProDOS has been loaded normally before your program has started. The API closely follows the ProDOS machine language interface. See the ProDOS 8 Technical Reference Manual for more details, such as the error code values returned. The following functions are currently implemented:
Read the specified block from device unit
into data_buffer
.
data_buffer
must be page-aligned.
Write the specified block from device unit
into data_buffer
.
data_buffer
must be page-aligned.
Close file referred to by reference rnum
.
ProDOS will free the associated buffers and flush all changes to disk if necessary.
Flush any changes to disk for file referred to by reference rnum
.
Takes a pointer to a 64-byte buffer. ProDOS will fill this with the current path prefix as a Pascal-style string.
Sets or modifies the ProDOS prefix. Takes a pointer to a Pascal-style string.
Create a file.
filename
is a pointer to a Pascal-style string.
filetype
is one of the standard ProDOS file types.
See the ProDOS manual for more details.
This must be called before a file can be opened or written.
ProDOS does not create files implicitly.
Delete a file.
Rename a file.
Open a file.
filename
is a pointer to a Pascal-style string containing the path of file to be opened.
Buffer is a 1024 byte I/O buffer used internally by ProDOS.
The buffer must be page-aligned.
This call returns a byte which is the ProDOS file handle.
This handle is used by other calls.
A minimal example:
byte file_handle
array io_buffer [1024] align (256)
file_handle = prodos_open("myfile"p, io_buffer)
prodos_close(file_handle)
Files must exist to be opened.
Use the prodos_create
call to create a file first if necessary.
Set the ProDOS newline character and mask. See ProDOS manual for details.
Read the number of bytes specified by read_count
into data_buffer
from file handle rnum
.
Write the number of bytes specified by write_count
from data_buffer
to file handle rnum
.