After a s...load of debugging I have finally made a source that can load programs from the SD card. Using sourcecode from another project was not the smartest way to do this, so I ended up remaking alot of it.
Anyway, here are some pictures:
Initializing a 8GiB SDcard takes 2-3 seconds. Smaller cards are faster. This is what the actual card requires to initialize memory and has nothing to do with the SPI interface or 6502-side software.
Displaying a rather large directory. RunStop works. Another SYS command to load a program. "POOL" did not start for some reason. Probably related to Basic pointers or something (will debug that).
Loading "The Pit.prg" instead. Loading of 10KiB takes a few milliseconds. It looks instant.
The Pit runs fine. Its a ok game.
The loading code will be moved to BLK5 and shifted to external SRAM when not in use. Loading to BLK5 will work (once implemented) so all games should load just fine. Protecting BLK5 is also not an issue (for cartridge games).
For startup I plan to put in an optional menu (it can be switched off if you like the plain Vic-20 startup message). Thus you can get the load commands as SYS (as shown above), LOAD"xxxx",6 or SDLOAD or whatever. There is generally no limit to how it can be implemented, so I will eventually add different options. SYS commands will point to IO2 which also acts as SPI buffer during loading.
All-in-all there are still a few bugs to get out, but with loading working I can start planning to mount the test units. I have also looked into doing a 50-pcs run of the unit. The reason is that it can be made fully assembled without insane overhead cost. Still, its risky to do assembly elsewhere, so I want to test the first 10 before doing that.