On 7 Feb 2003, at 13:26, Jerome Grimbert wrote:
>
> Thanks. At least it clarify a little the structure of the first sector of the file
>system.
> (but qwa.pflg for instance lie on the partition list (which I luckily already
> found and understood) on the first physical sector. It should never appears in
> the first sector of the filesystem.
Here is some info I have on the first sector.
Do you need info on the "BGM" / GEM/ XGM partitioning scheme
(if I can find it)?
Wolfgang
-----------------
www.wlenerz.com
Main header of device
+00 long "QLWA"
+04 word lenth device name
+06 20 bytes ASCII device name
+1A word 0000 ?
+1C word random number
+1E word access counter
+20 word 0000 ?
+22 word number of sectors (512 bytes) in cluster
(4 = 2048 bytes)
+24 3 x word 0000 0000 0000 ?
+2A word total clusters (1)
+2C word free clusters (1)
+2E word size of FAT?
+30 word 0001 ?
+32 word pointer to first free cluster (2)
+34 word pointer to main directory cluster (2)
+36 long lenth of main directory +header
+3A 3 x word 0000 0000 0000 ?
+40 words linked cluster pointer map (3)
(1) virtual values if device > 33 MB
(2) if cluster = 2048 bytes (h800) then pointer x h800 = address
(3) Linked cluster pointer map:
+0040 word pointer to next cluster or 0000 if end
+0042 word pointer to next cluster or 0000 if end
...
+xxxx word same until all clusters are pointed
Example reading main directory (win about 20M):
+0022: 0004 ----> cluster = h800
+0034: 001A ----> x800 = address hD000 = DIR
now look at (001A x 2 + h40 = 0074) if 0000 then main directory has
no more clusters else for exemple:
+0074: 1939 ---->; x800 = address hC9C800 more entries
now look at (1939 x 2 + h40 = 32B2)
+32B2: 2605 ---->; x800 = adress h01302800 still entries
now look at (2605 x 2 + h40 = 4C4A)
+4C4A: 0000 no more cluster: end of main directory
Structure of directories:
DIR+00 64 bytes space for header (not used)
DIR+40+00 long lenth of file (+header)
DIR+40+04 word filetype (0=data, 1=exe-file,
h00FF=subdirectory)
DIR+40+06 word generally 0000 sometimes 0318
DIR+40+08 word dataspace if exe-file else 0000
DIR+40+0A word generally 0000 sometimes 0318 if exe-file ?
DIR+40+0C word 0000 ?
DIR+40+0E word file name lenth
DIR+40+10 36 bytes ASCII file name
DIR+40+34 long date or 0000 0000 if subdir
DIR+40+38 word file version
DIR+40+3A word pointer to first file cluster (4)
DIR+40+3C 2 x word 0000 0000 ?
(4) Structure
of file:
FILE+00 64 (h40) bytes of space for not used header (only in the first
cluster of file)
FILE+40 h7C0 bytes of data
then search next adress through
clusterpointer: see example
adress+00 h800 bytes of data
until pointer = 0000
number of sectors = number of clusters * nbr_of_sects in clusters
$8C00
space need for FAT
= 2 bytes per cluster = 71680 bytes = 140 ($8c) sectors
+ $40 for header = 141 ($8d) sectors
how to find a cluster in absolute positioning:
cluster number * 512* nbr_of_sects_in_cluster