CP/M Disc Parameter Header
In CP/M, the DPH is a BIOS structure containing information about a disc drive. The actual format of the DPH is version-dependent.
Individual BIOSes may add extra fields to a DPH, before the start or after the end.
CP/M 2 DPH
This is the format of the DPH in 8-bit CP/M 2:
0000 DW xlt ;Address of sector translation table 0002 DW 0,0,0 ;Used as workspace by CP/M 0008 DW dirbuf ;Address of a 128-byte sector buffer; this is ;the same for all DPHs in the system. 000A DW dpb ;Address of the DPB ;giving the format of this drive. 000C DW csv ;Address of the directory checksum vector ;for this drive. 000E DW alv ;Address of the allocation vector ;for this drive.
CP/M 3 DPH
This is the format of the DPH in 8-bit CP/M 3:
0000 DW xlt ;Address of sector translation table 0002 DW 0,0,0,0 ;Used as workspace by CP/M 000A DB mf ;Media flag. If the BIOS has an interrupt-driven ;'disc changed' system, then changing a disc in this ;drive should set this flag (and the 'media changed' ;flag in the SCB) to 0FFh. 000B DB 0 ;Workspace 000C DW dpb ;Address of the DPB ;giving the format of this drive. 000E DW csv ;Address of the directory checksum vector ;for this drive (in bank 0). 0010 DW alv ;Address of the allocation vector ;for this drive (in bank 0). 0012 DW dirbcb ;Address of the directory buffer chain. 0014 DW dtabcb ;Address of the data buffer chain. 0016 DW hash ;Address of the hash buffer for this drive. 0018 DB hbank ;Bank number of the hash buffer.
Checksum Vector
This is a buffer which CP/M will use to hold the checksum of each 128-byte record in the directory. If the checksum of a sector changes unexpectedly, the disc is assumed to have been changed.
If the disc is not removable, then there will be no such buffer, and its address in the DPH is 0.
Allocation Vector
This is a bitmap of used/free blocks on the drive. Under CP/M 2, there is one bit per block. Under CP/M 3, there may be one bit per block, or two.
Buffer Chains
In a non-banked CP/M 3, each BCB pointer (DIRBCB/DTABCB) points straight at a single Buffer Control Block. In a banked system, they each point at a word, which in turn points to the first BCB in a linked list.
The two BCB pointers can only be the same if this is a nonbanked version of CP/M 3 and the drive is a fixed disk.
The format of each BCB is:
0000 DB drive ;The drive using this buffer, 0FFh if empty. 0001 DB rec# ;Sector number using this buffer (24-bit). 0004 DB wflg ;Nonzero if buffer is dirty and must be written back. 0005 DB 0 ;Scratch byte. 0006 DW track ;Track the buffer comes from. 0008 DW sector ;Sector the buffer comes from. 000A DW buffer ;Address of the buffered data. 000C DB bank ;Bank of the buffered data (banked CP/M only). ;BCBs in the directory chain must be in bank 0. ;Data BCBs can be in any bank that the XMOVE/MOVE ;BIOS calls support. 000D DW link ;Address of next BCB in chain, 0 for none. ;(banked CP/M only).
Hash Buffer
This is an optional hash table with 4 bytes per directory entry, used to speed up file access. If it is 0FFFFh there is no hash table.