Micro Vibe

My Micro Hobby Projects

  • Increase font size
  • Default font size
  • Decrease font size
Home CPM 80 CPM BIOS Disk Devices

Disk Devices

Print

The BIOS disk oriented functions are used to control any one of a possible sixteen logical disk drives named "A".."P". The BIOS disk support functions are used to transfer logical blocks of one hundred and twenty eight (128) bytes between a disk drive device and memory.  These 128 byte blocks are know as "standard sectors" in CPM terminology.  Only one disk drive can be selected at a time and all subsequent disk functions assume the last selected disk drive device. The disk devices are logical devices where a single physical disk device can contain more then one logical disk device. A disk device may store more then one standard sector in its native block storage size. The BIOS code is responsible for the deblocking of disk native storage blocks to standard sector blocks.

Except for low level disk maintenance programs, programs should never use these functions directly instead the equivalent BDOS service functions should be used. These functions when used directly by a program will cause the BIOS and BDOS code to become out of sync with each other usualy leading to system crashes and possible data corruption on the disk device. The main use of this information is for persons writing or modifying BIOS code.

More information is available on the BIOS on the CPM BIOS page.

BIOS 07 HOME

The BIOS HOME function is used to select track zero on the currently selected disk device. The next read or write request will use track zero. In most BIOS implementations the HOME function is the same as calling the SETTRK BIOS function specifying track zero. The HOME function does not pass any parameters in the CPU registers.

BIOS 08 SELDSK

The BIOS SELDSK function is used to select the disk device to be used in subsequent calls to BIOS disk device functions. The disk device number (0..15) is passed n the CPU's "C" register. On return from this function the CPU's "HL" register will contain the memory address of the disk parameter header (DPH) for the selected disk device. If the BIOS is unable to select the specified disk device the CPU "HL" register will contain zero. If the CPU register "E" has its LSB set to zero on entry to this function the BIOS should assume this is the first time this disk device is being selected and do what ever is required to ready the disk device for use. If the LSB of the "E" CPU register is set to one the BIOS can assume the device has previously been initialized.

The memory address of the disk parameter header (DPH) is used to locate the address of the disk skew translation table contained in the DPH structure in memory. The address of the disk skew translation table is required as a parameter to the SECTRAN BIOS function. In general this function should not be called by a program without first calling the BDOS service function 14 to select the same disk device.

BIOS 09 SETTRK

The BIOS SETTRK function is used to set the track number for the next disk device read or write BIOS function.  The track number is past as a parameter in the CPU "BC" register. The track number is the actual physical track number on the disk device. A request for track zero is the same as a call to the HOME function. To resolve the disk device track number range you must read the disk parameter block (DPB) for the selected logical disk device using the BDOS service function 31. The current disk device should have been selected using the SELDSK BIOS function before calling this function.

BIOS 10 SETSEC

The BIOS SETSEC function is used to set the standard record number for the next disk device read or write BIOS function.  The standard sector number is past as a parameter in the CPU "BC" register.  The sector numbers range from 1 to the maximum number of standard sectors on a track. The standard sectors may be saved on the physical device in a skewed or interlaced order to improve disk performance. Before calling this function a call to the BIOS SECTRAN function to map the logical standard sector number to the physical standard sector on the track must be made. The translated sector number returned by the SECTRAN function is then passes as a parameter to this function. To resolve the disk device sector number range you must read the disk parameter block (DPB) for the selected logical disk device using the BDOS service function 31. If the address of the sector skew table in the DPH is zero then no call to the SECTRAN function is require as physical and logical standard sector numbers are the same. The current disk device should have been selected using the SELDSK BIOS function before calling this function.

BIOS 11 SETDMA

The BIOS SETDMA function is used to specify the memory address used by the BIOS READ and WRITE functions. The memory address is past as a parameter in the CPU "BC" register and points to a memory buffer large enough to hold one standard sector (128 bytes). In general the memory address for disk devices should be set using the BDOS service function 26.

BIOS 12 READ

The BIOS READ function is used to transfer one standard record (128 byte) from the disk device selected by the SETDSK function to the memory address set by the SETDMA function. The disk track and sector numbers must be set using the SETTRK and SETSEC functions. When the function returns the CPU "A" register will contain zero if the READ function was successful. If the CPU "A" register contains a non zero number then the READ function failed.

BIOS 13 WRITE

The BIOS WRITE function is used to transfer one standard record (128 byte) from the memory address set by the SETDMA function to the disk device selected by the SETDSK function. The disk track and sector numbers must be set using the SETTRK and SETSEC functions. When the function returns the CPU "A" register will contain zero if the WRITE function was successful. If the CPU "A" register contains a non zero number then the WRITE function failed. The WRITE function is past a single parameter in the CPU "C" register to aid disk deblocking if required.

  • C = 0 a normal data write may be deferred if sector buffering is used, pre read if required.
  • C = 1 a write to the directory map must not be deferred.
  • C = 2 first write to an unallocated data block no need to pre read.

BIOS 15 SECTRAN

The BIOS SECTRAN function is used to convert a logical standard sector number to a physical sector number for a call to the BIOS SETSEC function. When the SECTRAN function is called the CPU "BC" register contains the sector number and the "DE" register contains the sector skew table memory address read from the DPH for the selected disk device. The translated standard sector number is returned in the CPU "HL" register. If the address of the sector skew table in the DPH is zero then no call to the SECTRAN function is require and calling this function with a 0 address value in the "DE" register may crash the CPM system.

Last Updated on Tuesday, 17 February 2009 08:52