Can't get floppy driver to work.
Can't get floppy driver to work.
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?
(also I'm sorry for the ugly code)
-
- Member
- Posts: 5575
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Can't get floppy driver to work.
Code: Select all
#define FLPY_SECTORS_PER_TRACK 80
Looks like we don't have this particular mistake documented yet.
Re: Can't get floppy driver to work.
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:
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;
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
-
- Member
- Posts: 5575
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Can't get floppy driver to work.
The downloadable code is correct, but the text in the tutorial is wrong.
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.
Not great!FLPY_SECTORS_PER_TRACK is 80. Great!
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.