DOSPLUS 3.5 for the Model I - SYS11/SYS Disassembled

Page Customization

Introduction/Summary

DOSPLUS 3.5 SYS11/SYS Disassembly - The Library Commands ASSIGN, FILTER, FORCE, JOIN and RESET (Model I)

SYS11/SYS is the third of the high overlays, which hold the library commands: it loads at 5200H, over the area 5200H-5BFFH that SYS0/SYS keeps for them, and holds FORCE (request code A3H), RESET (A4H), ASSIGN (A5H), JOIN (A6H) and FILTER (A7H). CMNDI@ takes these codes from SYS1/SYS's table of the library commands (51CEH, 51DAH, 51BAH, 51D2H and 51CDH) and passes them to the overlay request handler, which loads SYS11/SYS and calls routines 3 to 7 of its table at 5200H with Register Pair HL at the rest of the command line. No file of the diskette requests routine 2 (A2H). The file is a load module of 6 blocks, 1396 bytes, from 5200H to 5773H, with the transfer address 5200H; the work area after it holds the blocks of the command line fields and, at 5800H, the filter file's buffer. SYS11/SYS itself requests SYS7/SYS's routine 6 (66H, one command line field) for ASSIGN and SYS3/SYS's routine 6 (26H, the specification of an open file) for the device list.

The Parts of SYS11/SYS

AddressContents
5200H-520DHThe routine table (routines 2-7) and routine 2 (5200H, 520CH).
520EH-5374HFORCE and JOIN: the entry, the device list and routing a device (520EH, 5228H, 524CH, 52F2H).
5375H-539EHRESET (5375H).
539FH-5425HASSIGN: the fields, a copy of another driver, a driver program (539FH, 5409H, 540CH).
5426H-55A8HFILTER: the table from the file, the filter bit, MAP, reading the file (5426H, 54EBH, 5530H, 5549H).
55A9H-5704HThe helpers: hexadecimal and decimal output, the keyboard, spaces, resetting a device, the DCB table, a DCB of its own, a name, a file's specification, memory below HMEM$ (55AAH, 55CBH, 55E2H, 55F6H, 5607H, 5612H, 5655H, 5673H, 5699H, 56C2H, 56D8H, 56E6H).
5705H-5773HThe error exits, the texts, the evaluation blocks and FILTER's parameters (5705H, 5718H, 572AH).
5774H-58FFHThe work area after the file (5774H).

Devices, DCBs and the DCB Table

Each of the six character devices (0 @KI, 1 @DO, 2 @PR, 3 @RS, 4 @U1, 5 @U2) has an entry of 11 bytes in SYS0/SYS's DCB table (4369H): +00H its DCB's address, +02H its filter table, +04H the control block it is JOINed to, +06H and +08H the driver and type byte saved by FORCE or JOIN, +09H its name. A DCB starts with its type byte (bit 0 input, 1 output, 2 control, 3 NIL, 4 FORCE, 5 JOIN, 6 filter) and the address of its driver at +01H. @RS, @U1 and @U2, like drives 4-7 in DCTTBL, share SYS0/SYS's NIL block, whose driver address is FFFFH: before one of them is changed it gets 20 bytes of its own below HMEM$, made a NIL block (5673H). An entry is found from EVAL@'s flag byte of a field, bits 0-2 the number and bit 3 a drive (5699H).

FORCE and JOIN

The two commands share their code: FORCE enters with LD A,90H and JOIN inside the LD BC,A03EH that follows it, where the bytes read as LD A,A0H; the value is stored as the operand of an OR that later sets the device's type byte (520EH). Without fields they list the devices (5228H): $nn and @XX, the directions the device can do (< input, > output), then FORCE and the device or file it goes to, NIL, or the address of its driver, and for a JOINed device JOIN and the device or file it is linked to. With fields (52F2H), the source must be a device (2BH); it is reset first, and a destination that is the same device leaves it so. A file as the destination gets 288 bytes below HMEM$ for its buffer and control block and is opened by INIT@; a device gives its DCB through LOCDCB%. The source's driver and type are saved in its entry, its type byte loses its direction bits (so the ROM leaves its I/O to SYS0/SYS) and gains bit 7 with the FORCE or JOIN bit, and its DCB+01H points to the target (FORCE) or to the entry's +04H, which holds the target (JOIN).

RESET

RESET (5375H) undoes FORCE, JOIN and NIL for one device or for devices 0 to 5 (5612H): a file the device went to is closed and its block given back when it is the lowest one below HMEM$, the saved driver and type byte are put back. A filter stays.

ASSIGN

ASSIGN (539FH) takes its two fields one by one through SYS7/SYS's routine 6, so the rest of the line is left for a driver's parameters. The first must be a device or a drive (2BH); a device is reset first. With a file as the second field, the driver program is RUN (540CH) with Index Register IX at the first field's DCB or drive control table (one of its own), Index Register IY at its entry and Register Pair HL at its parameters; OVLYH$ is set to FFH because the program may load over SYS11/SYS. Otherwise both fields must be devices or both drives (2BH), the second must have a driver (29H), and its DCB (8 bytes) or drive control table (20 bytes) is copied over the first one's; a drive then has its NIL bit cleared and is logged at its next access.

FILTER

FILTER (5426H) needs a device (2FH, 2BH). With a file, the device's filter bit (bit 6 of the type byte) is cleared, its old table is given back when it is the lowest block below HMEM$, and the file is read (5549H): pairs old=new, each code two hexadecimal digits or a character in double or single quotation marks, separated by commas or ends of lines, with comments from a period to the end of a line. The table is built down from HMEM$, a count byte and up to 255 pairs, and its address goes to +02H of the entry. The filter is then switched on unless NO or OFF was given or the device has no table; MAP lists the table five pairs to a line (54EBH), printable codes quoted and the others in hexadecimal.

Differences from the Manual

RESET without a field resets the six devices only; the manual says all devices and disk drives, but the bytes never touch DCTTBL, and RESET with a drive is error 2BH. The manual's description of the second form of ASSIGN names the two fields the other way round from its own example (ASSIGN :5 :4) and from the bytes: the first field receives the second one's driver. FILTER also takes ON and OFF; ON and YES are stored into the file buffer and do nothing, since the filter is switched on anyway. A destination of FORCE or JOIN that is a drive is not refused: its number is taken as a device number. The directions of the two devices are not compared, as the manual warns.

In the filter file, spaces and comments are passed over even inside quotation marks (5584H), so neither a space nor a period can be given as a quoted code; a code such as 20H must be written in hexadecimal.

Variables

Self-Modified Operands and Data

Address
Size
Contents
5359H
1 byte
Type Bits
The operand of OR 00H at 5358H: 90H FORCE, A0H JOIN, stored by 5213H.
54D2H-54D3H
2 bytes
NO and OFF
The operand of LD DE,0000H at 54D1H.
54E6H-54E7H
2 bytes
MAP
The operand of LD DE,0000H at 54E5H.
55A9H
1 byte
Count of Pairs
55A9H

Work Area (5774H-58FFH)

Address
Size
Contents
5774H
1 byte
Source Flags
5774H
5775H-5794H
32 bytes
Source Block
5775H
5795H
1 byte
Destination Flags
5795H
5796H-57B5H
32 bytes
Destination Block
5796H
5800H-58FFH
256 bytes
Filter File Buffer
5800H

Outside Routines

AddressContents
4479HSYS0/SYS: EVAL@.
4420HSYS0/SYS: INIT@ (5332H).
4424HSYS0/SYS: OPEN@ (5486H).
4428HSYS0/SYS: CLOSE@ (5637H).
4433HSYS0/SYS: RUN@ (5423H).
4409HSYS0/SYS: ERROR@ (5715H).
4467HSYS0/SYS: DSPLY@.
4488HSYS0/SYS: LOCDCB% (5319H).
4934HSYS0/SYS: the 8 bit multiply (56ACH).
4525HSYS0/SYS: call the routine after the CALL with the registers saved.
0013HROM: input a byte from the control block at Register Pair DE.
002BHROM: scan the keyboard.
0033HROM: display the character in Register A.
0049HROM: wait for a key.

Disassembly

5200H - The Routine Table

Data: SYS11/SYS's table of routines 2-7, one word each, used by SYS0/SYS's overlay request handler (its 49C9H-49DCH) for the request codes A2H-A7H. CMNDI@ takes the codes of the library commands from SYS1/SYS's table: FORCE A3H (51CEH), RESET A4H (51DAH), ASSIGN A5H (51BAH), JOIN A6H (51D2H), FILTER A7H (51CDH). No file of the diskette requests A2H. The words for FORCE and JOIN point three bytes apart, into the same instruction (5210H).

5200-5201
DEFW 520CH 0C 52
Routine 2: 520CH, XOR A and RET, which SYS0/SYS's record locator requests when it loads SYS11/SYS back (its 4D55H-4D62H).
5202-5203
DEFW 520EH 0E 52
Routine 3: 520EH, FORCE, which loads Register A with 90H, the FORCE bits of a device's type byte.
5204-5205
DEFW 5375H 75 53
Routine 4: 5375H, RESET: the FORCE, JOIN and NIL settings of one device, or of devices 0-5, undone.
5206-5207
DEFW 539FH 9F 53
Routine 5: 539FH, ASSIGN: a driver program for a device or drive, or the driver of another one.
5208-5209
DEFW 5211H 11 52
Routine 6: 5211H, JOIN, the operand bytes of LD BC,A03EH at 5210H, which read as LD A,A0H when entered there.
520A-520B
DEFW 5426H 26 54
Routine 7: 5426H, FILTER: a table of character translations for a device, loaded from a file.

520CH - Routine 2

Nothing to do when SYS0/SYS's record locator brings SYS11/SYS back.

520C
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: routine 2 has no work to do.
520D
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH) with Register A = 00H.

520EH - FORCE and JOIN

Routines 3 (FORCE, 520EH) and 6 (JOIN, 5211H), entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. FORCE loads Register A with 90H and JOIN, entering inside the LD BC,A03EH, with A0H: the bits given to the device's type byte (bit 7 with bit 4 FORCE or bit 5 JOIN) go to 5359H, the operand of OR 00H at 5358H. EVAL@ then takes the command line with the block at 572AH. With no field at all, the six devices are listed with their settings (5228H); otherwise the device is routed (52F2H).

520E
LD A,90H 3E 90
Load Register A with 90H, the type bits of a FORCEd device: bit 7 and bit 4.
5210
LD BC,A03EH 01 3E A0
JOIN enters at 5211H inside this LD BC,A03EH: its bytes 3EH A0H read as LD A,A0H, the type bits of a JOINed device (bit 7 and bit 5); for FORCE the instruction only loads Register Pair BC.
5213
LD (5359H),A 32 59 53
Store Register A (90H for FORCE, A0H for JOIN) to 5359H, the operand of OR 00H at 5358H that sets the device's type byte.
5216
LD IX,572AH DD 21 2A 57
Point Index Register IX to 572AH, the evaluation block of FORCE and JOIN: source 5774H, destination and wildmask 5795H, no parameters (573CH).
521A
GOSUB to 4479H, EVAL@, to take the source and destination fields from the command line at Register Pair HL.
521D
If the NZ FLAG is set (an error in the command line), JUMP to 5713H to post the error in Register A.
5220
LD A,(IX+00H) DD 7E 00
Load Register A with the evaluation block's flags at Index Register IX+00H: bits 0-2 a source, a destination, a wildmask field.
5223
AND 07H E6 07
AND Register A with 07H, bits 0-2: the NZ FLAG when any field was given.
5225
If the NZ FLAG is set (a field), JUMP to 52F2H to route the device.

