After work I wrote the code for a few additional file system commands in my USB host replacement project: file open, file read, file seek, file close.
I also had to make a significant change to the command parser due to the structure of the file read and file seek commands.
For the time being it’s all stable and a great starting point that I would not have thought to be possible to put together so quickly: essentially I am ready to test with real hardware for what concerns the communication interface and file system access for reading files. I shall do that as soon as I manage to hook the device to my C64.
With my test rig, using a C64 mock-up, I am able to reliably read the contents of files, as per screenshot below:
A real Commodore 64 would now be in a position to browse folders and read file contents on an SD/SDHC card directly through the user port, without knowing anything at all about the hardware interface past the user port and, more importantly, without knowing anything at all about foreign file systems such as FAT-16, FAT-32 and exFAT.
The C64 would simply go through simple tasks such as:
- send me a list of folder contents
- navigate into a sub-folder
- read the whole contents of “cool demo v3.prg”
- read partial data from a file
The bus consists of a parallel interface, so these operations can be performed at godly speed, just as it happens with USBhost-64 🙂