IDEDOS is a hard disk formatting scheme designed for ZX Spectrum computers and clones. It was designed by Garry Lancaster for his +3e ROMs and ResiDOS RAM based operating system, and extended by Jarek Adamski to support his ZXVGS, CPM22QED and YaPaDOS operating systems.
Note: The following is not an official specification, it has been created from information collected from various sources. The labels given to bytes are entirely arbitrary and should not be assumed to be official designations.
IDEDOS supports up to 65535 partitions on a hard disk, with a theoretical maximum partition size of 2TB. However IDEDOS does not support Logical Block Addressing therefore the hard disk capacity is limited to 128GB by the limitations of cylinder-head-sector addressing.
8-bit vs 16-bit interfaces for Z80 based computers
Since the Z80 microprocessor has as an 8-bit data bus and IDE requires a 16-bit data bus some circuitry is required to combine a pair of 8-bit read/write operations into a single 16-bit operation. This extra circuitry increases cost and complexity in a hard disk interface so some interfaces omit this circuitry and simply treat the IDE bus as a normal 8-bit wide I/O device. This means that when any 16-bit word is read from or written to the hard disk, the upper byte is simply ignored, therefore half the hard disk's capacity cannot be utilised by computer. IDEDOS supports these halved capacity interfaces as it simply means that each hard disk sector contains 256 bytes instead of the standard 512 bytes. Software which reads from an IDEDOS formatted disk should not therefore make assumptions about the number of bytes per sector as it depends on the hardware used to format the disk. A Logical Sector is defined as 512 bytes therefore the number of logical sectors on an 8-bit formatted drive will be half the number of physical sectors and the offset calculated accordingly.
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 IBM 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 TD TD TD TD TD 0x0020 TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD 0x0030 TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD Key: PN: non case sensitive partition name. 16 byte un-terminated text string. Space padded. 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. TD: partition type specific data.
There are numerous partition types defined
Partition Type 0x00 - Unused Partition
This is an empty partition table entry. Type 0x00 entries do not describe any disk space and should be left blank.
Partition Type 0x01 - The IDEDOS System Partition
The first partition entry in the partition table is always the IDEDOS system partition. There must only be one System Partition on a hard disk. The partition label must always be the string "PLUSIDEDOS" followed by six spaces (ascii 0x20) as this string is used to determine whether the disk was created using an 8 or 16-bit interface. 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 EC EC EH LS LS LS LS 00 00 00 00 00 0x0020 NC NC NH ST SC SC MP MP EA BA UA UB UM M0 M1 MR 0x0030 DD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 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. EA: Default +3 Editor colour attribute byte. BA: Default +3 BASIC colour attribute byte. UA: Un-map drive A in non-zero. UB: Un-map drive B in non-zero. UM: Un-map drive M in non-zero. M0: Drive letter to map floppy unit 0. M1: Drive letter to map floppy unit 1. MR: Drive letter to map ramdisk. DD: +3DOS default drive letter.
Partition Type 0x02 - Swap Space
IDEDOS Partition entry - 64 bytes 0x0000 PN PN PN PN PN PN PN PN PN PN PN PN PN PN PN PN 0x0010 02 SC SC SH EC EC EH LS LS LS LS BS CB CB MB MB 0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Key: BS: Block size in sectors (1 to 32) CB: Current block number (0 to 65535) MB: Maximum block number (0 to 65535)
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 an extended version of the +3DOS XDPB 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 00 00 00 00 00 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 DP DP DL 00 00 00 Key: DP: First 28 bytes of the +3e "extended XDPB" DL: Plus3dos drive letter (or null)
Partition Type 0x04 - CP/M Partition
CP/M partition with an XDPB which reflects the geometry of the physical disk. The partition must use a whole number of cylinders and use whole number of tracks. If the partition does not start at track 0 of the cylinder the area before the partition on that cylinder must be marked as reserved tracks in the XDPB.
Partition Type 0x05 - Boot Partition
A partition of type 0x05 is accessed as a single file. This can be used as a boot file for example a Timex FDD3000 with a YABUS.TF searches for a type 0x05 partition with the label "YABUS.TF". If found the contents of the partition are copied to RAM and executed.
Partition Type 0x0F - Movie Partition
Partition containing a sequence of screenshots (and sound).
Partition Type 0x10 - FAT-16 Partition
Partition containing a FAT-16 filesystem.
Partition Type 0x20 - UZI(X) Partition
Partition for UZI(X) the UNIX Implementation for MSX.
Partition Types 0x3x - Non-CP/M Disk Image Partitions
For partitions containing non-CP/M floppy disk images the type specific information defines a virtual geometry. More than one disk image partition can be present on each track, i.e. the partitions do not have to align to track boundaries. This is achieved by specifying a sector shift in the partition table entry. For example for a disk with 980 cylinders, 5 heads, 17 sectors per track and 512 bytes per sector, a 800kB partition takes 1600 sectors which is equal to 18 cylinders + 4 tracks + 2 sectors, so the shift for next partition is 2.
The following non-CP/M format disk image types are defined:
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 SS V1 V2 V3 V4 0x0020 TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD 0x0030 TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD TD Key: SS: Sector Shift. V1: Virtual Sector Size (0-128B, 1-256B, 2-512B, 3-1024B). V2: Virtual first sector number (0 to 240). V3: Virtual heads. V4: Virtual sectors. TD: Type specific data if any.
Partition Types 0x4x - CP/M Disk Image Partitions
The following CP/M format disk image types are defined:
- 0x40: ZX Spectrum +3 image.
- 0x41: Elwro 800 Junior image.
- 0x48: Amstrad CPC image.
- 0x49: Amstrad PCW image.
Partition Type 0xFE - Bad Disk Space
Drive space which should not be used.
Partition Type 0xFF - Free Disk Space
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.
idedosfs is a FUSE (Filesystem in USErspace) module for mounting IDEDOS-format .HDF files as Unix filesystems (the individual files correspond to partitions). The project also includes plus3dosfs which mounts type 0x03 (+3DOS) partitions as Unix filesystems, and can edit, create and delete files on the partition.