![]() ![]() The Disk Parameter Block (DPB) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Later various mass storage devices appeared also for microcomputers and then CP/M was designed up from versions 2.0 to have all disk parameters available in "easy-to-change" tables of the BIOS ( Basic I/O System). These tables contain information about e.g. storage capacity and storage format for groups of identical configured drives. It also provides a scratch pad area for certain BDOS operations. There are two parts for these BIOS tables: - The Disk Parameter Header ( DPH; one for each drive ) and Given n disk drives, the DPHs are arranged in an array. The first row of 16 bytes corresponds to drive 0, with the last row corresponding to drive n-1. One array dimension follows:
The address of the DPH depends on the machine used, but it can be determined by a simple BIOS-call ( function 9: SELECT DISK ). A responsibility of the SELDSK subroutine is to return the base address of the DPH for the selected drive. The following sequence of operations returns the table address, with a $0000 returned if the selected drive does not exit. SELDSK example: NDISKS EQU 4 ;Number of disk drives .... SELDSK: ;Select disk given by BC LXI H,$0000 ;Error code MOV A,C ;drive ok? CPI NDISKS ;CY IF SO RNC ;RET f error ;no error, continue MOV L,C ;low (disk) MOV H,B ;high (disk) DAD H ;*2 DAD H ;*4 DAD H ;*8 DAD H ;*16 LXI D,DBASE ;first DPH DAD D ;DPH (disk) RET The translation vectors XLT are located elsewhere in the BIOS, and simply correspond one-for-one with the logical sector numbers zero through the sector count 1. The pointer to the DPB is located in a DPH at offset $0A. Note, that CP/M manages mass storage devices in 128-bytes sectors, regardless how many bytes are in the physical sectors of a disk. Several of such sectors are combined to "Allocation Blocks". The Allocation Blocks are combined to "Logical Extents" for the representation in the directory. The 15-bytes DPB describes the attributes of a drive and has this general form:
The values of BSH and BLM implicitly determine the data allocation size, BLS, which is not an entry in the DPB. Given that the designer has selected a value for BLS, the values of BSH and BLM are shown in the following table:
All values are decimal. The value of EXM depends upon the BLS and whether the DSM value is less than 256 or greater than 255. For DSM less than 256, the value of EXM is given by:
For DSM greater than 255, the value of EXM is given by:
The value of DSM is the maximum data block number measured in BLS units supported by this particular drive. The product BLS * ( DSM + 1 ) is the total number of bytes held by the drive and, of course, must be within the capacity of the physical disk, not counting the reserved operating system tracks. The DRM entry is one less than the total number of directory entries that can take on a 16-bit value. The values of AL0 and AL1 are determined by DRM. AL0 and AL1 values together can be considered a string of 16-bits, as shown below:
Position 00 corresponds to the high-order bit of the byte AL0, and position 15 to the low-order bit of the byte AL1. Each bit position reserves a data block for a number of directory entries, thus allowing a total of 16 data blocks to be assigned for directory entries ( bits are assigned starting at 00 and filled to the right through position 15 ). Each directory entry occupies 32 bytes, resulting in the following table:
If DRM = 127 ( 128 directory entries ) and BLS = 1,024, there are 32 directory entries per block, requiring four reserved blocks. In this case, the four high-order bits of AL0 are set, resulting in the values AL0 = $F0 and AL1 = $00. The CKS value is determined as follows:
Finally, the OFF field determines the number of tracks that are skipped at the beginning of the physical disk. This value is automatically added whenever SETTRK is called. It can be used as a mechanism for skipping reserved operating system tracks or for partitioning a large disk into smaller segmented sections. To complete the discussion of the DPB, several DPHs can address the same DPB if their drive characteristics are identical. Further, the DPB can be dynamically changed when a new drive is addressed. Since the BDOS copies the DPB values to a local area whenever the SELDSK function is called, simply change the pointer in the DPH. Returning back to the DPH for a particular drive, the two address values, CSV and ALV, reference areas of uninitialized memory in the BIOS data segment. The areas must be unique for each drive, and the size of each area is determined by the values in the DPB. The size of the data addressed by CSV is CKS bytes, which is sufficient to hold the directory check information for this particular drive. If CKS = ( DRM +1 ) / 4, you must reserve ( DRM + 1 ) / 4 bytes for directory check use. Id CKS = =, no storage is reserved. The size of the area addressed by ALV is determined by the maximum
number of data blocks allowed for this particular disk, and is equal
to 2 * ( DSM / 8 + 1 ). Two copies of the allocation map for the disk
are kept in this area: the first vector stores temporarily allocated
blocks resulting from write operations, the second stores permanently
allocated blocks resulting from CLOSE FILE operations. |