Disk Formats and CP/M Disk Routines – Part 4
by M.W.T. Waters
This is the final part in this series. But first of all here is a correction to the
part 3, published in Volume 1, Issue 3, page 11:
In the article, the author had a brainstorm and said that the directory buffer (DIRBUF) under
CP/M 2.2 is one physical sector long. This, of course, it quite incorrect. The length of this
buffer is one logical record (128 bytes) long. The description of the directory buffers controlled
by the Buffer Control Blocks under CP/M Plus IS correct, however. CP/M Plus, as stated in the
article, controls buffers, each of which is one physical sector long.
CP/M 3 Buffer Control Block format
The format of a Buffer Control Block is given below. The format is identical for both directory
and data BCB’s
|DRV||;||8 bits||–||Source drive of buffered data|
|REC||;||24 bits||–||Record Position on disk|
|WFLG||;||8 bits||–||Flag indicating unwritten data|
|00||;||8 bits||–||BDOS scratchpad|
|TRACK||;||16 bits||–||Track number for buffered data|
|SECTOR||;||16 bits||–||Sector number for buffered data|
|BUFFAD||;||16 bits||–||Address of buffer for this BCB|
|BANK||;||8 bits||–||Bank no of buffer for this BCB|
|LINK||;||16 bits||–||Address of next BCB in list|
DRV indicates the source drive from which the contents of the buffer located at BUFFAD was
obtained or, alternatively, the destination drive for the data in the buffer.
REC contains the record position of the current buffer contents. This figure is an absolute
sector number relative to the first sector in the data tracks of the disk. For example
the first sector in block 0 (i.e. the first directory sector) is numbered zero, the next is number
one and so on for all data blocks on the disk.
WFLG is set by the BDOS when the buffer associated with the BCB contained new data that has yet
to be written to the disk. When the data has been written, this flag is then set to zero by the
TRACK is the physical track location of the contents of the buffer.
SECTOR contains the physical sector location of the contents of the buffer.
BUFFAD contains a 16 bit address showing the location of the physical sector buffer associated
with this BCB.
BANK contains the memory bank umber holding the buffer. Naturally, this field is not present
in non-banked systems.
LINK contains the address of the next BCB in the linked list. If this the last BCB in the
list, this field will contain zero. This field isn’t present on non-banked systems as only one
buffer and associated BCB existm
Having covered the DPH, XDPH and associated data structures, we can now examine the Disk
Parameter Block detail.
Disk Parameter Blocks
The CP/M 2.2 DPB
The disk parameter blocks in the BIOS tell the BDOS all it needs to know about the physical
characteristics of the disk. The CP/M 2.2 DPB for a Gemini QDDS format disk looks like this: