In order to keep the boot code ultra small, I will read the SDCard in SPI mode (Raw data only).
But to be tricky, I have made a PC program that adds a secret "key" to the 6502 memory image.
This will allow the PC to use FAT16, FAT32, or EXFAT and read the SDCard as normal.
The 6502 code will simply hunt through the sectors until it finds the key.
Finding the key will let the 6502 know that what follows is 64K of memory to write to SRAM.
The key will be a sequence of 256 values starting from 0, and ending on 255.
It is unlikely that this sequence could just accidentally exist, and makes sensing code ultra small.
...
Cheers!
Radical Brad
I can think of two things which might trip up this plan... I think both of them will be OK if the FAT filesystem is formatted before putting the special 64k+header file onto it. And they might be OK anyway.
- I'm not sure FAT will always put the special file into a contiguous range of sectors.
- I'm not sure FAT will always overwrite an existing special file when it's updated, so you might find a previous version instead of the latest.
Not sure if it matters, but it seems sectors on an SDcard are 512 bytes - that's the unit of read/write you get - and clusters on a FAT filesystem are from 2k bytes to 32k bytes depending on how it's formatted