IDEDOS

From SinclairFAQ
Revision as of 10:14, 25 March 2011 by Guesser (talk | contribs) (Partition Table Entry Format)
Jump to: navigation, search


IDEDOS is a hard disk formatting scheme designed for ZX Spectrum computers and clones.

Format

Note: The following is not an official specification, it has been reverse engineered from hard disk images and information collected from various sources. The labels given to bytes are entirely arbitrary and should not be taken as the official labels.

The IDEDOS System Partition

The IDEDOS System Partition is normally the first partition on the drive located at Cylinder 0, Head 0, Sector 1 (C0/H0/S1). The specification also allows placing the system partition at Cylinder 0, Head 1, Sector 1 (C0/H1/S1) to allow an MS-DOS Master Boot Record to be present.

The IDEDOS System Partition contains the Partition Table for the drive. The Partition Table consists of a number of Partition Table Entries each 64 bytes long containing the partition type, location, size, and additional type specific information.

The first partition entry in the table describes the IDEDOS System Partition itself and contains information about the drive geometry and initialisation information for the +3e system ROMs

Partition Table Entry Format

All partition table entries conform to the following structure

IDEDOS Partition entry - 64 bytes
0x0000	PN PN PN PN PN PN PN PN PN PN PN PN PN PN PN PN	
0x0010	PT SC SC SH EC EC EH LS LS LS LS XX XX XX XX XX	
0x0020	XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX	
0x0030	XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX	

Key:
PN: partition name. 16 byte unterminated text string.
PT: partition type.
SC: starting cylinder. 16 bit little endian word.
SH: starting head.
EC: ending cylinder. 16 bit little endian word.
EH: ending head.
LS: largest logical sector. 32 bit little endian word.
XX: partition type specific data.

There are numerous partition types defined

0x00:	unused partition
0x01:	system partition
0x02:	swap partition
0x03:	+3DOS partition
0x04:	CP/M partition
0x05:	boot partition
0x0F:	movie partition
0x10:	FAT16 partition
0x20:	UZI(X) partition
0x30:	TR-DOS disk image
0x31:	+D/SAMDOS disk image
0x32:	MB-02 disk image
0x40:	ZX Spectrum +3 disk image
0x41:	Elwro 800 Junior disk image
0x48:	Amstrad CPC disk image
0x49:	Amstrad PCW disk image
0xFE:	bad disk space
0xFF:	free disk space

The IDEDOS System Partition Partition Table Entry

The first partition entry in the partition table is the IDEDOS system partition. The starting head and ending head are either zero or one depending on where the partition table has been written. The drive geometry is written in the type specific data in the bytes 0x0020 to 0x0027

0x0000	50 4C 55 53 49 44 45 44 4F 53 20 20 20 20 20 20		partition name "PLUSIDEDOS      "
0x0010	01 00 00 SH 00 00 EH LS LS LS LS ?? ?? ?? ?? ??	
0x0020	NC NC NH ST SC SC MP MP BA EA ?? ?? ?? ?? ?? ??	
0x0030	DD ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??	

Key:
NC: number of cylinders available to IDEDOS. 16 bit little endian word.
NH: number of heads.
ST: number of sectors per track.
SC: number of sectors per cylinder (equal to NH * ST). 16 bit little endian word.
MP: maximum partition. 16 bit little endian word.
BA: +3e boot colour attribute byte
EA: +3 BASIC editor attribute byte
DD: plus3dos default drive letter
??: unknown

Partition Type 0x03 - +3DOS

The +3e ROMs create partitions of type 0x03 i.e. +3DOS partitions. The type specific data portion of the Partition Entries for these partitions contain a +3DOS XDPB (eXtended Disc Parameter Block) between 0x0020 to 0x003A and also the +3DOS drive letter to which the partition has been mapped (if any)

0x0000	PN PN PN PN PN PN PN PN PN PN PN PN PN PN PN PN	
0x0010	03 SC SC SH EC EC EH LS LS LS LS ?? ?? ?? ?? ??	
0x0020	DP DP DP DP DP DP DP DP DP DP DP DP DP DP DP DP	
0x0030	DP DP DP DP DP DP DP DP DP DP ?? ?? DL ?? ?? ??	

Key:
DP: +3DOS extended disk parameter block byte
DL: plus3dos drive letter
??: unknown

The eXtended Disk Parameter Block data is ordered as follows

0x0020  SPT SPT BSH BLM EXM DSM DSM DRM DRM AL0 AL1 CKS CKS OFF OFF PSH
0x0030  PHM sid tps spt fsn ss  glr glf mms ff

key:
SPT: Records Per Track
BSH: Block Shift: 128 * 2^BSH
BLM: Block Mask: 128 * (BLM + 1)
EXM: Extent Mask
DSM: number of blocks - 1
DRM: number of directory entries - 1
AL0: AL0 directory bitmap
AL1: AL1 directory bitmap
CKS: size of checksum vector
OFF: reserved tracks
PSH: physical sector shift
PHM: sector size
sid: sidedness
tps: number of tracks per side
spt: number of sectors per track
fst: first sector number
ss:  (sector size / 128) - 1
glr: gap length (read/write)
glf: gap length (format)
mms: multitrack/modulation/skip
ff:  freeze flag

Partition Type 0xFF - Free Space

The last populated partition entry in the table is type 0xFF. A Type 0xFF partition entry as created by the +3e ROMs is all blank except for the type byte and the location and size information. The type specific information is not used.