System information
Appendix G lists the blocking and deblocking algorithms in skeletal form; this file is included on
your CP/M disk. Generally, the algorithms map all CP/M sector read operations onto the host
disk through an intermediate buffer that is the size of the host disk sector. Throughout the
program, values and variables that relate to the CP/M sector involved in a seek operation are
prefixed by sek, while those related to the host disk system are prefixed by hst. The equate
statements beginning on line 29 of Appendix G define the mapping between CP/M and the host
system, and must be changed if other than the sample host system is involved.
The entry points BOOT and WBOOT must contain the initialization code starting on line 57,
while the SELDSK entry point must be augmented by the code starting on line 65. Note that
although the SELDSK entry point computes and returns the Disk Parameter Header address, it
does not physically select the host disk at this point (it is selected later at READHST or
WRITEHST). Further, SETTRK and SETMA simply store the values, but do not take any other
action at this point. SECTRAN performs a trivial function of returning the physical sector
number.
The principal entry points are READ and WRITE, starting on lines 110 and 125, respectively.
These subroutines take the place of your previous READ and WRITE operations.
The actual physical read or write takes place at either WRITEHST or READHST, where all
values have been prepared: hstdsk is the host disk number, hsttrk is the host track number, and
hstsec is the host sector number, which may require translation to physical sector number. You
must insert code at this point that performs the full sector read or write into or out of the buffer at
hstbuf of length hstsiz. All other mapping functions are performed by the algorithms.
This particular algorithm was tested using an 80-megabyte hard disk unit that was originally
configured for 128-byte sectors, producing approximately 35 megabytes of formatted storage.
When configured for 512-byte host sectors, usable storage increased to 57 megabytes, with a
corresponding 400% improvement in overall response. In this situation, there is no apparent
overhead involved in deblocking sectors, with the advantage that user programs still maintain
128-byte sectors. This is primarily because of the information provided by the BDOS, which
eliminates the necessity for preread operations.
End of Section 6
6.11 The DISKDEF Macro Library CP/M Operating System Manual
6-40