Millfork: a middle-level programming language targeting 6502- and Z80-based microcomputers and home consoles
This project is maintained by KarolS
The cbm_file
module provides support for loading and saving files to tape and disk.
Currently, it works only for Commodore 64 targets, although support for more targets is coming.
It uses Kernal routines, so it requires the Kernal ROM to be enabled.
Returns the last device number, or 8 if none.
Loads a PRG file with the given null-terminated name to the address specified in the file.
Sets errno
.
Loads a PRG file with the given null-terminated name to the given address.
Sets errno
.
Saves length
bytes starting from start
to a PRG file named name
on device device
.
Sets errno
.
Executes a CBM DOS command on the given drive.
Deletes the given file in the given drive. (S0:
)
Renames the given file in the given drive. (R0:
)
Copies given file in the given drive. (C0:
)
Reinitialized disk status in the given drive. (I0
)
Validates disk status in the given drive. (V0
)
Formats disk status in the given drive. (N0:
)
Opens a file.
Sets errno
.
TODO: buggy.
Closes the given file.
Sets errno
.
TODO: buggy.
Reads a byte from file.
Sets errno
to err_eof
when reading the last byte, so don’t abort reading when getting errno != err_ok
.
TODO: buggy.
Writes a byte from file.
Sets errno
.
TODO: buggy.