TRS-80 DOS - LDOS 5.3.1 for the Model I - PR/FLT Disassembled

Page Customization

Introduction/Summary

LDOS 5.3.1 PR/FLT Disassembly - The Printer Forms Filter (Model I)

PR/FLT is the forms filter for the printer: FILTER *PR USING PR/FLT (parms) (or FILTER *PR PR (parms), /FLT being the default extension) puts a module of 0125H bytes above HIGH$ in front of the driver of *PR. The module counts the columns and the lines, wraps long lines, adds a left margin, expands tabs, changes one character into another and skips the end of every page. The FORMS command of SYS7/SYS changes its values later, and RESET *PR takes it out again; a later install uses the same memory.

The file is a program run once by the FILTER command (member 14 of SYS6/SYS) at its transfer address 5200H, with Register Pair DE = the device control block (4025H for *PR) and Register Pair HL = the text after the file name. It makes no RST 28H request of its own.

The Parameters

NameKeptWhat the code does with it
PAGE, P54DBHThe lines of a page, 66 when not given: +03H of the device control block (5317H).
LINES, L54D9HThe lines printed on a page before the rest of it is skipped, PAGE when not given: +05H of the device control block. It is not compared with PAGE.
CHARS, C54DDHThe bytes on a line; a full line is ended at once (5596H). 0 (the default) does not wrap.
INDENT, I54DFHSpaces at the start of the rest of a wrapped line (55B0H).
MARGIN, M54E1HSpaces before every line, not counted as columns (5619H).
ADDLF, A527AHA line feed after every carriage return; without it an empty line gets a line feed only (55C0H).
FFHARD, F5274HThe rest of a page is skipped with one 0CH instead of line ends (55ECH).
TAB, T526EH09H becomes spaces up to the next multiple of 8 columns (560EH).
XLATE, X5283HX'aabb': the byte aa is sent as bb (556DH).
SLINE, SL5330H0 (the default): PAGE, line count 0 and LINES as given, 66, 0 and 66 with the defaults; 1: each one more, 67, 1 and 67, and a new page starts with the count 1 (5609H). A value whose low byte is not 0 or 1, or SLINE alone, is a parameter error.
PORT522DHThe port the built-in printer driver uses instead of 37E8H, 1-255 (522CH).

How It Is Installed

After the banner, a device that is NIL, routed or not an output device is refused, and so is a second PR/FLT (bit 3 of DFLAG$, 441FH); @PARAM reads the parameters, most of them straight into operands of the installer (5200H). PORT rewrites two instructions of the built-in driver; bit 3 of DFLAG$ is set; the values go into the module's parameter block at 5517H (524AH). The module goes above a HIGH$ lowered by 0125H, or into the memory of an earlier install, whose address 4DF6H keeps (528DH). Its 17 operands that hold an address inside it are moved, and it is copied there (52ADH). When the device's driver is still the one the reset saved in PRSV$ (43BCH), the module's own printer driver takes its place; the device control block is copied into the module, and its driver becomes the module (52DFH). The page values go into +03H-+05H of the device control block (5317H). An installed spooler is given the module's copy of the block (533FH).

The Module

OffsetFileContents
+00H5505HJR to the entry (+19H), the start of the header; the device's driver address points here.
+02H5507HThe link word: the HIGH$ the module was put above.
+04H5509H03H and the name $FF.
+08H550DHThe copy of the device control block (8 bytes, not in the file): every request goes on through it, to the driver the device had or to the built-in driver.
+10H5515HThe address of the device control block (not in the file).
+12H5517HThe parameter block, Index Register IY +00H-+06H: column, XLATE from, XLATE to, INDENT, flags (bit 0 ADDLF, bit 1 FFHARD, bit 2 TAB, bit 3 SLINE), CHARS, MARGIN.
+19H551EHThe entry: a read and a control request are passed on; a byte to send is filtered.
+3AH553FHThe built-in printer driver, for 37E8H or the port of PORT=n.

How a Byte Is Printed

The ROM's device routine enters the module with Index Register IX = the device control block and Register C = the byte (551EH). XLATE is applied first; 0DH and 0AH end a line, 0CH skips the rest of the page, 06H sets the line count to the start of a page (LPRINT CHR$(6)), 09H is expanded with TAB, other control bytes go out as they are (556DH). A printable byte gets the margin at the start of a line, is sent and counted, and a full line is wrapped with INDENT spaces (5596H). Each line end is counted in +04H of the device control block; at LINES the rest of PAGE is skipped (55DFH). Every byte goes out through the copy of the device control block (5535H). The built-in printer driver treats a status of F0H as no printer attached and writes the byte without waiting, so the computer does not hang without a printer; a printer that is busy is waited for without a time out (553FH).

About This Page

Every byte of the file is shown at its address; the module is shown at its addresses in the file, and its branches link to its rows here. The ROM routines named are those of the Level II ROM, version 1.3. Found in the code: a bad SLINE value is reported after bit 3 of DFLAG$ is set, so the bit stays set with no filter installed and the next install says PR/FLT already active! (524AH); SYSTEM (PRTIME) of SYS7/SYS takes the byte at module +19H as the offset of a time out byte, but here that byte is the code of a JR C (38H), so PRTIME writes over the POP DE at 553DH and the next byte printed returns to a wrong address (5535H), and this filter has no time out; an INDENT not below CHARS wraps with no end, one call deeper each time (5596H); LINES is not compared with PAGE, and above it the rest of the page is taken modulo 256 (55ECH); a 0DH 0AH pair counts two lines (556DH); with INDENT 0, a line of exactly CHARS bytes followed by 0DH gets an empty line; a result of the driver behind the filter is not passed back for a byte sent (555EH); PORT acts only when the built-in driver is used (52DFH); with FFHARD a 0CH leaves the column as it was.

Memory Map

Load Blocks

The file (1135 bytes) starts with a copyright record (type 1FH), then 6 load blocks with 1056 bytes, 5200H-550CH and 5517H-5629H, and the transfer address 5200H. The ten bytes 550DH-5516H are not in the file.

AddressContents
5200H-52FFH256 bytes
5300H-53FFH256 bytes
5400H-54FFH256 bytes
5500H-550CH13 bytes
5517H-5616H256 bytes
5617H-5629H19 bytes

The Parts of the File

AddressContents
5200H-5374HThe installer: the tests, the parameters, the memory, the relocation and the copy of the module, the hook to the device, the page values, the spooler, the errors.
5375H-542FHThe banner and the four messages.
5430H-54D8HThe parameter table of @PARAM.
54D9H-54E2HThe cells of LINES, PAGE, CHARS, INDENT and MARGIN.
54E3H-5504HThe relocation table: 17 operands of the module.
5505H-5629HThe module, 0125H bytes, copied above HIGH$: its header (5505H-550CH), the copy of the device control block (550DH-5516H, not in the file), the parameter block (5517H-551DH) and the filter with its printer driver (551EH-5629H).

Sections of the Disassembly

AddressContents
5200HThe Start: the Device and Its Four Tests
522CHPORT: the Port of the Built-In Printer Driver
524AHDFLAG$ and the Parameter Block
528DHThe Memory for the Module
52ADHMoving the Module's Addresses
52DFHHooking the Module to the Device
5317HThe Page in the Device Control Block
533FHThe Spooler and the End
5357HParameter Error
5360HThe Refusals
5375HThe Banner
53DEHThe Messages of the Refusals
5430HThe Parameter Table
54D9HThe Value Cells
54E3HThe Relocation Table
5505HThe Module: Its Header
550DHThe Copy of the Device Control Block
5517HThe Parameter Block
551EHThe Entry for a Request
552CHA Byte to Read
5535HSend a Byte On
553FHThe Built-In Printer Driver
5553HThe Printer's Status
555EHA Byte to Send
556DHThe Filter
5596HA Printable Byte
55B5HSend Spaces
55C0HThe End of a Line
55DFHA Line Ended: the Count
55ECHThe Rest of the Page
560EHA Tab
5619HThe Margin

Memory PR/FLT Uses

AddressContents
0013H, 001BH, 0023HThe ROM: read a byte, send a byte and a control request for the device control block at Register Pair DE; they go through 03C2H, which enters the driver with Index Register IX = the block.
37E8HThe printer of the Model I: its status when read, the byte to print when written (the built-in driver).
4025HPRDCB$, the device control block of *PR, the device FILTER normally names: +00H type, +01H-+02H driver, +03H lines of a page, +04H lines printed, +05H lines to print.
402DH, 4030H@EXIT and @ABORT.
4049H-404AHHIGH$, lowered by 0125H for the module.
43BCH-43BDHPRSV$, the printer driver address the reset saved: when the device still has it, the built-in driver takes its place.
441FHDFLAG$: bit 0 the spooler is installed, bit 3 PR/FLT is installed.
4409H, 4467H, 4476H, 447BH@ERROR, @DSPLY, @PARAM, @LOGOT.
4DF0H-4DF1HThe spooler's parameter block (SYS6/SYS).
4DF6H-4DF7HThe address of PR/FLT's module, kept for the next install, SPOOL and the FORMS and PRTIME commands of SYS7/SYS.

Variables

The data of the file and the bytes of the module that are not in the file, then the operands PR/FLT changes.

Data in the File and in the Module

