Hi,
Prochamber wrote:It seems that I can support most features on PC/AT,PS/2 and Model 30 drives. I can't use the SRA, SRB or DSR registers or perpendicular mode, none of these are any great lose.
You can detect what sort of controller you're working with (using the "version" command) and have different code for different controllers for the pieces where it matters (mostly initialisation).
Prochamber wrote:I'm not sure if CONFIGURE and LOCK are supported, it doesn't mention them in the compatibility section of the 80077AA sheet but they are not on the 8272 and it would be a huge pain if they weren't supported. I'll probably just go ahead and use the commands.
CONFIGURE and LOCK are only supported on the enhanced controllers. Mostly they're only used for managing the FIFO queue (which doesn't exist on the older controllers). The LOCK command is so that old software written for old floppy controllers can't accidentally mess up the settings for newer features in newer controllers. For example, the BIOS might use the LOCK command so that old DOS applications don't cause problems. If your driver supports the newer controllers, and if only the driver and/or kernel can access the controller's registers, the LOCK command is pointless.
Prochamber wrote:CMOS doesn't actually say how many drives there, as claimed on the Floppy Disk Controller page, it merely says the type of floppy at for the first and second drive. I'm thinking of trying to detect drives by use SENSE_INTERRUPT after doing a controller reset with drive polling on. If an interrupt doesn't come then within a timeout, the drive doesn't exist. Would this work?
CMOS only tells you what the user set in the BIOS configuration thing (which may or may not have anything to do with what actually exists - e.g. if a system boots from hard drive the user can set anything they like for floppy types). It only covers the primary floppy controller, so if you've got 2 floppy disk controllers then you're out of luck.
For detecting if there's any disk drives connected to the controller; the SENSE_INTERRUPT won't work without a previous SEEK, and I'm not sure if there are any commands that can be used to tell the difference between "drive doesn't exist" and "drive exists but is empty".
I also don't think it's possible to detect what type of disk drive it is. However, if there's a floppy disk in the drive you can figure out what format it is and then make assumptions about the disk drive type from the floppy disk's format (e.g. if it's a 1440 KiB disk then assume the drive is 3.5 inch, and if the disk is 1200 KiB assume the drive is 5.25 inch).
Basically, auto-detection wasn't a priority when old hardware was designed, so it's very difficult to auto detect anything reliably (and it may be best to ask the user which disk drivers exist and what type they are).
Cheers,
Brendan