Notes

C++
If you are using C instead of C++, you will have to do a little bit of modification, as I put the floppy driver in a class. All the functions are currently static, so you won’t have to do much work.

No Malloc
I have not yet implemented malloc, so this floppy driver currently uses static memory. It is recommended that you implement malloc before using this tutorial to create a floppy driver so you will not have to rewrite some of the code later on (meaning, learn from my mistakes).

Polling
I also have not yet implemented multitasking, so currently the code simply polls waiting for the interrupt. Obviously, you will want to eliminate this as soon as possible, as do I.

No Time Delay for Motor
Currently the motor is started and stopped every time a read is done; it would be better to have a timer run -- if another read request is made before the timer fires, reset the timer; if the timer fires before another read request is made, stop the motor. This will save wear and tear on the drive from starting and stopping the motor each time. I have not implemented this yet, as I simply wanted to get the floppy driver working at this point.

Bug?
For some reason, the first time a read is attempted it always reads the wrong sector... I am not sure if this is a bug in my code, or if it is normal. The read always succeeds on the second try, so it’s not too big a deal, but if it’s a bug I’d like to fix it. Please let me know if you determine that it is a bug and what causes it. Thanks.