I would probably say it would make more sense to have this drive replacement have an internal table of as many drive geometries as you can possibly find and allow the user to select which one it emulates by matching the model number to their current (dead) drive than doing this scattered "sparse sectors" thing. You could do this by providing a simple program that would write configuration information for the MCU to the SD card (or whatever) from a desktop or laptop PC.
This is surprisingly difficult. I have been digging into this for a while and am still not sure what the actual drive parameters are for the 3 hard drives I have. I *think* I know the correct parameters for the ST325X with its current jumper configuration because it came attached to an ST05X card and I have pulled the parameters from its BIOS. But even that drive has a jumper for configuring it for use on other machines and I don't know what that does.
Things get more complicated with other drives. My WD drive has a "translation" jumper which presumably configures it for a different set of parameter tables. However nether of the two sets of parameter tables in the WD BIOS I disassembled match what I got from the BIOS of the machine I pulled the drive from (a Tandy 1000 TL/2).
Things get even more messy with the ST351 A/X. Even ignoring the AT mode settings, it has a lot of options. I have not been able to make much headway into characterizing exactly what they do. The only reason I was able to configure it to work with my ST05X card was because I found a Tandy fax-back doc saying to use a specific jumper arrangement I had not seen elsewhere. If I use the settings from stason.org or other Tandy docs, the drive does not work correctly with the ST05X. On one setting I tried, the drive was not detected at all. On another, the drive started hammering the heads continuously. Just for fun, the ST351 A/X comes in two varieties, one with a 12 pin jumper block, and another with an 8 pin jumper block.
Even if I can figure all this out, it seems like a high burden to put on anyone trying to configure the device. There is also no guarantee that the vintage PC is using optimal geometry. I suspect that my TL/2 is wasting a head (using 4 instead of 5), and so the image that computer wrote would not be readable on another computer even if I matched the WD geometry perfectly.
I think a good start is a default that works for everything but the SD card can't be used in other machines. A jumper config for a few known BIOSes would be doable. I am still concerned that the landscape is so confusing that most folks will not be able to get an SD card that works in their modern PC. I think the experience might be better if we just say up front that nope, the primary SD card won't work in another computer without reinitializing.
I was thinking I might do a a more complex translation where the first part of an SD card is configured for 5 heads / 17 sectors / 1024 tracks, then anything outside of that range is located later on the SD card. This will match some common 40MB drive parameters and so in some cases the SD card will be readable on another PC. Unfortunately I think it mostly just covers the Seagate and WD hard card BIOSes which are the weakest use case for this project. I have considered something that runs on the vintage PC to pull the parameters from the actual parameter table being used and store them to an unused sector towards the end of SD card. The tricky part of this is that it has to happen before fdisk runs. Maybe there could be an optional tool that could be run before fdisk to change the base parameters for the translation I just described. I think I can implement it in a way that even if something goes wrong with the parameters, the SD card will still work fine in the vintage PC that fdisk-ed it.
It is all configurable in software of course and could be changed later. First pass will be one fixed CHS translation method to the primary SD card. Next on my priority list is probably boot-floppy-image-via-MBR-injection because that sounds super fun. Then device driver support for the second SD card as a hard drive. Somewhere along the way I am going to lose interest. Not before there is something working with any luck.
The main outcome of these thoughts is that I am putting the second SD card connector back and I should probably add a few more dip switches.
When I thought the OnTrack MBR injection would work well, I removed the second SD connector from the drive and I was looking at cutting back on the dip switches to save an IC.
So far as preconfiguring goes, given the hulking power of the MCU you're planning to use and the fact you're already having to deal with geometry translation (vs. what XTIDE does, which is just use the native LBA geometry of the attached IDE/CF device) it might be worth considering doing disk image files instead of using the storage media "raw". There are utilities (or built-in OS facilities, depending on what you're using) for mounting disk images and raw images can also be attached to emulators, so doing this could eliminate the need for bizarre workarounds for bootstrapping on the machine you're using it on, and you could also provide a facility for switching between disk images. This would mean that even if you *were* limited to 40MB or whatever it'd be simple enough for the user to switch between a "Games" image, an "Apps" image, whatever.
(Doing disk images on a FAT32 or whatever formatted SD card or USB stick would also simplify that "configure me to look like a ..." step; the program to do that could literally live on the storage media, along with the config file it generates.)
I did originally plan to use .IMG files. I do love the ability to make an image in PCem and very much wish it was easier to move them to a vintage PC. If I could make the process robust (I think that means, override the drive parameter tables), I would be quite for that. Otherwise it gets pretty fragile and not much fun. Even using XTIDE it can be challenging to share drive IMG files. And XTIDE has full control over the parameter tables. Something that could be added later if I/someone is motivated and there is demand.
I do think I could potentially support HD IMG files on the second SD card via a driver. It occurs to me now that I could also boot a floppy image located there. Maybe even cycle floppy images so a clean DOS install is possible.