A floppy driver is actually fairly simple. Certainly, writing to the screen is easier, but once you get it down, writing code to use a floppy drive is straightforward and easy to understand. (Though it did take a week of reading others’ code, trying to port others’ code, and studying the command set and register information before I understood it well enough to code it myself [and figure out that the bug was not in the floppy or DMA code at all, but that's another story...].)
Unlike Programming Floppy Disk Controllers, which lists the commands and registers, I will be going in chronological order, from the first thing done to read from a floppy drive to the last. There are 4 main steps, though most steps require several smaller steps. I primarily pay attention to what to do and in what order; any exact details, such as the port number for a specific register, will not be given in the tutorial, as you may easily find them in the header file or on the Web page linked to above.
Since this is a tutorial, and not simply code to be downloaded, I will divide each step into an explanation of what each function does and the actual code. If you would rather try to write the code yourself, read only the explanation; then, after writing your own code, compare it to the code listed to see if it is correct.
Step 3: Read is in bold because it is the main step. If you want to get an overview of a complete read operation, visit it first. However, if you want to go chronologically, or you want to write your own driver without relying on the code available here and want to test your driver incrementally, start at Step 1.
Some lines of code will require changes, since they are dependent on other features of the operating system. These are red in the code sections.