Page 1 of 1
Floppy seek doesnt work
Posted: Tue Feb 17, 2004 11:34 am
by awas
Here is my seek code
Code: Select all
#define CMD_SEEK 0x0f
bool seek(unsigned int CylindirNo)
{
if(CurrentCylindir == CylindirNo)
return TRUE;
sendbyte(CMD_SEEK);
sendbyte(0);
sendbyte(CylindirNo);
if(CheckInterruptStatus())
if(CurrentCylindir == CylindirNo) {
return TRUE;
}
Print("FDC error");
return FALSE;
}
Whenever I call seek function, I get FDC error. And I dont hear any head moving voice from my floppy. Before calling seek I set motor on.
My fdc led turns on but not works. Is there any error in my seek function or what may couse problem??
Re:Floppy seek doesnt work
Posted: Wed Feb 18, 2004 2:53 am
by awas
No answer?
PS:I tried my seek function on real computer...
Re:Floppy seek doesnt work
Posted: Wed Feb 18, 2004 3:29 am
by Slasher
Hi,
you have not provided enough info.
what does sendbyte do?have you initialized the controller properly? what does CheckInterruptstatus?
how did you code all these functions?
Most importantly, the seek causes an interrupt to be fired after the seek is completed so you need to wait for the floppy int on IRQ 14 to fire befor you check the status.
Hope this helps.
Else there are a lot of post here on floppy, use the seach onto of the screen.
Re:Floppy seek doesnt work
Posted: Wed Feb 18, 2004 1:14 pm
by awas
What is IRQ 14? I think floppy irq is 6, doesnt it? And after calibration, and seek operation, irq 6 is not called in real computer but called in bochs. Why is irq6 not called in real machine??
Re:Floppy seek doesnt work
Posted: Wed Feb 18, 2004 2:31 pm
by Pype.Clicker
probably because you have something wrong in your PIC code or something alike ... as BOCHS is an idealized machine, there are things that can work with it and that will not work on a real machine ...
The fact that BOCHS zeroes memory before you read it may be a reason ...
Re:Floppy seek doesnt work
Posted: Wed Feb 18, 2004 5:45 pm
by jgmorford
IRQ6 is fired on a real machine. What CodeSlasher meant was
that interrupt 0x0E (hooked to IRQ6) is fired on disk operation
completions. Just set up interrupt 0x0E to set a completion
flag and then re-enable IRQs on the master PIC. Then all you
have to do is write a loop which checks the completion flag to
know when you may proceed.
Also, more problems may arise if you are not checking the
contents of the diskette main status register (3F4) to ensure
a write can be performed in your 'sendbyte' procedure.