Page 1 of 1

Can't get floppy driver to work.

Posted: Tue May 05, 2020 4:19 pm
by ad2017
Hello! I am kinda new to OS development. I have tried following this tutorial to make a floppy driver, but when I try reading the first sector, I always get the same data back, even when no floppy is attached, or when the floppy is empty (and the data I get back is not empty). I tried looking back at the tutorial, but I can't find the problem. Any help?
floppy.c
(5.84 KiB) Downloaded 41 times
(also I'm sorry for the ugly code)

Re: Can't get floppy driver to work.

Posted: Fri May 15, 2020 2:38 am
by Octocontrabass

Code: Select all

#define FLPY_SECTORS_PER_TRACK 80
A typical 1.44MB disk is formatted with 18 sectors per track. You can't fit 80 sectors in a single track.

Looks like we don't have this particular mistake documented yet.

Re: Can't get floppy driver to work.

Posted: Fri May 15, 2020 9:38 am
by neon
Hi,

So, we looked into this one and have noticed that FLPY_SECTORS_PER_TRACK is defined incorrectly in the text but is correct in the demo download as noted below. The text has been corrected. The demo defines it as the following:

Code: Select all

const int FLPY_SECTORS_PER_TRACK = 18;

Re: Can't get floppy driver to work.

Posted: Fri May 15, 2020 9:57 am
by Octocontrabass
The downloadable code is correct, but the text in the tutorial is wrong.
FLPY_SECTORS_PER_TRACK is 80. Great!
Not great! :lol:

Edit: and I see it's been corrected as I was writing this post. Very nice!

There are some other mistakes, such as "linear block address" (LBA is short for logical block address), and calling the floppy drive connector cable a form of PATA/IDE cable (neither ATA nor IDE existed when that cable was standardized), but those details aren't too important for writing a driver.