The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...
The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...
The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
====================================<br />
| Bit-7: Disk File character I/O |<br />
| Bit-3: NIL device - no I/O |<br />
| Bit-4: ROUTE <strong>to</strong> DCB or FCB |<br />
| Bit-5: LINK <strong>to</strong> 2nd DCB |<br />
| Bit-6: FILTERed DCB or filter |<br />
====================================<br />
Figure 3-9: DCB Hierarchy<br />
3.4.8 Device Chain Summary<br />
<strong>The</strong> preceding discussion should shed a great deal of light on the handling of device I/O<br />
by the operating system. You should also understand that in order <strong>to</strong> accomplish this<br />
device independence and flexible handling of character I/O, the programmer of device<br />
drivers and filters must adhere <strong>to</strong> a strict pro<strong>to</strong>col of handshaking the modules with the<br />
operating system. <strong>The</strong> next section will explore device I/O looked at from the standpoint<br />
of the modules and drivers. Once you grasp these requirements, you will be in <strong>to</strong>tal<br />
control of filters and device drivers.<br />
3.5 DEVICE DRIVER/FILTER TEMPLATE<br />
<strong>The</strong> system contains command level procedures that provide easy access <strong>to</strong> device<br />
references so that modifications may be made <strong>to</strong> the way in which devices are treated by<br />
the system. All devices require some type of driving program (a device driver) that is<br />
used <strong>to</strong> handshake the device with the system and cater <strong>to</strong> the special features and<br />
requirements of the device hardware. Some drivers are already implemented within the<br />
operating system <strong>to</strong> handle standard devices. For instance, drivers for handshaking the<br />
keyboard, video display, parallel printer port, and RS-232 serial port are included with<br />
the system.<br />
Some devices are completely supported with the existing drivers in the <strong>to</strong>tal DOS<br />
environment. Other devices may need a little more support. <strong>The</strong> characteristics of a<br />
driver may be modified by the introduction of a FILTER. For instance, suppose your<br />
printer required a line feed upon receipt of a carriage return <strong>to</strong> advance the paper. <strong>The</strong><br />
printer driver does not provide this function. Instead of writing a completely new<br />
printer driver, only a filter need be included <strong>to</strong> add that single function (the FORMS/FLT<br />
filter which incorporates this function is usually provided with the system).<br />
<strong>The</strong> DOS provides two commands <strong>to</strong> aid in interfacing drivers and filters. <strong>The</strong> SET command<br />
is used <strong>to</strong> define a new device, re-define an existing device, or install a filter module<br />
while assigning it a device name. FILTER is used <strong>to</strong> place the installed filter in<strong>to</strong> an<br />
existing device chain.<br />
<strong>The</strong> SET command takes the device specification from the command line "SET *XY <strong>to</strong><br />
filespec" and searches the Device Control Block tables for a matching device name. If the<br />
requested device is not defined in your configuration, SET establishes a Device Control<br />
Block for the new device. Control then passes <strong>to</strong> the DRIVER or FILTER with register pair<br />
DE containing the address of the Device Control Block record assigned <strong>to</strong> the "SET"<br />
device.<br />
Register pair HL points <strong>to</strong> the command line character separating the DRIVER/FILTER<br />
program filespec and optional parameters. This provides the module initialization<br />
routines with the opportunity of parsing a parameter string by using a parameter table<br />
and the @PARAM SuperVisor Call. SET provides a default file extension of /FLT since the<br />
function of adding filters <strong>to</strong> the system is the more usual case.<br />
<strong>The</strong> SET and FILTER commands are designed such that the DRIVER or FILTER program should<br />
first load in<strong>to</strong> the User Program Region (starting at X'3000'). After parsing any options<br />
or parameters, the module initialization routine au<strong>to</strong>matically relocates the resident<br />
3-9