Page 1 of 1

programming floppy

Posted: Sat Apr 26, 2003 11:06 am
by slacker
i have read every piece of documentation available on the internet about the floppy controller and still dont understand how it works. what port is actually used to write data to and from it since i dont want to program DMA. also if anyone knows or has any source that is well documented i would appreciate it...

Re:programming floppy

Posted: Sat Apr 26, 2003 12:14 pm
by Tim
You mean to say that no document on the Internet tells you what port to write to? I don't think you've looked at every document.

I recommend you get hold of the sources to Fabian Nunez' floppy driver (via http://www.execpc.com/~geezer/os/) and read through it.

Re:programming floppy

Posted: Sun Apr 27, 2003 11:03 am
by slacker
ok let me see if this is right...

by writing to port 0x3f5 you gain access to more registers like the ones the allow you to write to disk, read from disk etc?

so if you wanted to write a sector:

portout(0x3f5, 0x0x5)

//0x05 is function to write sector

so then you can set up the write register
and output the settings for that register to 0x3f5.

then finally you can send that byte to 0x3f5 and it will write to disk...

is this right?

Re:programming floppy

Posted: Sun Apr 27, 2003 6:10 pm
by Jamethiel
Fair warning: Some of us have discovered the hard way that some PCs don't work right when you try and run the floppy controller in non-DMA mode. You may have to set up DMA after all (which isn't hard, really).

Re:programming floppy

Posted: Sun Apr 27, 2003 6:58 pm
by slacker
i have heard that on newer PC's that the DMA is not present so i dont want to rely on it....

Re:programming floppy

Posted: Mon Apr 28, 2003 12:24 am
by Nairou
slacker wrote: i have heard that on newer PC's that the DMA is not present so i dont want to rely on it....
Its the other way around. Everyone uses DMA for the floppy drive, so some newer drives have stopped supporting direct port I/O.

You wouldn't want to use port I/O anyway, you'd have to do polling which would freeze up your kernel.