The storage memory starts at A0270000.
The first block is the sector map. It consists of 25 entries (not on the AU).
Each entry is 32 bytes long.
typedef struct{
unsigned short ID; // usually 0x4200
unsigned short UniqueID;
unsigned short sectorstartaddr[2]; // physical
unsigned short logicalsectornum_unused; // 0x00FF for sector 0x00270000, else
0.
unsigned short logicalsectornum; // the logical sectornum referred to by the
data definition blocks
unsigned short stuff1[2]; // FFFF FFFF
unsigned short stuff2[2]; // 0000 0001
unsigned short stuff3[6]; // FFFF...
} TSectorDirectoryEntry;
At A0270320 the directory starts. Each entry is 32 bytes long.
The maximum count of entries is 127.
The first nibble is 5 for an active entry.
The first nibble is 0 for a deleted entry.
There are three types of directory entries:
subdirectory definition:
typedef struct{
unsigned short ID; // 0x0110 (deleted) or 0x5110 (active)
unsigned short UniqueID;
unsigned short stuff1[2]; // FFFF FFFF
unsigned short dirname[8];
unsigned short stuff2[4]; // FFFF FFFF FFFF FFFF
} TDirDirectoryEntry;
file main definition:
typedef struct{
unsigned short ID; // 0x0120 (deleted) or 0x5120 (active)
unsigned short UniqueID;
unsigned short Directory[2]; // FFFF FFFF: main;
unsigned short filename[12];
} TFileDirectoryEntry;
file location definition:
typedef struct{
unsigned short ID; // 0x0130 (deleted) or 0x5130 (active)
unsigned short UniqueID;
unsigned short fileid[2]; // 0x?120 UniqueID of the corresponding
FileDirectoryEntry
unsigned short filetype;
unsigned short sectorcount;
unsigned short sectornumber;
unsigned short hi_logicalsectornumber;
unsigned short lo_physicalsectornumber;
unsigned short blocksize; // count of sigificant bytes in this block minus one
unsigned short stuff3[6]; // FFFF...
} TFileDirectoryLocator;
A file main definition contains the file's ID and UniqueID, its filename and
in case of file, which is located inside of a subdirectory,
this subdirectory's ID and UniqueID.
A file's main definition is immediately followed by one or more file location
definitions.
Hint:
Sometimes the first nibble of the file's location definitions are zeroed out,
when the file is deleted.
Sometimes the first nibble of the file's location definitions are not zeroed
out, when the file is deleted.
The file location definition contains the file's ID & 0x0FFF and its UniqueID
in TFileDirectoryLocator.fileid.
TFileDirectoryLocator.filetype is 1 for an unknown type, 2 for a G1A, 6 for a
G1M, 0x2E for a G1R.
TFileDirectoryLocator.sectorcount seems to be the total count of file location
definitions.
TFileDirectoryLocator.sectornumber is the consecutive number of the file
location definition.
TFileDirectoryLocator.hi_logicalsectornumber references a
TSectorDirectoryEntry.logicalsectornum.
TFileDirectoryLocator.lo_physicalsectornumber is the low short of the
physicalsectornumber, where the data are located..
TFileDirectoryLocator.blocksize is then count of sigificant bytes in the block
minus one.
(19.03.2011 12:43:48)