TRSDOS 6.2 for the Model 4 - SYS1/SYS Disassembled

Page Customization

Introduction/Summary

TRSDOS 6.2 SYS1/SYS Disassembly (Model 4)

SYS1/SYS is the system overlay of TRSDOS 6.2 that holds the command interpreter, the routine behind the TRSDOS Ready prompt. It is a load module of 1336 bytes in six load blocks, 1275 of them loaded: 1E00H-22F8H in the overlay area and the length word at 23FEH-23FFH, with its transfer address at 1E00H. CKMOD@ on the SYS0/SYS page reads it into 1E00H whenever an SVC asks for overlay 3 and it is not already resident, and RST28 calls 1E00H with the request in Register A: 93H @EXIT, A3H @CMNDR, B3H @CMNDI, C3H @FSPEC, D3H @FEXT or E3H @PARAM. Bits 6-4 of the request pick the function (1E00H).

@EXIT goes through CLEANUP (1E46H), which resets the stack to 0380H with the address of @EXIT under it, gives BREAK back to the system, sets the debugger hook from SFLAG$, clears the PAUSE and ENTER bits, bits 0-2 of SFLAG$ and every bit of CFLAG$ but bit 5, and sets LOW$ to 2FFFH (1E73H). The interpreter (1E8EH) then hands control to an Extended Command Interpreter in SYS13/SYS when EFLAG$ is not zero, or shows LS-DOS Ready and reads a line of up to 79 characters into INBUF$ (0420H). It switches in memory bank 0 and logs the line; a line starting with a period is a comment, one starting with * goes to SYS13/SYS, and one starting with ! is always run as a program. The command name is parsed into the system FCB at 00E0H and looked up in the library command table (1F24H), 38 names that run members of SYS6/SYS, SYS7/SYS and SYS8/SYS, and BOOT; any other name gets /CMD added and is run by @RUN. @CMNDI does the same with a line passed by a program, and @CMNDR runs it without CLEANUP, so that the command returns to the program.

The rest of the overlay is the parser shared with the commands: @FSPEC (205DH) copies a file or device specification into an FCB, passing over the prepositions TO, ON, OVER and USING; @FEXT (20D1H) adds a default extension; @PARSER (2105H) copies one word; @FNDPRM (2158H) looks a word up in a table of the old format (names of six characters) or the enhanced one (a leading 80H, then for each entry a type byte, the name, a response byte and an address word); and @PARAM (21D8H) reads a parameter list in parentheses, with flag, decimal, hexadecimal (X'nnnn') and string values (2244H).

The bytes are those of the TRSDOS 6.2.1 Level AR system diskette. The labels are those of Logical Systems' own source of the system, whose SYS1/ASM brings in PARAM/ASM and is headed LDOS 6.2: aligned against this file it accounts for all 1275 loaded bytes over 645 source rows with no instruction unexplained, with one exception that is worth knowing about. That source is Level AD and SYS1/SYS is the one file where Level AD and this release differ by more than a byte or two: seventeen bytes at 1E2DH-1E3EH, which is a patch made for Level AN. This release calls @CKBRKC at 1E2EH before it sets CFLAG$ bit 1, which Level AD does not, and Level AD jumps to @ABORT at its 1E3CH after the call to CLEANUP, which this release does not. The two changes are three bytes each and cancel out, which is why both files are 1336 bytes. Everything outside those seventeen bytes is the source's code instruction for instruction, so the labels of this page are the author's own.

Against LS-DOS 6.3.1H this file is the same program re-laid, and six places in it are real differences. Of its 856 instructions 364 stand at the same address and 376 more are the same instruction moved, most of them by one or two bytes; 51.5 per cent of its bytes are identical in place. The six differences, each of which has its own row below: the library table (1F24H), where this release has 38 commands and the later one 39, the addition being ID; the dormant KILL entry after the end of the table (2054H), which this release carries and the later one took out; an XOR A that does nothing at 2092H, which the later release dropped; the space loop of @PARSER (2144H), which the later release lays out to save two bytes by running an operand byte as an instruction; the clearing of the response bytes in @PARAM (21FBH), one byte shorter in the later release; and the LD BC,0000H that this release does three times over, in ONOFF (2292H), in HEXVAL (22BAH) and on the ON path (2228H), which the later release hoists into one place above the test. The prompt text itself is the tenth and last byte of difference in length: TRSDOS Ready is two characters longer than LS-DOS Ready.

Notes

One place hides an instruction: 226FH (3AH, an LD A,(0FECBH) that skips the SET 7,(HL) of a number). LS-DOS 6.3.1 has a second at its 213CH, in the space loop of @PARSER, which this release does not: it writes that loop plainly and ends it with a DEC HL (2144H).

Several operands are changed while SYS1 runs: 1EE6H (the exclamation mark test of TSTEXC, whose label is at 1EE5H), 2146H (the operand of PAR6 at 2145H, the mark of an empty word), and 2180H, 219EH and 21B8H, the operands of FND2, FND3A and FND5A, which @FNDPRM sets from the format of each table.

CLEANUP does not look at the return code in Register Pair HL that a program gives to @EXIT. The word at 1E02H points to the library table, 1F24H, and the LIB command reads it while SYS1 is still in the overlay area; the word at 23FEH is 04F9H, the length of the overlay, which SYSTEM (SYSRES) uses to keep a copy in high memory.

A single byte adds a command to this release. The table ends with a 00H at 2054H, and the source's own comment against that byte reads Patch 'K' here for KILL: the five characters at 2055H are ILL and two spaces, and the word at 205AH is 8018H, the member request of REMOVE. Write 4BH into 2054H and the table runs on to a 39th name, KILL, which removes a file exactly as REMOVE does; leave it at 00H and the table ends there and the eight bytes are unreachable. The Model 4 manual documents no such command, and LS-DOS 6.3.1 removed the entry and spent the eight bytes on ID instead.

Two things Part 13 records as changes of LS-DOS 6.3.1 are already in this release and so are not changes between the two at all: @PARSER passes over the spaces that follow a word (2140H), and @PARAM accepts a parameter list that ends at the end of the line with no closing parenthesis (223BH). What the later release did change about them is only how the code is laid out, and both are noted on their rows.

