Floppy Driver works in qemu, not on real HW

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

Floppy Driver works in qemu, not on real HW

Post by HanzZ »

Hi!
My Floppy Driver works correctly in Qemu, but not works on real HW. I find, that driver freeze in fdc_rw(); (line 388), when he call (line 427) seek(); (line 281).... And in seek function, i think, freeze on (line 294) waitfdc(); (line 135)
I have already read http://www.mega-tokyo.com/forum/index.php?board=1;action=display;threadid=8436;start=msg73290#msg73290,
but autor of this driver said, that his seek function was bad, but i don't know, where is any problem...

So here is my driver : http://hanzz.name/floppy.html

Thank you for any solution
HanzZ
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Floppy Driver works in qemu, not on real HW

Post by Pype.Clicker »

Code: Select all


   33 #define   WAIT   0xFFFFFL
   36 static void wait(void)
   37 {
   38    unsigned long wait;
   39 
   40    for(wait = WAIT; wait != 0; wait--)
   41       /* nothing */;
   42 for(wait = WAIT; wait != 0; wait--)
   43       /* nothing */;
   44 for(wait = WAIT; wait != 0; wait--)
   45       /* nothing */;
   46 }
does it surprise you it doesn't work properly on real hardware ? i mean, what about some decent delay function for those 15ms etc. delays you're supposed to observe when programming the floppy ?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:Floppy Driver works in qemu, not on real HW

Post by Candy »

Pype.Clicker wrote:

Code: Select all


   33 #define???WAIT???0xFFFFFL
   36 static void wait(void)
   37 {
   38 ???unsigned long wait;
   39 
   40 ???for(wait = WAIT; wait != 0; wait--)
   41 ??????/* nothing */;
   42 for(wait = WAIT; wait != 0; wait--)
   43 ??????/* nothing */;
   44 for(wait = WAIT; wait != 0; wait--)
   45 ??????/* nothing */;
   46 }
does it surprise you it doesn't work properly on real hardware ? i mean, what about some decent delay function for those 15ms etc. delays you're supposed to observe when programming the floppy ?

This'll wait for 3 million cycles, on bochs that'd be around 3 seconds, on a real cpu that could be about a millisecond.

Assuming you compile without optimizations, because GCC will see right through your nothing and optimize away the entire loop. All the way down to around 5 nanoseconds of delay.

And no, 5 nanoseconds for 1980 technology is not long enough.
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Post by HanzZ »

OK... :-) Now i have real delay with ticks... but now i have problem with seeking... if I call seek(); i get one of these errors (in emulator sometimes, on real HW everytime (in reset(); too)) :

Code: Select all

291       if (sr0 != 0x20) kprintf("FLOPPY | SEEK | SR0!=0x20\n");
292       if (fdc_track != track) kprintf("FLOPPY | SEEK | FDC_TRACK!=TRACK\n");
293       return FALSE;
I update source code on my site, so number lines aren't good in my first message.... I will read again floppy controler data sheet tonight, but i think, that my seek function is good ;)
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Post by HanzZ »

does it surprise you it doesn't work properly on real hardware ? i mean, what about some decent delay function for those 15ms etc. delays you're supposed to observe when programming the floppy ?
I simply thought, that it is not essentially.. only that time don't have to be too small..., but how tell Candy, it was too little... sorry ;) And thank you for your time... but problem with seek(); still be...
Dex4u

Re:Floppy Driver works in qemu, not on real HW

Post by Dex4u »

The floppy driver i witten for Dex4u OS, work fine and is well commented to go with the intel floppy pdf. But you need to be able to understand a man's programming language, as it written in ASM ;D .
http://www.dex4u.com/FloppyDriver.zip
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Post by HanzZ »

thanks... it will be usefull
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Post by HanzZ »

I'm so happy ;)!!!! My driver runs greatly ;D ... i thanks everyone, who helps me....

Problem was in lot of small bugs... for example on real HW i have to make "sense interrupt status" four times... and I make it only once... Great source code of driver is on (Free dos) http://koders.com/c/fid051291340B94EC7F5D1A38EF6843466C0B07627B.aspx?s=fdc

Thanks for help
HanzZ
Dex4u

Re:Floppy Driver works in qemu, not on real HW

Post by Dex4u »

Nice to hear you got it working :), but it's fat12 next :-[
HanzZ

Re:Floppy Driver works in qemu, not on real HW

Post by HanzZ »

I have just had FAT12 driver ;) I have many things, but I first time tested my OS on real HW... And from this test i got this , now solved, error...
Post Reply