Created by Ramsoft ZX Spectrum demogroup

Format revision: v1.1 (June 28th 2006)

  1. Introduction
  2. HDF file format
  3. Contacts and useful links
  4. Revision history

1. Introduction

HDF files are used to store hard-disk data into image files for emulation purposes. They consist in a file header, followed by a raw dump of the tracks data.

2. HDF file format

WORD2 bytes
DWORD4 bytes
BYTE[N]N bytes
ASCII[N]N ASCII characters
ASCIIZ[N]ASCII string with zero-padding to N bytes total
All multi-byte values are stored in Intel byte order (little-endian).
All reserved or undefined bits must be set to zero.
All the headers fields must be filled in; blank values are not allowed.

HDF Header
HDF file header - status: required
Offset Value Type Description
0x00 "RS-IDE" ASCII[6] HDF signature
0x06 0x1A BYTE Termination marker
0x07 0x11 BYTE HDF revision number
Represented in BCD form: 0x11 = v1.1
0x08 - BYTE Flags
b0: halved sector data (only LSB of sector words is stored)
b1: ATAPI device (e.g. CDROM)
0x09 DOFS WORD Image data offset
This is the absolute offset in the HDF file where the actual hard-disk data dump starts.
In HDF version 1.1 this is 0x216.
0x0B 0x00 BYTE[11] Reserved (must be set to zero)
0x16 - WORD[256] IDE/ATA device identification data
This is the dummy sector information returned by ATA command 0xEC or ATAPI command 0xA1 (see bit 1 of the flags to determine which is the case)
Data are stored in words using the ATA convention (big endian), e.g. ASCII string "Hello!" is stored as "eHll!o"
DOFS - - Raw disk data dump
Tracks are stored in the following order: C0 H0, C0 H1 ... C0 H15, C1 H0, C1 H1 ...

Note: IDE devices transfer data in 16-bit words. Since the Z80 data bus is only 8-bit, so some IDE adapters use additional logic to split the IDE word into two bytes so that the Z80 can fetch them. However, other adapters discard the most significant byte of the word completely, in favour of a simplified circuitry; in this case, only half of the nominal capacity of a disk sector is used. Bit 0 of the flags field is used to signal this evenience: when it is set, it means that the sector size specified by the IDE identification data is actually halved in the HDF file. This is done to reduce the HDF file size, by storing only the "usable" significant data; for all the supported adapters, the least significant byte is stored.

The IDE identification data format is reported into any IDE/ATA technical paper. It contains information about the drive geometry (cylinders, heads, sectors, sector size), the device model name, the supported features and so on.

3. Contacts and useful links

The HDF format is currently maintained by Ramsoft.
The latest version of this document can be found at: Emails concerning the HDF specifications should be directed to:
Useful links and references for emulator authors

  • A page with useful links to various ATA/IDE documents
  • SamDisk utility by Simon Owen can read/write HDF image files
  • Residos by Garry Lancaster is a Speccy OS which supports IDE devices, including +3e, ZXCF and ZXATASP
  • DivIDE website contains info about the DivIDE interfaces as well as links to ATA stuff

4. Revision history

Revision 1.1 (Jun 28th 2006)
  • The HDF header now contains the full 512 bytes of the device identification data.
  • Support for ATAPI devices (bit 1 of the flags defined).
Revision 1.0 (Feb 20th 2001)
  • First public release of this document.