Add file I/O to the ABI
Opened this issue · 2 comments
Need to be able to read/write files and list directories from the Apps, e.g. loading bitmaps/code from disk.
MS-DOS offered a bunch of virtual files you could open:
- COM1, COM2, ...
- AUX
- LPT1, LPT2...
- NUL
- etc
Linux/UNIX has virtual devices in /dev which acheive the same effect.
In Monotron the devices we want to perform file I/O (read, write, etc) on are:
- SDMMC interface (raw disk access)
- Files in a directory
- Directories (a special case of read) on a given volume
- Open volumes on a given disk
- Serial Interface (UART0 over USB and UART1 over TTL/RS-232) at various baud rates
- Raw SPI interface (with separate chip-select to the SD card)
- I2C interface (with addressing?)
- The text console (with cursor moves, and colours)
- The graphics frame buffer
- The keyboard (as CP850 bytes, as Unicode UTF8 bytes and as raw scan-codes for games).
- The joystick
- The synthesiser output (3 channels)
- The raw PCM output (into a ring buffer)
An alternative approach is to provide a BIOS-level API (enumerating fixed disks, read/write sectors, etc) and moving file read/write into a DOS. This could be loaded into RAM or stored in ROM, but it would be distinct from the BIOS. CP/M does something similar. It would allow us to keep the OS the same on multiple platforms, while the BIOS deals with high-speed SDMMC vs 1-bit SPI, for example. It would effectively be a HAL.