Page 1 of 1

FAT12 Root Directory Question

Posted: Sun Dec 30, 2018 6:09 am
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.

Re: FAT12 Root Directory Question

Posted: Sun Dec 30, 2018 7:40 am
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

Re: FAT12 Root Directory Question

Posted: Sun Dec 30, 2018 7:43 am
by Armature
Oh right, thanks. It's been bothering me for ages.

Re: FAT12 Root Directory Question

Posted: Sun Dec 30, 2018 9:05 am
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.