2.4.2 Device Drivers

Programs that need access to custom devices need device drivers. A device driver consists of a pair of routines that handle input and output for a given device. Device drivers are similar to TSRs in that they do not run on their own. Instead, MS-DOS calls the device driver's routines whenever the system needs access to the device. The driver then carries out whatever device-specific operations are required to read from or write to the device, passing information about the operation to MS-DOS.

2.4.2.1 ROM BIOS Routines

Most computers and custom devices provide device-support routines in read-only memory (ROM). These routines are collectively called the ROM BIOS (ROM basic input/output system). The ROM BIOS tests and initializes the devices and provides service routines that device drivers can use to read from or write to the devices.

Occasionally, the ROM BIOS for a given device may not be adequate for a program's needs. In such cases, the ROM BIOS for that device can be replaced with a special TSR called a hardware support program. Such a program provides low-level support for an interrupt-driven device. It installs an interrupt service routine that handles interrupts generated by the device. Hardware support programs also define an interface that device drivers or programs can use to retrieve input and send output. Although such programs use some features of MS-DOS, they are extremely device-dependent.