5228H - The Device List

FORCE or JOIN alone lists the six character devices, one line each: $nn, the device's number in two decimal digits, @ and its name, the directions it can do (< input, - , > output), then FORCE and the device or file it is routed to, NIL, or the address of its driver; a JOINed device adds JOIN and the device or file it is linked to.

5228
LD IY,4369H FD 21 69 43
Point Index Register IY to 4369H, the DCB table: six entries of 11 bytes, one for each character device.
522C
LD B,00H 06 00
Load Register B with 00H, the number of the first device, @KI.
522E
LD A,24H 3E 24
Load Register A with 24H, the dollar sign that starts each line of the list.
5230
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (24H).
5233
LD A,B 78
Load Register A with Register B, the number of the device.
5234
GOSUB to 55CBH to show the number in Register A as two decimal digits.
5237
GOSUB to 56D3H to show a space after the device number.
523A
GOSUB to 56C2H to show @, the device's two character name from the entry at Index Register IY, and a space.
523D
GOSUB to 524CH to show the device's directions and its driver, FORCE, NIL or JOIN.
5240
LD DE,000BH 11 0B 00
Load Register Pair DE with 000BH, the length of an entry of the DCB table.
5243
ADD IY,DE FD 19
ADD Register Pair DE (000BH) to Index Register IY: the next device's entry.
5245
LD A,05H 3E 05
Load Register A with 05H, the number of the last device, @U2.
5247
INC B 04
INCrement Register B by 1, the next device's number.
5248
CP B B8
Compare Register A (05H) against Register B: the NC FLAG while Register B is 5 or less.
5249
If the NC FLAG is set (a device is left), JUMP back to 522EH for its line.
524B
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.

524CH - One Device's Line

Index Register IY points to the device's entry in the DCB table, whose first word is the address of its DCB. The direction bits come from the DCB's type byte, or from the type saved at entry+08H while the device is NIL, FORCEd or JOINed. The registers are kept by SYS0/SYS's wrapper (4525H).

524C
GOSUB to 4525H, SYS0/SYS's wrapper, which saves the registers, runs the code after this CALL as a subroutine and restores them when it returns.
524F
LD E,(IY+00H) FD 5E 00
Load Register E with the low byte of the DCB's address from the entry at Index Register IY+00H.
5252
LD D,(IY+01H) FD 56 01
Load Register D with the high byte of the DCB's address from Index Register IY+01H.
5255
PUSH DE D5
Save Register Pair DE, the DCB's address, to the top of the stack.
5256
POP IX DD E1
Restore Index Register IX with the DCB's address from the top of the stack.
5258
LD A,(IX+00H) DD 7E 00
Load Register A with the DCB's type byte at Index Register IX+00H: bit 0 input, 1 output, 2 control, 3 NIL, 4 FORCE, 5 JOIN.
525B
LD C,A 4F
Load Register C with Register A, the type byte whose direction bits are shown.
525C
AND 38H E6 38
AND Register A with 38H, bits 3, 4 and 5: the NZ FLAG when the device is NIL, FORCEd or JOINed.
525E
If the Z FLAG is set (none of them), JUMP to 5263H with the device's own type in Register C.
5260
LD C,(IY+08H) FD 4E 08
Load Register C with the type byte saved at +08H of the entry at Index Register IY+08H, the device's own type.
5263
LD B,20H 06 20
Load Register B with 20H, the space shown for a direction the device does not have.
5265
LD A,3CH 3E 3C
Load Register A with 3CH, the < that shows that the device does input.
5267
BIT 0,C CB 41
Test bit 0 of Register C, the input bit of the type byte.
5269
If the NZ FLAG is set (input), JUMP to 526CH to show the <.
526B
LD A,B 78
Load Register A with Register B, a space (20H).
526C
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (< or a space).
526F
LD A,2DH 3E 2D
Load Register A with 2DH, the hyphen between the two directions.
5271
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (2DH).
5274
LD A,3EH 3E 3E
Load Register A with 3EH, the > that shows that the device does output.
5276
BIT 1,C CB 49
Test bit 1 of Register C, the output bit of the type byte.
5278
If the NZ FLAG is set (output), JUMP to 527BH to show the >.
527A
LD A,B 78
Load Register A with Register B, a space (20H).
527B
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (> or a space).
527E
LD A,B 78
Load Register A with Register B, a space (20H).
527F
GOSUB to 0033H, the ROM's display routine, to show the space in Register A.
5282
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of the DCB's type byte at Index Register IX+00H, the FORCE bit.
5286
If the Z FLAG is set (not FORCEd), JUMP to 5296H.
5288
LD HL,5718H 21 18 57
Point Register Pair HL to 5718H, the text FORCE.
528B
GOSUB to 4467H, DSPLY@, to show the text at Register Pair HL up to its 03H.
528E
LD L,(IX+01H) DD 6E 01
Load Register L with the low byte of DCB+01H at Index Register IX+01H: a FORCEd device's DCB+01H holds the control block it goes to.
5291
LD H,(IX+02H) DD 66 02
Load Register H with the high byte of DCB+02H at Index Register IX+02H.
5294
JUMP to 52CBH to show the device or file it is FORCEd to.
5296
BIT 3,(IX+00H) DD CB 00 5E
Test bit 3 of the DCB's type byte at Index Register IX+00H, the NIL bit.
529A
If the Z FLAG is set (not NIL), JUMP to 52A4H to show the driver's address.
529C
LD HL,5724H 21 24 57
Point Register Pair HL to 5724H, the text NIL.
529F
GOSUB to 4467H, DSPLY@, to show the text at Register Pair HL up to its 03H.
52A2
JUMP to 52B9H for the JOIN test of the NIL device.
52A4
LD L,(IX+01H) DD 6E 01
Load Register L with the low byte of the driver's address from DCB+01H at Index Register IX+01H.
52A7
LD H,(IX+02H) DD 66 02
Load Register H with the high byte of the driver's address from DCB+02H at Index Register IX+02H.
52AA
BIT 5,(IX+00H) DD CB 00 6E
Test bit 5 of the DCB's type byte at Index Register IX+00H, the JOIN bit: a JOINed DCB+01H points to the entry, not the driver.
52AE
If the Z FLAG is set (not JOINed), JUMP to 52B6H with the driver's address in Register Pair HL.
52B0
LD L,(IY+06H) FD 6E 06
Load Register L with the low byte of the driver saved at +06H of the entry at Index Register IY+06H.
52B3
LD H,(IY+07H) FD 66 07
Load Register H with the high byte of the saved driver at Index Register IY+07H.
52B6
GOSUB to 55AAH to show Register Pair HL, the driver's address, as four hexadecimal digits and H.
52B9
BIT 5,(IX+00H) DD CB 00 6E
Test bit 5 of the DCB's type byte at Index Register IX+00H, the JOIN bit.
52BD
If the Z FLAG is set (not JOINed), JUMP to 52EDH to end the line.
52BF
LD HL,571EH 21 1E 57
Point Register Pair HL to 571EH, the text JOIN with a space before it.
52C2
GOSUB to 4467H, DSPLY@, to show the text at Register Pair HL up to its 03H.
52C5
LD L,(IY+04H) FD 6E 04
Load Register L with the low byte of the linked control block from +04H of the entry at Index Register IY+04H.
52C8
LD H,(IY+05H) FD 66 05
Load Register H with the high byte of the linked control block at Index Register IY+05H.
52CB
GOSUB to 56D3H to show a space before the device or file.
52CE
LD A,(HL) 7E
Load Register A with the type byte of the control block at Register Pair HL, the device or file routed or linked to.
52CF
CP 80H FE 80
Compare Register A against 80H, the type of an open file control block.
52D1
If the Z FLAG is set (a file), JUMP to 52E0H to show its specification.
52D3
GOSUB to 5655H to look up the DCB at Register Pair HL in the DCB table: the Z FLAG with Index Register IY at its entry.
52D6
PUSH AF F5
Save Register Pair AF, the flags of the search, to the top of the stack.
52D7
If the NZ FLAG is set (not a device of the table), GOSUB to 55AAH to show the address in Register Pair HL in hexadecimal.
52DA
POP AF F1
Restore Register Pair AF, the flags of the search, from the top of the stack.
52DB
If the Z FLAG is set (a device of the table), GOSUB to 56C2H to show @ and its name from the entry at Index Register IY.
52DE
JUMP to 52EDH to end the line of the device list.
52E0
LD DE,5775H 11 75 57
Point Register Pair DE to 5775H, the source block's text, unused in the list, for a copy of the file control block.
52E3
PUSH DE D5
Save Register Pair DE (5775H) to the top of the stack.
52E4
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a file control block.
52E7
LDIR ED B0
Copy the file control block from Register Pair HL to Register Pair DE (5775H) by LDIR, with Register Pair BC as the count.
52E9
POP DE D1
Restore Register Pair DE (5775H) from the top of the stack.
52EA
GOSUB to 56D8H, which has SYS3/SYS put the specification back into the copy at Register Pair DE and shows it.
52ED
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the device's line.
52EF
JUMP to 0033H, the ROM's display routine, to show the character in Register A (0DH); its RETurn ends the line.

52F2H - Routing a Device

FORCE or JOIN with fields: both are needed (2FH), and the source must be a device (2BH). The source device is first reset (5612H); a destination that is the same device ends the command there (FORCE @PR @PR resets @PR). A destination with a name is a file: 288 bytes are taken below HMEM$ for its buffer and file control block and it is opened by INIT@; else it is a device and LOCDCB% gives its DCB. The source gets a DCB of its own if it shares the NIL block (5673H), its driver and type are saved in its entry (+06H, +08H), its type gets bit 7 and the FORCE or JOIN bit, and DCB+01H points to the target (FORCE) or to the entry's +04H, which holds the target (JOIN).

