Hi,
Brandon wrote:
Brendan: Are u sure that starting the motor wont fire an IRQ?
Yes
It's almost as if the bits in the DOR are directly connected to the floppy motors and nothing else.
Brandon wrote:
Is there anything else I have to do to "configure" the fdc? When I?ve ran the reset function, is there any way of testing that everything went ok during the initialization?
It depends on your OS and what sort of quality you want. You could try to detect which devices are connected (1200 Kb, 1440 Kb, 2880 Kb, tape, etc). You could also detect which floppy controllers are present (ie. first FDC at base IO port 0x03F0, second FDC at 0x0370), and what type they are (see the "version" command 0x10). Then there's the question of how many devices you'd support - the basic FDC chip handles 4 devices, while most motherboards/cards are only capable of handling 2 of them. In theory you could have 4 devices on the primary FDC, another 4 on the secondary FDC (for 8 devices).
Then there's the question of how your OS will handle all this. Some OSs have a single floppy disk driver, while on others you'd have a device driver for each floppy drive controller chip, and seperate drivers for each device.
Reseting a floppy drive device would include the "recalibrate" command, detecting if any media is in the drive and trying to figure out what type of media is inserted (and configuring for that media). Media specific configuration includes the "specify" command 0x03, the data rate, any device driver data (buffers, etc), and any OS specific stuff (for e.g. mounting it at "/dev/fda0").
The most annoying thing is there's no decent way of determining what media is in a device. DOS use the BPB (BIOS Parameter Block) in the first sector, but this is badly named and should be called the DPB (DOS Parameter Block) as it's not required, and not suitable for some of the floppy formats you could create (for e.g. if you use a higher number of sectors per track on the outer cyclinders).
In general I set the data rate to 1 Mb/s and try to read the first sector of the disk. If this doesn't work (or if 1 Mb/s isn't supported) I try 500 Kb/s, then 300 Kb/s, then 250 Kb/s. Sooner or later one of the data rates will work. Then you can try different numbers of sectors per track and/or different numbers of bytes per sector, and/or figure out the highest track number. The more floppy disk formats your OS will handle the harder this will be, which is why a lot of hobby OSs only support 1440 Kb.
Cheers,
Brendan