FAT story
4 posters
Page 1 of 1
FAT story
void get_diskinfo()
{
//To get boot record location, fat diagram location
// root diagram location, and data area location
//Also get sector per cluster information
bootloc = 0;
//Read the MBR
read(0);
if(buffer[0] != 0xE9 && buffer[0] != 0xEB){
//get the boot record location location
temp[0] = buffer[0x1C6];
temp[1] = buffer[0x1C7];
temp[2] = 0;
temp[3] = 0;
bootloc = char_to_long();
}
else{
bootloc = 0;
}
//Now read the boot record diagram
read(bootloc);
//Get the FAT diagram location
fatloc = bootloc + buffer[0x0E];
//Get the root directory location
temp[0] = buffer[0x16];
temp[1] = buffer[0x17];
temp[2] = 0;
temp[3] = 0;
secfat = char_to_long();
rootloc = fatloc + ((unsigned long)secfat * 2);
//Get the data area location
temp[0] = buffer[0x11];
temp[1] = buffer[0x12];
temp[2] = 0;
temp[3] = 0;
dataloc = rootloc + (char_to_long() / 16);
//Get the sector per cluster
secclust = buffer[0x00D];
//Get card Capacity
temp[0] = buffer[0x13];
temp[1] = buffer[0x14];
temp[2] = 0;
temp[3] = 0;
cardsize = char_to_long();
if(cardsize == 0)
{
temp[0] = buffer[0x20];
temp[1] = buffer[0x21];
temp[2] = buffer[0x22];
temp[3] = buffer[0x23];
cardsize = char_to_long();
}
}
//Well, it's writing...
{
//To get boot record location, fat diagram location
// root diagram location, and data area location
//Also get sector per cluster information
bootloc = 0;
//Read the MBR
read(0);
if(buffer[0] != 0xE9 && buffer[0] != 0xEB){
//get the boot record location location
temp[0] = buffer[0x1C6];
temp[1] = buffer[0x1C7];
temp[2] = 0;
temp[3] = 0;
bootloc = char_to_long();
}
else{
bootloc = 0;
}
//Now read the boot record diagram
read(bootloc);
//Get the FAT diagram location
fatloc = bootloc + buffer[0x0E];
//Get the root directory location
temp[0] = buffer[0x16];
temp[1] = buffer[0x17];
temp[2] = 0;
temp[3] = 0;
secfat = char_to_long();
rootloc = fatloc + ((unsigned long)secfat * 2);
//Get the data area location
temp[0] = buffer[0x11];
temp[1] = buffer[0x12];
temp[2] = 0;
temp[3] = 0;
dataloc = rootloc + (char_to_long() / 16);
//Get the sector per cluster
secclust = buffer[0x00D];
//Get card Capacity
temp[0] = buffer[0x13];
temp[1] = buffer[0x14];
temp[2] = 0;
temp[3] = 0;
cardsize = char_to_long();
if(cardsize == 0)
{
temp[0] = buffer[0x20];
temp[1] = buffer[0x21];
temp[2] = buffer[0x22];
temp[3] = buffer[0x23];
cardsize = char_to_long();
}
}
//Well, it's writing...
tkhnoman- New Dood
- Posts : 20
Join date : 2010-04-16
Re: FAT story
Pretty sure there is already a function for this in the C /C* librarys. Unless I appear to be missing some vital point...
Chaos- Light Player
- Posts : 89
Join date : 2009-11-05
Re: FAT story
haha, maybe yes. I did get one code similar to this, the one with more complexity.
I dunno, but i like to carving things again.
I dunno, but i like to carving things again.
tkhnoman- New Dood
- Posts : 20
Join date : 2010-04-16
Re: FAT story
[Hmmm]
[Mr_Self_Destruct]- [Admin of The Skies]
- Posts : 1996
Join date : 2009-09-01
Character sheet
Test Game:
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|