OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 7:23 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: FloppyDisk & FAT12 Tutorial
PostPosted: Tue Jul 18, 2017 10:06 pm 
Offline
User avatar

Joined: Wed Mar 11, 2015 8:13 pm
Posts: 23
Hey does anyone have any tutorial (preferably with code) about floppy disk initialization and FAT12 filesystem (How to read & write).
Also I was following the tutorial on brokenthorn, but it seems it has many bugs as:
1-Floppy disk totally hangs the system when waiting for the IRQ to fire.
2-Searching the file through the floppy disk function never find it.
3-I thought I maybe made a silly mistake ("Like in the last post sorry") , So I grabbed the tutorial source code and compiled it but it didn't work at all (Hangs at IRQ & doesn't find file.)


Also, I am using windows 10, bochs and ImDisk (if it matters). (Maybe it had something to do with emulator?)

_________________
Developing ZeroX Operating System;
I code C++ so much that I am ending English Statements & Replies with semi-colon instead of dot;


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 6:53 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
It is not that hard to find... You should do your homework.
http://starman.vertcomp.com/asm/mbr/DOS50FDB.htm
https://github.com/bztsrc/osz/blob/master/loader/mb-x86_64/bootboot.asm#L896
https://github.com/alexfru/BootProg/blob/master/boot12.asm
https://technet.microsoft.com/en-us/library/cc976796.aspx
http://fileadmin.cs.lth.se/cs/Education/EDA385/HT09/student_doc/FinalReports/FAT12_overview.pdf
etc. etc. etc.......


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 9:18 am 
Offline
User avatar

Joined: Wed Mar 11, 2015 8:13 pm
Posts: 23
Is there any C tutorials cuz i want to expand and create node based file system.

_________________
Developing ZeroX Operating System;
I code C++ so much that I am ending English Statements & Replies with semi-colon instead of dot;


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 6:25 pm 
Offline
Member
Member
User avatar

Joined: Sat Dec 27, 2014 9:11 am
Posts: 901
Location: Maadi, Cairo, Egypt
zlixine wrote:
Is there any C tutorials cuz i want to expand and create node based file system.

It's your OS. For something important like a file system driver, you should design it yourself, not follow a tutorial. Of course, you'd use references as to how the FAT12 file system is structured, but how you'd implement that should be up to you, not a tutorial.

_________________
You know your OS is advanced when you stop using the Intel programming guide as a reference.


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 6:28 pm 
Offline
User avatar

Joined: Wed Mar 11, 2015 8:13 pm
Posts: 23
omarrx024 wrote:
zlixine wrote:
Is there any C tutorials cuz i want to expand and create node based file system.

It's your OS. For something important like a file system driver, you should design it yourself, not follow a tutorial. Of course, you'd use references as to how the FAT12 file system is structured, but how you'd implement that should be up to you, not a tutorial.


Ok, but you have to go to sleep 2 am in Egypt is too late bro... :mrgreen:

_________________
Developing ZeroX Operating System;
I code C++ so much that I am ending English Statements & Replies with semi-colon instead of dot;


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 6:32 pm 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Hello,

We are not currently aware of any known bugs reported in the file system code; however it will certainly fail if the floppy driver provided is not able to properly read in sectors. The original code for the floppy driver does indeed have a known bug that may show under certain environments. We typically handle resolving this on a case by case basis so we can confirm it works on the target environment. The original code worked, however it used a legacy version of Bochs since it was so long ago. I.e. it may have worked when it should not have. If you are still wanting to resolve the error, please let us know and we can test it here.

We typically recommend the fat32 whitepaper released here. It covers the standard FAT file systems, including fat32, fat16, and fat12. You can implement a generic FAT driver supporting the major variations following the whitepaper. Since you are using ImDisk, we would recommend fat32 with ATA support since no one uses floppy disks anymore.

I was a little confused about your last request for C tutorials. It is typically recommended against designing a custom file system structure unless you are already familiar with existing designs and have good reasons (i.e. something that existing designs do not solve, or something that you can do better.) Since you mentioned wanting to go "node based," have you considered ext2 or ext3?

_________________
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: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 7:06 pm 
Offline
User avatar

Joined: Wed Mar 11, 2015 8:13 pm
Posts: 23
neon wrote:
Hello,

We are not currently aware of any known bugs reported in the file system code; however it will certainly fail if the floppy driver provided is not able to properly read in sectors. The original code for the floppy driver does indeed have a known bug that may show under certain environments. We typically handle resolving this on a case by case basis so we can confirm it works on the target environment. The original code worked, however it used a legacy version of Bochs since it was so long ago. I.e. it may have worked when it should not have. If you are still wanting to resolve the error, please let us know and we can test it here.

We typically recommend the fat32 whitepaper released here. It covers the standard FAT file systems, including fat32, fat16, and fat12. You can implement a generic FAT driver supporting the major variations following the whitepaper. Since you are using ImDisk, we would recommend fat32 with ATA support since no one uses floppy disks anymore.

I was a little confused about your last request for C tutorials. It is typically recommended against designing a custom file system structure unless you are already familiar with existing designs and have good reasons (i.e. something that existing designs do not solve, or something that you can do better.) Since you mentioned wanting to go "node based," have you considered ext2 or ext3?



Hello Neon, I have ditched Floppy Disk & Fat12 Support (for now), and I will support higher & newer versions, also I compiled your tutorial source code, then I ran it under newest bochs and it hangs as it waits for the irq to fire.

Thanks.

_________________
Developing ZeroX Operating System;
I code C++ so much that I am ending English Statements & Replies with semi-colon instead of dot;


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 10:08 pm 
Offline
Member
Member
User avatar

Joined: Thu Aug 06, 2015 6:41 am
Posts: 97
Location: Netherlands
zlixine wrote:
I ran it under newest bochs and it hangs as it waits for the irq to fire.

Which command was supposed to cause the IRQ? IIRC I have had an issue with bochs in the past where it didn't fire the IRQ 6 after a recalibrate command, even though the real hardware did and the command was correct. I don't know which version of bochs that was and wether or not that has changed in a newer version, but it might be a good idea to test your code on real hardware if you can.


Top
 Profile  
 
 Post subject: Re: FloppyDisk & FAT12 Tutorial
PostPosted: Wed Jul 19, 2017 10:10 pm 
Offline
Member
Member
User avatar

Joined: Tue Mar 06, 2007 11:17 am
Posts: 1225
My kernel is capable of loading program binaries from the root directory of FAT12 disks:
BOOTCFG__v2017-06-16.zip

See how to use it, you just need DOS to launch it:
http://f.osdev.org/viewtopic.php?t=32121
http://devel.archefire.org/forum/viewtopic.php?p=4263&hl=en


One thing that you must be aware of is that if you boot your system and try to access the floppy without initializing it and setting its transfer mode to DMA instead of PIO, you won't be able to use code based in DMA and such a simplistic system will simply lock up waiting for DMA and other things, if you use infinite loops.

The solution to this is just booting from floppy or just use "dir a:" from DOS. Accessing the floppy at least once will initialize the floppy.

The real solution is learning to do that initialization in your own system. I still need to do that, but at least I can load test programs from the FAT12 floppy root directory.

_________________
Live PC 1: Image Live PC 2: Image

YouTube:
http://youtube.com/@AltComp126/streams
http://youtube.com/@proyectos/streams

http://master.dl.sourceforge.net/projec ... 7z?viasf=1


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

All times are UTC - 6 hours


Who is online

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