Quote:
Originally Posted by
shen747
Hi Corona688,
Thanks a lot for pointing that out. I've been doing some reading & now I feel going for the FAT-12(classical floppy disk) format file system would be the best idea as it was the 1st form of FAT introduced to the world & I guess therefore it would be much simpler & easier to implement.
It's not. I already explained why. But if you're willing to deal with the 12-bit strangeness, all right...
Quote:
I found
this explaining how to write a file to a FAT-12 file system. But I'm still finding trouble finding a basic code to get me started on this.
If you don't want to write the code, you can just mount the filesystem and use it...
I think you're getting too far ahead of yourself. You can't write a file if you haven't even built things to deal with FAT tables, sectors, directory entries... Work from the ground up. Read up on the structure and try to find and use
everything they tell you about.
Look at the boot block structure I gave you. Load the boot sector from your floppy into it and see if the values in it make any sense -- if not, either you loaded the wrong data or I made a mistake in that structure.
Once you get that looking okay, use the values in it to find the FAT table. Write a function to get a 12-bit values out of it(you can't just use an array because of the weird 12-bit size). Use hexdump to see what values you should be getting.
Once you can read the FAT table, start checking what things these FAT entries are pointing to. (If your FAT entries are scrambled somehow you could end up reading garbage that makes no sense, so make really sure they're right. Test a bunch of them.) Read in data from where they direct you and these will be file and directory entry structures. Their size might depend on values you read somewhere else. Try following a chain of them to get a complete file or directory listing.
Once you've done all that, the steps you see in that course information will make a whole lot more sense to you.