Technical information
© Jean Louis-Guérin – V1.2a – September 2014 Page 49 / 69
9.5.4 Size and Position of the TOS Partition Structures
With the information given in the MBR and the information given in the Root sector, it is possible to
compute the size and position of the different TOS partition structures.
EQ-1 The position of the Boot Sector P
BS
(the beginning of a logical partition) is directly given in the Root
Sector or in an Extended Root Sector of the MBR. Given as an offset
EQ-2 The position of the first FAT P
FAT1
is:
P
FAT1
= P
BS
+ RES * (BPS/512)
EQ-3 The position of the second FAT P
FAT2
is:
P
FAT2
= P
FAT1
+ SPF * (BPS/512)
EQ-4 The position of the Root Directory P
RD
is:
P
RD
= P
FAT2
+ SPF * (BPS/512)
EQ-5 The position of the first data cluster P
DATA
is:
P
DATA
= P
RD
+ NDIRS * (32/512)
EQ-6 The size of the partition is:
S
P
= BPS * NSECTS = (RES * BPS/512) + NFATS * (SPF * BPS/512) + NDIRS * 32/512 + S
DATA
EQ-7 From this equation we can compute the size of the data region
S
DATA
= BPS * NSECTS - ((RES * BPS/512) + NFATS * SPF * BPS/512 + NDIRS * 32/512)
9.5.5 Computing Boot Sector values from User Inputs
The partitioning program has to computes several values to place into the Boot Sector based on input
from the user.
The following values are given by the user or known from the partitioning tool:
OEM:
SERIAL:
BPS: The BPS is either specified by the user or can take default values as given in TOS
Partition Size.
SPC always equal to 2
RES usually 1 but can be changed by the partitioning tool
NFATS for GEMDOS this value is always equal to 2
NDIRS is specified by the user and is usually 512
MEDIA is not used but usually set to F8 for hard disk
SPT, NHEADS, NHID not used can be set to any meaningful value or 0.
The partitioning tool has therefore to compute the following fields:
NSECTS
SPF
From the above equations we compute:
EQ-8 NSECTS = S
P
/ BPS
EQ-9 The minimum number of cluster entries in a FAT can be computed as follow:
N
CLUST
≥ (S
DATA
/ (BPS * SPC)) + 2