52F2
LD A,(IX+00H) DD 7E 00
Load Register A with the evaluation block's flags at Index Register IX+00H: bit 0 a source field, bit 1 a destination field.
52F5
CPL 2F
Invert every bit of Register A (CPL), so that bits 0 and 1 are set for the fields that are missing.
52F6
AND 03H E6 03
AND Register A with 03H, bits 0 and 1: the NZ FLAG when the source or the destination field is missing.
52F8
If the NZ FLAG is set (a field is missing), JUMP to 570BH to post error 2FH, I/o field not found.
52FB
LD A,(5774H) 3A 74 57
Load Register A with the flag byte of the source block at 5774H (bit 7 a device or a drive, bit 6 a name, bit 3 a drive, bits 0-2 the number).
52FE
LD E,A 5F
Load Register E with Register A, the source's flag byte, for 5612H and 5673H.
52FF
AND C8H E6 C8
AND Register A with C8H, bits 7, 6 and 3, which tell a device from a drive and a name.
5301
CP 80H FE 80
Compare Register A against 80H: the Z FLAG when only bit 7 is set, a device.
5303
If the NZ FLAG is set (a drive or a file), JUMP to 5705H to post error 2BH, Illegal devicespec.
5306
GOSUB to 5612H to reset the source device (number in Register E): any FORCE or JOIN is undone and a file it went to is closed.
5309
LD A,(5795H) 3A 95 57
Load Register A with the flag byte of the destination block at 5795H.
530C
XOR E AB
XOR Register A with Register E, the source's flag byte: the bits that differ.
530D
AND CFH E6 CF
AND Register A with CFH, every bit but bits 5 and 4: the Z FLAG when the destination is the source device itself.
530F
RET Z C8
If the Z FLAG is set (the same device), RETurn: the device stays reset.
5310
LD A,(5795H) 3A 95 57
Load Register A with the flag byte of the destination block at 5795H again.
5313
BIT 6,A CB 77
Test bit 6 of Register A, which EVAL@ sets for a field with a file name.
5315
If the NZ FLAG is set (a file), JUMP to 531EH to open it.
5317
AND 07H E6 07
AND Register A with 07H, bits 0-2: the device number of the destination (the drive bit is not tested).
5319
GOSUB to 4488H, LOCDCB%, to load Register Pair DE with the address of the DCB of device Register A.
531C
JUMP to 5338H with the destination's DCB in Register Pair DE.
531E
LD DE,57B5H 11 B5 57
Point Register Pair DE to 57B5H, the last byte of the destination block's text (5796H-57B5H).
5321
LD BC,0120H 01 20 01
Load Register Pair BC with 0120H, the 288 bytes of a sector buffer and a file control block.
5324
GOSUB to 56E6H to take Register Pair BC bytes below HMEM$: Register Pair HL returns the first byte of the block.
5327
PUSH HL E5
Save Register Pair HL, the start of the block, the file's buffer, to the top of the stack.
5328
DEC BC 0B
DECrement Register Pair BC by 1 to 011FH, the offset of the block's last byte.
5329
ADD HL,BC 09
ADD Register Pair BC (011FH) to Register Pair HL: the last byte of the block.
532A
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the last byte of the block, Register Pair HL = 57B5H.
532B
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of the destination's text.
532E
LDDR ED B8
Copy the text from 5796H-57B5H to the last 32 bytes of the block by LDDR (Register Pair HL down from 57B5H, Register Pair DE down from the block's end, Register Pair BC the count).
5330
INC DE 13
INCrement Register Pair DE by 1: the file control block at the start of the block's last 32 bytes, after the 256 byte buffer.
5331
POP HL E1
Restore Register Pair HL with the start of the block, the file's buffer, from the top of the stack.
5332
GOSUB to 4420H, INIT@, to open or create the file at Register Pair DE with the buffer at Register Pair HL; Register B is 00H (256) after the LDDR.
5335
If the NZ FLAG is set (INIT@ failed), JUMP to 5713H to post the error in Register A.
5338
PUSH DE D5
Save Register Pair DE, the target's DCB or file control block, to the top of the stack.
5339
LD A,(5774H) 3A 74 57
Load Register A with the flag byte of the source block at 5774H.
533C
LD E,A 5F
Load Register E with Register A, the source's flag byte, for 5673H.
533D
GOSUB to 5673H to point Index Register IX to the source's DCB, given one of its own when it shares the NIL block, and Index Register IY to its entry.
5340
LD A,(IX+00H) DD 7E 00
Load Register A with the source DCB's type byte at Index Register IX+00H.
5343
LD E,(IX+01H) DD 5E 01
Load Register E with the low byte of the source's driver address from DCB+01H at Index Register IX+01H.
5346
LD D,(IX+02H) DD 56 02
Load Register D with the high byte of the driver address from DCB+02H at Index Register IX+02H.
5349
LD (IY+06H),E FD 73 06
Store Register E, the low byte of the driver, to +06H of the entry at Index Register IY+06H, the saved driver.
534C
LD (IY+07H),D FD 72 07
Store Register D, the high byte of the driver, to +07H of the entry at Index Register IY+07H.
534F
LD (IY+08H),A FD 77 08
Store Register A, the device's own type byte, to +08H of the entry at Index Register IY+08H, the saved type.
5352
POP DE D1
Restore Register Pair DE, the target's DCB or file control block, from the top of the stack.
5353
LD A,(IX+00H) DD 7E 00
Load Register A with the source DCB's type byte at Index Register IX+00H.
5356
AND F8H E6 F8
AND Register A with F8H to clear bits 0-2: the ROM's 03C2H then finds no direction bit and leaves the I/O to SYS0/SYS through 4033H.
5358
OR 00H F6 00
OR Register A with the operand at 5359H (00H in the file): 90H for FORCE, A0H for JOIN, stored by 5213H.
535A
LD (IX+00H),A DD 77 00
Store Register A to the source DCB's type byte at Index Register IX+00H.
535D
AND 20H E6 20
AND Register A with 20H, bit 5, the JOIN bit: the NZ FLAG for JOIN.
535F
If the Z FLAG is set (FORCE), JUMP to 536EH: DCB+01H gets the target itself.
5361
LD (IY+04H),E FD 73 04
JOIN: store Register E, the low byte of the target, to +04H of the entry at Index Register IY+04H, the linked control block.
5364
LD (IY+05H),D FD 72 05
Store Register D, the high byte of the target, to +05H of the entry at Index Register IY+05H.
5367
PUSH IY FD E5
Save Index Register IY, the entry, to the top of the stack.
5369
POP DE D1
Restore Register Pair DE with the entry's address from the top of the stack.
536A
INC DE 13
INCrement Register Pair DE by 1, the first of four.
536B
INC DE 13
INCrement Register Pair DE by 1 again, the second time.
536C
INC DE 13
INCrement Register Pair DE by 1 again, the third time.
536D
INC DE 13
INCrement Register Pair DE by 1 again: Register Pair DE = +04H of the entry, which SYS0/SYS's JOIN code reads (its 44F8H).
536E
LD (IX+01H),E DD 73 01
Store Register E to DCB+01H at Index Register IX+01H: the target (FORCE) or the entry's +04H (JOIN).
5371
LD (IX+02H),D DD 72 02
Store Register D to DCB+02H at Index Register IX+02H.
5374
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.

5375H - RESET

Routine 4, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. EVAL@ takes the command line with the block at 5733H, whose three blocks are all 5774H. A source must be a device (2BH: a drive cannot be RESET), which is reset by 5612H; without one, devices 0-5 are reset in turn. The drives are not touched.

5375
LD IX,5733H DD 21 33 57
Point Index Register IX to 5733H, the evaluation block of RESET: source, destination and wildmask all 5774H, no parameters (573CH).
5379
GOSUB to 4479H, EVAL@, to take the device field from the command line at Register Pair HL.
537C
If the NZ FLAG is set (an error in the command line), JUMP to 5713H to post the error in Register A.
537F
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a field was given.
5383
If the Z FLAG is set (no field), JUMP to 5393H to reset every device.
5385
LD A,(5774H) 3A 74 57
Load Register A with the flag byte of the block at 5774H (bit 7 a device or drive, bit 6 a name, bit 3 a drive, bits 0-2 the number).
5388
LD E,A 5F
Load Register E with Register A, the flag byte, for 5612H.
5389
AND C8H E6 C8
AND Register A with C8H, bits 7, 6 and 3, which tell a device from a drive and a name.
538B
CP 80H FE 80
Compare Register A against 80H: the Z FLAG when the field is a device.
538D
If the NZ FLAG is set (a drive or a file), JUMP to 5705H to post error 2BH, Illegal devicespec.
5390
JUMP to 5612H to reset the device in Register E; its RETurn ends RESET.
5393
LD E,00H 1E 00
Load Register E with 00H, the first device, @KI.
5395
GOSUB to 5612H to reset the device in Register E.
5398
LD A,05H 3E 05
Load Register A with 05H, the last device, @U2.
539A
INC E 1C
INCrement Register E by 1, the number of the next device to reset.
539B
CP E BB
Compare Register A (05H) against Register E: the NC FLAG while Register E is 5 or less.
539C
If the NC FLAG is set (a device is left), JUMP back to 5395H to reset it.
539E
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.

539FH - ASSIGN

Routine 5, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. The two fields are taken one by one by SYS7/SYS's routine 6 (request 66H), not by EVAL@, so the rest of the line stays for a driver's parameters. The first must be a device or a drive (2BH); a device is reset first. A second field with a name is a driver program: it is RUN with Index Register IX at the first field's DCB and Register Pair HL at the rest of the line (540CH). Otherwise the second field must be of the same kind as the first (2BH) and have a driver (29H), and its DCB (8 bytes) or drive control table (20 bytes) is copied over the first one's; a drive gets its NIL bit cleared and is logged again.

539F
LD DE,5774H 11 74 57
Point Register Pair DE to 5774H, the source block, for the first field.
53A2
GOSUB to 5409H to have SYS7/SYS's routine 6 take one field from the command line at Register Pair HL into the block at Register Pair DE.
53A5
If the NZ FLAG is set (no valid field), JUMP to 5705H to post error 2BH, Illegal devicespec.
53A8
LD DE,5795H 11 95 57
Point Register Pair DE to 5795H, the destination block, for the second field.
53AB
GOSUB to 5409H to have SYS7/SYS's routine 6 take the second field from the command line at Register Pair HL.
53AE
If the NZ FLAG is set (no valid field), JUMP to 5708H to post error 2CH, Illegal filespec.
53B1
LD A,(5774H) 3A 74 57
Load Register A with the flag byte of the first field at 5774H (bit 6 a name, bit 3 a drive, bits 0-2 the number).
53B4
LD E,A 5F
Load Register E with Register A, the first field's flag byte, for 5612H, 5673H and 5699H.
53B5
BIT 6,A CB 77
Test bit 6 of Register A: the NZ FLAG when the first field is a file name.
53B7
If the NZ FLAG is set (a file name), JUMP to 5705H to post error 2BH, Illegal devicespec.
53BA
BIT 3,A CB 5F
Test bit 3 of Register A, the drive bit: the Z FLAG for a device.
53BC
If the Z FLAG is set (a device), GOSUB to 5612H to reset it: any FORCE or JOIN is undone first.
53BF
LD A,(5795H) 3A 95 57
Load Register A with the flag byte of the second field at 5795H.
53C2
BIT 6,A CB 77
Test bit 6 of Register A: the NZ FLAG when the second field is a file name, the driver program.
53C4
If the NZ FLAG is set (a driver program), JUMP to 540CH to run it.
53C6
XOR E AB
XOR Register A with Register E, the first field's flag byte: the bits that differ.
53C7
AND 88H E6 88
AND Register A with 88H, bits 7 and 3: the NZ FLAG when one field is a device and the other a drive.
53C9
If the NZ FLAG is set (not the same kind), JUMP to 5705H to post error 2BH, Illegal devicespec.
53CC
GOSUB to 5673H to point Index Register IX to the first field's DCB or drive control table, given one of its own when it shares the NIL block.
53CF
LD B,08H 06 08
Load Register B with 08H, the bytes of a DCB that are copied.
53D1
BIT 3,E CB 5B
Test bit 3 of Register E, the drive bit of the first field.
53D3
If the Z FLAG is set (a device), JUMP to 53D7H with Register B = 08H.
53D5
LD B,14H 06 14
Load Register B with 14H, the 20 bytes of a drive control table.
53D7
PUSH DE D5
Save Register Pair DE, the first field's flag byte in Register E, to the top of the stack.
53D8
PUSH IX DD E5
Save Index Register IX, the first field's DCB or drive control table, to the top of the stack, to restore below.
53DA
PUSH IX DD E5
Save Index Register IX again, for Register Pair DE of the copy.
53DC
LD A,(5795H) 3A 95 57
Load Register A with the flag byte of the second field at 5795H.
53DF
LD E,A 5F
Load Register E with Register A, the second field's flag byte, for 5699H.
53E0
GOSUB to 5699H to point Index Register IX to the second field's DCB or drive control table and Index Register IY to its entry.
53E3
LD L,(IX+01H) DD 6E 01
Load Register L with the low byte of the second one's driver address at Index Register IX+01H.
53E6
LD H,(IX+02H) DD 66 02
Load Register H with the high byte of the driver address at Index Register IX+02H.
53E9
INC HL 23
INCrement Register Pair HL by 1: 0000H when the driver address is FFFFH, none.
53EA
LD DE,FFFEH 11 FE FF
Load Register Pair DE with FFFEH, to add for the test below.
53ED
ADD HL,DE 19
ADD Register Pair DE (FFFEH) to Register Pair HL: the NC FLAG when the driver address is FFFFH or 0000H.
53EE
PUSH IX DD E5
Save Index Register IX, the second field's DCB or drive control table, to the top of the stack.
53F0
POP HL E1
Restore Register Pair HL with the second field's DCB or drive control table, the source of the copy, from the top of the stack.
53F1
POP DE D1
Restore Register Pair DE with the first field's DCB or drive control table, the destination of the copy, from the top of the stack.
53F2
If the NC FLAG is set (the second has no driver), JUMP to 5711H to post error 29H, Device not available.
53F5
LD C,B 48
Load Register C with Register B, the bytes to copy (08H or 14H).
53F6
LD B,00H 06 00
Load Register B with 00H, the high byte of the count.
53F8
LDIR ED B0
Copy Register Pair BC bytes from Register Pair HL (the second's block) to Register Pair DE (the first's) by LDIR.
53FA
POP IX DD E1
Restore Index Register IX with the first field's DCB or drive control table from the top of the stack.
53FC
POP DE D1
Restore Register Pair DE (Register E the first field's flag byte) from the top of the stack.
53FD
BIT 3,E CB 5B
Test bit 3 of Register E, the drive bit of the first field.
53FF
RET Z C8
If the Z FLAG is set (a device), RETurn: ASSIGN is done.
5400
RES 3,(IX+00H) DD CB 00 9E
A drive: reset bit 3, the NIL bit, of the type byte of the drive control table at Index Register IX+00H.
5404
SET 0,(IX+03H) DD CB 03 C6
Set bit 0 of +03H of the drive control table at Index Register IX+03H, the flag that has the diskette logged at its next access.
5408
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH), which returns to CMNDI@'s caller.

5409H - One Field

Requests SYS7/SYS's routine 6 (66H), which takes one field of the command line at Register Pair HL into the block at Register Pair DE. The overlay request handler drops the return address of the RST 28H, so the routine returns straight to the caller of 5409H.

5409
LD A,66H 3E 66
Load Register A with 66H, the request code for SYS7/SYS's routine 6, one command line field.
540B
RST 28H EF
RESTART to 28H, the overlay request handler; it returns to the caller of 5409H, not to 540CH.

540CH - A Driver Program

ASSIGN with a file name as its second field: the first field gets a DCB of its own if it shares the NIL block, the name goes to the file control block at 43DEH that CMNDI@ uses, OVLYH$ is set to FFH (the program may load over SYS11/SYS), and RUN@ loads and runs the driver with Index Register IX at the DCB or drive control table, Index Register IY at its entry and Register Pair HL at the rest of the command line, for its parameters.

540C
PUSH HL E5
Save Register Pair HL, the rest of the command line, to the top of the stack.
540D
GOSUB to 5673H to point Index Register IX to the first field's DCB or drive control table, given one of its own when it shares the NIL block.
5410
LD HL,5796H 21 96 57
Point Register Pair HL to 5796H, the second field's text, the driver program's file specification.
5413
LD DE,43DEH 11 DE 43
Point Register Pair DE to 43DEH, the file control block in which CMNDI@ also puts the commands it runs.
5416
PUSH DE D5
Save Register Pair DE (43DEH) to the top of the stack.
5417
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of the text.
541A
LDIR ED B0
Copy the specification from Register Pair HL (5796H) to Register Pair DE (43DEH) by LDIR, with Register Pair BC as the count.
541C
POP DE D1
Restore Register Pair DE (43DEH) from the top of the stack, the file control block for RUN@.
541D
LD A,FFH 3E FF
Load Register A with FFH, which names no overlay.
541F
LD (430BH),A 32 0B 43
Store Register A (FFH) to 430BH, OVLYH$: no high overlay is resident, since the driver may load over SYS11/SYS.
5422
POP HL E1
Restore Register Pair HL, the rest of the command line, from the top of the stack, for the driver's parameters.
5423
JUMP to 4433H, RUN@, to load and run the driver program named at Register Pair DE.

5426H - FILTER

Routine 7, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. The parameters NO/OFF (54D2H) and MAP (54E6H) and the count of the table (55A9H) are cleared, and EVAL@ takes the command line with the block at 573DH: a device must be given (2FH, 2BH). With a file as the second field, the device's filter is switched off (bit 6 of its type byte), its old table is given back when it is the lowest block in high memory, and the file's pairs are read into a new table below HMEM$, whose address goes to +02H of the device's entry. Then the filter is switched on unless NO or OFF was given and the device has a table; MAP lists the table.

5426
XOR A AF
Set Register A to 00H by XORing it with itself, to clear the parameters and the count below.
5427
LD (54E6H),A 32 E6 54
Store Register A (00H) to 54E6H, the low byte of the MAP value: the operand of LD DE,0000H at 54E5H.
542A
LD (55A9H),A 32 A9 55
Store Register A (00H) to 55A9H, the count of the pairs read from the filter file.
542D
LD (54D2H),A 32 D2 54
Store Register A (00H) to 54D2H, the low byte of the NO and OFF value: the operand of LD DE,0000H at 54D1H.
5430
LD IX,573DH DD 21 3D 57
Point Index Register IX to 573DH, the evaluation block of FILTER: source 5774H, destination and wildmask 5795H, parameters 5746H.
5434
GOSUB to 4479H, EVAL@, to take the device, the filter file and the parameters from the command line at Register Pair HL.
5437
If the NZ FLAG is set (an error in the command line), JUMP to 5713H to post the error in Register A.
543A
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a source field was given.
543E
If the Z FLAG is set (no device), JUMP to 570BH to post error 2FH, I/o field not found.
5441
LD A,(5774H) 3A 74 57
Load Register A with the flag byte of the source block at 5774H (bit 7 a device or drive, bit 6 a name, bit 3 a drive).
5444
LD E,A 5F
Load Register E with Register A, the device's flag byte, for 5699H.
5445
AND C8H E6 C8
AND Register A with C8H, bits 7, 6 and 3, which tell a device from a drive and a name.
5447
CP 80H FE 80
Compare Register A against 80H: the Z FLAG when the field is a device.
5449
If the NZ FLAG is set (a drive or a file), JUMP to 5705H to post error 2BH, Illegal devicespec.
544C
BIT 1,(IX+00H) DD CB 00 4E
Test bit 1 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a filter file was given.
5450
If the Z FLAG is set (no file), JUMP to 54C6H to switch the device's filter on or off and list it.
5453
LD A,(5795H) 3A 95 57
Load Register A with the flag byte of the destination block at 5795H.
5456
BIT 6,A CB 77
Test bit 6 of Register A: the NZ FLAG when the second field is a file name.
5458
If the Z FLAG is set (not a file), JUMP to 5708H to post error 2CH, Illegal filespec.
545B
GOSUB to 5699H to point Index Register IX to the device's DCB and Index Register IY to its entry in the DCB table.
545E
RES 6,(IX+00H) DD CB 00 B6
Reset bit 6 of the DCB's type byte at Index Register IX+00H: the filter is off while its table is replaced.
5462
LD L,(IY+02H) FD 6E 02
Load Register L with the low byte of the filter table's address from +02H of the entry at Index Register IY+02H.
5465
LD H,(IY+03H) FD 66 03
Load Register H with the high byte of the filter table's address at Index Register IY+03H.
5468
LD A,H 7C
Load Register A with Register H, the high byte of the address.
5469
AND L A5
AND Register A with Register L, the low byte: FFH only when the address is FFFFH.
546A
INC A 3C
INCrement Register A by 1: the Z FLAG when the device has no table (FFFFH).
546B
If the Z FLAG is set (no old table), JUMP to 5480H to read the file.
546D
LD (IY+02H),FFH FD 36 02 FF
Store FFH to +02H of the entry at Index Register IY+02H: the device has no table for now.
5471
LD (IY+03H),FFH FD 36 03 FF
Store FFH to +03H of the entry at Index Register IY+03H.
5475
LD C,(HL) 4E
Load Register C with the old table's first byte at Register Pair HL, its count of pairs.
5476
LD B,00H 06 00
Load Register B with 00H, the high byte of the size.
5478
SLA C CB 21
Shift Register C left (SLA): the count times 2, the low byte.
547A
RL B CB 10
Rotate Register B left through the C FLAG: the high byte of the count times 2.
547C
INC BC 03
INCrement Register Pair BC by 1: the size of the old table, its count byte and two bytes for each pair.
547D
GOSUB to 56F1H to give the Register Pair BC bytes at Register Pair HL back to free memory, if they are the lowest block below the top (HMEM$).
5480
LD DE,5796H 11 96 57
Point Register Pair DE to 5796H, the destination block's text, which OPEN@ makes the filter file's control block.
5483
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the filter file's sector buffer.
5486
GOSUB to 4424H, OPEN@, to open the filter file at Register Pair DE, with the logical record length in Register B.
5489
If the NZ FLAG is set (it could not be opened), JUMP to 5713H to post the error in Register A.
548C
LD DE,(4049H) ED 5B 49 40
Load Register Pair DE with HMEM$ from 4049H: the table is built downwards from the top of memory.
5490
LD HL,55A9H 21 A9 55
Point Register Pair HL to 55A9H, the count of the pairs read.
5493
GOSUB to 5549H to read a code from the file into Register C; Register A returns the character after it, or the NZ FLAG at the end of the file.
5496
If the NZ FLAG is set (the end of the file), JUMP to 54B5H to end the table.
5498
CP 3DH FE 3D
Compare Register A, the character after the first code, against 3DH, the equal sign.
549A
If the NZ FLAG is set (no equal sign), JUMP to 570EH to post error 2DH, Invalid data provided.
549D
LD B,C 41
Load Register B with Register C, the code to translate.
549E
GOSUB to 5549H to read the new code into Register C; Register A returns the character after it.
54A1
If the NZ FLAG is set (the end of the file), JUMP to 54B5H: a pair without its new code is not kept.
54A3
CP 20H FE 20
Compare Register A, the character after the pair, against 20H: the C FLAG for a control code, the end of a line.
54A5
If the C FLAG is set (the end of a line), JUMP to 54ACH to keep the pair.
54A7
CP 2CH FE 2C
Compare Register A against 2CH, the comma between two pairs on a line.
54A9
If the NZ FLAG is set (neither), JUMP to 570EH to post error 2DH, Invalid data provided.
54AC
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the next free byte of the table, Register Pair DE = 55A9H.
54AD
LD (HL),C 71
Store Register C, the new code, at Register Pair HL.
54AE
DEC HL 2B
DECrement Register Pair HL by 1, down the table.
54AF
LD (HL),B 70
Store Register B, the code to translate, at Register Pair HL, under its new code.
54B0
DEC HL 2B
DECrement Register Pair HL by 1, to the next free byte.
54B1
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the next free byte, Register Pair HL = 55A9H.
54B2
INC (HL) 34
INCrement the count of pairs at Register Pair HL (55A9H): the Z FLAG when it wraps to 00H.
54B3
If the NZ FLAG is set (fewer than 256 pairs), JUMP back to 5493H for the next pair.
54B5
INC (HL) 34
INCrement the count at Register Pair HL (55A9H) by 1, the first half of a test against 00H.
54B6
DEC (HL) 35
DECrement the count at Register Pair HL back to its value: the Z FLAG when no pair was read.
54B7
If the Z FLAG is set (an empty table), JUMP to 54C6H: the device keeps no table.
54B9
LDD ED A8
Copy the count from Register Pair HL (55A9H) to the byte below the pairs at Register Pair DE (LDD), DECrementing both and Register Pair BC.
54BB
LD (4049H),DE ED 53 49 40
Store Register Pair DE, the byte below the table, to 4049H, HMEM$: the table is protected.
54BF
INC DE 13
INCrement Register Pair DE by 1: the table's address, its count byte.
54C0
LD (IY+02H),E FD 73 02
Store Register E, the low byte of the table's address, to +02H of the entry at Index Register IY+02H.
54C3
LD (IY+03H),D FD 72 03
Store Register D, the high byte of the table's address, to +03H of the entry at Index Register IY+03H.
54C6
LD A,(5774H) 3A 74 57
Load Register A with the flag byte of the source block at 5774H, the device.
54C9
LD E,A 5F
Load Register E with Register A, the device's flag byte, for 5699H.
54CA
GOSUB to 5699H to point Index Register IX to the device's DCB and Index Register IY to its entry in the DCB table.
54CD
RES 6,(IX+00H) DD CB 00 B6
Reset bit 6 of the DCB's type byte at Index Register IX+00H, the filter bit.
54D1
LD DE,0000H 11 00 00
Load Register Pair DE with the NO and OFF value, the operand at 54D2H-54D3H (0000H in the file) that EVAL@ stored.
54D4
INC E 1C
INCrement Register E by 1, the first half of a test of Register E against 00H.
54D5
DEC E 1D
DECrement Register E by 1 back to its value: the NZ FLAG when NO or OFF was given.
54D6
If the NZ FLAG is set (NO or OFF), JUMP to 54E5H with the filter off.
54D8
LD A,(IY+02H) FD 7E 02
Load Register A with the low byte of the table's address from +02H of the entry at Index Register IY+02H.
54DB
AND (IY+03H) FD A6 03
AND Register A with the high byte at Index Register IY+03H: FFH only when the address is FFFFH.
54DE
INC A 3C
INCrement Register A by 1: the Z FLAG when the device has no table.
54DF
If the Z FLAG is set (no table), JUMP to 54E5H with the filter off.
54E1
SET 6,(IX+00H) DD CB 00 F6
Set bit 6 of the DCB's type byte at Index Register IX+00H: the filter is on.
54E5
LD DE,0000H 11 00 00
Load Register Pair DE with the MAP value, the operand at 54E6H-54E7H (0000H in the file) that EVAL@ stored.
54E8
INC E 1C
INCrement Register E by 1, the first half of a test of Register E against 00H.
54E9
DEC E 1D
DECrement Register E by 1 back to its value: the Z FLAG when MAP was not given.
54EA
RET Z C8
If the Z FLAG is set (no MAP), RETurn: FILTER is done.

54EBH - MAP

Lists the device's table, five pairs to a line, each as old=new: a printable character in single quotation marks, any other code (below 20H, or 80H and above) as two hexadecimal digits and H. The pairs are listed from the first read, at the top of the table, down. The SPACE BAR pauses at the end of a line and BREAK ends the list (55F6H).

54EB
LD L,(IY+02H) FD 6E 02
Load Register L with the low byte of the table's address from +02H of the entry at Index Register IY+02H.
54EE
LD H,(IY+03H) FD 66 03
Load Register H with the high byte of the table's address at Index Register IY+03H.
54F1
LD A,H 7C
Load Register A with Register H, the high byte of the address.
54F2
AND L A5
AND Register A with Register L, the low byte: FFH only when the address is FFFFH.
54F3
INC A 3C
INCrement Register A by 1: the Z FLAG when the device has no table.
54F4
RET Z C8
If the Z FLAG is set (no table), RETurn: there is nothing to list.
54F5
LD C,(HL) 4E
Load Register C with the count of pairs from the table's first byte at Register Pair HL.
54F6
LD B,00H 06 00
Load Register B with 00H, the high byte of the count.
54F8
ADD HL,BC 09
ADD Register Pair BC (the count) to Register Pair HL.
54F9
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL again: the top byte of the table, the new code of the first pair read.
54FA
LD B,05H 06 05
Load Register B with 05H, the pairs on a line.
54FC
LD A,02H 3E 02
Load Register A with 02H, the spaces that start a line.
54FE
GOSUB to 5607H to show Register A (02H) spaces.
5501
PUSH BC C5
Save Register Pair BC (Register B the pairs left on the line, Register C the pairs left) to the top of the stack.
5502
LD C,(HL) 4E
Load Register C with the new code of the pair at Register Pair HL.
5503
DEC HL 2B
DECrement Register Pair HL by 1, to the pair's code to translate.
5504
LD A,(HL) 7E
Load Register A with the code to translate at Register Pair HL.
5505
DEC HL 2B
DECrement Register Pair HL by 1, to the next pair's new code.
5506
GOSUB to 5530H to show the code in Register A, quoted or in hexadecimal.
5509
LD A,3DH 3E 3D
Load Register A with 3DH, the equal sign between the two codes.
550B
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (3DH).
550E
LD A,C 79
Load Register A with Register C, the new code.
550F
GOSUB to 5530H to show the code in Register A, quoted or in hexadecimal.
5512
POP BC C1
Restore Register Pair BC (the counts) from the top of the stack.
5513
DEC C 0D
DECrement Register C by 1, the pairs left in the table.
5514
If the Z FLAG is set (the last pair), JUMP to 552BH to end the line.
5516
DEC B 05
DECrement Register B by 1, the pairs left on the line.
5517
If the Z FLAG is set (the line is full), JUMP to 5520H to start a new line.
5519
LD A,04H 3E 04
Load Register A with 04H, the spaces between two pairs.
551B
GOSUB to 5607H to show Register A (04H) spaces.
551E
JUMP back to 5501H for the next pair on the same line.
5520
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends a full line.
5522
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (0DH).
5525
GOSUB to 55F6H to scan the keyboard: the SPACE BAR pauses, BREAK gives the Z FLAG.
5528
If the NZ FLAG is set (not BREAK), JUMP back to 54FAH for the next line.
552A
RET C9
RETurn to the caller: BREAK ends the list of the table.
552B
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the last line.
552D
JUMP to 0033H, the ROM's display routine, to show the character in Register A (0DH); its RETurn ends FILTER.

5530H - Show a Code

A code of 20H-7FH is shown as the character in single quotation marks; any other in hexadecimal, two digits and H (55AFH).

5530
CP 20H FE 20
Compare Register A, the code, against 20H: the C FLAG for a control code.
5532
If the C FLAG is set (a control code), JUMP to 55AFH to show it in hexadecimal.
5535
CP 80H FE 80
Compare Register A against 80H: the NC FLAG for a code of 80H or more.
5537
If the NC FLAG is set (80H or more), JUMP to 55AFH to show it in hexadecimal.
553A
PUSH AF F5
Save Register Pair AF, the code, to the top of the stack.
553B
LD A,27H 3E 27
Load Register A with 27H, the single quotation mark before the character.
553D
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (27H).
5540
POP AF F1
Restore Register Pair AF, the code, from the top of the stack.
5541
GOSUB to 0033H, the ROM's display routine, to show the character in Register A.
5544
LD A,27H 3E 27
Load Register A with 27H, the single quotation mark after the character.
5546
JUMP to 0033H, the ROM's display routine, to show the character in Register A (27H); its RETurn goes to the caller.

5549H - Reading the Filter File

5549H reads one code into Register C: two hexadecimal digits, or a character between double or single quotation marks; it returns the Z FLAG with Register A = the next character, or the NZ FLAG at the end of the file (1CH). Characters below 20H before a code are passed over. 5584H gets the next character from the file and passes over every space and every comment, which runs from a period to the end of its line: so a space or a period cannot be a quoted code. Any error other than the end of the file is posted.

5549
GOSUB to 5584H to get the next character of the file into Register A: the NZ FLAG at the end of the file.
554C
RET NZ C0
If the NZ FLAG is set (the end of the file), RETurn with it.
554D
CP 20H FE 20
Compare Register A against 20H: the C FLAG for a control code, such as the 0DH that ends a line.
554F
If the C FLAG is set (a control code), JUMP back to 5549H for the next character.
5551
CP 22H FE 22
Compare Register A against 22H, the double quotation mark.
5553
If the Z FLAG is set (a quoted character), JUMP to 5572H.
5555
CP 27H FE 27
Compare Register A against 27H, the single quotation mark.
5557
If the Z FLAG is set (a quoted character), JUMP to 5572H.
5559
GOSUB to 55E2H to turn the character in Register A into a hexadecimal digit: the C FLAG when it is not one.
555C
If the C FLAG is set (not a hexadecimal digit), JUMP to 570EH to post error 2DH, Invalid data provided.
555F
RLCA 07
Rotate Register A left (RLCA), the first of four: the digit moves to bits 4-7.
5560
RLCA 07
Rotate Register A left (RLCA), the second time.
5561
RLCA 07
Rotate Register A left (RLCA), the third time.
5562
RLCA 07
Rotate Register A left (RLCA), the fourth time: the high digit is in bits 4-7.
5563
LD C,A 4F
Load Register C with Register A, the high digit of the code.
5564
GOSUB to 5584H to get the second digit into Register A: the NZ FLAG at the end of the file.
5567
RET NZ C0
If the NZ FLAG is set (the end of the file), RETurn with it.
5568
GOSUB to 55E2H to turn the character in Register A into a hexadecimal digit: the C FLAG when it is not one.
556B
If the C FLAG is set (not a hexadecimal digit), JUMP to 570EH to post error 2DH, Invalid data provided.
556E
OR C B1
OR Register A (the low digit) with Register C (the high digit): the code.
556F
LD C,A 4F
Load Register C with Register A, the code read.
5570
JUMP to 5584H to get the character after the code into Register A; its RETurn goes to the caller.
5572
A quoted character: GOSUB to 5584H to get it into Register A (spaces and periods are passed over).
5575
RET NZ C0
If the NZ FLAG is set (the end of the file), RETurn with it.
5576
LD C,A 4F
Load Register C with Register A, the character, the code read.
5577
GOSUB to 5584H to get the closing quotation mark into Register A.
557A
RET NZ C0
If the NZ FLAG is set (the end of the file), RETurn with it.
557B
CP 22H FE 22
Compare Register A against 22H, the double quotation mark.
557D
If the Z FLAG is set (the closing mark), JUMP to 5584H to get the character after it.
557F
CP 27H FE 27
Compare Register A against 27H, the single quotation mark.
5581
If the NZ FLAG is set (no closing mark), JUMP to 570EH to post error 2DH, Invalid data provided.
5584
PUSH DE D5
Save Register Pair DE (the table's next free byte) to the top of the stack.
5585
LD DE,5796H 11 96 57
Point Register Pair DE to 5796H, the filter file's control block.
5588
GOSUB to 0013H, the ROM's input routine, to read the next byte of the file at Register Pair DE into Register A: the NZ FLAG on an error.
558B
If the NZ FLAG is set (an error or the end of the file), JUMP to 55A1H.
558D
CP 20H FE 20
Compare Register A against 20H, a space, which is passed over.
558F
If the Z FLAG is set (a space), JUMP back to 5588H for the next byte.
5591
CP 2EH FE 2E
Compare Register A against 2EH, the period that starts a comment.
5593
If the NZ FLAG is set (not a comment), JUMP to 559EH to return the character.
5595
A comment: GOSUB to 0013H, the ROM's input routine, to read the next byte of the file at Register Pair DE into Register A.
5598
If the NZ FLAG is set (an error or the end of the file), JUMP to 55A1H.
559A
CP 20H FE 20
Compare Register A against 20H: the NC FLAG for a character of the comment.
559C
If the NC FLAG is set (still the comment), JUMP back to 5595H for the next byte.
559E
POP DE D1
Restore Register Pair DE (the table's next free byte) from the top of the stack.
559F
CP A BF
Compare Register A against itself to set the Z FLAG: a character was read.
55A0
RET C9
RETurn with the Z FLAG and the character in Register A (the control code that ended a comment).
55A1
POP DE D1
Restore Register Pair DE (the table's next free byte) from the top of the stack.
55A2
CP 1CH FE 1C
Compare Register A, the error code, against 1CH, Attempted to read past eof: the end of the filter file.
55A4
If the NZ FLAG is set (another error), JUMP to 5713H to post the error in Register A.
55A7
OR A B7
OR Register A (1CH) with itself to set the NZ FLAG: the end of the file.
55A8
RET C9
RETurn with the NZ FLAG: the end of the file.

55A9H - The Count of Pairs

Data: the number of pairs read from the filter file, cleared by 542AH, counted up by 54B2H and copied below the table by 54B9H as its first byte.

55A9
DEFB 00H 00
The count of the pairs of the filter table being built (55A9H), at most 255.

55AAH - Hexadecimal Output

55AAH shows Register Pair HL as four hexadecimal digits and H; 55AFH shows Register A as two digits and H; 55B7H shows Register A as two digits; 55C0H shows the low four bits of Register A as one digit.

55AA
LD A,H 7C
Load Register A with Register H, the high byte of the word.
55AB
GOSUB to 55B7H to show Register A (Register H) as two hexadecimal digits.
55AE
LD A,L 7D
Load Register A with Register L, the low byte of the word.
55AF
GOSUB to 55B7H to show Register A as two hexadecimal digits; 5530H enters here for a code.
55B2
LD A,48H 3E 48
Load Register A with 48H, the letter H after a hexadecimal number.
55B4
JUMP to 0033H, the ROM's display routine, to show the character in Register A (48H); its RETurn goes to the caller.
55B7
PUSH AF F5
Save Register Pair AF, the byte, to the top of the stack, for its low digit.
55B8
RRA 1F
Rotate Register A right through the C FLAG (RRA), the first of four, to bring the high digit down.
55B9
RRA 1F
Rotate Register A right through the C FLAG (RRA), the second time.
55BA
RRA 1F
Rotate Register A right through the C FLAG (RRA), the third time.
55BB
RRA 1F
Rotate Register A right through the C FLAG (RRA), the fourth time: the high digit is in bits 0-3.
55BC
GOSUB to 55C0H to show the high digit, bits 0-3 of Register A.
55BF
POP AF F1
Restore Register Pair AF, the byte, from the top of the stack, and fall into 55C0H for its low digit.
55C0
AND 0FH E6 0F
AND Register A with 0FH, to keep the digit in bits 0-3.
55C2
ADD A,90H C6 90
ADD 90H to Register A, the first step of the digit conversion: 90H-99H for 0-9, 9AH-9FH for A-F.
55C4
DAA 27
Decimal Adjust Register A (DAA): 90H-99H stay with the C FLAG clear, 9AH-9FH become 00H-05H with the C FLAG set.
55C5
ADC A,40H CE 40
ADD 40H and the C FLAG to Register A (ADC): D0H-D9H for 0-9, 41H-46H for A-F.
55C7
DAA 27
Decimal Adjust Register A (DAA): D0H-D9H become 30H-39H, the digits 0-9; 41H-46H stay, the letters A-F.
55C8
JUMP to 0033H, the ROM's display routine, to show the digit in Register A; its RETurn goes to the caller.

55CBH - Two Decimal Digits

Shows Register A (0-99) as two decimal digits, the device number of the list. Register Pair DE is kept.

55CB
PUSH DE D5
Save Register Pair DE to the top of the stack.
55CC
LD E,30H 1E 30
Load Register E with 30H, the ASCII digit 0, the count of the tens.
55CE
SUB 0AH D6 0A
SUBtract 0AH (ten) from Register A: the C FLAG when it goes below zero.
55D0
If the C FLAG is set (no more tens), JUMP to 55D5H.
55D2
INC E 1C
INCrement Register E by 1, the next digit of the tens.
55D3
JUMP back to 55CEH to subtract the next ten from Register A.
55D5
ADD A,3AH C6 3A
ADD 3AH to Register A, the remainder less ten: the ASCII digit of the units.
55D7
PUSH AF F5
Save Register Pair AF, the units digit, to the top of the stack.
55D8
LD A,E 7B
Load Register A with Register E, the tens digit.
55D9
GOSUB to 0033H, the ROM's display routine, to show the tens digit in Register A.
55DC
POP AF F1
Restore Register Pair AF, the units digit, from the top of the stack.
55DD
GOSUB to 0033H, the ROM's display routine, to show the units digit in Register A.
55E0
POP DE D1
Restore Register Pair DE from the top of the stack.
55E1
RET C9
RETurn to the caller with the two digits shown.

55E2H - A Hexadecimal Digit

Turns the character in Register A (0-9, A-F or a-f) into its value 00H-0FH with the NC FLAG; the C FLAG for any other character.

55E2
SUB 30H D6 30
SUBtract 30H, the ASCII digit 0, from Register A: the C FLAG for a character below 0.
55E4
RET C D8
If the C FLAG is set (below 0), RETurn with it: not a digit.
55E5
CP 0AH FE 0A
Compare Register A against 0AH: the C FLAG for 0-9.
55E7
If the C FLAG is set (0-9), JUMP to 55F4H, which turns it into the NC FLAG with Register A the value.
55E9
ADD A,30H C6 30
ADD 30H to Register A, which gives the character back again.
55EB
AND 5FH E6 5F
AND Register A with 5FH, which makes a lower case letter upper case.
55ED
SUB 37H D6 37
SUBtract 37H from Register A: A-F become 0AH-0FH.
55EF
CP 0AH FE 0A
Compare Register A against 0AH: the C FLAG for a character between 9 and A.
55F1
RET C D8
If the C FLAG is set (below A), RETurn with it: not a digit.
55F2
CP 10H FE 10
Compare Register A against 10H: the C FLAG for A-F, the NC FLAG beyond F.
55F4
CCF 3F
Complement the C FLAG (CCF): the NC FLAG for a digit, the C FLAG beyond F.
55F5
RET C9
RETurn with Register A the digit's value and the NC FLAG, or the C FLAG for no digit.

55F6H - The Keyboard

Returns the NZ FLAG at once while a DO file runs (bit 5 of SFLAG1$). Otherwise the keyboard is scanned once: the SPACE BAR waits for the next key, and the Z FLAG is returned when the key is BREAK (01H).

55F6
LD A,(4302H) 3A 02 43
Load Register A with SFLAG1$ from 4302H, whose bit 5 is set while a DO file runs.
55F9
AND 20H E6 20
AND Register A with 20H, bit 5: the NZ FLAG while a DO file runs.
55FB
RET NZ C0
If the NZ FLAG is set (a DO file runs), RETurn with the NZ FLAG: the keyboard is not read.
55FC
GOSUB to 002BH, the ROM's keyboard scan, which returns the key pressed in Register A, or 00H.
55FF
CP 20H FE 20
Compare Register A against 20H, the SPACE BAR.
5601
If the Z FLAG is set (the SPACE BAR), GOSUB to 0049H, the ROM's routine that waits for a key and returns it in Register A.
5604
CP 01H FE 01
Compare Register A against 01H, the BREAK key: the Z FLAG for BREAK.
5606
RET C9
RETurn to the caller with the Z FLAG when the key was BREAK.

5607H - Spaces

Shows Register A spaces (Register A 1 or more).

5607
PUSH AF F5
Save Register Pair AF, the count of spaces, to the top of the stack.
5608
LD A,20H 3E 20
Load Register A with 20H, a space, the character to show.
560A
GOSUB to 0033H, the ROM's display routine, to show the space in Register A (20H).
560D
POP AF F1
Restore Register Pair AF, the count, from the top of the stack.
560E
DEC A 3D
DECrement Register A by 1, the count of the spaces left.
560F
If the NZ FLAG is set (spaces are left), JUMP back to 5607H.
5611
RET C9
RETurn to the caller with Register A spaces shown.

5612H - Reset a Device

The device or drive named by Register E (bits 0-2 the number, bit 3 a drive) is put back as it was before FORCE, JOIN or NIL: with nothing of these set (bits 3-5 of the type byte) nothing is done. A FORCE or JOIN to a file closes the file and gives its 288 byte block back when it is the lowest block below HMEM$; a FORCEd or JOINed device gets its saved driver back; the saved type from the entry's +08H is restored in every case. A filter (bit 6) is left as it is, since the saved type was taken from the type byte. The registers are kept by SYS0/SYS's wrapper (4525H).

5612
GOSUB to 4525H, SYS0/SYS's wrapper, which saves the registers, runs the code after this CALL as a subroutine and restores them when it returns.
5615
GOSUB to 5699H to point Index Register IX to the DCB of the device in Register E and Index Register IY to its entry.
5618
LD A,(IX+00H) DD 7E 00
Load Register A with the DCB's type byte at Index Register IX+00H.
561B
AND 38H E6 38
AND Register A with 38H, bits 3, 4 and 5: NIL, FORCE and JOIN.
561D
RET Z C8
If the Z FLAG is set (none of them), RETurn: the device is as it should be.
561E
LD E,(IX+01H) DD 5E 01
Load Register E with the low byte of DCB+01H at Index Register IX+01H: a FORCEd device's target.
5621
LD D,(IX+02H) DD 56 02
Load Register D with the high byte of DCB+02H at Index Register IX+02H.
5624
BIT 4,A CB 67
Test bit 4 of Register A, the FORCE bit of the type byte.
5626
If the NZ FLAG is set (FORCE), JUMP to 5632H with the target in Register Pair DE.
5628
LD E,(IY+04H) FD 5E 04
Load Register E with the low byte of the linked control block from +04H of the entry at Index Register IY+04H.
562B
LD D,(IY+05H) FD 56 05
Load Register D with the high byte of the linked control block at Index Register IY+05H.
562E
BIT 5,A CB 6F
Test bit 5 of Register A, the JOIN bit of the type byte.
5630
If the Z FLAG is set (NIL only), JUMP to 564EH to restore the saved type.
5632
LD A,(DE) 1A
Load Register A with the type byte of the target at Register Pair DE.
5633
CP 80H FE 80
Compare Register A against 80H, the type of an open file control block.
5635
If the NZ FLAG is set (a device), JUMP to 5642H to restore the driver.
5637
A file: GOSUB to 4428H, CLOSE@, to close the file at Register Pair DE.
563A
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the file control block, the last 32 bytes of its block.
563B
DEC H 25
DECrement Register H by 1: Register Pair HL = the start of the block, 256 bytes below, the file's buffer.
563C
LD BC,0120H 01 20 01
Load Register Pair BC with 0120H, the 288 bytes of the block (52F2H).
563F
GOSUB to 56F1H to give the Register Pair BC bytes at Register Pair HL back to free memory if they are the lowest block below the top (HMEM$).
5642
LD L,(IY+06H) FD 6E 06
Load Register L with the low byte of the saved driver from +06H of the entry at Index Register IY+06H.
5645
LD H,(IY+07H) FD 66 07
Load Register H with the high byte of the saved driver at Index Register IY+07H.
5648
LD (IX+01H),L DD 75 01
Store Register L, the low byte of the driver, to DCB+01H at Index Register IX+01H.
564B
LD (IX+02H),H DD 74 02
Store Register H, the high byte of the driver, to DCB+02H at Index Register IX+02H.
564E
LD A,(IY+08H) FD 7E 08
Load Register A with the type byte saved at +08H of the entry at Index Register IY+08H.
5651
LD (IX+00H),A DD 77 00
Store Register A, the saved type, to the DCB's type byte at Index Register IX+00H.
5654
RET C9
RETurn to the caller with the device reset as it was.

5655H - Find a DCB

Looks up the DCB address in Register Pair HL among the six entries of the DCB table: the Z FLAG with Index Register IY at the entry, the NZ FLAG when it is not there. Register Pairs BC and DE are kept.

5655
PUSH BC C5
Save Register Pair BC to the top of the stack.
5656
PUSH DE D5
Save Register Pair DE to the top of the stack.
5657
LD IY,4369H FD 21 69 43
Point Index Register IY to 4369H, the first entry of the DCB table.
565B
LD B,06H 06 06
Load Register B with 06H, the six entries of the DCB table.
565D
LD DE,000BH 11 0B 00
Load Register Pair DE with 000BH, the length of an entry.
5660
LD A,(IY+00H) FD 7E 00
Load Register A with the low byte of the entry's DCB address at Index Register IY+00H.
5663
CP L BD
Compare Register A against Register L, the low byte of the address looked for.
5664
If the NZ FLAG is set (it differs), JUMP to 566CH for the next entry.
5666
LD A,(IY+01H) FD 7E 01
Load Register A with the high byte of the entry's DCB address at Index Register IY+01H.
5669
CP H BC
Compare Register A against Register H, the high byte of the address looked for.
566A
If the Z FLAG is set (the entry is found), JUMP to 5670H with the Z FLAG.
566C
ADD IY,DE FD 19
ADD Register Pair DE (000BH) to Index Register IY: the next entry.
566E
DECrement Register B and, if it is not zero, JUMP back to 5660H (DJNZ).
5670
POP DE D1
Restore Register Pair DE from the top of the stack.
5671
POP BC C1
Restore Register Pair BC from the top of the stack.
5672
RET C9
RETurn with the Z FLAG for a DCB of the table, the NZ FLAG from the last compare when there is none.

5673H - A DCB of Its Own

Points Index Register IX to the DCB or drive control table of the device or drive in Register E and Index Register IY to its entry. When the driver address at its +01H is FFFFH (the NIL block 43CBH, which @RS, @U1, @U2 and drives 4-7 share), 20 bytes are taken below HMEM$, made a NIL block (08H, then 00H) and put into the entry, so that it can be changed without changing the others.

5673
GOSUB to 5699H to point Index Register IX to the DCB or drive control table in Register E and Index Register IY to its entry.
5676
LD A,(IX+01H) DD 7E 01
Load Register A with the low byte of the driver address at Index Register IX+01H.
5679
AND (IX+02H) DD A6 02
AND Register A with the high byte at Index Register IX+02H: FFH only for FFFFH.
567C
INC A 3C
INCrement Register A by 1: the Z FLAG when the driver address is FFFFH, the shared NIL block.
567D
RET NZ C0
If the NZ FLAG is set (a block of its own), RETurn.
567E
LD BC,0014H 01 14 00
Load Register Pair BC with 0014H, the 20 bytes of the new block, the size of a drive control table.
5681
GOSUB to 56E6H to take Register Pair BC bytes below HMEM$: Register Pair HL returns the first byte of the block.
5684
LD (IY+00H),L FD 75 00
Store Register L, the low byte of the new block, to the entry at Index Register IY+00H.
5687
LD (IY+01H),H FD 74 01
Store Register H, the high byte of the new block, to the entry at Index Register IY+01H.
568A
PUSH HL E5
Save Register Pair HL, the new block, to the top of the stack.
568B
POP IX DD E1
Restore Index Register IX with the new block from the top of the stack.
568D
LD (HL),08H 36 08
Store 08H, the NIL type, to the first byte of the block at Register Pair HL.
568F
CPI ED A1
Compare Register A against the byte at Register Pair HL and INCrement Register Pair HL, DECrement Register Pair BC (CPI): only the counting is used.
5691
LD (HL),00H 36 00
Store 00H to the byte of the block at Register Pair HL.
5693
CPI ED A1
INCrement Register Pair HL and DECrement Register Pair BC by CPI (the compare with Register A is not used): the P/V FLAG while Register Pair BC is not 0.
5695
If the PE FLAG is set (bytes are left), JUMP back to 5691H for the next one.
5698
RET C9
RETurn with Index Register IX at the new block and Index Register IY at the entry.

5699H - Find the Entry

Register E holds a device or drive as EVAL@'s flag byte gives it: bits 0-2 the number, bit 3 a drive. Index Register IY returns at its entry (in the DCB table, 11 bytes an entry, or DCTTBL, 4 bytes an entry) and Index Register IX at the DCB or drive control table the entry names. Register Pairs DE and HL are kept.

5699
PUSH DE D5
Save Register Pair DE to the top of the stack.
569A
PUSH HL E5
Save Register Pair HL to the top of the stack.
569B
LD A,E 7B
Load Register A with Register E, the flag byte.
569C
LD E,0BH 1E 0B
Load Register E with 0BH, the length of an entry of the DCB table.
569E
LD HL,4369H 21 69 43
Point Register Pair HL to 4369H, the DCB table.
56A1
BIT 3,A CB 5F
Test bit 3 of Register A, the drive bit of the flag byte.
56A3
If the Z FLAG is set (a device), JUMP to 56AAH.
56A5
LD E,04H 1E 04
Load Register E with 04H, the length of an entry of DCTTBL.
56A7
LD HL,43ABH 21 AB 43
Point Register Pair HL to 43ABH, DCTTBL, the table of the drive control tables.
56AA
AND 07H E6 07
AND Register A with 07H, bits 0-2: the device or drive number.
56AC
GOSUB to 4934H, SYS0/SYS's 8 bit multiply: Register A = Register A times Register E, the offset of the entry.
56AF
LD E,A 5F
Load Register E with Register A, the offset of the entry.
56B0
LD D,00H 16 00
Load Register D with 00H, the high byte of the offset.
56B2
ADD HL,DE 19
ADD Register Pair DE (the offset) to Register Pair HL: the entry.
56B3
PUSH HL E5
Save Register Pair HL, the entry, to the top of the stack.
56B4
POP IY FD E1
Restore Index Register IY with the entry from the top of the stack.
56B6
LD E,(IY+00H) FD 5E 00
Load Register E with the low byte of the block's address from the entry at Index Register IY+00H.
56B9
LD D,(IY+01H) FD 56 01
Load Register D with the high byte of the block's address at Index Register IY+01H.
56BC
PUSH DE D5
Save Register Pair DE, the DCB or drive control table, to the top of the stack.
56BD
POP IX DD E1
Restore Index Register IX with the DCB or drive control table from the top of the stack.
56BF
POP HL E1
Restore Register Pair HL from the top of the stack.
56C0
POP DE D1
Restore Register Pair DE from the top of the stack.
56C1
RET C9
RETurn with Index Register IY at the entry and Index Register IX at its block.

56C2H - A Device's Name

Shows @, the two characters of the name at +09H of the DCB table entry at Index Register IY, and a space (56D3H).

56C2
LD A,40H 3E 40
Load Register A with 40H, the at sign before a device's name.
56C4
GOSUB to 0033H, the ROM's display routine, to show the character in Register A (40H).
56C7
LD A,(IY+09H) FD 7E 09
Load Register A with the first character of the name at Index Register IY+09H.
56CA
GOSUB to 0033H, the ROM's display routine, to show the character in Register A.
56CD
LD A,(IY+0AH) FD 7E 0A
Load Register A with the second character of the name at Index Register IY+0AH.
56D0
GOSUB to 0033H, the ROM's display routine, to show the character in Register A.
56D3
LD A,20H 3E 20
Load Register A with 20H, a space; the list also comes here for a space alone.
56D5
JUMP to 0033H, the ROM's display routine, to show the space in Register A (20H); its RETurn goes to the caller.

56D8H - A File's Specification

Has SYS3/SYS's routine 6 (request 26H) put the specification back into the copy of a file control block at Register Pair DE, then shows it by DSPLY@. Nothing is shown when the routine returns the NZ FLAG.

56D8
GOSUB to 56E3H to request SYS3/SYS's routine 6 for the file control block at Register Pair DE.
56DB
RET NZ C0
If the NZ FLAG is set (no specification), RETurn.
56DC
PUSH HL E5
Save Register Pair HL to the top of the stack.
56DD
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the specification.
56DE
GOSUB to 4467H, DSPLY@, to show the specification at Register Pair HL.
56E1
POP HL E1
Restore Register Pair HL from the top of the stack.
56E2
RET C9
RETurn to the caller with the specification shown.
56E3
LD A,26H 3E 26
Load Register A with 26H, the request code for SYS3/SYS's routine 6, the specification put back without closing the file.
56E5
RST 28H EF
RESTART to 28H, the overlay request handler; it returns to the caller of 56E3H, not to 56E6H.

56E6H - Memory below HMEM$

56E6H takes Register Pair BC bytes below the top of memory: HMEM$ goes down by Register Pair BC and Register Pair HL returns the first byte of the block. 56F1H gives Register Pair BC bytes at Register Pair HL back when they start just above HMEM$, the lowest block; any other block stays taken.

56E6
LD HL,(4049H) 2A 49 40
Load Register Pair HL with HMEM$ from 4049H, the top of free memory.
56E9
OR A B7
OR Register A with itself, to clear the C FLAG for the subtraction.
56EA
SBC HL,BC ED 42
SUBtract Register Pair BC (the size) from Register Pair HL with the C FLAG: the new top.
56EC
LD (4049H),HL 22 49 40
Store Register Pair HL, the new top, to 4049H, HMEM$.
56EF
INC HL 23
INCrement Register Pair HL by 1: the first byte of the block.
56F0
RET C9
RETurn to the caller with Register Pair HL at the new block.
56F1
PUSH HL E5
Save Register Pair HL, the block, to the top of the stack.
56F2
PUSH BC C5
Save Register Pair BC, its size, to the top of the stack.
56F3
LD BC,(4049H) ED 4B 49 40
Load Register Pair BC with HMEM$ from 4049H, the top of free memory.
56F7
SCF 37
Set the C FLAG (SCF), for the subtraction of HMEM$ plus 1.
56F8
SBC HL,BC ED 42
SUBtract Register Pair BC (HMEM$) and the C FLAG from Register Pair HL: the Z FLAG when the block starts at HMEM$ plus 1.
56FA
If the NZ FLAG is set (another block is lower), JUMP to 5702H: the memory stays taken.
56FC
POP HL E1
Restore Register Pair HL with the size from the top of the stack.
56FD
PUSH HL E5
Save Register Pair HL, the size, to the top of the stack again.
56FE
ADD HL,BC 09
ADD Register Pair BC (HMEM$) to Register Pair HL (the size): the new top.
56FF
LD (4049H),HL 22 49 40
Store Register Pair HL, the new top, to 4049H, HMEM$.
5702
POP BC C1
Restore Register Pair BC from the top of the stack.
5703
POP HL E1
Restore Register Pair HL from the top of the stack.
5704
RET C9
RETurn to the caller with Register Pairs BC and HL as they were.

5705H - The Error Exits

Five entries, each loading its error code into Register A: 5705H 2BH Illegal devicespec, 5708H 2CH Illegal filespec, 570BH 2FH I/o field not found, 570EH 2DH Invalid data provided, 5711H 29H Device not available. Each LD A,n after the first is the operand of an LD BC,nn entered from the entry above it, so only one load counts. 5713H posts the error in Register A by ERROR@ with bit 6 set (no frame), and ERROR@ ends with ABORT@.

5705
LD A,2BH 3E 2B
Load Register A with 2BH, the error code Illegal devicespec.
5707
LD BC,2C3EH 01 3E 2C
5708H enters inside this LD BC,2C3EH: its bytes 3EH 2CH read as LD A,2CH, the error code Illegal filespec; from 5705H it only loads Register Pair BC.
570A
LD BC,2F3EH 01 3E 2F
570BH enters inside this LD BC,2F3EH: its bytes 3EH 2FH read as LD A,2FH, the error code I/o field not found; from above it only loads Register Pair BC.
570D
LD BC,2D3EH 01 3E 2D
570EH enters inside this LD BC,2D3EH: its bytes 3EH 2DH read as LD A,2DH, the error code Invalid data provided; from above it only loads Register Pair BC.
5710
LD BC,293EH 01 3E 29
5711H enters inside this LD BC,293EH: its bytes 3EH 29H read as LD A,29H, the error code Device not available; from above it only loads Register Pair BC.
5713
OR 40H F6 40
OR Register A, the error code, with 40H, bit 6, so that ERROR@ shows the message without its frame.
5715
JUMP to 4409H, ERROR@, to show the message of the error in Register A and end through ABORT@.

5718H - The Texts

Data: the three words of the device list, each ended by 03H for DSPLY@.

5718-571C
DEFM "FORCE" 46 4F 52 43 45
The word shown for a FORCEd device (5288H), before the device or file it goes to.
571D
DEFB 03H 03
The byte that ends the text FORCE for DSPLY@.
571E-5722
DEFM " JOIN" 20 4A 4F 49 4E
The word shown after a JOINed device's driver (52BFH), with a space before it.
5723
DEFB 03H 03
The byte that ends the text JOIN for DSPLY@ (4467H) at 52C2H.
5724-5728
DEFM "NIL " 4E 49 4C 20 20
The word shown for a NIL device (529CH), with two spaces after it.
5729
DEFB 03H 03
The byte that ends the text NIL for DSPLY@ (4467H) at 529FH.

572AH - The Evaluation Blocks

Data: the blocks that Index Register IX points to for EVAL@: the flags EVAL@ sets (bit 0 a source, bit 1 a destination, bit 2 a wildmask, bit 3 parameters), the addresses of the source, destination and wildmask blocks, and of the parameter table. FORCE and JOIN use 572AH, RESET 5733H (one block for every field) and FILTER 573DH; the empty table at 573CH serves FORCE, JOIN and RESET. A parameter entry is the name (6 characters), the address its value is stored to and a type byte (20H a logical value, so the name alone sets it).

572A
DEFB 00H 00
The flags of FORCE's and JOIN's block (5216H), set by EVAL@.
572B-572C
DEFW 5774H 74 57
The address of the source block, 5774H: the flag byte, then the device to route.
572D-572E
DEFW 5795H 95 57
The address of the destination block, 5795H: the flag byte, then the device or file it goes to.
572F-5730
DEFW 5795H 95 57
The address of the wildmask block: 5795H again, the destination block.
5731-5732
DEFW 573CH 3C 57
The address of the parameter table at 573CH, which is empty.
5733
DEFB 00H 00
The flags of RESET's block (5375H), set by EVAL@.
5734-5735
DEFW 5774H 74 57
The address of the source block, 5774H: the flag byte, then the device to reset.
5736-5737
DEFW 5774H 74 57
The address of the destination block: 5774H again, so a second field takes the place of the first.
5738-5739
DEFW 5774H 74 57
The address of the wildmask block: 5774H again.
573A-573B
DEFW 573CH 3C 57
The address of the parameter table at 573CH, which is empty.
573C
DEFB 00H 00
The empty parameter table of FORCE, JOIN and RESET: a 00H in place of the first name.
573D
DEFB 00H 00
The flags of FILTER's block (5430H), set by EVAL@.
573E-573F
DEFW 5774H 74 57
The address of the source block, 5774H: the flag byte, then the device to filter.
5740-5741
DEFW 5795H 95 57
The address of the destination block, 5795H: the flag byte, then the filter file.
5742-5743
DEFW 5795H 95 57
The address of the wildmask block: 5795H again, the destination block.
5744-5745
DEFW 5746H 46 57
The address of the parameter table at 5746H, FILTER's five parameters.
5746-574B
DEFM "OFF " 4F 46 46 20 20 20
The name of OFF: load the table without switching the filter on, or switch a loaded filter off.
574C-574D
DEFW 54D2H D2 54
OFF's value goes to 54D2H-54D3H, the operand of LD DE,0000H at 54D1H.
574E
DEFB 20H 20
The type byte of OFF: 20H, bit 5, a logical value, so the name alone sets it.
574F-5754
DEFM "NO " 4E 4F 20 20 20 20
The name of NO, the same as OFF: the value goes to the same place.
5755-5756
DEFW 54D2H D2 54
NO's value goes to 54D2H-54D3H, the operand of LD DE,0000H at 54D1H, as OFF's.
5757
DEFB 20H 20
The type byte of NO: 20H, bit 5, a logical value, so the name alone sets it.
5758-575D
DEFM "ON " 4F 4E 20 20 20 20
The name of ON: switch the filter on, which FILTER does anyway.
575E-575F
DEFW 5800H 00 58
ON's value goes to 5800H, the filter file's buffer, where nothing reads it: ON is accepted and has no effect.
5760
DEFB 20H 20
The type byte of ON: 20H, bit 5, a logical value, so the name alone sets it.
5761-5766
DEFM "YES " 59 45 53 20 20 20
The name of YES, the same as ON: accepted and without effect.
5767-5768
DEFW 5800H 00 58
YES's value goes to 5800H, the filter file's buffer, where nothing reads it, as ON's.
5769
DEFB 20H 20
The type byte of YES: 20H, bit 5, a logical value, so the name alone sets it.
576A-576F
DEFM "MAP " 4D 41 50 20 20 20
The name of MAP: list the device's filter table.
5770-5771
DEFW 54E6H E6 54
MAP's value goes to 54E6H-54E7H, the operand of LD DE,0000H at 54E5H.
5772
DEFB 20H 20
The type byte of MAP: 20H, bit 5, a logical value, so the name alone sets it.
5773
DEFB 00H 00
The end of FILTER's parameter table: a 00H in place of the next name, the last byte of the file.

5774H - The Work Area

Not in the file: SYS11/SYS uses the memory after its last byte (5773H) for the two blocks of EVAL@ (or of SYS7/SYS's routine 6 for ASSIGN) and the filter file's buffer.

5774
DEFS 1
The flag byte of the source block (52FBH): bit 7 a device or a drive, bit 6 a name, bit 3 a drive, bits 0-2 the number.
5775-5794
DEFS 32
The source's text; in the device list also a copy of a file control block for its specification (52E0H).
5795
DEFS 1
The flag byte of the destination block (5309H).
5796-57B5
DEFS 32
The destination's text: a device, a file to FORCE or JOIN to (moved below HMEM$, 532EH), a driver program (5410H) or the filter file's control block (5480H).
5800-58FF
DEFS 256
The filter file's sector buffer (5483H), where EVAL@ also stores the values of ON and YES.