Page 1 of 1
FAT info needed
Posted: Mon Sep 22, 2003 11:00 pm
by bubach
I got a bootsector that supports FAT and loads my real mode kernel "osdata.bin".
In my kernel i have a simple prompt. If i want to add commands like dir, mkdir, del, type and so on, how do i do it?
At the moment i would be happy by just getting my dir command work..
How?
RE:FAT info needed
Posted: Mon Sep 22, 2003 11:00 pm
by Robert Lee
Assuming FAT12 (floppy disks):
You can get the file list from the root directory structure on the disk. Load this structure/array using INT 13h. Enumerate the records in this structure (each record corresponds to a file in the root directory). Records beginning with invalid characters are deleted or do not exist. Specifically "?" is used as the first character of deleted records. These records contain the name of the item, the type of item (file or subfolder), the length of its data (in bytes) and its first cluster address.
The starting sector of the root directory structure can be read from the BPB. It immediatly follows the second file allocation table. Typically each FAT takes up 9 sectors and there are two FATs (one is a backup for the other and both are kept identical). The bootsector itself is on LBA sector 0 so the root directory should start at sector 18 and be about 15 sectors long (containing something like 240 32-byte records). But all this should be read from the BPB for the disk your using.
-Robert
RE:FAT info needed
Posted: Tue Sep 23, 2003 11:00 pm
by bubach
Thanks, it seems that all i have to do is to check my interrupt list... =)