OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 5:33 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Can't get floppy driver to work.
PostPosted: Tue May 05, 2020 4:19 pm 
Offline

Joined: Sun Nov 24, 2019 6:32 am
Posts: 1
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?
Attachment:
floppy.c [5.84 KiB]
Downloaded 19 times

(also I'm sorry for the ugly code)


Top
 Profile  
 
 Post subject: Re: Can't get floppy driver to work.
PostPosted: Fri May 15, 2020 2:38 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
Code:
#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.


Top
 Profile  
 
 Post subject: Re: Can't get floppy driver to work.
PostPosted: Fri May 15, 2020 9:38 am 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
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:
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();}


Top
 Profile  
 
 Post subject: Re: Can't get floppy driver to work.
PostPosted: Fri May 15, 2020 9:57 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5143
The downloadable code is correct, but the text in the tutorial is wrong.
Quote:
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], MichaelPetch and 103 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group