Page 3 of 3

Re:The making of my 32bit Floppy Driver..

Posted: Sat Mar 06, 2004 11:15 am
by Neo
i know this sounds dumb but is it really necessary to setup the DMA chip for the read sector command (0x66). I'm just testing the read sector command (with a dummy DMA function call) and wanted to know if it is absolutely necssary to setup DMA or should i get an interrupt even without this.
i'm not getting one so i wanted to be sure it was not my code.

Re:The making of my 32bit Floppy Driver..

Posted: Sat Mar 06, 2004 12:49 pm
by xsism@work
you *SHOULD* still get an int, but dont quote me on that. You want my dma code too? http://halfix.osdever.net/public/OS/kernel

it's in there. Feel free to take whatever you want. I would appreciate if you let me know. I want to make a list of people who use halfix's code on the website. Thanks.

Re:The making of my 32bit Floppy Driver..

Posted: Sun Mar 07, 2004 2:27 am
by Neo
I'm back with some more questions.
1) What exactly is the IDAM and what is its use or purpose?
2) what is a "deleted sector"? how does it differ from the other sectors?
3) Are you sure that you get a IRQ even without using DMA for the read command? If this is yes, then when you use DMA how do you know that a DMA transfer is completed if the IRQ has already been received before the DMA transfer completes?
4) Should i give the virtual address of a buffer to the DMA chip(implying that the DMA figures out what the physical address is) ? or do I have to give it the physical address only?
If anyone here knows the answers to these i would be grateful.

Re:The making of my 32bit Floppy Driver..

Posted: Sun Mar 07, 2004 3:05 am
by Candy
Neo wrote: 3) Are you sure that you get a IRQ even without using DMA for the read command? If this is yes, then when you use DMA how do you know that a DMA transfer is completed if the IRQ has already been received before the DMA transfer completes?
AFAIK, you get an interrupt with DMA as soon as the buffer is full. So, if you don't set the dma properly, you don't get an interrupt but a deadlock.
4) Should i give the virtual address of a buffer to the DMA chip(implying that the DMA figures out what the physical address is) ? or do I have to give it the physical address only?
If anyone here knows the answers to these i would be grateful.
As everybody keeps telling you it has to be below 16M physical, and it's such an artifact from the 8086 days, do you think it can convert from virtual to physical?

Re:The making of my 32bit Floppy Driver..

Posted: Sun Mar 07, 2004 11:30 am
by Neo
Thanks candy. does anyone know anything about the other 2 questions?
Can anyone give me the steps to be followed to read a sector off the floppy?
right now this is what i do
1) power on the FDC
2) calibrate it
3) fix-drive-data (defaults)
4) seek to the cylinder
((4.1) must init dma here )
5) delay for head-settle time
6) send the 9 bytes
7) wait for an int (this is where im stuck)

is this right?

Re:The making of my 32bit Floppy Driver..

Posted: Tue Mar 09, 2004 4:42 pm
by mr. xsism
looks accurate to me.

Re:The making of my 32bit Floppy Driver..

Posted: Wed Mar 10, 2004 1:00 pm
by Neo
<drum roll, trumpets, cymbals crashing and faint noise of a FDD motor in the background...........>
YES! YES! i finally got my floppy disk driver to read any sector off the disk last night (i couldnt post then as it was too late). There is a lot of info i've learnt and will share it all later. There are some things that i think most of you guys whose FDD code i've seen, have overlooked (or am i wrong??? :-\ ). I will get back with a post of these later (when i'm a little more certain). right now i'm too happy to do anything useful.
<still the music plays as Neo is on cloud nine>
of course i have a lot more to do till my code can be called "reliable".
I'll be back.

Re:The making of my 32bit Floppy Driver..

Posted: Thu Mar 11, 2004 1:30 pm
by Neo
here's a quote straight from the horse's mouth (intel). (I'm really surprised none of you guys who have implemented your FDD drivers saw this so far or if you have why hasnt anyone done this)
Since polling is enabled after a reset of the 82077AA,four SENSE INTERRUPT STATUS commands need to be issued afterwards to clear the status flags for each drive.
see 4 sense ints.

i have read debs refrence and he does not mention this (it is after all a reference so thats okay i guess). Fabian Nunez's code does not (or am i missing something), Code slashers tutorial has no reference to this, and so have a dozen others whose code i've chanced to see. Please dont get me wrong i'm not poking at anyone i just wanted to let you guys know.
Another thing is the get_byte() function. apparently intel says that the MSR have a value of 0xC0 ( 11xx_xxxx binary ) not 0xD0 (1101_0000 binary). They both work though (as testing the RDY bit should'nt be wrong IMHO).
if i see anything else ill let you know.

Re:The making of my 32bit Floppy Driver..

Posted: Fri Mar 12, 2004 1:48 am
by bubach
Nice! Now you can start writing on that "Writing a floppy driver for dummies" tutorial with asm source for me.. ;-P

Re:The making of my 32bit Floppy Driver..

Posted: Fri Mar 12, 2004 11:11 am
by Neo
:D i was thinking of something like that but not right now i've just started off on the floppy so maybe after some real hardwork later. :)
btw i've written in it in C and used only a bit of ASM (which actually could be written in C too) but the steps will be clear. (Hopefully ;) )

Re:The making of my 32bit Floppy Driver..

Posted: Mon Mar 15, 2004 3:53 am
by Neo
is my layout(attached here) of a 3 1/2" 1.44MB FAT12 floppy correct? Thanks in advance.


[attachment deleted by admin]

Re:The making of my 32bit Floppy Driver..

Posted: Mon Mar 15, 2004 4:16 am
by Candy
Neo wrote: is my layout(attached here) of a 3 1/2" 1.44MB FAT12 floppy correct? Thanks in advance.
last sector == 2879 decimal.

Yes it's correct - for the default fat12 floppies. You can have more or less FATs than you take for granted. Read microsofts fat docs.