The making of my 32bit Floppy Driver..

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post 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.
Only Human
xsism@work

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

Post 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.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post 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.
Only Human
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

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

Post 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?
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post 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?
Only Human
mr. xsism

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

Post by mr. xsism »

looks accurate to me.
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post 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.
Only Human
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post 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.
Only Human
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

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

Post by bubach »

Nice! Now you can start writing on that "Writing a floppy driver for dummies" tutorial with asm source for me.. ;-P
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post 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 ;) )
Only Human
User avatar
Neo
Member
Member
Posts: 842
Joined: Wed Oct 18, 2006 9:01 am

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

Post by Neo »

is my layout(attached here) of a 3 1/2" 1.44MB FAT12 floppy correct? Thanks in advance.


[attachment deleted by admin]
Only Human
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

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

Post 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.
Post Reply