OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 1:06 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Disk I/O in PMode
PostPosted: Wed Jul 10, 2002 11:00 pm 
OK... ran into my first major big problem today :(

I am trying to write my own OS, and have so far completed a boot-loader, kernel with screen output, interrupt handling, malloc() and stuff like that. Now the problem is, I want to design my own file system. The design part is not the problem, but I can't seem to find any information regarding how to do Disk I/O under protected mode. From reading source code, I can see that it will likely entail a lot of "in" and "out" assembler calls. If anybody can help me out with a code snippet that explains this, or a good tutorial on the subject, I would be most appreciative.

Thank you in advance
  Hunter Seeker


Top
  
 
 Post subject: Update:Disk I/O in PMode
PostPosted: Thu Jul 11, 2002 11:00 pm 
So far, I have managed to figure out most of the commands that need to be passed to the FDC, but the read command is giving me problems. I need to know what normal values are for "bytes per sector", "GAP3 length" and "last track in sector". Also, I would love to know where the data I have read is going to be stored in memory... Is there a way this has to be set up, or will it also be available on the FDC Interface port?

PS: Error I am getting from the FDC is "Command started but terminated abnormally"... Any ideas ;) ?

Thanks
   HuntrCkr


Top
  
 
 Post subject: RE:Update:Disk I/O in PMode
PostPosted: Thu Jul 11, 2002 11:00 pm 
For 1.44MB Floppies:
512 bytes/sector
~ 12 Gap3
18 sectors/track

For 2.88MB Floppies:
512 bytes/sector
~ 18 Gap3
36 sectors/track

The GAP3 isn't always constant and should be calculated (not totally sure how... start low, and add one if it doesn't work).

Last track in sector!?  Don't you mean last sector in track?  In which case, would be (trackNum * sectorsPerTrack)

Hope that helps,
Jeff


Top
  
 
 Post subject: RE:Update:Disk I/O in PMode
PostPosted: Sun Jul 14, 2002 11:00 pm 
Hmmm... I'm sorry to say, it didn't. Those were pretty much the values I was using, but it still comes up with the same error. According to the Status registers returned when I do a read command, it fails to find a valid data address mark. Now I am not quite sure what that is and how you put it on a disk, but my disks seems to be missing it. The disk I am trying to read from is a DOS formatted disk with 100K of data on. This is really frustrating the hell out of me. Has anybody on these forums ever written a working FDC driver?

Hope someone helps,
   Hunter Seeker


Top
  
 
 Post subject: RE:Disk I/O in PMode
PostPosted: Sun Jul 14, 2002 11:00 pm 
You will need to set up some DMS routines to transfer the data from the floppy drive to your system memory so you can use it. Other then that its pretty straight forward you spin up the floppy disk you seek your track and read the sectors you need. If you need an example of this you can snatch the fdc drivers from the ubixos source.



-Christopher


Top
  
 
 Post subject: RE:Disk I/O in PMode
PostPosted: Mon Jul 15, 2002 11:00 pm 
Thanks Christopher,

The source code for your FDC Driver helped a lot. With a couple of modifications, I got it working on my OS.

BTW, UbixOS looks good :)


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 39 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