29.12.2012 Views

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 ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

===========================================================<br />

| TYPE VECTOR SYSDATA NAME MODULE/MODDCB |<br />

| ---- -------- ---------- ---- ________________ |<br />

| | | |<br />

| 10 FCB-FILE PRINTER/06 PR | PRINTER/*PR | |<br />

| |________________| |<br />

| 80 31-bytes of FCB data FCB |<br />

| |<br />

===========================================================<br />

Figure 3-5: DCB Table After ROUTE<br />

Let's now follow an output request <strong>to</strong> the *PR device. <strong>The</strong> DOS device I/O handler will<br />

recognize the ROUTE bit (bit-4 of the TYPE byte) and update the register linkage so that<br />

the FCB will be pointed <strong>to</strong> instead of the DCB. Noticing that the control block now<br />

indicates a disk file (bit-7 of the TYPE byte), the I/O handler will pass control <strong>to</strong> the<br />

character I/O file routines.<br />

<strong>The</strong> action taken by the operating system <strong>to</strong> reset a DCB that has been routed is <strong>to</strong> first<br />

close the file, if a filespec was the initial "route-<strong>to</strong>", then recover the original TYPE<br />

and VECTOR from the SYSDATA field.<br />

3.4.5 Filtering a Routed Device<br />

Let's suppose we have a text file that needs line feeds removed (it may be a CP/M file<br />

that uses CR-LF as the end-of-line pro<strong>to</strong>col). We could write a program <strong>to</strong> read the file<br />

and write out <strong>to</strong> another file all characters that are not a line feed. We could also use<br />

a trap filter that is handy. We want <strong>to</strong> be able <strong>to</strong> filter the file with this trap filter.<br />

Using the routing identical <strong>to</strong> that shown in figure 3-5, establish the trap filter and<br />

invoke it with:<br />

SET *LF USING TRAP (CHAR=10)<br />

FILTER *PR USING *LF<br />

Figure 3-6 will now reflect the DCB structure after this series of commands. It is now<br />

easy <strong>to</strong> LIST the source file with the (P,T=N) option. This will direct a copy of the file<br />

<strong>to</strong> the *PR device (while suppressing tab expansion). As can be observed from the figure,<br />

the device handler passes *PR I/O requests <strong>to</strong> the TRAP filter. After performing whatever<br />

filtering is necessary, the @CHNIO request will reference the *LF Device Control Block<br />

(which is pointed <strong>to</strong> by the MODDCB field). <strong>The</strong> device handler then notes that the ROUTE<br />

bit is set and continues <strong>to</strong> control the @PUT request as was done under figure 3-5. A<br />

simple "RESET *PR" upon completion will close the filtered FILE/TXT.<br />

===========================================================<br />

| TYPE VECTOR SYSDATA NAME MODULE/MODDCB |<br />

| ---- -------- ----------- ---- ________________ |<br />

| | | |<br />

| 47 TRAP PRINTER/06 PR | PRINTER/*PR | |<br />

| |________________| |<br />

| 80 31-bytes of FCB data FCB ________________ |<br />

| | | |<br />

| 10 FCB-FILE LF | TRAP/*LF | |<br />

| |________________| |<br />

| |<br />

===========================================================<br />

Figure 3-6: Filtering a Route<br />

3.4.6 Linking<br />

Linking is handled by establishing a link Device Control Block s<strong>to</strong>rage area for each LINK<br />

command invoked. For example, if you "LINK *DO TO *PR", we can illustrate the DCB area as<br />

3-7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!