But I still want to know how to code a floppy driver.
This is a difficult question to answer, because the answer is different for every OS. The "job" of a floppy driver (or any driver, for that matter) is to allow the OS to communicate with the hardware in a simple, standardized way. But the specific design of the driver is up to you, as the developer of the OS.
You can choose to design your OS drivers exactly like an existing OS -- Linux is a good choice for this, since all of its source code is freely available to read or even use in your OS. Or, you can choose to design your own driver model. It's entirely up to you.
A device driver hides all of the difficult/complex/ugly code needed to talk to the actual hardware (i.e. the Floppy Controller), and provides the OS with a set of simplified functions that can be used to do things like:
- Check to see if a disk is currently inserted into the drive
- Copy one or more blocks of data from the disk to system memory
- Copy one or more blocks of data from system memory to disk
You may want to design your driver(s) in a way that all of your devices can be accessed in a similar way (and have similar functions). This will make your kernel code simpler, in the end.
Once you have decided how you want to proceed, then you can start asking specific questions, like "Should I use PIO mode or DMA mode when reading from a Floppy disk?", which is a question we can actually answer. (DMA mode, by the way...)
Just be sure the answer to your question isn't already in the Wiki pages before you post it. Some people here get frustrated when this happens.
I should mention that the "Floppy Driver" usually has nothing to do with the "File System". These are normally two different components in an OS. Your file system code may use your floppy driver to communicate with the floppy drive controller, but they are still two different things.
Anyways I wanted a filesystem like a B-tree. I have no idea how to do that, I have looked countless places and nothing, just diagrams. I figured that if I do that, the data index stored would be infinite and fill up the hard drive.
Wikipedia has quite a bit of information on B-trees, and even has a section on File Systems:
http://en.wikipedia.org/wiki/B-tree#In_filesystems
However, I would recommend starting with something simpler, like FAT12, especially if you are going to be working with Floppy disks (since most Operating Systems will be able to read and write your floppy disks as well). One of the disadvantages to writing your own file system is that no one else will be able to read it...
Let us know if you have any other questions. (Specific questions, that is...
)
Good luck!