luxos/SysCore/drivers/filesys/fat.c
2021-09-14 18:46:50 +03:00

34 lines
932 B
C

#include "../floppy/floppy.h"
//#include "vfs.h"
#include "fat.h"
#include <conio.h>
// Detect what FAT is used
unsigned FATDetect(unsigned TotalClusters)
{
if (TotalClusters == 0) return 0;
if (TotalClusters < 4085) return 12;
if (TotalClusters < 65525) return 16;
return 32;
}
/*FatMountInfo FloppyMount(int drive)
{
FatMountInfo a;
FATBootSectorPointer fat = (FATBootSectorPointer)0x7e00;
FloppyReadSector((unsigned*)fat, drive, 0);
// Write mount info
a.FATEntrySize = 8;
a.FATOffset = 1;
a.FATSize = (unsigned)fat->SectorsPerFAT;
a.NumberOfRootEntries = (unsigned)fat->NumberOfDirectoryEntries;
a.NumberOfSectors = (unsigned)(fat->NumberOfSectors == 0) ? (fat->NumberOfSectorsLong) : (fat->NumberOfSectors);
a.RootOffset = (unsigned)(fat->NumberOfFATs)*a.FATSize + 1;
a.RootSize = (a.NumberOfRootEntries * 32) / (unsigned)fat->BytesPerSector;
return a;
}*/