We are presenting the (to our knowledge) first full-featured open source library for 65c02 CPUs for accessing FAT32 formatted disks.
- The library supports filesystems from 32 MB to 2 TB, can read and write long filenames, subdirectories and time stamps, and can even create new filesystems.
- It decodes a Master Boot Record (MBR) partitioning table and can have multiple partitions mounted at the same time.
- It comes with a driver for the SD card protocol, so you can hook it to your own SD card solution; all you have to do is implement your own byte transmission code. If you want to use a VIA 65c22, you can hook up the 65c22 serial port code by the Steckschwein project.
- Converting character encodings and matching names is done using callbacks – you can use the X16 implementation for a template.
The API looks like this:
; allocate context for filesystem #0
; (first MBR partition, mount if necessary)
; open file
sta fat32_ptr + 1
; read and print byte
.byte '/path/to/file.txt', 0
The implementation uses the 65c02 extensions. With the help of 65c02.inc and some simple search-and-replace, it can be adapted for the 6502 though.
The library was written by Frank van den Hoef, with features (LFN, mkfs, …) added by Michael Steil.
It is the core of the DOS in the Commodore-like Commander X16 retro computer. The source is currently maintained as part of the X16 ROM: