CP/M Disk Formats as revealed by DPB.COM
written by Maurice Hawes / SUC/UK
Source: SUC-magazine July 2003, Volume 23 Number 2, pp. 8 - 9
| Sharp Users Club - General Section - DPB.COM
|The Disk Parameter Block
In the very early versions of CP/M the format of the floppy-disk drives
( which at that time were 8 IBM ) is built into the code and is
difficult to change. But in CP/M 2.2 and later versions of CP/M the
details of the disk format are held in a table known as the 'Disk Parameter
In CP/M 2.2 the 'Disk Parameter Block' consists of 15 bytes, but in
some of the very late versions of CP/M ( such as 'CP/M PLUS' ) two further
bytes are added to allow for 'Logical Sectors' larger than 128 Bytes.
As far as early Sharp MZ-computers are concerned, it is sufficient
to consider the contents of the 15-byte Disk Parameter Block in CP/M
||Name of Field
|00 - 01
||No. of Logical ( 128-byte ) Sectors per Logical Track
||Block Shift - Block Size is given by 128 * 2(BSH)
||Block Mask - Block Size is given by 128 * (BLM +1)
||Extent Mask ( see opposite )
|05 - 06
||Highest Block Number ( see opposite )
|07 - 08
||Highest Directory Entry Number ( see opposite
|09 - 10
||AL0 - AL1
||16-bit Directory Allocation Pattern ( see opposite
|11 - 12
||Directory Check Sum
|13 - 14
||No. of reserved tracks ( see opposite )
The CP/M 'DPB.COM' locates this table and lists all the values except
CKS on the screen. Typical displays, for the 5.25" Crystal and
M-T versions of CP/M 2.2 for the MZ-80K and MZ-80B respectively, are
|( Parameter )
||( MZ-80K display )
||( MZ-80B display )
|Sectors per Track
|Block Shift ( BSH )
|Block Mask ( BLM )
|Extent Mask ( EXM )
|Total Blocks ( DSM )
|Directory Entries ( DRM )
|Allocation 0 ( AL0 )
|Allocation 1 ( AL1 )
|Cylinder Offset ( OFS )
As shown on the opposite page, care has to be
taken when interpreting many of the values in displays such as those
| NOTES ON INTERPRETING
THE DPB.COM DISPLAY
|Sectors Per Track
This may be used to find the capacity of a disk - but the calculation
must allow for the fact that in some cases a 'Logical Track' is limited
to ONE SIDE of a disk, but in other cases it extends over BOTH
SIDES of a disk.
For example in Xtal's '35-track' CP/M for the MZ-80K a 'Logical Track'
is limited to ONE side of the disk; there are therefore 35 'Logical
tracks' on each side of a disk, and 70 'Logical Tracks' on the disk
as a whole.
The capacity of a disk is therefore
128 * 16 * 70 = 143,360 Bytes ( 140K ).
But in M-T's '35-track' CP/M 2.2 for the MZ-80B a 'Logical Track' extends
over BOTH sides of a disk; there are therefore 35 'Logical Tracks' on
the whole of a disk, and the disk capacity is
128 * 80 * 35 = 358,400 ( 350K ).
|BSH & BLM
Either one of these parameters may be used to calculate the CP/M
block size. For example in Crystal's MZ-80K CP/M 2.2, BSH gives 128
* 23 and BLM gives 128 * (7 + 1), both = 1024 ( 1K ); whereas in Microtechnology's
MZ-80B CP/M 18.104.22.168 similar calculations give the block size as 128
* 24 and 128 * (15 + 1), both = 2048 ( 2K ).
Large CP/M files are divided into EXTENTS of 16K. In early versions
of CP/M 'Logical and 'Physical' Extents were both 16K; but in CP/M 2.2
and later a 'Logical' extent is 16K but a 'Physical' extent can be 16K,
32K, 64K, 128K or 256K, and this is indicated by setting EXM to either
0, 1, 3, 7, or 15 ( i.e. EXM is set to 1 less than the number of
'Logical' extents in a 'Physical' extent ).
|DSM ( 2 bytes )
This indicates the HIGHEST PERMISSIBLE BLOCK NUMBER; numbering starts
at 0, so the TOTAL NUMBER OF BLOCKS is 1 more than the value shown.
|DRM ( 2 bytes )
This indicates the HIGHEST PERMISSIBLE DIRECTORY NUMBER; numbering starts
at 0 so the MAXIMUM NUMBER OF DIRECTORY ENTRIES is 1 more than the
These parameters, taken BITWISE, indicate which of the first
16 CP/M blocks ( numbered 00 - 15 ) are allocated to the Directory.
$80 00 = 10000000 00000000 i.e. the Directory is allocated BLOCK
$C0 00= 11000000 00000000 i.e. the Directory is allocated BLOCKS
00 & 01
This shows the location of CP/M BLOCK 00 and also, by implication,
how many tracks are reserved for bootstrap & system files.
Thus, '5' on the MZ-80K shows that Block 00 is at the start of track
5, and Tracks 0 - 4 are used for bootstrap & system files; whereas
'1' on the MZ-80B shows that Block 00 is at the start of Track 1, and
Track 0 is used for bootstrap & system files.
The full implications of the Disk Parameter Block for specific CP/M
and PCP/M systems on various Sharp MZ-machines are discussed in the
individual MZ-80K / MZ-80B
/ MZ-80A / MZ-700
/ MZ-800 / MZ-3500 sections of this issue.