FAT12 Root Directory Question

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
Armature
Member
Member
Posts: 33
Joined: Wed Apr 25, 2018 2:44 pm
Libera.chat IRC: idk

FAT12 Root Directory Question

Post by Armature »

Hi, I've been working on a simple MSDOS style operating system but I'm having issues with the FAT12 File system, specifically the root directory entries. Whenever I add a file such as a PDF file to the disk, the root directory adds the typical 8:3 entry, however, when I add my Kernel.bin file, I notice two entries are added in the root directory. The first entry added is "AK e r n e l". This entry takes up 32 bytes. The second entry is the typical FAT12 entry with the 8:3 file name and the data associated with it. Ive been searching the Internet for days for an answer to this mystery but I can't seem to find anything about it. I even bought the book Modern Operating Systems by tanenbaum yet it doesn't mention this.

My boot code keeps recognising this as the actual kernel entry, so when I check the bytes at 0x0A and 0x0B, the first cluster isn't there and it just jumps into some random location in memory. Can someone explain this to me because its been driving me crazy for ages now.

Thanks for any help you guys can offer.
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: FAT12 Root Directory Question

Post by Octacone »

The thing you're talking about is called a long file name entry. It gets automatically created once you add a file to your FATxx medium.
It is useful because it preserves the entire file name, aka your file name can be longer that 8 letters and have both lower and upper case.
For example:
Short file name: HELLOWOR.TXT
Long file name: Hello World Something Something.txt
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
Armature
Member
Member
Posts: 33
Joined: Wed Apr 25, 2018 2:44 pm
Libera.chat IRC: idk

Re: FAT12 Root Directory Question

Post by Armature »

Oh right, thanks. It's been bothering me for ages.
nullplan
Member
Member
Posts: 1766
Joined: Wed Aug 30, 2017 8:24 am

Re: FAT12 Root Directory Question

Post by nullplan »

If your FAT12 code worked correctly, you would notice that these entries are invalid, since they have the volume label and system bits set.

Anyway, if you're interested, search for VFAT.
Carpe diem!
Post Reply