Floppy seek doesnt work

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
awas

Floppy seek doesnt work

Post 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??
awas

Re:Floppy seek doesnt work

Post by awas »

No answer?

PS:I tried my seek function on real computer...
Slasher

Re:Floppy seek doesnt work

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

Re:Floppy seek doesnt work

Post 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??
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 seek doesnt work

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

Re:Floppy seek doesnt work

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