CVF Region: Sector Heap
The Sector Heap is a variable-length region that contains all of the file
data for the CVF "disk". When DoubleSpace needs to store data in a
compressed volume, it gets a free sector from the sector heap and sets the
corresponding bit in the BitFAT to indicate the sector is in use.
The Sector Heap is located 2 sectors after the end of the RootDir; its
location can be obtained from the wHeapStart field (offset 2bH) of the
MdBpbRec.
DoubleSpace will not create a volume smaller than about 600K (about 1.2M
of storage), so expect the Sector Heap to be at least 1200 sectors long.
█▌Cluster Allocations▐█
Sectors are allocated individually, but always in sequential groups that
represent a cluster (16 sectors= 8K of uncompressed data) in the FAT.
This provides DoubleSpace with "bonus" compression since it gives very
little physical storage for cluster slack▲--the up to 8191 bytes of disk
storage that can be left empty in the last cluster of a file. In the
worst-case scenario, a 1-byte file uses only one sector (512 bytes) of the
CVF while on a regular disk, a 1-byte file uses 8092 bytes (16 sectors).
Therefore, a 1-byte file (actually any file containing less than 513
bytes) yields DoubleSpace's maximum compression ratio, 16-to-1.
Stand-alone compression tools such as PKZIP can take maximum advantage of
saving on file slack when they compress a series of short files. For
instance, ten 1-byte files compress into a file not much longer than
10 bytes, yielding a ratio of around 8000-to-1.
█▌Cluster Tags▐█
Most sectors in the heap contain compressed data, but some do not. For
instance, DoubleSpace does not bother compressing data in files smaller
than 512 bytes. Also, the DoubleSpace compression algorithm cannot
squeeze any air out of most types of previously-compressed data, such a
.ZIP and .ARC compressed files.
Entries in the MDFAT identify which clusters are stored in compressed form
and which are stored raw. As an additional safeguard and aid to data
recovery, the first sector in each cluster begins with one of the
following 4-byte tags (as documented):
'DS00' (4DH, 44H, 00H, 00H) IHV Level 2
'DS0' (4DH, 44H, 00H, 01H) "MaxCompressed" (IHV Level Max)
'DS0' (4DH, 44H, 00H, 02H) "StandardCompressed"
'DS0' (4DH, 44H, 00H, 03H) IHV Level 3
'DS0♦' (4DH, 44H, 00H, 04H) IHV Level 4
IHV might be "Independent Hardware Vendor". Could be anything.
In actual use, I have not seen the 00H version and presume that it is
obsolete. The 01H and 02H versions appear in my CVFs. The MRCI Fn 0001H
(compress) starts with a similar 'MD0' tag. And data backed up by
Msbackup stores some data as ??,??,??,'M','D',00, 02.
Uncompressed (incompressable) clusters have no initial tag. Since it is
possible for an incompressible cluster to begin with one of these tags,
you should refer to the MDFAT rather than making any assumptions.
See Also: CVF Layout
DoubleSpace Overview
DoubleSpace API
DOS Functions
-♦-