Hi Team!

I have made really good progress on the Floppy Disk Controller (FDC).
However, I have run into a stumbling block and need some assistance. The
code is able to read the first track (cylinder) on the floppy. However, when
attempting to read any other track, it returns data on the first track. I
suspect the problem is with the SEEK operation; since the head does not
physically move. However, the operation returns a successful status and
reports back the correct track number. It has me stumbled!

If anyone can help, below is the code snippet for the SEEK operation.
However, it would probably be easier to download the project from my
sandbox. I made special floppy disk image (Data\FloppyDiskImage\Test.img)
where each byte in the sector is encoded with its sector number plus one. It
helps to determine if the SEEK and following READ_TRACK operation worked. I
use Virtual PC to associate the disk image or real floppy to the virtual
machine. 

protected static bool Seek(byte drive, byte track, byte head)
{
        TurnOnMotor(drive);
        Diagnostics.Message("..Seeking #", track);

        for (int i = 0; i < 5; i++) {
                SetInterruptOccurred(false);

                SendByte(FIFOCommand.Seek);
                SendByte((byte)((drive | (head << 2))));
                SendByte(track);

                WaitForInterrupt();

                SendByte(FIFOCommand.SenseInterrupt);
                byte sr0 = GetByte();
                byte fdc_track = GetByte();

                Diagnostics.Message("..Status: ", (int)sr0);

                if ((sr0 == (0x20 + (drive | (head << 2)))) && (fdc_track ==
track)) {
                        Diagnostics.Message("Seek successful at #",
fdc_track);
                        return true;
                }

                Diagnostics.Message("...Retrying");

        }
        Diagnostics.Message("Seek failed");
        return false;
}

References to documentation on the FDC are listed at the top of the
FloppyDiskController.cs file.

Thanks in advance,

Phil



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
SharpOS-Developers mailing list
SharpOS-Developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sharpos-developers

Reply via email to