Booting ADFS discs:

FileCore has the concept of Floppies and Winnies. The way each of these boots is different. A floppy boots by reading the first 1K of the disc. This 1K on E map discs is the first copy of the free space map. Being a free space map the first 4 bytes are the map block header, and the subsequent 60 bytes are the disc record, with padding. A winnie boots by reading sectors addresses &c00 to &e00. From the beginning of these is the bad block list, terminated by &20000000. At the very end of the boot block (&c00 to &e00) is the disc record padded to 64 bytes, preceded by the device-specific parameters - see the PRM page 1014. From the boot-block copy of the disc record FileCore manages to find the real location of the map, but does not necessarily try to access it immediately. FileCore, to distinguish between E format floppies and D/L format floppies check whether the top bit of the 3rd byte (disc address &00000002) is set. If it is set then it's probably E map, otherwise D or L map.

In answer to Tim's question, the approved way to find the map is <FS>_DescribeDisc, which, if it does not work on a Winnie, means the map is hard to find automatically. As an alternative to this, when it fails, a disc fixer program may choose to hunt for correctly formed map sectors somewhere round the middle of the disc, and so hunt out the real map. Once a map has been sussed like this (and checked that it matches the shape of the disc etc) the disc fixer can attempt to fix the boot block, or siphon off the information on the disc to somewhere safer. <FS>_DescribeDisc is slightly more future proof than booting the disc 'manually' using <FS>_DiscOp to read the boot block, but, having said that, the ADFS D and E disc formats are pretty much cast in stone and are unlikely to change such that <FS>_DiscOp doesn't work, <FS>_DescribeDisc does work, and an ADFS D/E format disc fixer can still fix the disc, so, do it whichever way you feel best works for your program. (Don't, whatever you do, try driving the hardware directly, as there are enough interfaces provided (<FS>_DiscOp) and doing this is definitely NOT future proof)

There is a slight problem when doing <FS>_DiscOp with a dodgy disc. The problem occurs if no disc record is specified in the <FS>_DiscOp, when FileCore will try to mount the disc itself and generate its own internal disc record. If the disc is dodgy then there's a fair chance that the mount will fail, but FileCore will still carry on with the DiscOp with a duff disc record, thus possibly generating spurious error messages (such as Bad parameters). So, when trying to fix a dodgy disc always specify a disc record, and you also probably want to specify an empty bad block list too.