Address
Size
Contents
5375H-53A7H
51 bytes
DEFM "PR/FLT - Generalized Printer Filter - Version 5.3.1"
5375H-53A7H: the first line of the banner, the name and the version.
53A8H
1 byte
DEFB 0AH
53A8H: 0AH, a line feed: the copyright goes on the next line.
53A9H-53DBH
51 bytes
DEFM "Copyright 1991, MISOSYS, Inc., All rights reserved"
53A9H-53DBH: the second line of the banner, the copyright.
53DCH
1 byte
DEFB 0AH
53DCH: 0AH, a line feed after the copyright, before the 0DH that ends the text.
53DDH
1 byte
DEFB 0DH
53DDH: 0DH, the end of the banner for @DSPLY.
53DEH-53EFH
18 bytes
DEFM "Device not active!"
53DEH-53EFH: the message of 5360H, a NIL device (type byte bit 3, 520DH).
53F0H
1 byte
DEFB 0DH
53F0H: 0DH, the end of the message Device not active!
53F1H-5405H
21 bytes
DEFM "Not an output device!"
53F1H-5405H: the message of 5364H, a device that takes no output (type byte bit 1 clear, 5217H).
5406H
1 byte
DEFB 0DH
5406H: 0DH, the end of the message Not an output device!
5407H-541CH
22 bytes
DEFM "PR/FLT already active!"
5407H-541CH: the message of 5368H, DFLAG$ bit 3 already set (521FH).
541DH
1 byte
DEFB 0DH
541DH: 0DH, the end of the message PR/FLT already active!
541EH-542EH
17 bytes
DEFM "Device is routed!"
541EH-542EH: the message of 536CH, a routed device (type byte bit 4, 5212H).
542FH
1 byte
DEFB 0DH
542FH: 0DH, the end of the message Device is routed!
5430H-5435H
6 bytes
DEFM "LINES "
5430H-5435H: entry 1 of the parameter table, the name LINES.
5436H-5437H
2 bytes
DEFW 54D9H
5436H-5437H: entry 1: 54D9H, where @PARAM stores the value of LINES: the LINES cell 54D9H-54DAH (5322H).
5438H-543DH
6 bytes
DEFM "L "
5438H-543DH: entry 2 of the parameter table, the name L, the short form of LINES.
543EH-543FH
2 bytes
DEFW 54D9H
543EH-543FH: entry 2: 54D9H, where @PARAM stores the value of L: the LINES cell 54D9H-54DAH (5322H).
5440H-5445H
6 bytes
DEFM "PAGE "
5440H-5445H: entry 3 of the parameter table, the name PAGE.
5446H-5447H
2 bytes
DEFW 54DBH
5446H-5447H: entry 3: 54DBH, where @PARAM stores the value of PAGE: the PAGE cell 54DBH-54DCH (5317H).
5448H-544DH
6 bytes
DEFM "P "
5448H-544DH: entry 4 of the parameter table, the name P, the short form of PAGE.
544EH-544FH
2 bytes
DEFW 54DBH
544EH-544FH: entry 4: 54DBH, where @PARAM stores the value of P: the PAGE cell 54DBH-54DCH (5317H).
5450H-5455H
6 bytes
DEFM "CHARS "
5450H-5455H: entry 5 of the parameter table, the name CHARS.
5456H-5457H
2 bytes
DEFW 54DDH
5456H-5457H: entry 5: 54DDH, where @PARAM stores the value of CHARS: the CHARS cell 54DDH-54DEH (524DH).
5458H-545DH
6 bytes
DEFM "C "
5458H-545DH: entry 6 of the parameter table, the name C, the short form of CHARS.
545EH-545FH
2 bytes
DEFW 54DDH
545EH-545FH: entry 6: 54DDH, where @PARAM stores the value of C: the CHARS cell 54DDH-54DEH (524DH).
5460H-5465H
6 bytes
DEFM "INDENT"
5460H-5465H: entry 7 of the parameter table, the name INDENT.
5466H-5467H
2 bytes
DEFW 54DFH
5466H-5467H: entry 7: 54DFH, where @PARAM stores the value of INDENT: the INDENT cell 54DFH-54E0H (5259H).
5468H-546DH
6 bytes
DEFM "I "
5468H-546DH: entry 8 of the parameter table, the name I, the short form of INDENT.
546EH-546FH
2 bytes
DEFW 54DFH
546EH-546FH: entry 8: 54DFH, where @PARAM stores the value of I: the INDENT cell 54DFH-54E0H (5259H).
5470H-5475H
6 bytes
DEFM "ADDLF "
5470H-5475H: entry 9 of the parameter table, the name ADDLF.
5476H-5477H
2 bytes
DEFW 527AH
5476H-5477H: entry 9: 527AH, where @PARAM stores the value of ADDLF: 527AH-527BH, the operand of the LD BC at 5279H (527EH builds bit 0 of the flags from it).
5478H-547DH
6 bytes
DEFM "A "
5478H-547DH: entry 10 of the parameter table, the name A, the short form of ADDLF.
547EH-547FH
2 bytes
DEFW 527AH
547EH-547FH: entry 10: 527AH, where @PARAM stores the value of A: 527AH-527BH, the operand of the LD BC at 5279H (527EH builds bit 0 of the flags from it).
5480H-5485H
6 bytes
DEFM "FFHARD"
5480H-5485H: entry 11 of the parameter table, the name FFHARD.
5486H-5487H
2 bytes
DEFW 5274H
5486H-5487H: entry 11: 5274H, where @PARAM stores the value of FFHARD: 5274H-5275H, the operand of the LD BC at 5273H (bit 1 of the flags).
5488H-548DH
6 bytes
DEFM "F "
5488H-548DH: entry 12 of the parameter table, the name F, the short form of FFHARD.
548EH-548FH
2 bytes
DEFW 5274H
548EH-548FH: entry 12: 5274H, where @PARAM stores the value of F: 5274H-5275H, the operand of the LD BC at 5273H (bit 1 of the flags).
5490H-5495H
6 bytes
DEFM "TAB "
5490H-5495H: entry 13 of the parameter table, the name TAB.
5496H-5497H
2 bytes
DEFW 526EH
5496H-5497H: entry 13: 526EH, where @PARAM stores the value of TAB: 526EH-526FH, the operand of the LD BC at 526DH (bit 2 of the flags).
5498H-549DH
6 bytes
DEFM "T "
5498H-549DH: entry 14 of the parameter table, the name T, the short form of TAB.
549EH-549FH
2 bytes
DEFW 526EH
549EH-549FH: entry 14: 526EH, where @PARAM stores the value of T: 526EH-526FH, the operand of the LD BC at 526DH (bit 2 of the flags).
54A0H-54A5H
6 bytes
DEFM "XLATE "
54A0H-54A5H: entry 15 of the parameter table, the name XLATE.
54A6H-54A7H
2 bytes
DEFW 5283H
54A6H-54A7H: entry 15: 5283H, where @PARAM stores the value of XLATE: 5283H-5284H, the operand of the LD BC at 5282H (5518H and 5519H).
54A8H-54ADH
6 bytes
DEFM "X "
54A8H-54ADH: entry 16 of the parameter table, the name X, the short form of XLATE.
54AEH-54AFH
2 bytes
DEFW 5283H
54AEH-54AFH: entry 16: 5283H, where @PARAM stores the value of X: 5283H-5284H, the operand of the LD BC at 5282H (5518H and 5519H).
54B0H-54B5H
6 bytes
DEFM "MARGIN"
54B0H-54B5H: entry 17 of the parameter table, the name MARGIN.
54B6H-54B7H
2 bytes
DEFW 54E1H
54B6H-54B7H: entry 17: 54E1H, where @PARAM stores the value of MARGIN: the MARGIN cell 54E1H-54E2H (5253H).
54B8H-54BDH
6 bytes
DEFM "M "
54B8H-54BDH: entry 18 of the parameter table, the name M, the short form of MARGIN.
54BEH-54BFH
2 bytes
DEFW 54E1H
54BEH-54BFH: entry 18: 54E1H, where @PARAM stores the value of M: the MARGIN cell 54E1H-54E2H (5253H).
54C0H-54C5H
6 bytes
DEFM "SLINE "
54C0H-54C5H: entry 19 of the parameter table, the name SLINE.
54C6H-54C7H
2 bytes
DEFW 5330H
54C6H-54C7H: entry 19: 5330H, where @PARAM stores the value of SLINE: 5330H-5331H, the operand of the LD HL at 532FH (also read at 525FH).
54C8H-54CDH
6 bytes
DEFM "SL "
54C8H-54CDH: entry 20 of the parameter table, the name SL, the short form of SLINE.
54CEH-54CFH
2 bytes
DEFW 5330H
54CEH-54CFH: entry 20: 5330H, where @PARAM stores the value of SL: 5330H-5331H, the operand of the LD HL at 532FH (also read at 525FH).
54D0H-54D5H
6 bytes
DEFM "PORT "
54D0H-54D5H: entry 21 of the parameter table, the name PORT.
54D6H-54D7H
2 bytes
DEFW 522DH
54D6H-54D7H: entry 21: 522DH, where @PARAM stores the value of PORT: 522DH-522EH, the operand of the LD HL at 522CH (the port of the built-in driver).
54D8H
1 byte
DEFB 00H
54D8H: 00H, the end of the parameter table: @PARAM stops at a first byte of 00H.
54D9H-54DAH
2 bytes
DEFW FFFFH
54D9H-54DAH: LINES: FFFFH, not given; 5322H uses PAGE then.
54DBH-54DCH
2 bytes
DEFW 0042H
54DBH-54DCH: PAGE: 0042H, 66 lines, when not given (5317H).
54DDH-54DEH
2 bytes
DEFW 0000H
54DDH-54DEH: CHARS: 0000H, no wrap, when not given (524DH).
54DFH-54E0H
2 bytes
DEFW 0000H
54DFH-54E0H: INDENT: 0000H when not given (5259H).
54E1H-54E2H
2 bytes
DEFW 0000H
54E1H-54E2H: MARGIN: 0000H when not given (5253H).
54E3H-54E4H
2 bytes
DEFW 552EH
54E3H-54E4H: relocation entry 1: 552EH, the operand of the LD DE,550DH at 552DH.
54E5H-54E6H
2 bytes
DEFW 5525H
54E5H-54E6H: relocation entry 2: 5525H, the operand of the LD DE,550DH at 5524H.
54E7H-54E8H
2 bytes
DEFW 5538H
54E7H-54E8H: relocation entry 3: 5538H, the operand of the LD DE,550DH at 5537H.
54E9H-54EAH
2 bytes
DEFW 554AH
54E9H-54EAH: relocation entry 4: 554AH, the operand of the CALL 5553H at 5549H.
54EBH-54ECH
2 bytes
DEFW 5562H
54EBH-54ECH: relocation entry 5: 5562H, the operand of the LD IY,5517H at 5560H.
54EDH-54EEH
2 bytes
DEFW 5566H
54EDH-54EEH: relocation entry 6: 5566H, the operand of the CALL 556DH at 5565H.
54EFH-54F0H
2 bytes
DEFW 559BH
54EFH-54F0H: relocation entry 7: 559BH, the operand of the CALL NZ,5619H at 559AH.
54F1H-54F2H
2 bytes
DEFW 559EH
54F1H-54F2H: relocation entry 8: 559EH, the operand of the CALL 5535H at 559DH.
54F3H-54F4H
2 bytes
DEFW 55AEH
54F3H-54F4H: relocation entry 9: 55AEH, the operand of the CALL 55DFH at 55ADH.
54F5H-54F6H
2 bytes
DEFW 55BAH
54F5H-54F6H: relocation entry 10: 55BAH, the operand of the CALL 5596H at 55B9H.
54F7H-54F8H
2 bytes
DEFW 55C9H
54F7H-54F8H: relocation entry 11: 55C9H, the operand of the CALL 5535H at 55C8H.
54F9H-54FAH
2 bytes
DEFW 55D8H
54F9H-54FAH: relocation entry 12: 55D8H, the operand of the CALL 5535H at 55D7H.
54FBH-54FCH
2 bytes
DEFW 55E0H
54FBH-54FCH: relocation entry 13: 55E0H, the operand of the CALL 55C0H at 55DFH.
54FDH-54FEH
2 bytes
DEFW 55FFH
54FDH-54FEH: relocation entry 14: 55FFH, the operand of the CALL 5535H at 55FEH.
54FFH-5500H
2 bytes
DEFW 5604H
54FFH-5500H: relocation entry 15: 5604H, the operand of the CALL 55C0H at 5603H.
5501H-5502H
2 bytes
DEFW 5624H
5501H-5502H: relocation entry 16: 5624H, the operand of the CALL 5535H at 5623H.
5503H-5504H
2 bytes
DEFW 5586H
5503H-5504H: relocation entry 17: 5586H, the operand of the JP Z,5609H at 5585H.
5507H-5508H
2 bytes
DEFW 0000H
5507H-5508H: module +02H-+03H, the link word, 0000H in the file: the HIGH$ the module was put above (52AEH), which is its last byte.
5509H
1 byte
DEFB 03H
5509H: module +04H, 03H, the length of the module's name.
550AH-550CH
3 bytes
DEFM "$FF"
550AH-550CH: module +05H-+07H, the module's name $FF.
550DH-5514H
8 bytes
DEFS 8
550DH-5514H: not in the file. Module +08H-+0FH: the copy of the 8 bytes of the device control block (5308H): +00H the type, +01H-+02H the driver the filter passes requests to (the driver the device had, or the module's printer driver at 553FH), +03H-+05H the page values from before the install, +06H-+07H the device's name. 5524H, 552DH and 5537H point Register Pair DE at it, and a spooler installed before PR/FLT is given its address (5351H).
5515H-5516H
2 bytes
DEFS 2
5515H-5516H: not in the file. Module +10H-+11H: the address of the device control block (530CH), read by SYS6/SYS (SPOOL) and SYS7/SYS (FORMS).
5517H
1 byte
DEFB 00H
5517H: IY +00H, the column: the bytes printed on the line since its start, the margin not counted; 00H at the start of a line (55DAH).
5518H
1 byte
DEFB 00H
5518H: IY +01H, the character XLATE changes (5286H); 00H in the file.
5519H
1 byte
DEFB 00H
5519H: IY +02H, the character it becomes (528AH); 00H in the file.
551AH
1 byte
DEFB 00H
551AH: IY +03H, INDENT: the spaces at the start of a wrapped line (525CH).
551BH
1 byte
DEFB 00H
551BH: IY +04H, the flags (527FH): bit 0 ADDLF, bit 1 FFHARD, bit 2 TAB, bit 3 SLINE.
551CH
1 byte
DEFB 00H
551CH: IY +05H, CHARS: the bytes on a line, 00H no wrap (5250H).
551DH
1 byte
DEFB 00H
551DH: IY +06H, MARGIN: the spaces of the left margin (5256H).

Operands Changed

Address
Size
Contents
522DH-522EH
2 bytes
PORT: 0000H in the file, the value of PORT= (@PARAM).
526EH-526FH
2 bytes
TAB: 0000H in the file, FFFFH for TAB (@PARAM).
5274H-5275H
2 bytes
FFHARD: 0000H in the file, FFFFH for FFHARD (@PARAM).
527AH-527BH
2 bytes
ADDLF: 0000H in the file, FFFFH for ADDLF (@PARAM).
5283H-5284H
2 bytes
XLATE: 0000H in the file, X'aabb' (@PARAM).
5330H-5331H
2 bytes
SLINE: 0000H in the file, 0 or 1 (@PARAM).
5507H-5508H
2 bytes
The module's link word: the HIGH$ it was put above (52AEH).
554FH-5551H
3 bytes
LD (37E8H),A, made OUT (n),A and NOP by PORT=n (5244H, 5247H).
5553H-5555H
3 bytes
LD A,(37E8H), made IN A,(n) and NOP by PORT=n (523CH, 523FH).
560CH
1 byte
The line count at the start of a page: 01H in the file, 00H or 01H from SLINE (526AH).
17 operands
2 bytes each
The operands listed in the relocation table, moved by the distance from 5505H to the module (52C3H).
553DH
1 byte
In memory: SYSTEM (PRTIME) of SYS7/SYS stores 1BH or 00H over this POP DE (551EH).

Disassembly

5200H - The Start: the Device and Its Four Tests

The transfer address. The FILTER command (member 14 of SYS6/SYS) runs PR/FLT with Register Pair DE = the device control block to filter (4025H for *PR) and Register Pair HL = the text after the file name. The banner is shown; a NIL device, a routed device, a device that takes no output and a second PR/FLT are refused; then @PARAM reads the parameters.

5200
PUSH DE D5
Save Register Pair DE (the device control block from FILTER) to the stack; 52E0H takes it back into Index Register IX.
5201
PUSH HL E5
Save Register Pair HL (the parameter text after the file name) to the stack.
5202
LD A,(DE) 1A
Load Register A with +00H of the device control block at Register Pair DE, its type byte: bit 1 output, bit 3 NIL, bit 4 routed.
5203
PUSH AF F5
Save Register Pair AF (Register A = the type byte) to the stack while the banner is shown.
5204
LD HL,5375H 21 75 53
Point Register Pair HL to 5375H, the banner: the name and version, 0AH, the copyright, 0AH and 0DH.
5207
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL up to its 0DH.
520A
POP AF F1
Restore Register Pair AF from the stack: Register A = the type byte of the device control block.
520B
BIT 3,A CB 5F
Test bit 3 of Register A (the type byte): set for a NIL device.
520D
If the NZ FLAG is set (NIL), JUMP to 5360H for Device not active!.
5210
BIT 4,A CB 67
Test bit 4 of Register A (the type byte): set for a device routed elsewhere.
5212
If the NZ FLAG is set (routed), JUMP to 536CH, inside the LD IX at 536BH, for Device is routed!.
5215
BIT 1,A CB 4F
Test bit 1 of Register A (the type byte): set for a device that takes output.
5217
If the Z FLAG is set (no output), JUMP to 5364H, inside the LD IX at 5363H, for Not an output device!.
521A
LD HL,441FH 21 1F 44
Point Register Pair HL to 441FH, DFLAG$, the device flags.
521D
BIT 3,(HL) CB 5E
Test bit 3 of DFLAG$ at Register Pair HL: set while a PR/FLT is installed.
521F
If the NZ FLAG is set (installed), JUMP to 5368H, inside the LD IX at 5367H, for PR/FLT already active!.
5222
EX (SP),HL E3
Exchange Register Pair HL (441FH) with the word at the top of the stack (Stack Pointer SP): Register Pair HL = the parameter text, and 441FH stays on the stack for 524AH.
5223
LD DE,5430H 11 30 54
Point Register Pair DE to 5430H, the parameter table: 21 names of six characters, each followed by the address where @PARAM stores its value.
5226
GOSUB to 4476H, @PARAM, to read the parameters in parentheses at Register Pair HL with the table at Register Pair DE: the Z FLAG when they are good or when there are none.
5229
If the NZ FLAG is set (a name not in the table or a bad value), JUMP to 5357H for Parameter error.

522CH - PORT: the Port of the Built-In Printer Driver

PORT=n makes the built-in printer driver (553FH) use port n instead of the memory address 37E8H: IN A,(n) and OUT (n),A, each followed by a NOP, are written over its LD instructions at 5553H and 554FH. A value above 255 is a parameter error. The built-in driver is used only when the device's driver is still PRSV$ (52E8H), so on another driver PORT does nothing.

522C
LD HL,0000H 21 00 00
Load Register Pair HL with the PORT value, the operand at 522DH-522EH where @PARAM stores it: 0000H in the file, when PORT is not given.
522F
LD A,H 7C
Copy Register H (the high byte of PORT) into Register A.
5230
OR L B5
OR Register L (the low byte of PORT) into Register A: the Z FLAG when PORT is 0000H.
5231
If the Z FLAG is set (no PORT), JUMP to 524AH.
5233
INC H 24
INCrement Register H (the high byte of PORT).
5234
DEC H 25
DECrement Register H back: the Z FLAG when it is 00H, a port of 1-255.
5235
If the NZ FLAG is set (a value above 255), JUMP to 5357H for Parameter error.
5238
XOR A AF
Set Register A to 00H (XOR A), the code of NOP.
5239
LD H,L 65
Copy Register L (the port number) into Register H.
523A
LD L,DBH 2E DB
Load Register L with DBH, the code of IN A,(n): Register Pair HL = DBH and the port, the two bytes of IN A,(port).
523C
LD (5553H),HL 22 53 55
Store Register Pair HL (DBH and the port) at 5553H-5554H: the LD A,(37E8H) of the status routine becomes IN A,(port).
523F
LD (5555H),A 32 55 55
Store Register A (00H, NOP) at 5555H, over 37H, the high byte of the old operand.
5242
LD L,D3H 2E D3
Load Register L with D3H, the code of OUT (n),A: Register Pair HL = D3H and the port.
5244
LD (554FH),HL 22 4F 55
Store Register Pair HL (D3H and the port) at 554FH-5550H: the LD (37E8H),A of the output routine becomes OUT (port),A.
5247
LD (5551H),A 32 51 55
Store Register A (00H, NOP) at 5551H, over 37H, the high byte of the old operand.

524AH - DFLAG$ and the Parameter Block

DFLAG$ bit 3 is set. CHARS, MARGIN and INDENT (the low bytes of their cells) go into the parameter block at 5517H, which the module reads with Index Register IY; SLINE must be 0 or 1 and becomes the line count a new page starts with (the operand at 560CH); SLINE, TAB, FFHARD and ADDLF become bits 3-0 of the flag byte at 551BH; the two characters of XLATE go to 5518H and 5519H.

524A
POP HL E1
Restore Register Pair HL from the stack: 441FH, DFLAG$, put there at 5222H.
524B
SET 3,(HL) CB DE
Set bit 3 of DFLAG$ at Register Pair HL: PR/FLT is installed. A bad SLINE at 5266H still ends with Parameter error after this, and then the bit stays set with no filter installed.
524D
LD A,(54DDH) 3A DD 54
Load Register A with the low byte of CHARS from 54DDH: 00H when not given.
5250
LD (551CH),A 32 1C 55
Store Register A (CHARS) at 551CH, the characters on a line (Index Register IY +05H; 00H no wrap).
5253
LD A,(54E1H) 3A E1 54
Load Register A with the low byte of MARGIN from 54E1H: 00H when not given.
5256
LD (551DH),A 32 1D 55
Store Register A (MARGIN) at 551DH, the spaces of the left margin (IY +06H).
5259
LD A,(54DFH) 3A DF 54
Load Register A with the low byte of INDENT from 54DFH: 00H when not given.
525C
LD (551AH),A 32 1A 55
Store Register A (INDENT) at 551AH, the spaces put before the rest of a wrapped line (IY +03H).
525F
LD A,(5330H) 3A 30 53
Load Register A with the low byte of SLINE from 5330H, the operand of the LD HL at 532FH: 00H when not given.
5262
OR A B7
Set the flags from Register A (OR A): the Z FLAG for SLINE 0.
5263
If the Z FLAG is set (SLINE 0), JUMP to 526AH with Register A = 00H.
5265
DEC A 3D
DECrement Register A (SLINE): 00H only for SLINE 1.
5266
If the NZ FLAG is set (a low byte other than 00H or 01H, SLINE without =n included), JUMP to 5357H for Parameter error.
5269
INC A 3C
INCrement Register A back to 01H, the SLINE value 1, for the operand at 560CH and bit 3 of the flags.
526A
LD (560CH),A 32 0C 56
Store Register A (00H or 01H) at 560CH, the operand of the LD (IX+04H) at 5609H: the line count a new page starts with.
526D
LD BC,0000H 01 00 00
Load Register Pair BC with the TAB value, the operand at 526EH-526FH where @PARAM stores it: 0000H in the file, FFFFH for TAB.
5270
RLC C CB 01
Rotate Register C (the low byte of TAB) left: its bit 7 goes into the CARRY FLAG.
5272
RLA 17
Rotate Register A (the SLINE bit) left through the CARRY FLAG: the TAB bit comes in at bit 0.
5273
LD BC,0000H 01 00 00
Load Register Pair BC with the FFHARD value, the operand at 5274H-5275H: 0000H in the file, FFFFH for FFHARD.
5276
RLC C CB 01
Rotate Register C (the low byte of FFHARD) left: its bit 7 goes into the CARRY FLAG.
5278
RLA 17
Rotate Register A left through the CARRY FLAG: the FFHARD bit comes in at bit 0.
5279
LD BC,0000H 01 00 00
Load Register Pair BC with the ADDLF value, the operand at 527AH-527BH: 0000H in the file, FFFFH for ADDLF.
527C
RLC C CB 01
Rotate Register C (the low byte of ADDLF) left: its bit 7 goes into the CARRY FLAG.
527E
RLA 17
Rotate Register A left through the CARRY FLAG: Register A = bit 3 SLINE, bit 2 TAB, bit 1 FFHARD, bit 0 ADDLF.
527F
LD (551BH),A 32 1B 55
Store Register A (the flags) at 551BH, the flag byte (IY +04H). The module tests bits 0-2; bit 3 is kept for the FORMS command.
5282
LD BC,0000H 01 00 00
Load Register Pair BC with the XLATE value, the operand at 5283H-5284H: 0000H in the file; X'aabb' gives Register B = aa, the character to change, and Register C = bb, the character it becomes.
5285
LD A,B 78
Copy Register B (the character to change) into Register A.
5286
LD (5518H),A 32 18 55
Store Register A (the character to change) at 5518H (IY +01H).
5289
LD A,C 79
Copy Register C (the character it becomes) into Register A.
528A
LD (5519H),A 32 19 55
Store Register A (the character it becomes) at 5519H (IY +02H).

528DH - The Memory for the Module

The module is 0125H (293) bytes, 5505H-5629H. When 4DF6H-4DF7H holds the address of the module of an earlier install, that memory is used again; else HIGH$ (4049H) is lowered by 0125H and the module goes just above the new HIGH$, its address kept in 4DF6H. The module's link word (5507H) gets the HIGH$ it had before, which is the module's last byte.

528D
LD HL,(4DF6H) 2A F6 4D
Load Register Pair HL with the word at 4DF6H-4DF7H: the address of the module of an earlier install, 0000H at boot.
5290
PUSH HL E5
Save Register Pair HL (that address) to the stack.
5291
INC HL 23
INCrement Register Pair HL to +01H of that module.
5292
INC HL 23
INCrement Register Pair HL to +02H, its link word. With 0000H this points at the ROM's 0002H, and the word read is not used.
5293
LD E,(HL) 5E
Load Register E with the low byte of the link word at Register Pair HL.
5294
INC HL 23
INCrement Register Pair HL to the high byte of the link word of the earlier module.
5295
LD D,(HL) 56
Load Register D with the high byte of the link word at Register Pair HL: Register Pair DE = the link word, the HIGH$ before the earlier install.
5296
POP HL E1
Restore Register Pair HL from the stack: the address from 4DF6H.
5297
LD A,H 7C
Copy Register H (the high byte of the address) into Register A.
5298
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG when 4DF6H held 0000H.
5299
LD BC,0125H 01 25 01
Load Register Pair BC with 0125H, the length of the module 5505H-5629H. LD does not change the flags.
529C
If the NZ FLAG is set (a module from an earlier install), JUMP to 52ADH to use its memory again.
529E
LD HL,(4049H) 2A 49 40
Load Register Pair HL with HIGH$ from 4049H-404AH, the highest address free for programs.
52A1
LD E,L 5D
Copy Register L (the low byte of HIGH$) into Register E.
52A2
LD D,H 54
Copy Register H (the high byte of HIGH$) into Register D: Register Pair DE = HIGH$ as it was.
52A3
XOR A AF
Set Register A to 00H (XOR A), which clears the CARRY FLAG for the SBC.
52A4
SBC HL,BC ED 42
Subtract Register Pair BC (0125H) from Register Pair HL (HIGH$).
52A6
LD (4049H),HL 22 49 40
Store Register Pair HL (the new HIGH$) at 4049H-404AH.
52A9
INC HL 23
INCrement Register Pair HL: the first byte above the new HIGH$, the module's address.
52AA
LD (4DF6H),HL 22 F6 4D
Store Register Pair HL (the module's address) at 4DF6H-4DF7H, where SYS6/SYS (SPOOL), SYS7/SYS (FORMS and PRTIME) and the next install find it.

52ADH - Moving the Module's Addresses

The module's link word gets the HIGH$ below which the module was put. The relocation table at 54E3H lists the 17 operands of the module that hold an address inside it; the distance from 5505H to the module's address is added to each. Then the 0125H bytes are copied.

52AD
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the module's address, Register Pair HL = the HIGH$ before it (on the path from 529CH, the earlier module's link word).
52AE
LD (5507H),HL 22 07 55
Store Register Pair HL at 5507H-5508H, the module's link word.
52B1
LD HL,5505H 21 05 55
Point Register Pair HL to 5505H, the start of the module in the file.
52B4
PUSH DE D5
Save Register Pair DE (the module's address) to the stack.
52B5
PUSH HL E5
Save Register Pair HL (5505H, the start of the module in the file) to the stack.
52B6
PUSH BC C5
Save Register Pair BC (0125H, the length) to the stack.
52B7
XOR A AF
Set Register A to 00H (XOR A), which clears the CARRY FLAG for the SBC.
52B8
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the module's address, Register Pair DE = 5505H.
52B9
SBC HL,DE ED 52
Subtract Register Pair DE (5505H) from Register Pair HL (the module's address): the distance the module moves.
52BB
LD B,H 44
Copy Register H (the high byte of the distance) into Register B.
52BC
LD C,L 4D
Copy Register L (the low byte) into Register C: Register Pair BC = the distance.
52BD
LD IX,54E3H DD 21 E3 54
Point Index Register IX to 54E3H, the relocation table.
52C1
LD A,11H 3E 11
Load Register A with 11H, the 17 entries of the table.
52C3
LD L,(IX+00H) DD 6E 00
Load Register L with the low byte of the entry at Index Register IX +00H.
52C6
INC IX DD 23
INCrement Index Register IX to the high byte.
52C8
LD H,(IX+00H) DD 66 00
Load Register H with the high byte of the entry at Index Register IX +00H: Register Pair HL = the address of an operand in the module.
52CB
INC IX DD 23
INCrement Index Register IX to the next entry.
52CD
LD E,(HL) 5E
Load Register E with the low byte of the operand at Register Pair HL.
52CE
INC HL 23
INCrement Register Pair HL to the operand's high byte.
52CF
LD D,(HL) 56
Load Register D with the high byte of the operand at Register Pair HL: Register Pair DE = the address in the operand.
52D0
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the address in the operand, Register Pair DE = where its high byte is.
52D1
ADD HL,BC 09
ADD Register Pair BC (the distance) to Register Pair HL: the address the operand must hold.
52D2
EX DE,HL EB
Exchange Register Pairs DE and HL back: Register Pair DE = the new address, Register Pair HL = where the operand's high byte is.
52D3
LD (HL),D 72
Store Register D (the high byte of the new address) at Register Pair HL.
52D4
DEC HL 2B
DECrement Register Pair HL to the operand's low byte.
52D5
LD (HL),E 73
Store Register E (the low byte of the new address) at Register Pair HL.
52D6
DEC A 3D
DECrement Register A, the count of the relocation entries left to do.
52D7
LOOP BACK to 52C3H until all 17 operands are changed.
52D9
POP BC C1
Restore Register Pair BC from the stack: 0125H, the length.
52DA
POP HL E1
Restore Register Pair HL from the stack: 5505H.
52DB
POP DE D1
Restore Register Pair DE from the stack: the module's address.
52DC
PUSH DE D5
Save Register Pair DE (the module's address) to the stack again.
52DD
LDIR ED B0
Copy Register Pair BC (0125H) bytes from Register Pair HL (5505H) to Register Pair DE (the module's address).

52DFH - Hooking the Module to the Device

Index Register IX = the device control block. When its driver is still the one the reset saved in PRSV$ (43BCH), it is first replaced by the module's own printer driver (module +3AH, 553FH). The 8 bytes of the block are then copied into the module (+08H, 550DH), and the module passes every request on through that copy; the block's address goes to module +10H (5515H), and the block's driver becomes the module itself, whose first instruction is JR 551EH.

52DF
POP BC C1
Restore Register Pair BC from the stack: the module's address.
52E0
POP IX DD E1
Restore Index Register IX from the stack: the device control block from FILTER, pushed at 5200H.
52E2
LD E,(IX+01H) DD 5E 01
Load Register E with +01H of the device control block at Index Register IX: the low byte of its driver's address.
52E5
LD D,(IX+02H) DD 56 02
Load Register D with +02H of the device control block at Index Register IX: Register Pair DE = its driver's address.
52E8
LD HL,(43BCH) 2A BC 43
Load Register Pair HL with PRSV$ from 43BCH-43BDH: the printer driver address the reset saved from 4026H.
52EB
XOR A AF
Set Register A to 00H (XOR A), which clears the CARRY FLAG for the SBC.
52EC
SBC HL,DE ED 52
Subtract Register Pair DE (the device's driver) from Register Pair HL (PRSV$): the Z FLAG when they are the same.
52EE
If the NZ FLAG is set (another driver, a spooler for one), JUMP to 52FAH and keep it.
52F0
LD HL,003AH 21 3A 00
Load Register Pair HL with 003AH, the offset of the module's printer driver (553FH less 5505H).
52F3
ADD HL,BC 09
ADD Register Pair BC (the module's address) to Register Pair HL: the address of the module's printer driver.
52F4
LD (IX+01H),L DD 75 01
Store Register L (the low byte) at +01H of the device control block at Index Register IX.
52F7
LD (IX+02H),H DD 74 02
Store Register H (the high byte) at +02H of the device control block at Index Register IX: its driver is now the module's printer driver, for the copy made next.
52FA
PUSH BC C5
Save Register Pair BC (the module's address) to the stack.
52FB
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the offset of the copy of the device control block in the module (550DH less 5505H).
52FE
ADD HL,BC 09
ADD Register Pair BC (the module's address) to Register Pair HL: the address of the copy.
52FF
PUSH HL E5
Save Register Pair HL (the copy's address) to the stack.
5300
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the copy's address.
5301
PUSH IX DD E5
Save Index Register IX (the device control block) to the stack.
5303
POP HL E1
Restore the word into Register Pair HL: Register Pair HL = the device control block.
5304
PUSH HL E5
Save Register Pair HL (the device control block) to the stack.
5305
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the length of a device control block.
5308
LDIR ED B0
Copy Register Pair BC (8) bytes from Register Pair HL (the device control block) to Register Pair DE (the copy in the module): the type, the driver, +03H-+05H and the name. Register Pair DE ends at module +10H.
530A
POP HL E1
Restore Register Pair HL from the stack: the device control block.
530B
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = module +10H (5515H), Register Pair DE = the device control block.
530C
LD (HL),E 73
Store Register E (the low byte of the device control block's address) at Register Pair HL.
530D
INC HL 23
INCrement Register Pair HL to module +11H, the high byte of the cell.
530E
LD (HL),D 72
Store Register D (the high byte) at Register Pair HL: module +10H-+11H holds the device control block, which SYS6/SYS (SPOOL) and SYS7/SYS (FORMS) read.
530F
POP BC C1
Restore Register Pair BC from the stack: the copy's address, module +08H.
5310
POP HL E1
Restore Register Pair HL from the stack: the module's address.
5311
LD (IX+01H),L DD 75 01
Store Register L (the low byte of the module's address) at +01H of the device control block at Index Register IX.
5314
LD (IX+02H),H DD 74 02
Store Register H (the high byte of the module's address) at +02H of the device control block at Index Register IX: the device's driver is now the module.

5317H - The Page in the Device Control Block

+03H of the device control block = PAGE (66 when not given), +04H, the count of the lines printed, = 1, and +05H = LINES (PAGE when not given), PAGE and LINES each plus 1. Unless SLINE=1, all three are made 1 less: 66, 0 and 66 with the defaults. The LINES value is not compared with PAGE.

5317
LD A,(54DBH) 3A DB 54
Load Register A with the low byte of PAGE from 54DBH: 42H (66) when not given.
531A
INC A 3C
INCrement Register A: PAGE plus 1, made 1 less again at 5336H unless SLINE=1.
531B
LD (IX+03H),A DD 77 03
Store Register A (PAGE plus 1) at +03H of the device control block at Index Register IX: the lines of a page.
531E
LD (IX+04H),01H DD 36 04 01
Store 01H at +04H of the device control block at Index Register IX: the count of the lines printed on the page.
5322
LD A,(54D9H) 3A D9 54
Load Register A with the low byte of LINES from 54D9H: FFH when not given (the cell holds FFFFH).
5325
INC A 3C
INCrement Register A: LINES plus 1, 00H when not given.
5326
AND A A7
Set the flags from Register A (AND A): the Z FLAG for 00H.
5327
If the NZ FLAG is set (LINES given, its low byte not FFH), JUMP to 532CH.
5329
LD A,(IX+03H) DD 7E 03
Load Register A with +03H of the device control block at Index Register IX: PAGE plus 1.
532C
LD (IX+05H),A DD 77 05
Store Register A at +05H of the device control block at Index Register IX: the lines printed before the rest of the page is skipped.
532F
LD HL,0000H 21 00 00
Load Register Pair HL with the SLINE value, the operand at 5330H-5331H where @PARAM stores it: 0000H in the file.
5332
LD A,H 7C
Copy Register H (the high byte of SLINE) into Register A.
5333
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG for SLINE 0.
5334
If the NZ FLAG is set (the word is not 0000H: SLINE 1), JUMP to 533FH and keep the values.
5336
DEC (IX+03H) DD 35 03
DECrement +03H of the device control block at Index Register IX: PAGE.
5339
DEC (IX+04H) DD 35 04
DECrement +04H of the device control block at Index Register IX: the line count 0.
533C
DEC (IX+05H) DD 35 05
DECrement +05H of the device control block at Index Register IX: LINES.

533FH - The Spooler and the End

When the spooler is installed (DFLAG$ bit 0), it is given the module's copy of the device control block: the word at +08H of the spooler's parameter block (whose address SYS6/SYS keeps at 4DF0H) is the address of the spooler's cell that holds the control block it gives the printer driver, and the copy's address goes there. Then @EXIT.

533F
LD HL,441FH 21 1F 44
Point Register Pair HL to 441FH, DFLAG$, the device flags, for the test of the spooler.
5342
BIT 0,(HL) CB 46
Test bit 0 of DFLAG$ at Register Pair HL: set while the spooler is installed.
5344
If the Z FLAG is set (no spooler), JUMP to 5354H.
5346
LD HL,(4DF0H) 2A F0 4D
Load Register Pair HL with the word at 4DF0H-4DF1H: the spooler's parameter block (its module +0AH), stored there by SYS6/SYS.
5349
LD DE,0008H 11 08 00
Load Register Pair DE with 0008H, the offset of a word in the spooler's parameter block.
534C
ADD HL,DE 19
ADD Register Pair DE (8) to Register Pair HL: +08H of the spooler's parameter block.
534D
LD A,(HL) 7E
Load Register A with the low byte of the word at Register Pair HL.
534E
INC HL 23
INCrement Register Pair HL to the high byte of the word at +08H of the spooler's parameter block.
534F
LD H,(HL) 66
Load Register H with the high byte of the word at Register Pair HL.
5350
LD L,A 6F
Copy Register A (the low byte) into Register L: Register Pair HL = the spooler's cell that holds the control block it gives the printer driver.
5351
LD (HL),C 71
Store Register C (the low byte of the copy's address, module +08H) at Register Pair HL.
5352
INC HL 23
INCrement Register Pair HL to the cell's high byte.
5353
LD (HL),B 70
Store Register B (the high byte of the copy's address) at Register Pair HL: the spooler now gives the printer driver the module's copy of the device control block.
5354
JUMP to 402DH, @EXIT: back to DOS with the filter installed.

5357H - Parameter Error

Error 2CH, Parameter error, displayed by @ERROR, then @ABORT.

5357
LD A,2CH 3E 2C
Load Register A with 2CH, the error number of Parameter error.
5359
OR C0H F6 C0
Set bits 7 and 6 of Register A (OR C0H): bit 7 makes @ERROR return here, bit 6 asks for the short message.
535B
GOSUB to 4409H, @ERROR, to display the message of the error number in Register A.
535E
JUMP to 5372H for @ABORT: the program ends after the message of the error.

5360H - The Refusals

Four entries load Register Pair HL with a message: 5360H, and 5364H, 5368H and 536CH inside LD IX instructions (on the way through, the DDH byte before each makes its LD HL an LD IX, so Register Pair HL keeps the message of the entry taken). @LOGOT displays the message and writes it to the job log, then @ABORT.

5360
LD HL,53DEH 21 DE 53
Point Register Pair HL to 53DEH, the message Device not active! (from 520DH). The LD IX instructions after it change only Index Register IX.
5363
LD IX,53F1H DD 21 F1 53
Load Index Register IX with 53F1H; nothing reads it. Entered at 5364H (from 5217H), the bytes 21 F1 53 are LD HL,53F1H: Register Pair HL = the message Not an output device!.
5367
LD IX,5407H DD 21 07 54
Load Index Register IX with 5407H; nothing reads it. Entered at 5368H (from 521FH), the bytes are LD HL,5407H: Register Pair HL = the message PR/FLT already active!.
536B
LD IX,541EH DD 21 1E 54
Load Index Register IX with 541EH; nothing reads it. Entered at 536CH (from 5212H), the bytes are LD HL,541EH: Register Pair HL = the message Device is routed!.
536F
GOSUB to 447BH, @LOGOT, to display the message at Register Pair HL up to its 0DH and write it to the job log.
5372
JUMP to 4030H, @ABORT: the program ends in error. 535EH comes here after Parameter error.

5375H - The Banner

Displayed by @DSPLY at 5207H: the name and version, a line feed, the copyright, a line feed, and 0DH, which ends the text.

5375-53A7
DEFM "PR/FLT - Generalized Printer Filter - Version 5.3.1" 50 52 2F 46 4C 54 20 2D 20 47 65 6E 65 72 61 6C 69 7A 65 64 20 50 72 69 6E 74 65 72 20 46 69 6C 74 65 72 20 2D 20 56 65 72 73 69 6F 6E 20 35 2E 33 2E 31
5375H-53A7H: the first line of the banner, the name and the version.
53A8
DEFB 0AH 0A
53A8H: 0AH, a line feed: the copyright goes on the next line.
53A9-53DB
DEFM "Copyright 1991, MISOSYS, Inc., All rights reserved" 43 6F 70 79 72 69 67 68 74 20 31 39 39 31 2C 20 4D 49 53 4F 53 59 53 2C 20 49 6E 63 2E 2C 20 20 41 6C 6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 64
53A9H-53DBH: the second line of the banner, the copyright.
53DC
DEFB 0AH 0A
53DCH: 0AH, a line feed after the copyright, before the 0DH that ends the text.
53DD
DEFB 0DH 0D
53DDH: 0DH, the end of the banner for @DSPLY.

53DEH - The Messages of the Refusals

Each ends with 0DH, where @LOGOT stops (536FH).

53DE-53EF
DEFM "Device not active!" 44 65 76 69 63 65 20 6E 6F 74 20 61 63 74 69 76 65 21
53DEH-53EFH: the message of 5360H, a NIL device (type byte bit 3, 520DH).
53F0
DEFB 0DH 0D
53F0H: 0DH, the end of the message Device not active!
53F1-5405
DEFM "Not an output device!" 4E 6F 74 20 61 6E 20 6F 75 74 70 75 74 20 64 65 76 69 63 65 21
53F1H-5405H: the message of 5364H, a device that takes no output (type byte bit 1 clear, 5217H).
5406
DEFB 0DH 0D
5406H: 0DH, the end of the message Not an output device!
5407-541C
DEFM "PR/FLT already active!" 50 52 2F 46 4C 54 20 61 6C 72 65 61 64 79 20 61 63 74 69 76 65 21
5407H-541CH: the message of 5368H, DFLAG$ bit 3 already set (521FH).
541D
DEFB 0DH 0D
541DH: 0DH, the end of the message PR/FLT already active!
541E-542E
DEFM "Device is routed!" 44 65 76 69 63 65 20 69 73 20 72 6F 75 74 65 64 21
541EH-542EH: the message of 536CH, a routed device (type byte bit 4, 5212H).
542F
DEFB 0DH 0D
542FH: 0DH, the end of the message Device is routed!

5430H - The Parameter Table

Read by @PARAM (5226H): 21 entries of a name of six characters (spaces after a short name) and the address where @PARAM stores the value: FFFFH for the name alone, the number or the X'hex' value after =, 0000H for =N or =OFF. A name must equal a whole entry, the spaces after it included: the short forms are L, P, C, I, A, F, T, X, M and SL, and PORT has none. The table ends with 00H.

5430-5435
DEFM "LINES " 4C 49 4E 45 53 20
5430H-5435H: entry 1 of the parameter table, the name LINES.
5436-5437
DEFW 54D9H D9 54
5436H-5437H: entry 1: 54D9H, where @PARAM stores the value of LINES: the LINES cell 54D9H-54DAH (5322H).
5438-543D
DEFM "L " 4C 20 20 20 20 20
5438H-543DH: entry 2 of the parameter table, the name L, the short form of LINES.
543E-543F
DEFW 54D9H D9 54
543EH-543FH: entry 2: 54D9H, where @PARAM stores the value of L: the LINES cell 54D9H-54DAH (5322H).
5440-5445
DEFM "PAGE " 50 41 47 45 20 20
5440H-5445H: entry 3 of the parameter table, the name PAGE.
5446-5447
DEFW 54DBH DB 54
5446H-5447H: entry 3: 54DBH, where @PARAM stores the value of PAGE: the PAGE cell 54DBH-54DCH (5317H).
5448-544D
DEFM "P " 50 20 20 20 20 20
5448H-544DH: entry 4 of the parameter table, the name P, the short form of PAGE.
544E-544F
DEFW 54DBH DB 54
544EH-544FH: entry 4: 54DBH, where @PARAM stores the value of P: the PAGE cell 54DBH-54DCH (5317H).
5450-5455
DEFM "CHARS " 43 48 41 52 53 20
5450H-5455H: entry 5 of the parameter table, the name CHARS.
5456-5457
DEFW 54DDH DD 54
5456H-5457H: entry 5: 54DDH, where @PARAM stores the value of CHARS: the CHARS cell 54DDH-54DEH (524DH).
5458-545D
DEFM "C " 43 20 20 20 20 20
5458H-545DH: entry 6 of the parameter table, the name C, the short form of CHARS.
545E-545F
DEFW 54DDH DD 54
545EH-545FH: entry 6: 54DDH, where @PARAM stores the value of C: the CHARS cell 54DDH-54DEH (524DH).
5460-5465
DEFM "INDENT" 49 4E 44 45 4E 54
5460H-5465H: entry 7 of the parameter table, the name INDENT.
5466-5467
DEFW 54DFH DF 54
5466H-5467H: entry 7: 54DFH, where @PARAM stores the value of INDENT: the INDENT cell 54DFH-54E0H (5259H).
5468-546D
DEFM "I " 49 20 20 20 20 20
5468H-546DH: entry 8 of the parameter table, the name I, the short form of INDENT.
546E-546F
DEFW 54DFH DF 54
546EH-546FH: entry 8: 54DFH, where @PARAM stores the value of I: the INDENT cell 54DFH-54E0H (5259H).
5470-5475
DEFM "ADDLF " 41 44 44 4C 46 20
5470H-5475H: entry 9 of the parameter table, the name ADDLF.
5476-5477
DEFW 527AH 7A 52
5476H-5477H: entry 9: 527AH, where @PARAM stores the value of ADDLF: 527AH-527BH, the operand of the LD BC at 5279H (527EH builds bit 0 of the flags from it).
5478-547D
DEFM "A " 41 20 20 20 20 20
5478H-547DH: entry 10 of the parameter table, the name A, the short form of ADDLF.
547E-547F
DEFW 527AH 7A 52
547EH-547FH: entry 10: 527AH, where @PARAM stores the value of A: 527AH-527BH, the operand of the LD BC at 5279H (527EH builds bit 0 of the flags from it).
5480-5485
DEFM "FFHARD" 46 46 48 41 52 44
5480H-5485H: entry 11 of the parameter table, the name FFHARD.
5486-5487
DEFW 5274H 74 52
5486H-5487H: entry 11: 5274H, where @PARAM stores the value of FFHARD: 5274H-5275H, the operand of the LD BC at 5273H (bit 1 of the flags).
5488-548D
DEFM "F " 46 20 20 20 20 20
5488H-548DH: entry 12 of the parameter table, the name F, the short form of FFHARD.
548E-548F
DEFW 5274H 74 52
548EH-548FH: entry 12: 5274H, where @PARAM stores the value of F: 5274H-5275H, the operand of the LD BC at 5273H (bit 1 of the flags).
5490-5495
DEFM "TAB " 54 41 42 20 20 20
5490H-5495H: entry 13 of the parameter table, the name TAB.
5496-5497
DEFW 526EH 6E 52
5496H-5497H: entry 13: 526EH, where @PARAM stores the value of TAB: 526EH-526FH, the operand of the LD BC at 526DH (bit 2 of the flags).
5498-549D
DEFM "T " 54 20 20 20 20 20
5498H-549DH: entry 14 of the parameter table, the name T, the short form of TAB.
549E-549F
DEFW 526EH 6E 52
549EH-549FH: entry 14: 526EH, where @PARAM stores the value of T: 526EH-526FH, the operand of the LD BC at 526DH (bit 2 of the flags).
54A0-54A5
DEFM "XLATE " 58 4C 41 54 45 20
54A0H-54A5H: entry 15 of the parameter table, the name XLATE.
54A6-54A7
DEFW 5283H 83 52
54A6H-54A7H: entry 15: 5283H, where @PARAM stores the value of XLATE: 5283H-5284H, the operand of the LD BC at 5282H (5518H and 5519H).
54A8-54AD
DEFM "X " 58 20 20 20 20 20
54A8H-54ADH: entry 16 of the parameter table, the name X, the short form of XLATE.
54AE-54AF
DEFW 5283H 83 52
54AEH-54AFH: entry 16: 5283H, where @PARAM stores the value of X: 5283H-5284H, the operand of the LD BC at 5282H (5518H and 5519H).
54B0-54B5
DEFM "MARGIN" 4D 41 52 47 49 4E
54B0H-54B5H: entry 17 of the parameter table, the name MARGIN.
54B6-54B7
DEFW 54E1H E1 54
54B6H-54B7H: entry 17: 54E1H, where @PARAM stores the value of MARGIN: the MARGIN cell 54E1H-54E2H (5253H).
54B8-54BD
DEFM "M " 4D 20 20 20 20 20
54B8H-54BDH: entry 18 of the parameter table, the name M, the short form of MARGIN.
54BE-54BF
DEFW 54E1H E1 54
54BEH-54BFH: entry 18: 54E1H, where @PARAM stores the value of M: the MARGIN cell 54E1H-54E2H (5253H).
54C0-54C5
DEFM "SLINE " 53 4C 49 4E 45 20
54C0H-54C5H: entry 19 of the parameter table, the name SLINE.
54C6-54C7
DEFW 5330H 30 53
54C6H-54C7H: entry 19: 5330H, where @PARAM stores the value of SLINE: 5330H-5331H, the operand of the LD HL at 532FH (also read at 525FH).
54C8-54CD
DEFM "SL " 53 4C 20 20 20 20
54C8H-54CDH: entry 20 of the parameter table, the name SL, the short form of SLINE.
54CE-54CF
DEFW 5330H 30 53
54CEH-54CFH: entry 20: 5330H, where @PARAM stores the value of SL: 5330H-5331H, the operand of the LD HL at 532FH (also read at 525FH).
54D0-54D5
DEFM "PORT " 50 4F 52 54 20 20
54D0H-54D5H: entry 21 of the parameter table, the name PORT.
54D6-54D7
DEFW 522DH 2D 52
54D6H-54D7H: entry 21: 522DH, where @PARAM stores the value of PORT: 522DH-522EH, the operand of the LD HL at 522CH (the port of the built-in driver).
54D8
DEFB 00H 00
54D8H: 00H, the end of the parameter table: @PARAM stops at a first byte of 00H.

54D9H - The Value Cells

@PARAM stores LINES, PAGE, CHARS, INDENT and MARGIN here (the other six go straight into operands of the installer). Only the low byte of each is used.

54D9-54DA
DEFW FFFFH FF FF
54D9H-54DAH: LINES: FFFFH, not given; 5322H uses PAGE then.
54DB-54DC
DEFW 0042H 42 00
54DBH-54DCH: PAGE: 0042H, 66 lines, when not given (5317H).
54DD-54DE
DEFW 0000H 00 00
54DDH-54DEH: CHARS: 0000H, no wrap, when not given (524DH).
54DF-54E0
DEFW 0000H 00 00
54DFH-54E0H: INDENT: 0000H when not given (5259H).
54E1-54E2
DEFW 0000H 00 00
54E1H-54E2H: MARGIN: 0000H when not given (5253H).

54E3H - The Relocation Table

17 words, each the address of an operand in the module that holds an address inside the module (the LD DE,550DH of the three routines that pass a request on, the LD IY,5517H, the JP Z,5609H and the 12 CALLs to routines of the module; the CALLs to the ROM are not moved). 52C3H adds the distance the module moves to each of them before the module is copied.

54E3-54E4
DEFW 552EH 2E 55
54E3H-54E4H: relocation entry 1: 552EH, the operand of the LD DE,550DH at 552DH.
54E5-54E6
DEFW 5525H 25 55
54E5H-54E6H: relocation entry 2: 5525H, the operand of the LD DE,550DH at 5524H.
54E7-54E8
DEFW 5538H 38 55
54E7H-54E8H: relocation entry 3: 5538H, the operand of the LD DE,550DH at 5537H.
54E9-54EA
DEFW 554AH 4A 55
54E9H-54EAH: relocation entry 4: 554AH, the operand of the CALL 5553H at 5549H.
54EB-54EC
DEFW 5562H 62 55
54EBH-54ECH: relocation entry 5: 5562H, the operand of the LD IY,5517H at 5560H.
54ED-54EE
DEFW 5566H 66 55
54EDH-54EEH: relocation entry 6: 5566H, the operand of the CALL 556DH at 5565H.
54EF-54F0
DEFW 559BH 9B 55
54EFH-54F0H: relocation entry 7: 559BH, the operand of the CALL NZ,5619H at 559AH.
54F1-54F2
DEFW 559EH 9E 55
54F1H-54F2H: relocation entry 8: 559EH, the operand of the CALL 5535H at 559DH.
54F3-54F4
DEFW 55AEH AE 55
54F3H-54F4H: relocation entry 9: 55AEH, the operand of the CALL 55DFH at 55ADH.
54F5-54F6
DEFW 55BAH BA 55
54F5H-54F6H: relocation entry 10: 55BAH, the operand of the CALL 5596H at 55B9H.
54F7-54F8
DEFW 55C9H C9 55
54F7H-54F8H: relocation entry 11: 55C9H, the operand of the CALL 5535H at 55C8H.
54F9-54FA
DEFW 55D8H D8 55
54F9H-54FAH: relocation entry 12: 55D8H, the operand of the CALL 5535H at 55D7H.
54FB-54FC
DEFW 55E0H E0 55
54FBH-54FCH: relocation entry 13: 55E0H, the operand of the CALL 55C0H at 55DFH.
54FD-54FE
DEFW 55FFH FF 55
54FDH-54FEH: relocation entry 14: 55FFH, the operand of the CALL 5535H at 55FEH.
54FF-5500
DEFW 5604H 04 56
54FFH-5500H: relocation entry 15: 5604H, the operand of the CALL 55C0H at 5603H.
5501-5502
DEFW 5624H 24 56
5501H-5502H: relocation entry 16: 5624H, the operand of the CALL 5535H at 5623H.
5503-5504
DEFW 5586H 86 55
5503H-5504H: relocation entry 17: 5586H, the operand of the JP Z,5609H at 5585H.

5505H - The Module: Its Header

The 0125H bytes 5505H-5629H are copied above HIGH$ (52DDH). The rows show them at their addresses in the file; the 17 operands that hold an address inside the module are moved by the same distance first (52ADH), so in memory every branch lands on the row it links to here. The module starts with the header of a module in high memory: JR over the header, the link word, the length of the name and the name $FF. The device control block's driver is the module's address, so a request to the device runs the JR.

5505
JUMP to 551EH, the entry for a request to the device. Its two bytes, 18H and 17H, are also the start of the module's header.
5507-5508
DEFW 0000H 00 00
5507H-5508H: module +02H-+03H, the link word, 0000H in the file: the HIGH$ the module was put above (52AEH), which is its last byte.
5509
DEFB 03H 03
5509H: module +04H, 03H, the length of the module's name.
550A-550C
DEFM "$FF" 24 46 46
550AH-550CH: module +05H-+07H, the module's name $FF.

550DH - The Copy of the Device Control Block

Module +08H-+11H, not in the file: written by the installer (5308H, 530CH). The filter passes every request on through this copy.

550D-5514
DEFS 8
550DH-5514H: not in the file. Module +08H-+0FH: the copy of the 8 bytes of the device control block (5308H): +00H the type, +01H-+02H the driver the filter passes requests to (the driver the device had, or the module's printer driver at 553FH), +03H-+05H the page values from before the install, +06H-+07H the device's name. 5524H, 552DH and 5537H point Register Pair DE at it, and a spooler installed before PR/FLT is given its address (5351H).
5515-5516
DEFS 2
5515H-5516H: not in the file. Module +10H-+11H: the address of the device control block (530CH), read by SYS6/SYS (SPOOL) and SYS7/SYS (FORMS).

5517H - The Parameter Block

Module +12H-+18H: seven bytes the filter reads with Index Register IY = 5517H (5560H), written by the installer (524DH-528AH) and by the FORMS command of SYS7/SYS.

5517
DEFB 00H 00
5517H: IY +00H, the column: the bytes printed on the line since its start, the margin not counted; 00H at the start of a line (55DAH).
5518
DEFB 00H 00
5518H: IY +01H, the character XLATE changes (5286H); 00H in the file.
5519
DEFB 00H 00
5519H: IY +02H, the character it becomes (528AH); 00H in the file.
551A
DEFB 00H 00
551AH: IY +03H, INDENT: the spaces at the start of a wrapped line (525CH).
551B
DEFB 00H 00
551BH: IY +04H, the flags (527FH): bit 0 ADDLF, bit 1 FFHARD, bit 2 TAB, bit 3 SLINE.
551C
DEFB 00H 00
551CH: IY +05H, CHARS: the bytes on a line, 00H no wrap (5250H).
551D
DEFB 00H 00
551DH: IY +06H, MARGIN: the spaces of the left margin (5256H).

551EH - The Entry for a Request

The device's driver. The ROM's device routine (03C2H) comes here with Index Register IX = the device control block, Register C = the byte, Register A = the request bit (01H, 02H or 04H) and the flags: the CARRY FLAG for a byte to read, the Z FLAG for a byte to send, neither for a control request. A read and a control request are passed on unchanged through the copy of the device control block at 550DH; a byte to send goes to 555EH. SYSTEM (PRTIME) of SYS7/SYS takes the byte at module +19H, 551EH, as the offset of a time out byte; here it is 38H, the code of JR C, and points at 553DH.

551E
If the CARRY FLAG is set (a byte to read), JUMP to 552CH. This byte, 38H at module +19H, is what SYSTEM (PRTIME) takes as the offset of a time out byte: PRTIME stores 1BH or 00H at module +38H, 553DH.
5520
If the Z FLAG is set (a byte to send), JUMP to 555EH.
5522
LD A,C 79
Copy Register C (the control byte) into Register A for the ROM's 0023H.
5523
PUSH DE D5
Save Register Pair DE (the caller's) to the stack.
5524
LD DE,550DH 11 0D 55
Point Register Pair DE to 550DH, the module's copy of the device control block (the operand is moved with the module).
5527
GOSUB to 0023H, the ROM's control request, to pass Register A to the driver of the copy at Register Pair DE.
552A
POP DE D1
Restore Register Pair DE (the caller's) from the stack.
552B
RET C9
RETurn with Register A and the flags the driver behind the filter returned.

552CH - A Byte to Read

Passed on through the copy of the device control block.

552C
PUSH DE D5
Save Register Pair DE (the caller's) to the stack.
552D
LD DE,550DH 11 0D 55
Point Register Pair DE to 550DH, the module's copy of the device control block (moved with the module).
5530
GOSUB to 0013H, the ROM's read request, to read a byte from the driver of the copy at Register Pair DE into Register A.
5533
POP DE D1
Restore Register Pair DE (the caller's) from the stack.
5534
RET C9
RETurn with Register A and the flags the driver behind the filter returned.

5535H - Send a Byte On

Sends Register C to the driver behind the filter through the copy of the device control block: every byte the filter prints goes through here. SYSTEM (PRTIME) of SYS7/SYS writes over the POP DE at 553DH (551EH), so after PRTIME this routine returns to the saved Register Pair DE instead of its caller.

5535
LD A,C 79
Copy Register C (the byte to send) into Register A for the ROM's 001BH.
5536
PUSH DE D5
Save Register Pair DE (the caller's) to the stack.
5537
LD DE,550DH 11 0D 55
Point Register Pair DE to 550DH, the module's copy of the device control block (moved with the module).
553A
GOSUB to 001BH, the ROM's send request, to send Register A to the driver of the copy at Register Pair DE.
553D
POP DE D1
Restore Register Pair DE (the caller's) from the stack. PRTIME=ON stores 1BH (DEC DE) here and PRTIME=OFF 00H (NOP): either way the saved Register Pair DE stays on the stack and the RET takes it as its return address.
553E
RET C9
RETurn to the caller with the flags of the driver behind the filter.

553FH - The Built-In Printer Driver

Module +3AH. The installer makes it the driver of the copy of the device control block when the device's driver was PRSV$ (52E8H). A byte to send waits until the printer can take it and is stored at 37E8H, the printer address of the Model I (or sent to the port of PORT=n); a byte to read gives 00H; a control request with Register C = 00H gives the printer's status, any other 00H. The wait at 5549H has no time out.

553F
If the Z FLAG is set (a byte to send), JUMP to 5549H.
5541
If the CARRY FLAG is set (a byte to read), JUMP to 5547H: the printer gives nothing.
5543
LD A,C 79
Copy Register C (the control byte) into Register A.
5544
OR A B7
Set the flags from Register A (OR A): the Z FLAG for control byte 00H, the status request.
5545
If the Z FLAG is set (00H), JUMP to 5553H to RETurn the status.
5547
XOR A AF
Set Register A to 00H (XOR A) with the Z FLAG: no byte and no error. 5541H and the other control bytes come here.
5548
RET C9
RETurn with Register A = 00H and the Z FLAG: no byte read, or the control request done.
5549
GOSUB to 5553H for the printer's status: the Z FLAG when it can take a byte (the operand is moved with the module).
554C
If the NZ FLAG is set (not ready), LOOP BACK to 5549H and read the status again.
554E
LD A,C 79
Copy Register C (the byte to send) into Register A.
554F
LD (37E8H),A 32 E8 37
Store Register A (the byte) at 37E8H, the printer. PORT=n makes these three bytes OUT (n),A and NOP (5244H).
5552
RET C9
RETurn with the Z FLAG from 5553H: the byte is sent.

5553H - The Printer's Status

Reads 37E8H, or the port of PORT=n, and keeps bits 7-4. The Z FLAG for 30H (bits 7 and 6, busy and out of paper, clear; bits 5 and 4 set), the ready status the ROM's own driver waits for (05D1H), and for F0H, all four set, which is taken as no printer attached: the byte is then written at once instead of waited on, so the computer does not hang.

5553
LD A,(37E8H) 3A E8 37
Load Register A with the status at 37E8H, the printer. PORT=n makes these three bytes IN A,(n) and NOP (523CH).
5556
AND F0H E6 F0
Keep bits 7-4 of Register A (AND F0H), the status bits.
5558
CP F0H FE F0
Compare Register A against F0H, all four status bits set.
555A
RET Z C8
If the Z FLAG is set (F0H, taken as no printer), RETurn with the Z FLAG: the byte is then written at once, without a wait.
555B
CP 30H FE 30
Compare Register A against 30H, the ready status.
555D
RET C9
RETurn with the status bits in Register A: the Z FLAG when the printer is ready.

555EH - A Byte to Send

Index Register IY = 5517H, the parameter block, while the filter at 556DH runs. The return is always the Z FLAG with the CARRY FLAG clear and Register A as it came: a result of the driver behind the filter is not passed back.

555E
PUSH IY FD E5
Save Index Register IY (the caller's) to the stack.
5560
LD IY,5517H FD 21 17 55
Point Index Register IY to 5517H, the parameter block (the operand is moved with the module).
5564
PUSH AF F5
Save Register Pair AF (Register A = 02H, the request bit, and the flags) to the stack.
5565
GOSUB to 556DH to filter and send the byte in Register C (moved with the module).
5568
POP AF F1
Restore Register Pair AF from the stack: Register A as it came.
5569
CP A BF
Compare Register A with itself (CP A): the Z FLAG set and the CARRY FLAG clear, the byte is taken.
556A
POP IY FD E1
Restore Index Register IY (the caller's) from the stack.
556C
RET C9
RETurn to the ROM's device routine with the Z FLAG.

556DH - The Filter

XLATE first; then 0DH and 0AH end a line (55DFH), 0CH skips to the next page (55ECH), 06H sets the line count to the start of a page (5609H, the manual's LPRINT CHR$(6)), 09H is expanded when TAB is on, the other bytes below 20H are sent as they are, and a printable byte goes to 5596H. 0DH and 0AH both count as a line, so a 0DH 0AH pair counts two.

556D
LD A,(IY+01H) FD 7E 01
Load Register A with Index Register IY +01H (5518H), the character XLATE changes.
5570
CP C B9
Compare Register A against Register C, the byte to send.
5571
If the NZ FLAG is set (another byte), JUMP to 5576H.
5573
LD C,(IY+02H) FD 4E 02
Load Register C with Index Register IY +02H (5519H), the character it becomes.
5576
LD A,C 79
Copy Register C (the byte, changed by XLATE or not) into Register A for the tests.
5577
CP 0DH FE 0D
Compare Register A against 0DH, a carriage return.
5579
If the Z FLAG is set (0DH), JUMP to 55DFH to end the line.
557B
CP 0AH FE 0A
Compare Register A (the byte) against 0AH, a line feed, the other byte that ends a line.
557D
If the Z FLAG is set (0AH), JUMP to 55DFH to end the line.
557F
CP 0CH FE 0C
Compare Register A (the byte) against 0CH, a form feed, the end of a page.
5581
If the Z FLAG is set (0CH), JUMP to 55ECH to skip to the next page.
5583
CP 06H FE 06
Compare Register A against 06H, the code for the start of a page.
5585
If the Z FLAG is set (06H), JUMP to 5609H to set the line count to the start of a page (the operand is moved with the module).
5588
BIT 2,(IY+04H) FD CB 04 56
Test bit 2 of Index Register IY +04H (551BH), the flags: TAB is on when it is set.
558C
If the Z FLAG is set (no TAB), JUMP to 5592H.
558E
CP 09H FE 09
Compare Register A (the byte) against 09H, a tab.
5590
If the Z FLAG is set (09H), JUMP to 560EH to send spaces to the next tab column.
5592
CP 20H FE 20
Compare Register A (the byte) against 20H, a space: the CARRY FLAG for a control code.
5594
If the CARRY FLAG is set (below 20H), JUMP to 5535H to send it as it is, not counted in the column.

5596H - A Printable Byte

At the start of a line the margin comes first (5619H). The byte is sent and the column counted. With CHARS, a line that has CHARS bytes is ended at once (55DFH) and the next one starts with INDENT spaces, sent through 5596H itself, so they are counted and wrapped too: an INDENT not below CHARS wraps again and again with no end. With INDENT 0, a line of exactly CHARS bytes followed by 0DH gets an empty line, since the 0DH then comes at column 0 (55C0H).

5596
LD A,(IY+06H) FD 7E 06
Load Register A with Index Register IY +06H (551DH), MARGIN.
5599
AND A A7
Set the flags from Register A (AND A): the Z FLAG for no margin.
559A
If the NZ FLAG is set (a margin), GOSUB to 5619H, which sends the margin when the column is 0 (moved with the module).
559D
GOSUB to 5535H to send the byte in Register C (moved with the module).
55A0
INC (IY+00H) FD 34 00
INCrement Index Register IY +00H (5517H), the column: one more byte on the line.
55A3
LD A,(IY+05H) FD 7E 05
Load Register A with Index Register IY +05H (551CH), CHARS, the bytes on a line.
55A6
AND A A7
Set the flags from Register A (AND A): the Z FLAG for 00H, no wrap.
55A7
RET Z C8
If the Z FLAG is set (no wrap), RETurn to the caller with the byte sent.
55A8
DEC A 3D
DECrement Register A: CHARS less 1, compared with the column next.
55A9
CP (IY+00H) FD BE 00
Compare Register A (CHARS less 1) against Index Register IY +00H, the column: the NO CARRY FLAG while the column is not above it.
55AC
RET NC D0
If the NO CARRY FLAG is set (the line has room), RETurn.
55AD
GOSUB to 55DFH to end the line and count it (moved with the module).
55B0
LD A,(IY+03H) FD 7E 03
Load Register A with Index Register IY +03H (551AH), INDENT.
55B3
AND A A7
Set the flags from Register A (AND A): the Z FLAG for no indent.
55B4
RET Z C8
If the Z FLAG is set (no indent), RETurn to the caller with the line ended.

55B5H - Send Spaces

Register A spaces through 5596H, which counts them in the column and applies the margin and the wrap: the INDENT after a wrap (55B0H) and the spaces of a tab (560EH).

55B5
PUSH BC C5
Save Register Pair BC to the stack: Register C is the byte on the way from 560EH, and 0DH or 0AH after a wrap.
55B6
LD B,A 47
Copy Register A (the number of spaces) into Register B.
55B7
LD C,20H 0E 20
Load Register C with 20H, a space, the byte 5596H prints each time.
55B9
GOSUB to 5596H to print the space (moved with the module).
55BC
DECrement Register B (the spaces left) and LOOP BACK to 55B7H until they are sent.
55BE
POP BC C1
Restore Register Pair BC from the stack, as it was at 55B5H.
55BF
RET C9
RETurn to the caller with the spaces in Register A sent.

55C0H - The End of a Line

With ADDLF a carriage return and a line feed; else a carriage return when the column is not 0 and a line feed when it is (an empty line, the manual's LPRINT with no arguments). The column is set to 0. Register C is changed.

55C0
BIT 0,(IY+04H) FD CB 04 46
Test bit 0 of Index Register IY +04H (551BH), the flags: ADDLF is on when it is set.
55C4
If the Z FLAG is set (no ADDLF), JUMP to 55CDH.
55C6
LD C,0DH 0E 0D
Load Register C with 0DH, a carriage return, the first byte of the pair.
55C8
GOSUB to 5535H to send it (moved with the module).
55CB
JUMP to 55D5H for the line feed after the carriage return.
55CD
LD A,(IY+00H) FD 7E 00
Load Register A with Index Register IY +00H (5517H), the column.
55D0
AND A A7
Set the flags from Register A (AND A): the Z FLAG at column 0.
55D1
LD C,0DH 0E 0D
Load Register C with 0DH, a carriage return. LD does not change the flags.
55D3
If the NZ FLAG is set (something on the line), JUMP to 55D7H to send the carriage return.
55D5
LD C,0AH 0E 0A
Load Register C with 0AH, a line feed: after the carriage return of ADDLF, or for an empty line.
55D7
GOSUB to 5535H to send Register C (moved with the module).
55DA
LD (IY+00H),00H FD 36 00 00
Store 00H at Index Register IY +00H (5517H): the column of a new line, 0.
55DE
RET C9
RETurn to the caller with the line ended and Register C changed.

55DFH - A Line Ended: the Count

The line is ended and counted in +04H of the device control block at Index Register IX. When the count reaches +05H (LINES), the rest of the page is skipped (55ECH).

55DF
GOSUB to 55C0H to end the line (moved with the module).
55E2
INC (IX+04H) DD 34 04
INCrement +04H of the device control block at Index Register IX, the lines printed on the page.
55E5
LD A,(IX+04H) DD 7E 04
Load Register A with +04H of the device control block at Index Register IX, the count.
55E8
CP (IX+05H) DD BE 05
Compare Register A (the count) against +05H of the device control block at Index Register IX, LINES: the CARRY FLAG while the count is below it.
55EB
RET C D8
If the CARRY FLAG is set (the page is not full), RETurn to the caller.

55ECH - The Rest of the Page

PAGE (+03H of the device control block) less the count: one 0CH with FFHARD, else that many line ends, which are not counted; then the count is set to the start of a page. A 0CH sent to the device comes here from anywhere on a line (5581H); with FFHARD the column is then left as it was. With LINES above PAGE the difference is taken modulo 256: up to 255 line ends.

55EC
LD A,(IX+03H) DD 7E 03
Load Register A with +03H of the device control block at Index Register IX, PAGE.
55EF
SUB (IX+04H) DD 96 04
Subtract +04H of the device control block at Index Register IX, the count, from Register A (PAGE): the lines left on the page.
55F2
If the Z FLAG is set (no lines left), JUMP to 5609H to set the count to the start of a page.
55F4
PUSH BC C5
Save Register Pair BC to the stack: Register C is 0CH on the way from 5581H, and 0DH or 0AH from 55DFH.
55F5
LD B,A 47
Copy Register A (the lines left) into Register B.
55F6
BIT 1,(IY+04H) FD CB 04 4E
Test bit 1 of Index Register IY +04H (551BH), the flags: FFHARD is on when it is set.
55FA
If the Z FLAG is set (no FFHARD), JUMP to 5603H for line ends.
55FC
LD C,0CH 0E 0C
Load Register C with 0CH, a form feed, sent to the printer for the rest of the page.
55FE
GOSUB to 5535H to send it (moved with the module).
5601
JUMP to 5608H, past the line ends, to restore Register Pair BC.
5603
GOSUB to 55C0H to send a line end (moved with the module).
5606
DECrement Register B (the lines left) and LOOP BACK to 5603H until the page is done.
5608
POP BC C1
Restore Register Pair BC from the stack, as it was at 55F4H.
5609
LD (IX+04H),01H DD 36 04 01
Store 01H at +04H of the device control block at Index Register IX: the count at the start of a page. 526AH writes the operand at 560CH: 00H, or 01H with SLINE=1. 5585H (06H) and 55F2H come here.
560D
RET C9
RETurn to the caller with the count set to the start of a page.

560EH - A Tab

8 less the column modulo 8 spaces (1-8), sent through 55B5H.

560E
LD A,(IY+00H) FD 7E 00
Load Register A with Index Register IY +00H (5517H), the column.
5611
AND 07H E6 07
Keep bits 2-0 of Register A (AND 07H): the column modulo 8.
5613
SUB 08H D6 08
Subtract 08H from Register A (the column modulo 8): a value from F8H to FFH.
5615
NEG ED 44
Negate Register A (NEG): 8 less the column modulo 8, the spaces to the next multiple of 8.
5617
JUMP to 55B5H to send the number of spaces in Register A.

5619H - The Margin

Register A (MARGIN) spaces, only at column 0, sent through 5535H, so they are not counted in the column.

5619
PUSH BC C5
Save Register Pair BC (Register C the byte to print) to the stack.
561A
LD B,A 47
Copy Register A (MARGIN, the number of spaces) into Register B, the counter.
561B
LD A,(IY+00H) FD 7E 00
Load Register A with Index Register IY +00H (5517H), the column.
561E
AND A A7
Set the flags from Register A (AND A): the Z FLAG at column 0.
561F
If the NZ FLAG is set (not at the start of a line), JUMP to 5628H.
5621
LD C,20H 0E 20
Load Register C with 20H, a space, one byte of the margin.
5623
GOSUB to 5535H to send it (moved with the module).
5626
DECrement Register B (the spaces left) and LOOP BACK to 5621H until the margin is sent.
5628
POP BC C1
Restore Register Pair BC (Register C the byte to print) from the stack.
5629
RET C9
RETurn to 5596H, which then sends the byte in Register C.