I fixed several bugs in my code, and now the DIY4 can display the directory of an SD card and read and write files. It’s not perfect, as the first I/O fails, but subsequent accesses succeed.
I’m using the open source FatFs code to implement the FAT filesystem. It’s configured to work with two “drives”, the internal SPI FRAM chip in the DIY4, and the SD card. I used the SD interface code from the “generic” example, with only minor changes necessary.
I still have to write a -41 microcode ROM to provide the equivalent of the HP-IL module’s mass storage commands, but talking to the SD card rather than HP-IL.