Bugs (listed on the TRSDOS 6.2 reference page): T32, @FNDPRM (21B3H) does not check that the word ends where a name that fills its field ends, so a command name such as APPENDIX or SETCOMM runs the library command APPEND or SETCOM; T33, a file specification that ends with an exclamation mark at the end of the line leaves Register Pair HL one byte past the 0DH, and one followed by an opening parenthesis loses it (208CH); T34, @PARAM leaves the response bytes as they were when there is no parameter list (21DBH, latent); T35, a file named TO, ON, OVER or USING cannot be given to @FSPEC (209DH, a limit); T36, the signs : ; < = > ? @ and [ and the letters W, X, Y and Z are taken as hexadecimal digits in X'nnnn' (22D1H).

Variables

Memory Used by SYS1/SYS

Address
Size
Contents
001EH-001FH
2 bytes
LOW$
Set to 2FFFH by CLEANUP on every @EXIT and @CMNDI (1E73H).
006CH
1 byte
CFLAG$
Bit 1 set by @CMNDR (1E36H), bit 2 set while @KEYIN reads a command (1EA0H, 1EADH), bit 4 tested for library commands only (1EFCH); CLEANUP keeps only bit 5 (1E7CH).
006EH
1 byte
EFLAG$
Not zero when an Extended Command Interpreter is in SYS13/SYS; bits 6-4 are its function (1E8EH).
0074H
1 byte
KFLAG$
Bits 1 (PAUSE) and 2 (ENTER) cleared by CLEANUP (1E65H).
007CH
1 byte
SFLAG$
Bit 7 sets the debugger hook (1E56H), bits 2-0 cleared by CLEANUP (1E69H), bit 5 (a DO file running) tested by COMMENT (1F05H).
00E0H-00FFH
32 bytes
CFCB$
The system command FCB, into which the command name is parsed (1EC5H).
0420H-046FH
80 bytes
INBUF$
The command line buffer: 79 bytes copied in by @CMNDR and @CMNDI with 03H at 046FH (1E1DH), or read by @KEYIN (1EA3H).
0835H-0836H
2 bytes
OPREG_SV_PTR
The save pointer of ENADIS_DO_RAM, reset to 086EH by CLEANUP (1E79H).
199FH
1 byte
@DBGHK
The debugger hook: 00H (on) or C9H (off) from SFLAG$ bit 7 (1E5FH); C9H before a library command (1F14H).
1D00H-1D0FH
16 bytes
SBUFF$
The word of each parameter, copied by @PARAM for @FNDPRM (2202H); in page 1DH also the response bits of an old format table (21C4H).
1E02H-1E03H
2 bytes
LIBTBL$ pointer
1F24H, the address of the library command table, read by the LIB command.
1EE6H
1 byte
TSTEXC operand
00H when the command line starts with an exclamation mark (1EDCH).
2146H
1 byte
PAR6 operand
Not zero until @PARSER copies a character (2108H, 212EH).
2180H, 219EH, 21B8H
3 bytes
FND2, FND3A and FND5A operands
The entry length, the characters to compare after the first and the offset of the word, set by @FNDPRM from the table format (2178H, 2170H, 2174H).
23FEH-23FFH
2 bytes
Overlay length
04F9H, the length of SYS1, read by SYSTEM (SYSRES).

Routines of Other Files Called

AddressRoutine
03E1H@DECHEX (SYS0/SYS): decimal text to binary, for a numeric parameter (2266H).
0503H@LOGER (BOOT/SYS): logs the command line (1EC2H).
052DH@DSPLY (BOOT/SYS): shows LS-DOS Ready (1E9AH).
0553H@CKBRKC (BOOT/SYS): clears a pending BREAK (1E2EH, 1E8AH). The call at 1E2EH is the Level AN patch described above.
0585H@KEYIN (BOOT/SYS): reads the command line (1EA9H).
0642H@DSP (BOOT/SYS): the new line before a command runs (1EB9H).
0877H@BANK (BOOT/SYS): switches in bank 0 (1EBFH).
196FH@BREAK (SYS0/SYS): gives BREAK back to the system (1E4AH).
1B1DH@RUN (SYS0/SYS): loads and runs a /CMD program (1EFEH).
RST 28HSYS13/SYS for an ECI (1E96H) or an asterisk line (1ED6H), the libraries SYS6/SYS, SYS7/SYS and SYS8/SYS (1F21H), @IPL for BOOT (1F23H).

Disassembly

1E00H - SYS1: Entry and the Function Dispatcher

SYS1/SYS is loaded at 1E00H by CKMOD@ (1A7FH on the SYS0/SYS page) whenever an SVC asks for overlay 3 and it is not already resident, and RST28 calls 1E00H with Register A holding the request: 93H @EXIT, A3H @CMNDR, B3H @CMNDI, C3H @FSPEC, D3H @FEXT and E3H @PARAM, sent by the stubs at 1B0BH and 197BH-1987H. Bits 6-4 of the request pick the function. The word at 1E02H points to the library command table, which the LIB command reads while SYS1 is still in the overlay area. @CMNDR and @CMNDI first copy the caller's command line into INBUF$ (0420H); @CMNDR keeps the caller's stack and memory settings, @CMNDI goes through CLEANUP like @EXIT.

1E00SYS1
Jump relative to 1E04H (SYS1BGN), over the table pointer at 1E02H-1E03H. RST28 enters here with Register A holding the overlay request.
1E02-1E03
DEFW 1F24H 24 1F
1E02H-1E03H = 1F24H (LIBTBL$): the address of the library command table. The LIB command in SYS6/SYS reads this word with LD HL,(1E02H) to list the commands, relying on SYS1 still being in the overlay area when it runs.
1E04SYS1BGN
AND 70H E6 70
Mask Register A (the request) with 70H, keeping bits 6-4, the function number times 10H: 10H @EXIT, 20H @CMNDR, 30H @CMNDI, 40H @FSPEC, 50H @FEXT, 60H @PARAM.
1E06
RET Z C8
Return at once if Register A is 00H: function 0 (request 83H) does nothing; none of the SVC stubs on the SYS0/SYS page sends it.
1E07
CP 10H FE 10
Compare Register A with 10H, the function of @EXIT (request 93H from 1B0BH).
1E09
If Register A is 10H, jump relative to 1E41H (CMD), the @EXIT entry, which resets the system and asks for a command.
1E0B
CP 40H FE 40
Compare Register A with 40H, the function of @FSPEC (request C3H from 1981H).
1E0D
If Register A is 40H, jump to 205DH (FSPEC), which parses a file or device specification at Register Pair HL into the FCB at Register Pair DE.
1E10
CP 50H FE 50
Compare Register A with 50H, the function of @FEXT (request D3H from 1984H).
1E12
If Register A is 50H, jump to 20D1H (FEXT), which inserts the default extension at Register Pair HL into the FCB at Register Pair DE.
1E15
CP 60H FE 60
Compare Register A with 60H, the function of @PARAM (request E3H from 1987H).
1E17
If Register A is 60H, jump to 21D8H (PARAM), which parses the parameters at Register Pair HL against the table at Register Pair DE.
1E1A
CP 70H FE 70
Compare Register A with 70H, function 7, which SYS1 does not use.
1E1C
RET Z C8
Return if Register A is 70H: a request F3H does nothing. What is left is 20H (@CMNDR) or 30H (@CMNDI).
1E1D
LD DE,0420H 11 20 04LD DE,INBUF$
Point Register Pair DE to 0420H (INBUF$), the system's command line buffer, for both @CMNDR and @CMNDI.
1E20
PUSH DE D5
Save Register Pair DE (0420H, INBUF$) on the stack, to be the command line pointer below.
1E21
LD BC,004FH 01 4F 00
Load Register Pair BC with 004FH (79), the number of bytes to copy from the caller's command line.
1E24
LDIR ED B0
Copy Register Pair BC (79) bytes from the caller's buffer at Register Pair HL to INBUF$ at Register Pair DE: the command is taken into the system buffer whatever its length; Register Pair DE ends at 046FH.
1E26
EX DE,HL EB
Exchange Register Pair DE (046FH, the byte after the copy) with Register Pair HL.
1E27
LD (HL),03H 36 03
Store 03H (ETX) at Register Pair HL (046FH), so a line of 79 bytes without its 0DH still has an end mark.
1E29
POP HL E1
Restore Register Pair HL from the stack: 0420H, the start of INBUF$ with the copied command.
1E2A
CP 30H FE 30
Compare Register A (20H or 30H) with 30H, the function of @CMNDI (request B3H from 197EH).
1E2C
If Register A is 30H, jump relative to 1E3CH (CMD30), the @CMNDI entry.
1E2E
@CMNDR: call @CKBRKC at 0553H (on the BOOT/SYS page) to clear a pending BREAK (bit 0 of KFLAG$, 0074H), so that the command does not start with a BREAK already set. It returns NZ if a BREAK was pending, with Register A unchanged; the flag is not tested.
1E31
LD A,(006CH) 3A 6C 00LD A,(CFLAG$)
Load Register A with CFLAG$ (006CH), the command flags.
1E34
OR 02H F6 02
Set bit 1 of Register A: @CMNDR is executing. The bit is cleared by CLEANUP at 1E81H on the next @EXIT or @CMNDI.
1E36
LD (006CH),A 32 6C 00LD (CFLAG$),A
Store Register A, with bit 1 now set, back into CFLAG$ at 006CH, the command flags.
1E39
Jump to 1EBCH (CMD20) to run the command in INBUF$ at Register Pair HL. @CMNDR skips CLEANUP: the caller's stack, BREAK vector, LOW$ and flags stay as they are, and a library command or program returns to the caller.
1E3CCMD30
@CMNDI: call CLEANUP at 1E46H, which resets the stack to 0380H with @EXIT (1B0BH) as the return address, resets the BREAK vector, the flags and LOW$, and returns with Register Pair HL = Register Pair BC = 0420H (INBUF$).
1E3F
Jump relative to 1EB2H (CMD3A) to show a new line and run the command now in INBUF$.

1E41H - @EXIT and CLEANUP: Return to the Command Level

@EXIT (SVC 22, request 93H) comes here from 1B0BH, @ABORT through it with Register Pair HL = FFFFH. CLEANUP does not look at Register Pair HL: the return code is lost here. CLEANUP resets the system for the next command: the BREAK vector goes back to the system, the stack is reset to STACK$ (0380H) with the address of @EXIT under the return address, the debugger hook is set from SFLAG$ bit 7, the PAUSE and ENTER bits of KFLAG$ and the three low bits of SFLAG$ are cleared, LOW$ becomes 2FFFH, the pointer of the video memory switch (OPREG_SV_PTR) goes back to its rest value, and CFLAG$ keeps only bit 5. A pending BREAK is cleared last.

1E41CMD
@EXIT: call CLEANUP at 1E46H to reset the stack, the BREAK vector, the flags and LOW$; it returns with Register Pair HL = Register Pair BC = 0420H (INBUF$).
1E44
Jump relative to 1E8EH (CMDCONT) to hand over to an Extended Command Interpreter or to show TRSDOS Ready and read a command.
1E46CLEANUP
DI F3
Disable interrupts while the stack and the system flags are changed.
1E47
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value that gives the BREAK key back to the system.
1E4A
Call @BREAK at 196FH (on the SYS0/SYS page) with Register Pair HL = 0000H: the BREAK vector at 1C88H is cleared, so a program's BREAK handler is no longer entered. Register Pair HL returns the old vector, which is dropped.
1E4D
POP HL E1
Restore Register Pair HL from the stack: the return address of the CALL to CLEANUP (1E3FH or 1E44H), taken off before the stack is moved.
1E4E
LD SP,0380H 31 80 03LD SP,STACK$
Load the Stack Pointer with 0380H (STACK$): whatever the program left on the stack is dropped.
1E51
LD BC,1B0BH 01 0B 1BLD BC,@EXIT
Load Register Pair BC with 1B0BH, the address of @EXIT on the SYS0/SYS page.
1E54
PUSH BC C5
Save Register Pair BC (1B0BH) on the new stack: a library command, a program run by @RUN or an Extended Command Interpreter that ends with RET goes to @EXIT.
1E55
PUSH HL E5
Save Register Pair HL (the return address into SYS1) on the stack above it, so the RET at 1E8DH returns to the caller.
1E56
LD A,(007CH) 3A 7C 00LD A,(SFLAG$)
Load Register A with SFLAG$ (007CH), the system flags; bit 7 asks for the debugger to be on (DEBUG command).
1E59
RLCA 07
Rotate Register A left: bit 7 of SFLAG$ goes into the Carry flag.
1E5A
LD A,0C9H 3E C9
Load Register A with C9H (RET), the debugger hook value for off; the LD does not change the Carry flag.
1E5C
If the Carry flag is clear (SFLAG$ bit 7 off), jump relative to 1E5FH with Register A = C9H.
1E5E
XOR A AF
Clear Register A to 00H (NOP), the debugger hook value for on.
1E5FDBGOFF
LD (199FH),A 32 9F 19LD (@DBGHK),A
Store Register A (C9H off, 00H on) into 199FH (@DBGHK), the debugger hook that the BREAK handling of the task processor uses (1C71H); RST28 forces it to C9H around each overlay call.
1E62
LD HL,0074H 21 74 00LD HL,KFLAG$
Point Register Pair HL to 0074H (KFLAG$), the keyboard flags.
1E65
LD A,0F9H 3E F9
Load Register A with F9H (11111001 binary), the mask that clears bits 1 (PAUSE, SHIFT @) and 2 (ENTER pressed).
1E67
AND (HL) A6
AND Register A with KFLAG$ at Register Pair HL (0074H): the other bits (BREAK, CAPS, type-ahead) are kept.
1E68
LD (HL),A 77
Store Register A back into KFLAG$ at Register Pair HL (0074H).
1E69
LD HL,007CH 21 7C 00LD HL,SFLAG$
Point Register Pair HL to 007CH (SFLAG$), the system flags.
1E6C
LD A,0F8H 3E F8
Load Register A with F8H (11111000 binary), the mask that clears bits 0 (no open bit, no LRL test), 1 (an EXEC only file was opened) and 2 (@LOAD called from @RUN).
1E6E
AND (HL) A6
AND Register A with SFLAG$ at Register Pair HL (007CH), keeping bits 3 to 7.
1E6F
LD (HL),A 77
Store Register A back into SFLAG$ at Register Pair HL (007CH).
1E70
LD HL,2FFFH 21 FF 2F
Load Register Pair HL with 2FFFH, the value of LOW$ for the command level: the last byte below 3000H, where programs load.
1E73
LD (001EH),HL 22 1E 00LD (LOW$),HL
Store Register Pair HL (2FFFH) into 001EH-001FH (LOW$), which @HIGH$ reads and sets with Register B not zero. SYS0/SYS loads 3000H there; every @EXIT and @CMNDI makes it 2FFFH.
1E76
LD HL,086EH 21 6E 08LD HL,OPREG_SV_AREA
Load Register Pair HL with 086EH (OPREG_SV_AREA), the rest value of the save pointer of ENADIS_DO_RAM on the BOOT/SYS page.
1E79
LD (0835H),HL 22 35 08LD (OPREG_SV_PTR),HL
Store Register Pair HL (086EH) into 0835H-0836H (OPREG_SV_PTR), the operand that ENADIS_DO_RAM and DIS_DO_RAM step: a program that left the video memory switched in does not leave its nesting level behind.
1E7C
LD A,(006CH) 3A 6C 00LD A,(CFLAG$)
Load Register A with CFLAG$ (006CH), the command flags.
1E7F
AND 20H E6 20
Mask Register A with 20H, keeping only bit 5 (SYSGEN not allowed); bits 0 (HIGH$ locked), 1 (@CMNDR executing), 2, 3, 4 (library commands only), 6 and 7 (error message options) are cleared.
1E81
LD (006CH),A 32 6C 00LD (CFLAG$),A
Store Register A, holding only bit 5, back into CFLAG$ at 006CH, the command flags.
1E84
LD HL,0420H 21 20 04LD HL,INBUF$
Point Register Pair HL to 0420H (INBUF$), the command line buffer.
1E87
PUSH HL E5
Save Register Pair HL (0420H, INBUF$) on the stack, to copy it into Register Pair BC.
1E88
POP BC C1
Restore it into Register Pair BC: Register Pair BC = 0420H too, the pointer to the start of the command line that @RUN and the commands expect.
1E89
EI FB
Enable interrupts again: the stack, the flags and the vectors are set for the next command.
1E8A
Call @CKBRKC at 0553H (on the BOOT/SYS page) to clear a BREAK still pending in KFLAG$ bit 0 (0074H), emptying the type-ahead buffer if there was one; it returns NZ if a BREAK was pending, with Register A unchanged, and the flag is not tested.
1E8D
RET C9
Return to the caller of CLEANUP (1E3FH or 1E44H, the address restored at 1E4DH) with Register Pair HL = Register Pair BC = 0420H.

1E8EH - The Command Interpreter: TRSDOS Ready

CMDCONT hands control to an Extended Command Interpreter in SYS13/SYS when EFLAG$ is not zero; otherwise it shows TRSDOS Ready and reads a line of up to 79 characters into INBUF$ (0420H) with @KEYIN, with bit 2 of CFLAG$ set while it waits. BREAK at the prompt starts over through @EXIT. CMD3A sends a new line unless the line is a comment (it starts with a period). CMD20, where @CMNDR joins, switches in memory bank 0, logs the line, and then: a comment line asks for the next line (or, while a DO file runs, ends the command); a line starting with * goes to SYS13/SYS function 7; a line starting with ! is run as a program even when its name is a library command; otherwise the name is parsed into the system FCB at 00E0H, looked up in the library table, and run as a library command, or else run with @RUN as a /CMD file.

1E8ECMDCONT
LD A,(006EH) 3A 6E 00LD A,(EFLAG$)
Load Register A with EFLAG$ (006EH), the Extended Command Interpreter flag, set by the user when SYS13/SYS holds an ECI program.
1E91
OR A B7
OR Register A with itself to test it for zero.
1E92
If Register A is 00H (no ECI), jump relative to 1E97H (CMD1A) to show TRSDOS Ready.
1E94
OR 8FH F6 8F
OR Register A with 8FH: bit 7 (overlay request) and bits 3-0 = FH (SYS13/SYS) are set, bits 6-4 of EFLAG$ stay as the function number of the request.
1E96
RST 28H EF
Issue RST 28H with the request in Register A: RST28 at 1A5BH loads SYS13/SYS over SYS1 and runs it. Its return (with RET) goes to @EXIT (1B0BH), which CLEANUP put on the stack, so the ECI is run again.
1E97CMD1A
LD HL,22EAH 21 EA 22LD HL,RDYMSG$
Point Register Pair HL to 22EAH (RDYMSG$), the prompt: line feed, cursor on, TRSDOS Ready, ENTER.
1E9A
Call @DSPLY at 052DH (on the BOOT/SYS page) to show the message at Register Pair HL (22EAH) on the video display.
1E9DCMD2
LD HL,006CH 21 6C 00LD HL,CFLAG$
Point Register Pair HL to 006CH (CFLAG$), the command flags. COMMENT jumps back here for the next line after a comment.
1EA0
SET 2,(HL) CB D6
Set bit 2 of CFLAG$ at Register Pair HL (006CH): @KEYIN is reading for SYS1, which lets the keyboard driver allow CTL-R (the previous command again).
1EA2
PUSH HL E5
Save Register Pair HL (006CH, CFLAG$) on the stack, to clear the bit again after @KEYIN.
1EA3
LD HL,0420H 21 20 04LD HL,INBUF$
Point Register Pair HL to 0420H (INBUF$), the command line buffer.
1EA6
LD BC,4F00H 01 00 4F
Load Register Pair BC with 4F00H: Register B = 4FH (79), the most characters @KEYIN accepts, and Register C = 00H, which @KEYIN does not use (it copies Register B into Register C).
1EA9
Call @KEYIN at 0585H (on the BOOT/SYS page): it reads a line into INBUF$ at Register Pair HL, ends it with 0DH, and returns Register Pair HL = 0420H, Register B = the number of characters, Carry set if BREAK ended it.
1EAC
EX (SP),HL E3
Exchange Register Pair HL (0420H) with the top of the stack (Stack Pointer): Register Pair HL = 006CH (CFLAG$), the buffer address goes on the stack. EX does not change the flags.
1EAD
RES 2,(HL) CB 96
Clear bit 2 of CFLAG$ at Register Pair HL (006CH): SYS1 is no longer waiting in @KEYIN.
1EAF
POP HL E1
Restore Register Pair HL from the stack: 0420H, the command line.
1EB0
If @KEYIN returned Carry (BREAK pressed), jump relative to 1E41H (CMD): the line is dropped and the system is reset and prompts again.
1EB2CMD3A
LD A,(HL) 7E
Load Register A with the first character of the command line at Register Pair HL (0420H). @CMNDI enters here from 1E3FH.
1EB3
CP 2EH FE 2E
Compare Register A with 2EH (the period), which starts a comment line.
1EB5
If the line is a comment, jump relative to 1EBCH (CMD20) without sending the new line below.
1EB7
LD A,0DH 3E 0D
Load Register A with 0DH (ENTER), the new line code of the video driver.
1EB9
Call @DSP at 0642H (on the BOOT/SYS page) to send Register A (0DH) to the video display: the output of the command starts on a new line, also for a command passed by @CMNDI that was never typed.
1EBCCMD20
XOR A AF
Clear Register A to 00H: bank 0. @CMNDR enters here from 1E39H with Register Pair HL = 0420H.
1EBD
LD B,A 47
Copy Register A (00H) into Register B: @BANK function 0, select a bank.
1EBE
LD C,A 4F
Copy Register A (00H) into Register C, the bank number in the form of the SVC call.
1EBF
Call @BANK at 0877H (on the BOOT/SYS page) with Register A = 00H (bank 0) and Register B = 00H (select): the normal upper 32K is switched in, whatever bank the last program left in use.
1EC2
Call @LOGER at 0503H (on the BOOT/SYS page) to send the command line at Register Pair HL (0420H) to the job log device (JL), so every command is logged when the job log is on.
1EC5
LD DE,00E0H 11 E0 00LD DE,CFCB$
Point Register Pair DE to 00E0H (CFCB$), the system's command FCB, into which the command name is parsed.
1EC8
LD A,(HL) 7E
Load Register A with the first character of the line at Register Pair HL.
1EC9
CP 2EH FE 2E
Compare Register A with 2EH (the period), a comment line.
1ECB
If the line is a comment, jump relative to 1F05H (COMMENT), which runs nothing.
1ECD
CP 2AH FE 2A
Compare Register A with 2AH (the asterisk), which asks for the alternate command processor in SYS13/SYS.
1ECF
If the line does not start with an asterisk, jump relative to 1ED7H (CKNOEXC).
1ED1
PUSH HL E5
Save Register Pair HL (the start of the line) on the stack.
1ED2
POP BC C1
Restore it into Register Pair BC: Register Pair BC points to the start of the command line, as for a program.
1ED3
INC HL 23
Increment Register Pair HL past the asterisk: Register Pair HL points to the rest of the line.
1ED4
LD A,0FFH 3E FF
Load Register A with FFH: an overlay request for SYS13/SYS (bits 3-0 = FH) with function 7 (bits 6-4).
1ED6
RST 28H EF
Issue RST 28H with the request in Register A: SYS13/SYS is loaded and run with Register Pair HL after the asterisk and Register Pair BC at the line. It returns to the address under SYS1's entry, @EXIT for a typed line.
1ED7CKNOEXC
SUB 21H D6 21
Subtract 21H (the exclamation mark) from Register A, the first character: Register A is 00H only for a line starting with an exclamation mark, which forces a program to be run.
1ED9
If Register A is not 00H, jump relative to 1EDCH (NOEXC) with Register Pair HL at the first character.
1EDB
INC HL 23
Increment Register Pair HL past the exclamation mark, to the program name.
1EDCNOEXC
LD (1EE6H),A 32 E6 1E
Self-Modifying Code
Store Register A (00H for an exclamation mark, any other value otherwise) into 1EE6H, the operand of the LD A at 1EE5H (TSTEXC).
1EDF
Call FSPEC at 205DH to parse the command name at Register Pair HL into the FCB at Register Pair DE (00E0H, CFCB$); it returns Register Pair HL after the name, Z for a valid specification.
1EE2
If the name is not a valid specification (NZ), jump relative to 1F01H (WHAT) to end with Register Pair HL = FFFFH.
1EE4
PUSH HL E5
Save Register Pair HL (the line after the command name) on the stack.
1EE5TSTEXC
LD A,00H 3E 00
Self-Modifying Code
Load Register A with the operand at 1EE6H, stored at 1EDCH: 00H when the line started with an exclamation mark. The file holds 00H.
1EE7
OR A B7
OR Register A with itself to test it for zero.
1EE8
If Register A is 00H (an exclamation mark), jump relative to 1EF2H (NOTLIB): the library table is not searched.
1EEA
LD BC,1F24H 01 24 1FLD BC,LIBTBL$
Load Register Pair BC with 1F24H (LIBTBL$), the library command table.
1EED
Call @FNDPRM at 2158H to look up the name in the FCB at Register Pair DE (00E0H) in the table at Register Pair BC (1F24H); it returns Z when found, with Register Pair DE = the entry's word.
1EF0
If the name is a library command (Z), jump relative to 1F11H (CMD4) to run it.
1EF2NOTLIB
LD HL,22E7H 21 E7 22LD HL,DFTEXT
Point Register Pair HL to 22E7H (DFTEXT), the default extension CMD.
1EF5
Call FEXT at 20D1H to add /CMD to the name in the FCB at Register Pair DE (00E0H) when it has no extension of its own.
1EF8
POP HL E1
Restore Register Pair HL from the stack: the pointer to the line after the command name, which the program receives.
1EF9
LD A,(006CH) 3A 6C 00LD A,(CFLAG$)
Load Register A with CFLAG$ (006CH), the command flags.
1EFC
AND 10H E6 10
Mask Register A with 10H, keeping bit 4: set when @CMNDR is to run library commands only.
1EFE
If bit 4 is clear, jump to @RUN at 1B1DH (on the SYS0/SYS page) with Register Pair DE = 00E0H (the FCB of the program) and Register Pair HL = the rest of the line: the program is loaded and run.
1F01WHAT
LD HL,0FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the return code of an aborted command: the name was not valid, or a program was asked for while only library commands are allowed.
1F04
RET C9
Return with Register Pair HL = FFFFH: to @EXIT (1B0BH, put on the stack by CLEANUP) for a typed command or @CMNDI, to the caller for @CMNDR.
1F05COMMENT
LD A,(007CH) 3A 7C 00LD A,(SFLAG$)
Load Register A with SFLAG$ (007CH), the system flags.
1F08
BIT 5,A CB 6F
Test bit 5 of Register A, set while a DO file supplies the command lines.
1F0A
If no DO file is running (bit 5 clear), jump to 1E9DH (CMD2) to read the next line without showing the prompt again.
1F0D
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, no error: a comment line read from a DO file ends as a command that worked.
1F10
RET C9
Return with Register Pair HL = 0000H, to @EXIT (1B0BH) or to the caller of @CMNDR.
1F11CMD4
POP HL E1
Restore Register Pair HL from the stack: the line after the command name, which the library command parses.
1F12
LD A,0C9H 3E C9
Load Register A with C9H (RET), the debugger hook value for off.
1F14
LD (199FH),A 32 9F 19LD (@DBGHK),A
Store Register A (C9H) into 199FH (@DBGHK): the debugger does not stop inside a library command.
1F17
LD A,D 7A
Copy Register D, the high byte of the table word in Register Pair DE, into Register A.
1F18
RLCA 07
Rotate Register A left: bit 7 of the word goes into the Carry flag. Bit 7 set marks a library member; clear, the word is the address of a routine of SYS1 (BOOTIT for BOOT).
1F19
PUSH DE D5
Save Register Pair DE (the table word) on the stack, as an address for the RET below.
1F1A
RET NC D0
If the Carry flag is clear, return to the address in Register Pair DE: BOOT jumps to 1F22H (BOOTIT).
1F1B
POP DE D1
Restore Register Pair DE from the stack: the word is a library entry.
1F1C
LD B,E 43
Copy Register E (the low byte of the word, the member's request code, as 21H for DIR) into Register B, where CKMOD@ looks for the member.
1F1D
RLCA 07
Rotate Register A left a second time: the bits of Register D (80H SYS6, A0H SYS7, C0H SYS8) move round; Register A is now 02H, 82H or 03H.
1F1E
RLCA 07
Rotate Register A left a third time: Register A is 04H for SYS6, 05H for SYS7 or 06H for SYS8, the library request less 84H.
1F1F
ADD A,84H C6 84
Add 84H to Register A: the request 88H (SYS6/SYS), 89H (SYS7/SYS) or 8AH (SYS8/SYS), function 0, the library requests of CKMOD@.
1F21
RST 28H EF
Issue RST 28H with the request in Register A and the member code in Register B: CKMOD@ reads the member from the library into 2400H and runs it with Register Pair HL at the line after the command name. Its RET goes to @EXIT or to the caller of @CMNDR.
1F22BOOTIT
XOR A AF
Clear Register A to 00H, SVC 0 (@IPL). The BOOT command enters here from the RET at 1F1AH.
1F23
RST 28H EF
Issue RST 28H with Register A = 00H: @IPL at 1BF2H (on the SYS0/SYS page) restarts the machine, as the BOOT command asks.

1F24H - LIBTBL$: The Library Command Table

The 39 command names of SYS1: 38 library commands, run from the libraries SYS6/SYS, SYS7/SYS and SYS8/SYS, and BOOT, in alphabetical order, in the old format of @FNDPRM: a name of six characters padded with spaces, then a word. In a word with bit 7 set, bits 6-5 pick the library (8000H SYS6, A000H SYS7, C000H SYS8, turned into the requests 88H, 89H and 8AH at 1F17H) and the low byte is the request code of the member entry that CKMOD@ looks for in the library file; a word with bit 7 clear is an address in SYS1 (BOOT, 1F22H). A 00H where the next name would start ends the table (2054H). LIB lists this table, reading its address from 1E02H.

1F24-1F29LIBTBL$
DEFM "APPEND" 41 50 50 45 4E 44
1F24H-1F29H: the name APPEND, six characters, entry 1 of the table.
1F2A-1F2B
DEFW 8031H 31 80
1F2AH-1F2BH = 8031H: APPEND runs member request 31H of SYS6/SYS (the member that holds COPY, at its second entry 2403H), through the request 88H.
1F2C-1F31
DEFM "ATTRIB" 41 54 54 52 49 42
1F2CH-1F31H: the name ATTRIB, six characters, entry 2 of the table.
1F32-1F33
DEFW 0A051H 51 A0
1F32H-1F33H = A051H: ATTRIB runs member request 51H of SYS7/SYS (the member that holds ATTRIB, at its entry 2400H), through the request 89H.
1F34-1F39
DEFM "AUTO " 41 55 54 4F 20 20
1F34H-1F39H: the name AUTO padded with spaces to six characters, entry 3 of the table.
1F3A-1F3B
DEFW 0A011H 11 A0
1F3AH-1F3BH = A011H: AUTO runs member request 11H of SYS7/SYS (the member that holds AUTO, at its entry 2400H), through the request 89H.
1F3C-1F41
DEFM "BOOT " 42 4F 4F 54 20 20
1F3CH-1F41H: the name BOOT padded with spaces to six characters, entry 4 of the table.
1F42-1F43
DEFW 1F22H 22 1F
1F42H-1F43H = 1F22H: bit 7 clear, so the word is an address in SYS1: BOOT returns to 1F22H (BOOTIT), which issues SVC 0 (@IPL) and restarts the machine.
1F44-1F49
DEFM "BUILD " 42 55 49 4C 44 20
1F44H-1F49H: the name BUILD padded with spaces to six characters, entry 5 of the table.
1F4A-1F4B
DEFW 0A033H 33 A0
1F4AH-1F4BH = A033H: BUILD runs member request 33H of SYS7/SYS (the member that holds BUILD, at its entry 2400H), through the request 89H.
1F4C-1F51
DEFM "CAT " 43 41 54 20 20 20
1F4CH-1F51H: the name CAT padded with spaces to six characters, entry 6 of the table.
1F52-1F53
DEFW 8020H 20 80
1F52H-1F53H = 8020H: CAT runs member request 20H of SYS6/SYS (the member that holds DIR, at its second entry 2403H), through the request 88H.
1F54-1F59
DEFM "CLS " 43 4C 53 20 20 20
1F54H-1F59H: the name CLS padded with spaces to six characters, entry 7 of the table.
1F5A-1F5B
DEFW 8024H 24 80
1F5AH-1F5BH = 8024H: CLS runs member request 24H of SYS6/SYS (the member that holds LIB, at its second entry 2403H), through the request 88H.
1F5C-1F61
DEFM "COPY " 43 4F 50 59 20 20
1F5CH-1F61H: the name COPY padded with spaces to six characters, entry 8 of the table.
1F62-1F63
DEFW 8032H 32 80
1F62H-1F63H = 8032H: COPY runs member request 32H of SYS6/SYS (the member that holds COPY, at its entry 2400H), through the request 88H.
1F64-1F69
DEFM "CREATE" 43 52 45 41 54 45
1F64H-1F69H: the name CREATE, six characters, entry 9 of the table.
1F6A-1F6B
DEFW 0A013H 13 A0
1F6AH-1F6BH = A013H: CREATE runs member request 13H of SYS7/SYS (the member that holds CREATE, at its entry 2400H), through the request 89H.
1F6C-1F71
DEFM "DATE " 44 41 54 45 20 20
1F6CH-1F71H: the name DATE padded with spaces to six characters, entry 10 of the table.
1F72-1F73
DEFW 0A015H 15 A0
1F72H-1F73H = A015H: DATE runs member request 15H of SYS7/SYS (the member that holds DATE, at its second entry 2403H), through the request 89H.
1F74-1F79
DEFM "DEBUG " 44 45 42 55 47 20
1F74H-1F79H: the name DEBUG padded with spaces to six characters, entry 11 of the table.
1F7A-1F7B
DEFW 0A014H 14 A0
1F7AH-1F7BH = A014H: DEBUG runs member request 14H of SYS7/SYS (the member that holds DEBUG, at its second entry 2403H), through the request 89H.
1F7C-1F81
DEFM "DEVICE" 44 45 56 49 43 45
1F7CH-1F81H: the name DEVICE, six characters, entry 12 of the table.
1F82-1F83
DEFW 8061H 61 80
1F82H-1F83H = 8061H: DEVICE runs member request 61H of SYS6/SYS (the member that holds DEVICE, at its entry 2400H), through the request 88H.
1F84-1F89
DEFM "DIR " 44 49 52 20 20 20
1F84H-1F89H: the name DIR padded with spaces to six characters, entry 13 of the table.
1F8A-1F8B
DEFW 8021H 21 80
1F8AH-1F8BH = 8021H: DIR runs member request 21H of SYS6/SYS (the member that holds DIR, at its entry 2400H), through the request 88H.
1F8C-1F91
DEFM "DO " 44 4F 20 20 20 20
1F8CH-1F91H: the name DO padded with spaces to six characters, entry 14 of the table.
1F92-1F93
DEFW 8091H 91 80
1F92H-1F93H = 8091H: DO runs member request 91H of SYS6/SYS (the member that holds DO, at its entry 2400H), through the request 88H.
1F94-1F99
DEFM "DUMP " 44 55 4D 50 20 20
1F94H-1F99H: the name DUMP padded with spaces to six characters, entry 15 of the table.
1F9A-1F9B
DEFW 0A071H 71 A0
1F9AH-1F9BH = A071H: DUMP runs member request 71H of SYS7/SYS (the member that holds DUMP, at its entry 2400H), through the request 89H.
1F9C-1FA1
DEFM "FILTER" 46 49 4C 54 45 52
1F9CH-1FA1H: the name FILTER, six characters, entry 16 of the table.
1FA2-1FA3
DEFW 8066H 66 80
1FA2H-1FA3H = 8066H: FILTER runs member request 66H of SYS6/SYS (the member that holds SET, at its entry 2C00H), through the request 88H.
1FA4-1FA9
DEFM "FORMS " 46 4F 52 4D 53 20
1FA4H-1FA9H: the name FORMS padded with spaces to six characters, entry 17 of the table.
1FAA-1FAB
DEFW 0C0B1H B1 C0
1FAAH-1FABH = C0B1H: FORMS runs member request B1H of SYS8/SYS (the member that holds FORMS, at its entry 2400H), through the request 8AH.
1FAC-1FB1
DEFM "FREE " 46 52 45 45 20 20
1FACH-1FB1H: the name FREE padded with spaces to six characters, entry 18 of the table.
1FB2-1FB3
DEFW 0A022H 22 A0
1FB2H-1FB3H = A022H: FREE runs member request 22H of SYS7/SYS (the member that holds FREE, at its entry 2400H), through the request 89H.
1FB4-1FB9
DEFM "LIB " 4C 49 42 20 20 20
1FB4H-1FB9H: the name LIB padded with spaces to six characters, entry 20 of the table.
1FBA-1FBB
DEFW 8019H 19 80
1FBAH-1FBBH = 8019H: LIB runs member request 19H of SYS6/SYS (the member that holds LIB, at its entry 2400H), through the request 88H.
1FBC-1FC1
DEFM "LINK " 4C 49 4E 4B 20 20
1FBCH-1FC1H: the name LINK padded with spaces to six characters, entry 21 of the table.
1FC2-1FC3
DEFW 8062H 62 80
1FC2H-1FC3H = 8062H: LINK runs member request 62H of SYS6/SYS (the member that holds LINK, at its entry 2400H), through the request 88H.
1FC4-1FC9
DEFM "LIST " 4C 49 53 54 20 20
1FC4H-1FC9H: the name LIST padded with spaces to six characters, entry 22 of the table.
1FCA-1FCB
DEFW 8041H 41 80
1FCAH-1FCBH = 8041H: LIST runs member request 41H of SYS6/SYS (the member that holds LIST, at its entry 2400H), through the request 88H.
1FCC-1FD1
DEFM "LOAD " 4C 4F 41 44 20 20
1FCCH-1FD1H: the name LOAD padded with spaces to six characters, entry 23 of the table.
1FD2-1FD3
DEFW 8081H 81 80
1FD2H-1FD3H = 8081H: LOAD runs member request 81H of SYS6/SYS (the member that holds LOAD, at its second entry 2403H), through the request 88H.
1FD4-1FD9
DEFM "MEMORY" 4D 45 4D 4F 52 59
1FD4H-1FD9H: the name MEMORY, six characters, entry 24 of the table.
1FDA-1FDB
DEFW 801EH 1E 80
1FDAH-1FDBH = 801EH: MEMORY runs member request 1EH of SYS6/SYS (the member that holds MEMORY, at its entry 2400H), through the request 88H.
1FDC-1FE1
DEFM "PURGE " 50 55 52 47 45 20
1FDCH-1FE1H: the name PURGE padded with spaces to six characters, entry 25 of the table.
1FE2-1FE3
DEFW 0A072H 72 A0
1FE2H-1FE3H = A072H: PURGE runs member request 72H of SYS7/SYS (the member that holds PURGE, at its entry 2400H), through the request 89H.
1FE4-1FE9
DEFM "REMOVE" 52 45 4D 4F 56 45
1FE4H-1FE9H: the name REMOVE, six characters, entry 26 of the table.
1FEA-1FEB
DEFW 8018H 18 80
1FEAH-1FEBH = 8018H: REMOVE runs member request 18H of SYS6/SYS (the member that holds REMOVE, at its entry 2400H), through the request 88H.
1FEC-1FF1
DEFM "RENAME" 52 45 4E 41 4D 45
1FECH-1FF1H: the name RENAME, six characters, entry 27 of the table.
1FF2-1FF3
DEFW 8053H 53 80
1FF2H-1FF3H = 8053H: RENAME runs member request 53H of SYS6/SYS (the member that holds RENAME, at its entry 2400H), through the request 88H.
1FF4-1FF9
DEFM "RESET " 52 45 53 45 54 20
1FF4H-1FF9H: the name RESET padded with spaces to six characters, entry 28 of the table.
1FFA-1FFB
DEFW 8063H 63 80
1FFAH-1FFBH = 8063H: RESET runs member request 63H of SYS6/SYS (the member that holds RESET, at its entry 2400H), through the request 88H.
1FFC-2001
DEFM "ROUTE " 52 4F 55 54 45 20
1FFCH-2001H: the name ROUTE padded with spaces to six characters, entry 29 of the table.
2002-2003
DEFW 8064H 64 80
2002H-2003H = 8064H: ROUTE runs member request 64H of SYS6/SYS (the member that holds ROUTE, at its entry 2400H), through the request 88H.
2004-2009
DEFM "RUN " 52 55 4E 20 20 20
2004H-2009H: the name RUN padded with spaces to six characters, entry 30 of the table.
200A-200B
DEFW 8082H 82 80
200AH-200BH = 8082H: RUN runs member request 82H of SYS6/SYS (the member that holds LOAD, at its entry 2400H), through the request 88H.
200C-2011
DEFM "SET " 53 45 54 20 20 20
200CH-2011H: the name SET padded with spaces to six characters, entry 31 of the table.
2012-2013
DEFW 8065H 65 80
2012H-2013H = 8065H: SET runs member request 65H of SYS6/SYS (the member that holds SET, at its second entry 2C03H), through the request 88H.
2014-2019
DEFM "SETCOM" 53 45 54 43 4F 4D
2014H-2019H: the name SETCOM, six characters, entry 32 of the table.
201A-201B
DEFW 0C0B2H B2 C0
201AH-201BH = C0B2H: SETCOM runs member request B2H of SYS8/SYS (the member that holds SETCOM, at its entry 2400H), through the request 8AH.
201C-2021
DEFM "SETKI " 53 45 54 4B 49 20
201CH-2021H: the name SETKI padded with spaces to six characters, entry 33 of the table.
2022-2023
DEFW 0C0B3H B3 C0
2022H-2023H = C0B3H: SETKI runs member request B3H of SYS8/SYS (the member that holds SETKI, at its entry 2400H), through the request 8AH.
2024-2029
DEFM "SPOOL " 53 50 4F 4F 4C 20
2024H-2029H: the name SPOOL padded with spaces to six characters, entry 34 of the table.
202A-202B
DEFW 0C0A2H A2 C0
202AH-202BH = C0A2H: SPOOL runs member request A2H of SYS8/SYS (the member that holds SPOOL, at its entry 2400H), through the request 8AH.
202C-2031
DEFM "SYSGEN" 53 59 53 47 45 4E
202CH-2031H: the name SYSGEN, six characters, entry 35 of the table.
2032-2033
DEFW 0C01CH 1C C0
2032H-2033H = C01CH: SYSGEN runs member request 1CH of SYS8/SYS (the member that holds SYSGEN, at its entry 2400H), through the request 8AH.
2034-2039
DEFM "SYSTEM" 53 59 53 54 45 4D
2034H-2039H: the name SYSTEM, six characters, entry 36 of the table.
203A-203B
DEFW 0C0A1H A1 C0
203AH-203BH = C0A1H: SYSTEM runs member request A1H of SYS8/SYS (the member that holds SYSTEM, at its entry 2400H), through the request 8AH.
203C-2041
DEFM "TIME " 54 49 4D 45 20 20
203CH-2041H: the name TIME padded with spaces to six characters, entry 37 of the table.
2042-2043
DEFW 0A016H 16 A0
2042H-2043H = A016H: TIME runs member request 16H of SYS7/SYS (the member that holds DATE, at its entry 2400H), through the request 89H.
2044-2049
DEFM "TOF " 54 4F 46 20 20 20
2044H-2049H: the name TOF padded with spaces to six characters, entry 38 of the table.
204A-204B
DEFW 8025H 25 80
204AH-204BH = 8025H: TOF runs member request 25H of SYS6/SYS (the member that holds LIB, at its fourth entry 2409H), through the request 88H.
204C-2051
DEFM "VERIFY" 56 45 52 49 46 59
204CH-2051H: the name VERIFY, six characters, entry 39 of the table.
2052-2053
DEFW 0A01BH 1B A0
2052H-2053H = A01BH: VERIFY runs member request 1BH of SYS7/SYS (the member that holds DEBUG, at its entry 2400H), through the request 89H.
2054
DEFB 00H 00
2054H: 00H, and it does two things at once. It is the byte where the first letter of a 39th name would stand, and the source's own comment against it reads Patch 'K' here for KILL, so writing 4BH here joins it to the five characters at 2055H and adds KILL to the table as a command. Left at 00H it is the end of the table instead, for @FNDPRM (2183H) and for LIB, and the eight bytes after it are unreachable. LS-DOS 6.3.1 took the dormant entry out altogether and spent the eight bytes on an ID entry at the head of the table.
2055-2059
DEFM "ILL " 49 4C 4C 20 20
2055H-2059H: the letters ILL and two spaces, the rest of the dormant name KILL. While 2054H holds 00H the table ends before these bytes and nothing reads them.
205A-205B
DEFW 8018H 18 80
205AH-205BH = 8018H: the member request the patched KILL would run, 18H of SYS6/SYS, which is REMOVE at its entry 2400H, through the request 88H. So KILL and REMOVE would be one command under two names.
205C
DEFB 00H 00
205CH: a zero byte after the end of the table, not used by the code; FSPEC starts at 205DH.

205DH - FSPEC: @FSPEC, Parse a File or Device Specification

@FSPEC (SVC 78, request C3H) copies a specification from the text at Register Pair HL into the FCB at Register Pair DE, in capitals: a name of up to 8 characters, then optional parts in this order: /extension (3), .password (8), :drive (1) and the exclamation mark that asks for the end of file to be written to the directory on every write. The text in the FCB ends with 03H (ETX). A device is * and two characters. When the word parsed is one of the prepositions TO, ON, OVER or USING, it is dropped and the next word is parsed into the same FCB. The return is Z with Register A = 00H for a valid specification, Register Pair HL after it (at the next word when spaces follow); NZ with Register A = the character that stopped it for an error. The command interpreter uses it for the command name (1EDFH).

205DFSPEC
PUSH DE D5
Save Register Pair DE (the FCB) on the stack, to return it in Register Pair DE.
205E
Call @PARSER at 2105H to copy up to 8 letters and digits of the name from Register Pair HL to the FCB at Register Pair DE; it returns Register A = the separator, Register Pair DE after the name (with 03H stored there), and Z if at least one character was taken.
2061
If no character was taken (NZ), jump relative to 20A1H (FSP5) to see whether this is a device specification.
2063
CP 2FH FE 2F
Compare Register A (the separator) with 2FH (the slash), which starts the extension.
2065
If there is no extension, jump relative to 206EH (FSP1).
2067
LD (DE),A 12
Store Register A (the slash) in the FCB at Register Pair DE, after the name.
2068
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
2069
LD B,03H 06 03
Load Register B with 03H, the most characters of an extension.
206B
Call @PAR1 at 2107H to copy up to Register B (3) characters of the extension into the FCB at Register Pair DE; Register A returns the separator after it. An empty extension is not refused.
206EFSP1
CP 2EH FE 2E
Compare Register A (the separator) with 2EH (the period), which starts the password.
2070
If there is no password, jump relative to 2079H (FSP2).
2072
LD (DE),A 12
Store Register A (the period) in the FCB at Register Pair DE.
2073
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
2074
Call @PARSER at 2105H to copy up to 8 characters of the password into the FCB at Register Pair DE; Register A returns the separator.
2077
If the password is empty (NZ), jump relative to 20AEH (FSP6) to return NZ, an error.
2079FSP2
CP 3AH FE 3A
Compare Register A (the separator) with 3AH (the colon), which starts the drive number.
207B
If there is no drive, jump relative to 2086H (FSP3).
207D
LD (DE),A 12
Store Register A (the colon) in the FCB at Register Pair DE.
207E
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
207F
LD B,01H 06 01
Load Register B with 01H: the drive is one character.
2081
Call @PAR1 at 2107H to copy the drive character into the FCB at Register Pair DE; Register A returns the separator.
2084
If no drive character followed the colon (NZ), jump relative to 20AEH (FSP6) to return NZ, an error.
2086FSP3
CP 21H FE 21
Compare Register A (the separator) with 21H (the exclamation mark), which asks that the end of file be written to the directory on every write.
2088
If there is none, jump relative to 208EH (FSP4).
208A
LD (DE),A 12
Store Register A (the exclamation mark) in the FCB at Register Pair DE.
208B
INC DE 13
Increment Register Pair DE past the exclamation mark, to the next byte of the FCB.
208C
INC HL 23
Increment Register Pair HL. @PARSER already left Register Pair HL after the exclamation mark, so this skips whatever character follows it: a space before the next word is harmless, but an opening parenthesis is lost (FILE!(X=1) hands @PARAM no list), and when the exclamation mark ends the line Register Pair HL is left one byte past the 0DH. This is bug T33. Bug T33: the INC HL steps over whatever follows the exclamation mark without testing it, so a specification ending in an exclamation mark at the end of the line leaves Register Pair HL one byte past the 0DH, and one followed by an opening parenthesis loses the parenthesis. The same instructions stand in LS-DOS 6.3.1, where Part 13 numbers it B12.
208D
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, taken as the separator.
208EFSP4
LD C,A 4F
Copy Register A (the separator) into Register C to keep it.
208F
LD A,03H 3E 03
Load Register A with 03H (ETX), the end mark of the text in the FCB.
2091
LD (DE),A 12
Store Register A (03H) in the FCB at Register Pair DE, after the last part of the specification.
2092
XOR A AF
Clear Register A to 00H and set the Z flag. Neither survives: the LD A,C below overwrites Register A without touching the flags, and @FNDPRM at 2099H sets the flags itself, so this instruction changes nothing the code goes on to read. LS-DOS 6.3.1 does not have it, which is one of the ten bytes by which the two files differ in length.
2093
LD A,C 79
Copy Register C (the separator) back into Register A.
2094
POP DE D1
Restore Register Pair DE from the stack: the start of the FCB.
2095
PUSH DE D5
Save Register Pair DE (the FCB) on the stack again.
2096
LD BC,20B0H 01 B0 20LD BC,PREPTBL
Load Register Pair BC with 20B0H (PREPTBL), the table of the prepositions TO, ON, OVER and USING.
2099
Call @FNDPRM at 2158H to look up the text in the FCB at Register Pair DE in the table at Register Pair BC (20B0H); Z if it is a preposition. Register Pair HL is kept.
209C
POP DE D1
Restore Register Pair DE from the stack: the start of the FCB.
209D
If the word was a preposition (Z), jump relative to 205DH (FSPEC) to parse the next word into the same FCB. A file named TO, ON, OVER or USING (whatever its extension) cannot be given. Bug T35: a word that matches one of the prepositions TO, ON, OVER or USING is passed over and the next word parsed into the same FCB, so a file of one of those four names cannot be given to @FSPEC at all. The same instructions stand in LS-DOS 6.3.1, where Part 13 numbers it B14.
209F
XOR A AF
Clear Register A to 00H and set the Z flag: the specification is valid.
20A0
RET C9
Return Z with Register Pair DE at the FCB and Register Pair HL after the specification.
20A1FSP5
CP 2AH FE 2A
Compare Register A (the separator) with 2AH (the asterisk), the start of a device specification.
20A3
If it is not an asterisk, jump relative to 20AEH (FSP6) to return NZ (from the CP) with Register A = the character.
20A5
LD (DE),A 12
Store Register A (the asterisk) in the FCB at Register Pair DE.
20A6
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
20A7
LD B,02H 06 02
Load Register B with 02H: a device name is two characters.
20A9
Call @PAR1 at 2107H to copy up to Register B (2) characters of the device name into the FCB at Register Pair DE.
20AC
If a character was taken (Z), jump relative to 208EH (FSP4) to end the text with 03H and check for a preposition.
20AEFSP6
POP DE D1
Restore Register Pair DE from the stack: the start of the FCB.
20AF
RET C9
Return NZ with Register A = the character that ended the parse, an error.
20B0-20B5PREPTBL
DEFM "TO " 54 4F 20 20 20 20
PREPTBL, 20B0H-20B5H: the preposition TO, padded with spaces to six characters, in the old table format of @FNDPRM.
20B6-20B7
DEFW 1D00H 00 1D
20B6H-20B7H = 1D00H (SBUFF$): the word of the TO entry. FSPEC only uses the Z of a match; the word is a harmless address in the system buffer.
20B8-20BD
DEFM "ON " 4F 4E 20 20 20 20
20B8H-20BDH: the preposition ON, padded with spaces to six characters.
20BE-20BF
DEFW 1D00H 00 1D
20BEH-20BFH = 1D00H (SBUFF$): the word of the ON entry, not used.
20C0-20C5
DEFM "OVER " 4F 56 45 52 20 20
20C0H-20C5H: the preposition OVER, padded with spaces to six characters.
20C6-20C7
DEFW 1D00H 00 1D
20C6H-20C7H = 1D00H (SBUFF$): the word of the OVER entry, not used.
20C8-20CD
DEFM "USING " 55 53 49 4E 47 20
20C8H-20CDH: the preposition USING, padded with a space to six characters.
20CE-20CF
DEFW 1D00H 00 1D
20CEH-20CFH = 1D00H (SBUFF$): the word of the USING entry, not used.
20D0
DEFB 00H 00
20D0H: 00H, the end of the preposition table for @FNDPRM.

20D1H - FEXT: @FEXT, Insert a Default Extension

@FEXT (SVC 79, request D3H) looks at the text in the FCB at Register Pair DE: if the name, read from its second character for up to nine letters and digits, ends in a slash, the file has an extension and nothing changes. Otherwise the rest of the text from the character that ended the name (a period, a colon, an exclamation mark or the 03H) is moved four bytes up and /ext, the three characters at Register Pair HL, is put in. Register Pair DE returns the FCB; Register Pair BC and, when the extension is inserted, Register Pair HL are changed. The command interpreter uses it to add /CMD to a program name (1EF5H).

20D1FEXT
PUSH DE D5
Save Register Pair DE (the FCB) on the stack.
20D2
PUSH HL E5
Save Register Pair HL (the default extension) on the stack.
20D3
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the FCB.
20D4
INC HL 23
Increment Register Pair HL past the first character of the name, which @FSPEC took as a letter or digit.
20D5
LD B,09H 06 09
Load Register B with 09H, the most characters to look at.
20D7FEX1
LD A,(HL) 7E
Load Register A with the character of the FCB at Register Pair HL.
20D8
CP 2FH FE 2F
Compare Register A with 2FH (the slash) that starts an extension.
20DA
If the name has an extension, jump relative to 20E9H (FEX3) to return without a change.
20DC
If Register A is below 2FH (a period, an exclamation mark, the 03H end mark), jump relative to 20ECH (FEX4) to insert the extension here.
20DE
CP 3AH FE 3A
Compare Register A with 3AH, one above the digit 9.
20E0
If Register A is a digit (below 3AH), jump relative to 20E6H (FEX2) to go on.
20E2
CP 41H FE 41
Compare Register A with 41H, the letter A, the first of the capitals.
20E4
If Register A is 3AH-40H (a colon or another sign), jump relative to 20ECH (FEX4) to insert the extension before it.
20E6FEX2
INC HL 23
Increment Register Pair HL past the letter or digit.
20E7
Decrement Register B and loop to 20D7H (FEX1) until nine characters have been seen.
20E9FEX3
POP HL E1
Restore Register Pair HL from the stack: the default extension, unchanged.
20EA
POP DE D1
Restore Register Pair DE from the stack: the start of the FCB.
20EB
RET C9
Return with Register Pair DE at the FCB and the text of the FCB unchanged.
20ECFEX4
LD BC,000FH 01 0F 00
Load Register Pair BC with 000FH (15), to point 15 bytes past the separator at Register Pair HL.
20EF
ADD HL,BC 09
Add Register Pair BC (15) to Register Pair HL: Register Pair HL points to the last of the 16 bytes of the FCB from the separator on.
20F0
LD D,H 54
Copy Register H into Register D, the high byte of the last byte to move.
20F1
LD E,L 5D
Copy Register L into Register E: Register Pair DE = Register Pair HL.
20F2
INC DE 13
Increment Register Pair DE: the destination is four bytes higher, room for the slash and three characters.
20F3
INC DE 13
Increment Register Pair DE again, the second of the four bytes of room.
20F4
INC DE 13
Increment Register Pair DE again, the third of the four bytes of room.
20F5
INC DE 13
Increment Register Pair DE (fourth of four): Register Pair DE = Register Pair HL + 4.
20F6
INC BC 03
Increment Register Pair BC to 0010H (16), the number of bytes to move.
20F7
LDDR ED B8
Copy Register Pair BC (16) bytes downward from Register Pair HL to Register Pair DE: the separator and the rest of the text move four bytes up. Register Pair DE ends three bytes after the separator's old place.
20F9
POP HL E1
Restore Register Pair HL from the stack: the default extension.
20FA
INC HL 23
Increment Register Pair HL to the second character of the default extension.
20FB
INC HL 23
Increment Register Pair HL again: Register Pair HL points to the third character of the extension.
20FC
LD C,03H 0E 03
Load Register C with 03H (Register B is already 00H): three characters to copy.
20FE
LDDR ED B8
Copy Register Pair BC (3) bytes downward from Register Pair HL to Register Pair DE: the extension goes into the three bytes after the separator's old place; Register Pair DE ends at that place.
2100
LD A,2FH 3E 2F
Load Register A with 2FH, the slash that starts the inserted extension.
2102
LD (DE),A 12
Store Register A (the slash) at Register Pair DE, before the extension: the name now reads NAME/EXT.
2103
POP DE D1
Restore Register Pair DE from the stack: the start of the FCB.
2104
RET C9
Return with Register Pair DE at the FCB, whose text now has the default extension.

2105H - @PARSER: Copy One Word into a Buffer

@PARSER (entered with Register B = 8) and @PAR1 (Register B = the length) copy the letters and digits at Register Pair HL to Register Pair DE, small letters made capitals, at most Register B of them; further letters and digits are passed over. The word ends at 03H, 0DH or an opening parenthesis (left at Register Pair HL) or at any other character (Register Pair HL is left after it). A space that ends the word is followed past the spaces after it. A 03H is stored after the word at Register Pair DE. The return is Z when at least one character was copied, NZ for an empty word, with Register A and Register C = the separator. FSPEC and PARAM use it; TST09AZ, the test for a letter or digit, is shared with @FNDPRM.

2105@PARSER
LD B,08H 06 08
Load Register B with 08H, the length of a name or a password.
2107@PAR1
LD A,B 78
Copy Register B (the most characters to copy) into Register A.
2108
LD (2146H),A 32 46 21
Self-Modifying Code
Store Register A (the length, never 00H) into 2146H, the operand of the LD A at 2145H (PAR6): it stays non zero, the mark of an empty word, until a character is copied.
210B
INC B 04
Increment Register B, so that the count at 2129H reaches zero only after Register B characters.
210CPAR2
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
210D
CP 03H FE 03
Compare Register A with 03H (ETX), an end of text.
210F
If it is 03H, jump relative to 2137H (PAR5) with Register Pair HL at it.
2111
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of a command line.
2113
If it is 0DH, jump relative to 2137H (PAR5) with Register Pair HL at it.
2115
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis of a parameter list.
2117
If it is the parenthesis, jump relative to 2137H (PAR5) with Register Pair HL at it, for @PARAM.
2119
INC HL 23
Increment Register Pair HL past the character: from here on a separator is left behind Register Pair HL.
211A
Call TST09AZ at 214AH: No Carry when Register A is a digit 0-9 or a capital A-Z.
211D
If Register A is a digit or a capital (No Carry), jump relative to 2129H (PAR3) to copy it.
211F
CP 61H FE 61
Compare Register A with 61H, the small letter a.
2121
If Register A is below 61H (a sign or a space), jump relative to 2137H (PAR5): it ends the word.
2123
CP 7BH FE 7B
Compare Register A with 7BH, one above the small letter z.
2125
If Register A is 7BH or above, jump relative to 2137H (PAR5): it ends the word.
2127
RES 5,A CB AF
Clear bit 5 of Register A: the small letter becomes a capital.
2129PAR3
DEC B 05
Decrement Register B, the count of characters still to copy.
212A
If Register B has reached zero (the word is longer than allowed), jump relative to 2134H (PAR4) without copying.
212C
LD (DE),A 12
Store Register A (the character) at Register Pair DE.
212D
XOR A AF
Clear Register A to 00H, the mark that the word is not empty.
212E
LD (2146H),A 32 46 21
Self-Modifying Code
Store Register A (00H) into 2146H, the operand of the LD A at 2145H: at least one character has been copied.
2131
INC DE 13
Increment Register Pair DE to the next byte of the buffer.
2132
Jump relative to 210CH (PAR2) for the next character.
2134PAR4
INC B 04
Increment Register B back to 01H, so that the next extra character also finds the count at zero and is passed over.
2135
Jump relative to 210CH (PAR2) for the next character.
2137PAR5
LD C,A 4F
Copy Register A (the separator) into Register C.
2138
LD A,03H 3E 03
Load Register A with 03H (ETX), the mark that ends the word in the buffer.
213A
LD (DE),A 12
Store Register A (03H) at Register Pair DE, after the characters copied. Register Pair DE is not moved, so the next word of the same parse overwrites the 03H.
213B
LD A,C 79
Copy Register C, the separator saved at 2137H, back into Register A.
213C
CP 20H FE 20
Compare Register A, the separator, with 20H, the space character.
213E
If the separator is not a space, jump relative to 2145H (PAR6) with Register Pair HL at the character after it.
2140PAR5A
CP (HL) BE
Compare Register A (20H) with the character at Register Pair HL, the next one in the line.
2141
INC HL 23
Increment Register Pair HL past that character.
2142
If it was another space (Z), jump relative to 2140H (PAR5A) to pass over it as well.
2144
DEC HL 2B
Decrement Register Pair HL back to the character that is not a space, so that the next word is read from there. This release spends a byte on the DEC HL; LS-DOS 6.3.1 lays the same loop out so that it falls out with Register Pair HL already right, by jumping into the second byte of a CP 23H and running it as an INC HL.
2145PAR6
LD A,00H 3E 00
Self-Modifying Code
Load Register A with the operand at 2146H: 00H when a character was copied, the length stored at 2108H when none was. The file holds 00H.
2147
OR A B7
OR Register A with itself: Z for a word of at least one character, NZ for an empty one.
2148
LD A,C 79
Copy Register C (the separator) back into Register A; the flags are kept.
2149
RET C9
Return with Register A = Register C = the separator.
214ATST09AZ
CP 30H FE 30
Compare Register A with 30H, the digit 0, the lowest letter or digit.
214C
RET C D8
Return with Carry if Register A is below 30H: not a digit or a letter.
214D
CP 3AH FE 3A
Compare Register A with 3AH, one above the digit 9.
214F
If Register A is a digit (Carry), jump relative to 2156H (EXITC) to turn the Carry into No Carry.
2151
CP 41H FE 41
Compare Register A with 41H, the letter A, the first of the capitals.
2153
RET C D8
Return with Carry if Register A is 3AH-40H, a sign between the digits and the capitals.
2154
CP 5BH FE 5B
Compare Register A with 5BH, one above the letter Z: Carry for a capital, No Carry for 5BH and above.
2156EXITC
CCF 3F
Complement the Carry flag: No Carry for a digit or a capital, Carry for any other value of Register A.
2157
RET C9
Return with the result in the Carry flag; Register A is unchanged.

2158H - @FNDPRM: Look Up a Word in a Table

@FNDPRM looks up the word at Register Pair DE (ended by 03H, 0DH or any character that is not a letter or digit) in the table at Register Pair BC. A table whose first byte has bit 7 set (80H) is in the enhanced format: after that byte, entries of a type byte (bits 3-0 the name length, bit 4 a single letter abbreviation allowed), the name, a response byte and a word. Any other table is in the old format: names of six characters padded with spaces, each with a word. A 00H where the next entry starts ends the table. Three instruction operands (2180H, 219EH and 21B8H) are set from the format: the step from a name to the next entry, the characters to compare after the first, and the offset of the word. The return is Z with Register Pair DE = the entry's word and Register Pair BC = the address of its response byte (for an old table, a byte in page 1DH, SBUFF$, so that the table is not changed), or NZ with Register A = 01H when the word is not in the table; Register Pair HL is kept. The word matches when its characters agree with the name for the name's length: a longer word whose first characters are a name that fills its field (any name of an enhanced table, a six letter name of an old one) matches that name (bug T32).

2158@FNDPRM
PUSH HL E5
Save Register Pair HL (the caller's pointer) on the stack.
2159
LD H,B 60
Copy Register B into Register H, the high byte of the table address.
215A
LD L,C 69
Copy Register C into Register L: Register Pair HL points to the table at Register Pair BC.
215B
LD A,(HL) 7E
Load Register A with the first byte of the table at Register Pair HL.
215C
RLCA 07
Rotate Register A left: bit 7, the mark of the enhanced format, goes into the Carry flag.
215D
PUSH AF F5
Save Register Pair AF on the stack: the Carry flag (set for the enhanced format) is kept there for the whole search.
215E
If the table is in the old format (No Carry), jump relative to 2161H (FND1) with Register Pair HL at the first name.
2160
INC HL 23
Increment Register Pair HL past the 80H mark of an enhanced table, to the first type byte.
2161FND1
POP AF F1
Restore Register Pair AF from the stack: the Carry flag tells the format.
2162
PUSH AF F5
Save Register Pair AF on the stack again, to keep the format flag for later tests.
2163
LD A,05H 3E 05
Load Register A with 05H, the characters to compare after the first in an old table (names of six).
2165
LD BC,0102H 01 02 01
Load Register Pair BC with 0102H: Register B = 01H and Register C = 02H, added below to give the offsets of an old table.
2168
If the table is in the old format (No Carry), jump relative to 2170H (FND1A) with these values.
216A
LD A,(HL) 7E
Load Register A with the type byte of the entry at Register Pair HL.
216B
AND 0FH E6 0F
Mask Register A with 0FH, keeping bits 3-0, the length of the name.
216D
DEC A 3D
Decrement Register A: the characters to compare after the first.
216E
INC B 04
Increment Register B to 02H: in an enhanced entry the word is one byte further on, after the response byte.
216F
INC HL 23
Increment Register Pair HL past the type byte, to the name.
2170FND1A
LD (219EH),A 32 9E 21
Self-Modifying Code
Store Register A (the name length less 1; 05H for an old table) into 219EH, the operand of the LD B at 219DH (FND3A).
2173
ADD A,B 80
Add Register B to Register A: the name length (old: 6), or the name length plus 1 (enhanced), the offset of the word from the name.
2174
LD (21B8H),A 32 B8 21
Self-Modifying Code
Store Register A (the offset of the word) into 21B8H, the operand of the LD BC at 21B7H (FND5A).
2177
ADD A,C 81
Add Register C (02H) to Register A: the length from this name to the next entry (old: 8; enhanced: the name length plus 3, the name, the response byte and the word).
2178
LD (2180H),A 32 80 21
Self-Modifying Code
Store Register A into 2180H, the low byte of the operand of the LD BC at 217FH (FND2), the step to the next entry.
217B
LD A,(DE) 1A
Load Register A with the first character of the word at Register Pair DE.
217C
CP (HL) BE
Compare Register A with the first character of the name at Register Pair HL.
217D
If they are the same, jump relative to 218BH (FND3) to compare the rest.
217FFND2
LD BC,0008H 01 08 00
Self-Modifying Code
Load Register Pair BC with the length of an entry, the operand at 2180H stored at 2178H. The file holds 0008H.
2182
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL points to the next entry (its name in an old table, its type byte in an enhanced one).
2183
LD A,(HL) 7E
Load Register A with the first byte of the next entry at Register Pair HL.
2184
OR A B7
OR Register A with itself: 00H is the end of the table.
2185
If there is another entry (NZ), jump relative to 2161H (FND1) to try it.
2187
POP HL E1
Restore Register Pair HL from the stack: the format flag is dropped.
2188
POP HL E1
Restore Register Pair HL from the stack: the caller's pointer.
2189
INC A 3C
Increment Register A from 00H to 01H: the NZ flag tells the caller that the word is not in the table.
218A
RET C9
Return NZ with Register A = 01H and Register Pair HL as the caller gave it.
218BFND3
POP AF F1
Restore Register Pair AF from the stack: the format flag in the Carry flag.
218C
PUSH AF F5
Save Register Pair AF on the stack again, to keep the format flag for 21C1H.
218D
If the table is in the old format (No Carry), jump relative to 219DH (FND3A): no abbreviations there.
218F
DEC HL 2B
Decrement Register Pair HL to the type byte of the enhanced entry.
2190
BIT 4,(HL) CB 66
Test bit 4 of the type byte at Register Pair HL: set when the name's first letter alone may stand for it.
2192
INC HL 23
Increment Register Pair HL back to the name; INC does not change the Z flag of the BIT.
2193
If no abbreviation is allowed (Z), jump relative to 219DH (FND3A) to compare the whole name.
2195
INC DE 13
Increment Register Pair DE to the second character of the word.
2196
LD A,(DE) 1A
Load Register A with the second character of the word at Register Pair DE.
2197
DEC DE 1B
Decrement Register Pair DE back to the first character.
2198
Call TST09AZ at 214AH: Carry if the second character is not a letter or digit, so the word is the single letter.
219B
If the word is a single letter (Carry), jump relative to 21B7H (FND5A): it is the abbreviation of this name.
219DFND3A
LD B,05H 06 05
Self-Modifying Code
Load Register B with the characters to compare after the first, the operand at 219EH stored at 2170H. The file holds 05H.
219F
PUSH HL E5
Save Register Pair HL (the name) on the stack.
21A0
PUSH DE D5
Save Register Pair DE (the word) on the stack.
21A1
LD A,B 78
Copy Register B (the characters still to compare) into Register A, to test it.
21A2
OR A B7
OR Register A with itself, to test Register B for zero (a name of one character).
21A3
If there is nothing more to compare, jump relative to 21B5H (FND5): the word matches.
21A5FND4
INC DE 13
Increment Register Pair DE to the next character of the word.
21A6
INC HL 23
Increment Register Pair HL to the next character of the name.
21A7
LD A,(DE) 1A
Load Register A with the character of the word at Register Pair DE.
21A8
CP 03H FE 03
Compare Register A with 03H (ETX), the end of the word.
21AA
If the word ends here, jump relative to 21CEH (FND7) to see whether the name ends too.
21AC
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of a line.
21AE
If the word ends here, jump relative to 21CEH (FND7).
21B0
CP (HL) BE
Compare Register A with the character of the name at Register Pair HL.
21B1
If they differ, jump relative to 21C9H (FND6).
21B3
Decrement Register B and loop to 21A5H (FND4) until the whole name has been compared. Characters of the word after that are not looked at, so a longer word matches a name that fills its field (bug T32). Bug T32: @FNDPRM compares only as many characters as the name in the table holds and does not test that the word ends there, so a command name such as APPENDIX or SETCOMM is taken as the library command APPEND or SETCOM and run. The same instructions stand in LS-DOS 6.3.1, where Part 13 numbers it B11.
21B5FND5
POP DE D1
Restore Register Pair DE from the stack: the start of the word.
21B6
POP HL E1
Restore Register Pair HL from the stack: the start of the name.
21B7FND5A
LD BC,0006H 01 06 00
Self-Modifying Code
Load Register Pair BC with the offset of the entry's word from its name, the operand at 21B8H stored at 2174H. The file holds 0006H.
21BA
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL points to the entry's word.
21BB
LD C,L 4D
Copy Register L, the low byte of the address of the word, into Register C.
21BC
LD B,H 44
Copy Register H into Register B: Register Pair BC = the address of the word.
21BD
DEC BC 0B
Decrement Register Pair BC to the byte before the word: the response byte of an enhanced entry.
21BE
LD E,(HL) 5E
Load Register E with the low byte of the word at Register Pair HL.
21BF
INC HL 23
Increment Register Pair HL from the low byte to the high byte of the entry's word.
21C0
LD D,(HL) 56
Load Register D with the high byte at Register Pair HL: Register Pair DE = the entry's word.
21C1
POP AF F1
Restore Register Pair AF from the stack: the format flag in the Carry flag.
21C2
If the table is in the enhanced format (Carry), jump relative to 21C6H with Register Pair BC at the response byte.
21C4
LD B,1DH 06 1D
Load Register B with 1DH: in an old table the byte before the word is the last letter of the name, so Register Pair BC is moved into page 1DH (SBUFF$, 1D00H-1DFFH) and @PARAM marks its response there instead.
21C6
POP HL E1
Restore Register Pair HL from the stack: the caller's pointer.
21C7
XOR A AF
Clear Register A to 00H and set the Z flag: found.
21C8
RET C9
Return Z with Register Pair DE = the word and Register Pair BC = the response byte.
21C9FND6
Call TST09AZ at 214AH with Register A, the character of the word that differs from the name.
21CC
If it is a letter or digit (No Carry), jump relative to 21D3H (FND8): the word is a different name.
21CEFND7
LD A,(HL) 7E
Load Register A with the character of the name at Register Pair HL, where the word ended.
21CF
CP 20H FE 20
Compare Register A with 20H, the space that pads a name of an old table.
21D1
If the name ends here too (a space), jump relative to 21B5H (FND5): the word matches.
21D3FND8
POP DE D1
Restore Register Pair DE from the stack: the start of the word.
21D4
POP HL E1
Restore Register Pair HL from the stack: the start of the name.
21D5
Jump relative to 217FH (FND2) to step to the next entry.

21D7H - PARAM: @PARAM, Parse a Parameter List

@PARAM (SVC 17, request E3H) reads the parameters at Register Pair HL against the table at Register Pair DE. Spaces are passed over; a line that ends (0DH) or does not go on with an opening parenthesis returns Z at once, and the response bytes of the table are then left as they were. With a parenthesis, the response bytes of an enhanced table are first set to zero; then each word (up to 15 characters, copied to SBUFF$ at 1D00H) is looked up with @FNDPRM, and its value goes into the two bytes the entry's word points to: FFFFH for a word without =, else the value after = (ASSIGN at 2244H). Parameters are separated by commas; the list ends at the closing parenthesis or at 0DH. A word not in the table or a bad value returns NZ with Register A = 2CH (44, Parameter error). The types allowed by an entry's type byte are not checked: the program reads the response byte.

21D7PARAM0
INC HL 23
Increment Register Pair HL past a space before the parameters.
21D8PARAM
LD A,(HL) 7E
Load Register A with the character at Register Pair HL. @PARAM enters here from 1E17H.
21D9
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of the command line.
21DB
RET Z C8
Return Z if the line ends here: there are no parameters, and nothing in the table is changed. Bug T34: @PARAM returns here without clearing the response bytes when the line has no parameter list, so they keep whatever the caller left in them. The same instructions stand in LS-DOS 6.3.1, where Part 13 numbers it B13.
21DC
CP 20H FE 20
Compare Register A with 20H, the space that may come before the parameter list.
21DE
If it is a space, jump relative to 21D7H (PARAM0) to pass over it.
21E0
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis.
21E2
If there is no parenthesis, jump relative to 2242H (PARAM5) to return Z: no parameter list.
21E4
LD A,(DE) 1A
Load Register A with the first byte of the table at Register Pair DE.
21E5
RLCA 07
Rotate Register A left: bit 7 (80H, the enhanced format) goes into the Carry flag.
21E6
If the table is in the old format (No Carry), jump relative to 21FFH (PARAM1): it has no response bytes.
21E8
PUSH DE D5
Save Register Pair DE (the table) on the stack.
21E9
INC DE 13
Increment Register Pair DE past the 80H mark, to the first type byte.
21EA
PUSH HL E5
Save Register Pair HL (the line at the parenthesis) on the stack.
21EB
LD A,(DE) 1A
Load Register A with the type byte at Register Pair DE.
21EC
AND 0FH E6 0F
Mask Register A with 0FH, keeping the length of the name.
21EE
If the length is 0 (the 00H that ends the table), jump relative to 21FDH.
21F0
LD L,A 6F
Copy Register A, the length of this name, into Register L.
21F1
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the name length.
21F3
INC L 2C
Increment Register L: the name length plus 1, the distance from the type byte to the response byte of this entry.
21F4
ADD HL,DE 19
Add Register Pair DE, the type byte of the entry, to Register Pair HL: Register Pair HL points at the response byte.
21F5
LD (HL),00H 36 00
Store 00H into the response byte at Register Pair HL: no value has been found for this parameter yet.
21F7
INC HL 23
Increment Register Pair HL past the response byte.
21F8
INC HL 23
Increment Register Pair HL past the low byte of the word that follows it.
21F9
INC HL 23
Increment Register Pair HL past the high byte, to the type byte of the next entry.
21FA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE points at the next type byte.
21FB
Jump relative to 21EBH to clear the response byte of that entry, and so on to the 00H that ends the table. LS-DOS 6.3.1 writes the same loop in one byte less, by clearing Register A once with XOR A and using it for Register H and for the stored byte where this release loads each of them separately.
21FD
POP HL E1
Restore Register Pair HL from the stack: the line at the parenthesis.
21FE
POP DE D1
Restore Register Pair DE from the stack: the table.
21FFPARAM1
PUSH DE D5
Save Register Pair DE (the table) on the stack. The loop for each parameter comes back here with Register Pair HL at the parenthesis or the comma before it.
2200
LD B,0FH 06 0F
Load Register B with 0FH, the most characters of a parameter word.
2202
LD DE,1D00H 11 00 1DLD DE,SBUFF$
Point Register Pair DE to 1D00H (SBUFF$), the system buffer, where the word is copied for @FNDPRM.
2205
INC HL 23
Increment Register Pair HL past the parenthesis or the comma.
2206
Call @PAR1 at 2107H to copy up to Register B (15) characters of the word from Register Pair HL to 1D00H at Register Pair DE; it returns Register A = the separator and Z if the word is not empty.
2209
DEC HL 2B
Decrement Register Pair HL back to the separator, which @PAR1 left behind Register Pair HL (after spaces, to the last of them). A 03H or an opening parenthesis is left at Register Pair HL, so there the decrement lands on the last letter of the word, which is then stored as a flag before 223FH finds the error.
220A
POP DE D1
Restore Register Pair DE from the stack: the table.
220B
If the word was empty (NZ), jump relative to 2220H (ERROUT): Parameter error.
220D
CP 0DH FE 0D
Compare Register A (the separator) with 0DH (ENTER).
220F
If Register A is not 0DH, jump relative to 2212H with Register Pair HL at the separator.
2211
INC HL 23
Increment Register Pair HL again: @PAR1 leaves a 0DH at Register Pair HL, so the decrement at 2209H is undone.
2212
PUSH DE D5
Save Register Pair DE (the table) on the stack.
2213
LD B,D 42
Copy Register D into Register B, the high byte of the table address.
2214
LD C,E 4B
Copy Register E into Register C: Register Pair BC = the table for @FNDPRM.
2215
LD DE,1D00H 11 00 1DLD DE,SBUFF$
Point Register Pair DE to 1D00H (SBUFF$), the word.
2218
Call @FNDPRM at 2158H to look up the word at Register Pair DE (1D00H) in the table at Register Pair BC; Z if found, with Register Pair DE = the address for the value and Register Pair BC = the response byte.
221B
PUSH BC C5
Save Register Pair BC (the response byte) on the stack.
221C
If the word is in the table (Z), jump relative to 2223H (PARAM3).
221EPARAM2
POP DE D1
Restore Register Pair DE from the stack: the response pointer is dropped.
221F
POP DE D1
Restore Register Pair DE from the stack: the table.
2220ERROUT
LD A,2CH 3E 2C
Load Register A with 2CH (44), the error code Parameter error; the NZ flag of the failed test is kept.
2222
RET C9
Return NZ with Register A = 2CH, the error code for a bad parameter.
2223PARAM3
LD A,(HL) 7E
Load Register A with the separator at Register Pair HL.
2224
CP 3DH FE 3D
Compare Register A with 3DH, the equals sign that brings a value.
2226
If an equals sign follows the word (Z), jump relative to 2244H (ASSIGN) to read the value after it.
2228
LD BC,0FFFFH 01 FF FF
Load Register Pair BC with 0FFFFH: a parameter given with no value means ON. LS-DOS 6.3.1 loads Register Pair BC with 0000H above this test instead, at its own 2224H, and reaches FFFFH here with a DEC BC, which saves it two bytes and also hands ASSIGN, ONOFF and HEXVAL a Register Pair BC of 0000H that in this release each of them clears for itself.
222BPARMSW
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (Stack Pointer): Register Pair HL = the response byte, the line pointer goes on the stack.
222C
SET 6,(HL) CB F6
Set bit 6 of the response byte at Register Pair HL: a flag value was found.
222EPARAM4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = the address for the value, Register Pair DE = the response byte.
222F
LD (HL),C 71
Store Register C, the low byte of the value, at Register Pair HL.
2230
INC HL 23
Increment Register Pair HL from the low byte to the high byte of the value cell.
2231
LD (HL),B 70
Store Register B, the high byte of the value, at Register Pair HL: the program's two bytes hold the value (for a string, its address).
2232
POP HL E1
Restore Register Pair HL from the stack: the line, at the character after the parameter.
2233
POP DE D1
Restore Register Pair DE from the stack: the table.
2234
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
2235
CP 2CH FE 2C
Compare Register A with 2CH, the comma before another parameter.
2237
If it is a comma, jump relative to 21FFH (PARAM1) for the next parameter.
2239
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of the command line.
223B
If the line ends here (Z), jump relative to 2242H to return Register A = 00H and Z: a parameter list with no closing parenthesis is accepted. LS-DOS 6.3.1 returns from this test directly with a RET Z, so it returns Register A = 0DH where this release returns 00H.
223D
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
223F
If it is anything else, jump relative to 2220H (ERROUT): Parameter error.
2241
INC HL 23
Increment Register Pair HL past the closing parenthesis.
2242PARAM5
XOR A AF
Clear Register A to 00H and set the Z flag: the parameters were all right.
2243
RET C9
Return Z with Register Pair HL after the list.

2244H - ASSIGN: The Value after the Equals Sign

ASSIGN reads the value of a parameter and sets its response byte; the value goes into Register Pair BC, which PARAM4 (222EH) stores. A value in double quotes is a string: Register Pair BC = the address of its first character, the response byte 20H plus the length (0 for a string longer than 31 characters, and for an empty one, whose address then holds the closing quote). X'nnnn' is a hexadecimal number and a value starting with a digit a decimal number (@DECHEX), both marked with bit 7. A value starting with Y, N or O (ON, OFF) is a flag, FFFFH or 0000H, marked with bit 6, as is an empty value (PARM=), which gives 0000H. Any other value is a Parameter error.

2244ASSIGN
INC HL 23
Increment Register Pair HL past the equals sign.
2245
LD A,(HL) 7E
Load Register A with the first character of the value at Register Pair HL.
2246
CP 22H FE 22
Compare Register A with 22H, the double quote that starts a string.
2248
If it is a string, jump relative to 2274H (STRING).
224A
CP 41H FE 41
Compare Register A with 41H, the letter A, the first of the capitals.
224C
If Register A is below 41H (a digit, a sign, a comma, the closing parenthesis or 0DH), jump relative to 2263H (ASS3).
224E
RES 5,A CB AF
Clear bit 5 of Register A: a small letter becomes a capital.
2250
CP 58H FE 58
Compare Register A with 58H, the letter X of a hexadecimal value.
2252
If Register A is X, jump relative to 225BH (ASS1) to read a hexadecimal value.
2254
Call ONOFF at 2292H to read the word as Y, N, YES, NO, ON or OFF; it returns Z with Register Pair BC = 0FFFFH for true or 0000H for false, NZ for anything else.
2257
If the flag word was understood (Z), jump relative to 222BH (PARMSW) to set bit 6 of the response byte and store Register Pair BC.
2259
Otherwise jump relative to 221EH (PARAM2): Parameter error.
225BASS1
INC HL 23
Increment Register Pair HL past the X, to the opening single quote.
225C
Call HEXVAL at 22BAH to read the quoted hexadecimal digits at Register Pair HL into Register Pair BC; NZ if the opening single quote is missing.
225F
If the format is bad (NZ), jump relative to 221EH (PARAM2): Parameter error.
2261
Jump relative to 226AH (ASS3A) with No Carry, so the value is marked as a number.
2263ASS3
CP 30H FE 30
Compare Register A with 30H, the digit 0: Carry for a character below it (a comma, the closing parenthesis, 0DH or another sign), No Carry for a digit or 3AH-40H.
2265
PUSH AF F5
Save Register Pair AF (the Carry flag of the test) on the stack across @DECHEX.
2266
Call @DECHEX at 03E1H (on the SYS0/SYS page) to convert the decimal digits at Register Pair HL to binary in Register Pair BC; with no digit there Register Pair BC is 0000H and Register Pair HL does not move.
2269
POP AF F1
Restore Register Pair AF from the stack: the Carry flag of the test at 2263H.
226AASS3A
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (Stack Pointer): Register Pair HL = the response byte, the line pointer goes on the stack.
226B
If the value started with a digit (No Carry), jump relative to 2270H (ASS4) to mark it as a number.
226D
SET 6,(HL) CB F6
Set bit 6 of the response byte at Register Pair HL: no digits, so the value counts as the flag 0000H (OFF), as for PARM=.
226F
DEFB 3AH 3A
226FH: the byte 3AH, which with the CBH FEH at 2270H-2271H is the instruction LD A,(FECBH). Falling in from 226DH it only loads Register A from FECBH, a value that is not used, and so skips the SET 7 at 2270H; the jump at 226BH enters at 2270H.
2270ASS4
SET 7,(HL) CB FE
Set bit 7 of the response byte at Register Pair HL: a numeric value was found.
2272
Jump relative to 222EH (PARAM4) to store the value in Register Pair BC.
2274STRING
INC HL 23
Increment Register Pair HL past the opening double quote.
2275
LD B,H 44
Copy Register H into Register B, the high byte of the address of the string.
2276
LD C,L 4D
Copy Register L into Register C: Register Pair BC = the address of the first character of the string, which is the value stored.
2277STR1
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
2278
CP 20H FE 20
Compare Register A with 20H, the space: anything below it is a control character.
227A
If it is a control character (below 20H, as 0DH when the closing quote is missing), jump relative to 221EH (PARAM2): Parameter error.
227C
INC HL 23
Increment Register Pair HL past the character.
227D
CP 22H FE 22
Compare Register A with 22H, the closing double quote.
227F
If it is not the quote, jump relative to 2277H (STR1) for the next character.
2281
PUSH HL E5
Save Register Pair HL (after the closing quote) on the stack.
2282
SBC HL,BC ED 42
Subtract Register Pair BC (the start) from Register Pair HL with the Carry flag (clear after the equal compare): Register Pair HL = the length of the string plus 1 for the quote.
2284
LD A,L 7D
Copy Register L, the low byte of the length plus 1, into Register A.
2285
DEC A 3D
Decrement Register A: the length of the string, without the quote.
2286
CP 20H FE 20
Compare Register A, the length of the string, with 20H (32).
2288
If the length is below 32, jump relative to 228BH.
228A
XOR A AF
Clear Register A to 00H: a string of 32 or more characters is given the length 0.
228B
POP HL E1
Restore Register Pair HL from the stack: the line after the closing quote.
228C
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (Stack Pointer): Register Pair HL = the response byte, the line pointer goes on the stack.
228D
OR 20H F6 20
OR Register A (the length) with 20H: bit 5, a string was found, with the length in bits 4-0.
228F
LD (HL),A 77
Store Register A into the response byte at Register Pair HL.
2290
Jump relative to 222EH (PARAM4) to store the address of the string in Register Pair BC.
2292ONOFF
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value a false word gives. LS-DOS 6.3.1 has no instruction here: it is given Register Pair BC = 0000H by its caller and starts this routine at its own 2290H with the SUB below.
2295
SUB 59H D6 59
Subtract 59H (the letter Y) from Register A, the capital first letter of the value.
2297
If the letter was Y (Register A 00H after the subtraction), jump relative to 22AAH (ONO1) to load the value for true.
2299
ADD A,0BH C6 0B
Add 0BH to Register A: 00H for the letter N (4EH).
229B
If it is N, jump relative to 22ADH (ONO2) with Register Pair BC = 0000H.
229D
DEC A 3D
Decrement Register A: 00H for the letter O (4FH).
229E
RET NZ C0
Return NZ if the value starts with any other character from 41H up (other than X): Parameter error.
229F
INC HL 23
Increment Register Pair HL to the second letter, after the O.
22A0
LD A,(HL) 7E
Load Register A with the second letter at Register Pair HL.
22A1
RES 5,A CB AF
Clear bit 5 of Register A: a small letter becomes a capital.
22A3
CP 46H FE 46
Compare Register A with 46H, the letter F of OFF.
22A5
If it is OFF, jump relative to 22ADH (ONO2) with Register Pair BC = 0000H.
22A7
CP 4EH FE 4E
Compare Register A with 4EH, the letter N, the second letter of ON.
22A9
RET NZ C0
Return NZ if the second letter is neither F nor N: the caller gives Parameter error.
22AAONO1
LD BC,0FFFFH 01 FF FF
Load Register Pair BC with 0FFFFH, the value for true, which Y, YES and ON all reach. LS-DOS 6.3.1 does the same with a DEC BC in two bytes less, Register Pair BC already holding 0000H from its caller.
22ADONO2
INC HL 23
Increment Register Pair HL to the next character of the word.
22AE
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
22AF
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
22B1
RET Z C8
Return Z at the closing parenthesis: the rest of the word (ES of YES, F of OFF) has been passed over.
22B2
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of the command line.
22B4
RET Z C8
Return Z at the end of the line, with Register Pair BC holding the flag value.
22B5
CP 2CH FE 2C
Compare Register A with 2CH, the comma before another parameter.
22B7
RET Z C8
Return Z at a comma before the next parameter.
22B8
Jump relative to 22ADH (ONO2) to pass over the next character.
22BAHEXVAL
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value the digits are built into. LS-DOS 6.3.1 has no instruction here either, for the same reason as at 2292H, and starts this routine at its own 22B3H.
22BD
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, after the X.
22BE
CP 27H FE 27
Compare Register A with 27H, the single quote that must follow the X.
22C0
RET NZ C0
Return NZ if there is no quote: Parameter error.
22C1HEX1
INC HL 23
Increment Register Pair HL past the quote or the last digit.
22C2
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
22C3
SUB 30H D6 30
Subtract 30H from Register A: a digit becomes its value.
22C5
If the character is below 0 (Carry), jump relative to 22D3H (HEX2): the end of the number.
22C7
CP 0AH FE 0A
Compare Register A, the character less 30H, with 0AH, one above the digit 9.
22C9
If it is a digit 0-9 (below 0AH), jump relative to 22DBH (HEX3) to add it.
22CB
RES 5,A CB AF
Clear bit 5 of Register A: the value of a small letter a-f (31H-36H) becomes that of the capital (11H-16H). The signs 3AH-40H (0AH-10H here), the capitals W to Z (27H-2AH, cleared to 07H-0AH) and the signs 5BH-60H (2BH-30H, cleared to 0BH-10H) pass the same way.
22CD
SUB 07H D6 07
Subtract 07H from Register A: A to F become 0AH to 0FH.
22CF
CP 10H FE 10
Compare Register A with 10H, one above the value of the letter F.
22D1
If Register A is below 10H, jump relative to 22DBH (HEX3) to add it: A to F as 0AH to 0FH, but also the signs : ; < = > ? @ and [ \ ] ^ _ ` as 03H to 09H and the letters W, X, Y and Z as 00H to 03H, which are taken as digits instead of ending the number (bug T36). Bug T36: the test for a hexadecimal digit accepts every byte from 3AH to 46H after the subtraction, so the signs colon, semicolon, <, =, >, question mark, at sign and opening square bracket, and the letters W, X, Y and Z, are all taken as digits in an X'nnnn' value. The same instructions stand in LS-DOS 6.3.1, where Part 13 numbers it B15.
22D3HEX2
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, the one that ended the digits.
22D4
CP 27H FE 27
Compare Register A with 27H, the closing single quote.
22D6
INC HL 23
Increment Register Pair HL past it; INC does not change the flags.
22D7
RET Z C8
Return Z if it was the closing quote, with Register Pair HL after it.
22D8
DEC HL 2B
Decrement Register Pair HL back to the character: without a closing quote the number ends here.
22D9
XOR A AF
Clear Register A to 00H and set the Z flag: a value without its closing quote is accepted too.
22DA
RET C9
Return Z with Register Pair BC = the value and Register Pair HL at the character after it.
22DBHEX3
PUSH BC C5
Save Register Pair BC (the value so far) on the stack.
22DC
EX (SP),HL E3
Exchange Register Pair HL with the top of the stack (Stack Pointer): Register Pair HL = the value, the line pointer goes on the stack.
22DD
ADD HL,HL 29
Add Register Pair HL to itself: the value times 2.
22DE
ADD HL,HL 29
Add Register Pair HL to itself again: the value times 4.
22DF
ADD HL,HL 29
Add Register Pair HL to itself again: the value times 8.
22E0
ADD HL,HL 29
Add Register Pair HL to itself: times 16; digits beyond the fourth push the first ones out.
22E1
LD B,H 44
Copy Register H into Register B, the high byte of the new value.
22E2
ADD A,L 85
Add Register L (whose low four bits are 0 after the shifts) to Register A, the digit.
22E3
LD C,A 4F
Copy Register A into Register C: Register Pair BC = the value times 16 plus the digit.
22E4
POP HL E1
Restore Register Pair HL from the stack: the line, at the digit.
22E5
Jump relative to 22C1H (HEX1) for the next digit.

22E7H - Texts, Free Space and the Overlay Length

The default extension for programs, the TRSDOS Ready prompt, the bytes of the overlay area not loaded, and the length of SYS1 at 23FEH, as in the other system overlays.

22E7-22E9DFTEXT
DEFM "CMD" 43 4D 44
DFTEXT, 22E7H-22E9H: the default extension CMD, which @FEXT puts after a command name that has no extension (1EF2H).
22EA-22EBRDYMSG$
DEFB 0AH, 0EH 0A 0E
RDYMSG$, 22EAH-22EBH: 0AH (line feed, a new line) and 0EH (cursor on), the start of the prompt shown at 1E97H.
22EC-22F7
DEFM "TRSDOS Ready" 54 52 53 44 4F 53 20 52 65 61 64 79
22ECH-22F7H: the text TRSDOS Ready, the name Tandy sold the system under and its prompt word. LS-DOS 6.3.1, which Logical Systems sold itself, has LS-DOS Ready in the same place, two characters shorter, which is why the last ten bytes of this file sit ten addresses higher than the later release's.
22F8
DEFB 0DH 0D
22F8H: 0DH, which ends the prompt for @DSPLY; it is shown too, so the command is typed on the line below TRSDOS Ready. The last byte of SYS1/SYS.
22F9-23FD
DEFS 261
22F9H-23FDH: the rest of the overlay area, not loaded by SYS1/SYS; it holds whatever the overlay before it left there. DIRBUF$ (2300H-23FFH), the directory buffer of SYS0/SYS, is inside it, so a directory read while SYS1 is resident writes over this space and over the overlay length below.
23FE-23FF
DEFW 04F9H F9 04
23FEH-23FFH = 04F9H (1273): the length of SYS1/SYS, 1E00H to 22F8H. SYSTEM (SYSRES) reads it with LD BC,(23FEH) when it copies the overlay into high memory, so that the copy is only as long as the file. LS-DOS 6.3.1 holds 04EFH here, ten bytes less.