LS-DOS 6.3.1 for the Model 4 - SYS1/SYS Disassembled

Page Customization

Introduction/Summary

LS-DOS 6.3.1 SYS1/SYS Disassembly (Model 4)

SYS1/SYS is the system overlay of LS-DOS 6.3.1 that holds the command interpreter, the routine behind the LS-DOS Ready prompt. It is a load module of 1265 bytes in six load blocks: 1E00H-22EEH 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 (1E41H), 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. 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), 39 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 (205EH) 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 (2157H) 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 (21D7H) reads a parameter list in parentheses, with flag, decimal, hexadecimal (X'nnnn') and string values (2242H).

The bytes are those of the LS-DOS 6.3.1 level 1H system diskette. The labels are those of the LS-DOS 6.3.1 source code of SYS1, which assembles to this file byte for byte.

Notes

Two places hide an instruction: 213CH (FEH, a CP 23H that skips the INC HL of the space loop) and 226DH (3AH, an LD A,(FECBH) that skips the SET 7 of a number).

Several operands are changed while SYS1 runs: 1EE6H (the exclamation mark test of TSTEXC), 2145H (PAR6, the mark of an empty word), and 217FH, 219DH and 21B7H, 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, and the LIB command reads it while SYS1 is still in the overlay area; the word at 23FEH is the length of the overlay, which SYSTEM (SYSRES) uses to keep a copy in high memory.

LS-DOS 6.3.1 changes visible here: @PARSER passes over the spaces after a word (2138H); @PARAM accepts a list that ends at the end of the line without a closing parenthesis (223AH), clears the response bytes with a shorter loop and sets the value FFFFH with a DEC BC (2229H, 22A5H).

Bugs (listed on the LS-DOS reference page): B11, @FNDPRM (21B2H) 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; B12, 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 (208DH); B13, @PARAM leaves the response bytes as they were when there is no parameter list (21DAH, latent); B14, a file named TO, ON, OVER or USING cannot be given to @FSPEC (209DH, a limit); B15, the signs : ; < = > ? @ and [ \ ] ^ _ ` and the letters W, X, Y and Z are taken as hexadecimal digits in X'nnnn' (22C7H).

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 (1E34H), bit 2 set while @KEYIN reads a command (1EA0H, 1EADH), bit 4 tested for library commands only (1EFCH); CLEANUP keeps only bit 5 (1E7FH).
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 (1E6CH), bit 5 (a DO file running) tested by COMMENT (1F08H).
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 (2200H); in page 1DH also the response bits of an old format table (21C3H).
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).
2145H
1 byte
PAR6 operand
Not zero until @PARSER copies a character (2108H, 212EH).
217FH, 219DH, 21B7H
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 (2177H, 216FH, 2173H).
23FEH-23FFH
2 bytes
Overlay length
04EFH, 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 (2264H).
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).
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 a * 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 205EH (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 21D7H (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 LS-DOS 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,C9H 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,F9H 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,F8H 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: LS-DOS Ready

CMDCONT hands control to an Extended Command Interpreter in SYS13/SYS when EFLAG$ is not zero; otherwise it shows LS-DOS 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 LS-DOS 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,22E0H 21 E0 22LD HL,RDYMSG$
Point Register Pair HL to 22E0H (RDYMSG$), the prompt: line feed, cursor on, LS-DOS Ready, ENTER.
1E9A
Call @DSPLY at 052DH (on the BOOT/SYS page) to show the message at Register Pair HL (22E0H) 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,FFH 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 205EH 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 2157H 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,22DDH 21 DD 22LD HL,DFTEXT
Point Register Pair HL to 22DDH (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,FFFFH 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,C9H 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 (205CH). LIB lists this table, reading its address from 1E02H.

1F24-1F29
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 "ID " 49 44 20 20 20 20
1FB4H-1FB9H: the name ID padded with spaces to six characters, entry 19 of the table.
1FBA-1FBB
DEFW 8026H 26 80
1FBAH-1FBBH = 8026H: ID runs member request 26H of SYS6/SYS (the member that holds LIB, at its third entry 2406H), through the request 88H.
1FBC-1FC1
DEFM "LIB " 4C 49 42 20 20 20
1FBCH-1FC1H: the name LIB padded with spaces to six characters, entry 20 of the table.
1FC2-1FC3
DEFW 8019H 19 80
1FC2H-1FC3H = 8019H: LIB runs member request 19H of SYS6/SYS (the member that holds LIB, at its entry 2400H), through the request 88H.
1FC4-1FC9
DEFM "LINK " 4C 49 4E 4B 20 20
1FC4H-1FC9H: the name LINK padded with spaces to six characters, entry 21 of the table.
1FCA-1FCB
DEFW 8062H 62 80
1FCAH-1FCBH = 8062H: LINK runs member request 62H of SYS6/SYS (the member that holds LINK, at its entry 2400H), through the request 88H.
1FCC-1FD1
DEFM "LIST " 4C 49 53 54 20 20
1FCCH-1FD1H: the name LIST padded with spaces to six characters, entry 22 of the table.
1FD2-1FD3
DEFW 8041H 41 80
1FD2H-1FD3H = 8041H: LIST runs member request 41H of SYS6/SYS (the member that holds LIST, at its entry 2400H), through the request 88H.
1FD4-1FD9
DEFM "LOAD " 4C 4F 41 44 20 20
1FD4H-1FD9H: the name LOAD padded with spaces to six characters, entry 23 of the table.
1FDA-1FDB
DEFW 8081H 81 80
1FDAH-1FDBH = 8081H: LOAD runs member request 81H of SYS6/SYS (the member that holds LOAD, at its second entry 2403H), through the request 88H.
1FDC-1FE1
DEFM "MEMORY" 4D 45 4D 4F 52 59
1FDCH-1FE1H: the name MEMORY, six characters, entry 24 of the table.
1FE2-1FE3
DEFW 801EH 1E 80
1FE2H-1FE3H = 801EH: MEMORY runs member request 1EH of SYS6/SYS (the member that holds MEMORY, at its entry 2400H), through the request 88H.
1FE4-1FE9
DEFM "PURGE " 50 55 52 47 45 20
1FE4H-1FE9H: the name PURGE padded with spaces to six characters, entry 25 of the table.
1FEA-1FEB
DEFW 0A072H 72 A0
1FEAH-1FEBH = A072H: PURGE runs member request 72H of SYS7/SYS (the member that holds PURGE, at its entry 2400H), through the request 89H.
1FEC-1FF1
DEFM "REMOVE" 52 45 4D 4F 56 45
1FECH-1FF1H: the name REMOVE, six characters, entry 26 of the table.
1FF2-1FF3
DEFW 8018H 18 80
1FF2H-1FF3H = 8018H: REMOVE runs member request 18H of SYS6/SYS (the member that holds REMOVE, at its entry 2400H), through the request 88H.
1FF4-1FF9
DEFM "RENAME" 52 45 4E 41 4D 45
1FF4H-1FF9H: the name RENAME, six characters, entry 27 of the table.
1FFA-1FFB
DEFW 8053H 53 80
1FFAH-1FFBH = 8053H: RENAME runs member request 53H of SYS6/SYS (the member that holds RENAME, at its entry 2400H), through the request 88H.
1FFC-2001
DEFM "RESET " 52 45 53 45 54 20
1FFCH-2001H: the name RESET padded with spaces to six characters, entry 28 of the table.
2002-2003
DEFW 8063H 63 80
2002H-2003H = 8063H: RESET runs member request 63H of SYS6/SYS (the member that holds RESET, at its entry 2400H), through the request 88H.
2004-2009
DEFM "ROUTE " 52 4F 55 54 45 20
2004H-2009H: the name ROUTE padded with spaces to six characters, entry 29 of the table.
200A-200B
DEFW 8064H 64 80
200AH-200BH = 8064H: ROUTE runs member request 64H of SYS6/SYS (the member that holds ROUTE, at its entry 2400H), through the request 88H.
200C-2011
DEFM "RUN " 52 55 4E 20 20 20
200CH-2011H: the name RUN padded with spaces to six characters, entry 30 of the table.
2012-2013
DEFW 8082H 82 80
2012H-2013H = 8082H: RUN runs member request 82H of SYS6/SYS (the member that holds LOAD, at its entry 2400H), through the request 88H.
2014-2019
DEFM "SET " 53 45 54 20 20 20
2014H-2019H: the name SET padded with spaces to six characters, entry 31 of the table.
201A-201B
DEFW 8065H 65 80
201AH-201BH = 8065H: SET runs member request 65H of SYS6/SYS (the member that holds SET, at its second entry 2C03H), through the request 88H.
201C-2021
DEFM "SETCOM" 53 45 54 43 4F 4D
201CH-2021H: the name SETCOM, six characters, entry 32 of the table.
2022-2023
DEFW 0C0B2H B2 C0
2022H-2023H = C0B2H: SETCOM runs member request B2H of SYS8/SYS (the member that holds SETCOM, at its entry 2400H), through the request 8AH.
2024-2029
DEFM "SETKI " 53 45 54 4B 49 20
2024H-2029H: the name SETKI padded with spaces to six characters, entry 33 of the table.
202A-202B
DEFW 0C0B3H B3 C0
202AH-202BH = C0B3H: SETKI runs member request B3H of SYS8/SYS (the member that holds SETKI, at its entry 2400H), through the request 8AH.
202C-2031
DEFM "SPOOL " 53 50 4F 4F 4C 20
202CH-2031H: the name SPOOL padded with spaces to six characters, entry 34 of the table.
2032-2033
DEFW 0C0A2H A2 C0
2032H-2033H = C0A2H: SPOOL runs member request A2H of SYS8/SYS (the member that holds SPOOL, at its entry 2400H), through the request 8AH.
2034-2039
DEFM "SYSGEN" 53 59 53 47 45 4E
2034H-2039H: the name SYSGEN, six characters, entry 35 of the table.
203A-203B
DEFW 0C01CH 1C C0
203AH-203BH = C01CH: SYSGEN runs member request 1CH of SYS8/SYS (the member that holds SYSGEN, at its entry 2400H), through the request 8AH.
203C-2041
DEFM "SYSTEM" 53 59 53 54 45 4D
203CH-2041H: the name SYSTEM, six characters, entry 36 of the table.
2042-2043
DEFW 0C0A1H A1 C0
2042H-2043H = C0A1H: SYSTEM runs member request A1H of SYS8/SYS (the member that holds SYSTEM, at its entry 2400H), through the request 8AH.
2044-2049
DEFM "TIME " 54 49 4D 45 20 20
2044H-2049H: the name TIME padded with spaces to six characters, entry 37 of the table.
204A-204B
DEFW 0A016H 16 A0
204AH-204BH = A016H: TIME runs member request 16H of SYS7/SYS (the member that holds DATE, at its entry 2400H), through the request 89H.
204C-2051
DEFM "TOF " 54 4F 46 20 20 20
204CH-2051H: the name TOF padded with spaces to six characters, entry 38 of the table.
2052-2053
DEFW 8025H 25 80
2052H-2053H = 8025H: TOF runs member request 25H of SYS6/SYS (the member that holds LIB, at its fourth entry 2409H), through the request 88H.
2054-2059
DEFM "VERIFY" 56 45 52 49 46 59
2054H-2059H: the name VERIFY, six characters, entry 39 of the table.
205A-205B
DEFW 0A01BH 1B A0
205AH-205BH = A01BH: VERIFY runs member request 1BH of SYS7/SYS (the member that holds DEBUG, at its entry 2400H), through the request 89H.
205C
DEFB 00H 00
205CH: 00H where the name of a 40th entry would start, the end of the table for @FNDPRM (2182H) and for LIB. The source marks this place for a patch that adds KILL as a command.
205D
DEFB 00H 00
205DH: a zero byte after the end of the table, not used by the code; FSPEC starts at 205EH.

205EH - 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).

205EFSPEC
PUSH DE D5
Save Register Pair DE (the FCB) on the stack, to return it in Register Pair DE.
205F
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.
2062
If no character was taken (NZ), jump relative to 20A1H (FSP5) to see whether this is a device specification.
2064
CP 2FH FE 2F
Compare Register A (the separator) with 2FH (the slash), which starts the extension.
2066
If there is no extension, jump relative to 206FH (FSP1).
2068
LD (DE),A 12
Store Register A (the slash) in the FCB at Register Pair DE, after the name.
2069
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
206A
LD B,03H 06 03
Load Register B with 03H, the most characters of an extension.
206C
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.
206FFSP1
CP 2EH FE 2E
Compare Register A (the separator) with 2EH (the period), which starts the password.
2071
If there is no password, jump relative to 207AH (FSP2).
2073
LD (DE),A 12
Store Register A (the period) in the FCB at Register Pair DE.
2074
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
2075
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.
2078
If the password is empty (NZ), jump relative to 20AEH (FSP6) to return NZ, an error.
207AFSP2
CP 3AH FE 3A
Compare Register A (the separator) with 3AH (the colon), which starts the drive number.
207C
If there is no drive, jump relative to 2087H (FSP3).
207E
LD (DE),A 12
Store Register A (the colon) in the FCB at Register Pair DE.
207F
INC DE 13
Increment Register Pair DE to the next byte of the FCB.
2080
LD B,01H 06 01
Load Register B with 01H: the drive is one character.
2082
Call @PAR1 at 2107H to copy the drive character into the FCB at Register Pair DE; Register A returns the separator.
2085
If no drive character followed the colon (NZ), jump relative to 20AEH (FSP6) to return NZ, an error.
2087FSP3
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.
2089
If there is none, jump relative to 208FH (FSP4).
208B
LD (DE),A 12
Store Register A (the exclamation mark) in the FCB at Register Pair DE.
208C
INC DE 13
Increment Register Pair DE past the exclamation mark, to the next byte of the FCB.
208D
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 B12.
208E
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, taken as the separator.
208FFSP4
LD C,A 4F
Copy Register A (the separator) into Register C to keep it.
2090
LD A,03H 3E 03
Load Register A with 03H (ETX), the end mark of the text in the FCB.
2092
LD (DE),A 12
Store Register A (03H) in the FCB at Register Pair DE, after the last part of the specification.
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 2157H 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 205EH (FSPEC) to parse the next word into the same FCB. A file named TO, ON, OVER or USING (whatever its extension) cannot be given (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 208FH (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 change of LS-DOS 6.3.1. 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 (2145H),A 32 45 21
Self-Modifying Code
Store Register A (the length, never 00H) into 2145H, the operand of the LD A at 2144H (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 2149H: 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 (2145H),A 32 45 21
Self-Modifying Code
Store Register A (00H) into 2145H, the operand of the LD A at 2144H: 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
CP 20H FE 20
Compare Register A, the separator, with 20H, the space character.
213A
If the separator is not a space, jump relative to 2141H (PAR5A).
213C
DEFB 0FEH FE
213CH: the byte FEH, which with the 23H at 213DH is the instruction CP 23H. Falling in from 213AH with a space, it is a compare whose result is not used, so the INC HL at 213DH is skipped: Register Pair HL stays at the character after the space. The loop at 213FH enters at 213DH.
213DPAR5B
INC HL 23
Increment Register Pair HL past one more space.
213E
CP (HL) BE
Compare Register A (20H) with the character at Register Pair HL.
213F
If it is another space, jump relative to 213DH (PAR5B) to pass over it: Register Pair HL ends at the first character after the spaces.
2141PAR5A
LD A,03H 3E 03
Load Register A with 03H (ETX), the end mark stored after the word.
2143
LD (DE),A 12
Store Register A (03H) at Register Pair DE, after the copied word. Register Pair DE is not moved.
2144PAR6
LD A,00H 3E 00
Self-Modifying Code
Load Register A with the operand at 2145H: 00H when a character was copied, the length stored at 2108H when none was. The file holds 00H.
2146
OR A B7
OR Register A with itself: Z for a word of at least one character, NZ for an empty one.
2147
LD A,C 79
Copy Register C (the separator) back into Register A; the flags are kept.
2148
RET C9
Return with Register A = Register C = the separator.
2149TST09AZ
CP 30H FE 30
Compare Register A with 30H, the digit 0, the lowest letter or digit.
214B
RET C D8
Return with Carry if Register A is below 30H: not a digit or a letter.
214C
CP 3AH FE 3A
Compare Register A with 3AH, one above the digit 9.
214E
If Register A is a digit (Carry), jump relative to 2155H (EXITC) to turn the Carry into No Carry.
2150
CP 41H FE 41
Compare Register A with 41H, the letter A, the first of the capitals.
2152
RET C D8
Return with Carry if Register A is 3AH-40H, a sign between the digits and the capitals.
2153
CP 5BH FE 5B
Compare Register A with 5BH, one above the letter Z: Carry for a capital, No Carry for 5BH and above.
2155EXITC
CCF 3F
Complement the Carry flag: No Carry for a digit or a capital, Carry for any other value of Register A.
2156
RET C9
Return with the result in the Carry flag; Register A is unchanged.

2157H - @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 (217FH, 219DH and 21B7H) 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 B11).

2157@FNDPRM
PUSH HL E5
Save Register Pair HL (the caller's pointer) on the stack.
2158
LD H,B 60
Copy Register B into Register H, the high byte of the table address.
2159
LD L,C 69
Copy Register C into Register L: Register Pair HL points to the table at Register Pair BC.
215A
LD A,(HL) 7E
Load Register A with the first byte of the table at Register Pair HL.
215B
RLCA 07
Rotate Register A left: bit 7, the mark of the enhanced format, goes into the Carry flag.
215C
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.
215D
If the table is in the old format (No Carry), jump relative to 2160H (FND1) with Register Pair HL at the first name.
215F
INC HL 23
Increment Register Pair HL past the 80H mark of an enhanced table, to the first type byte.
2160FND1
POP AF F1
Restore Register Pair AF from the stack: the Carry flag tells the format.
2161
PUSH AF F5
Save Register Pair AF on the stack again, to keep the format flag for later tests.
2162
LD A,05H 3E 05
Load Register A with 05H, the characters to compare after the first in an old table (names of six).
2164
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.
2167
If the table is in the old format (No Carry), jump relative to 216FH (FND1A) with these values.
2169
LD A,(HL) 7E
Load Register A with the type byte of the entry at Register Pair HL.
216A
AND 0FH E6 0F
Mask Register A with 0FH, keeping bits 3-0, the length of the name.
216C
DEC A 3D
Decrement Register A: the characters to compare after the first.
216D
INC B 04
Increment Register B to 02H: in an enhanced entry the word is one byte further on, after the response byte.
216E
INC HL 23
Increment Register Pair HL past the type byte, to the name.
216FFND1A
LD (219DH),A 32 9D 21
Self-Modifying Code
Store Register A (the name length less 1; 05H for an old table) into 219DH, the operand of the LD B at 219CH (FND3A).
2172
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.
2173
LD (21B7H),A 32 B7 21
Self-Modifying Code
Store Register A (the offset of the word) into 21B7H, the operand of the LD BC at 21B6H (FND5A).
2176
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).
2177
LD (217FH),A 32 7F 21
Self-Modifying Code
Store Register A into 217FH, the low byte of the operand of the LD BC at 217EH (FND2), the step to the next entry.
217A
LD A,(DE) 1A
Load Register A with the first character of the word at Register Pair DE.
217B
CP (HL) BE
Compare Register A with the first character of the name at Register Pair HL.
217C
If they are the same, jump relative to 218AH (FND3) to compare the rest.
217EFND2
LD BC,0008H 01 08 00
Self-Modifying Code
Load Register Pair BC with the length of an entry, the operand at 217FH stored at 2177H. The file holds 0008H.
2181
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).
2182
LD A,(HL) 7E
Load Register A with the first byte of the next entry at Register Pair HL.
2183
OR A B7
OR Register A with itself: 00H is the end of the table.
2184
If there is another entry (NZ), jump relative to 2160H (FND1) to try it.
2186
POP HL E1
Restore Register Pair HL from the stack: the format flag is dropped.
2187
POP HL E1
Restore Register Pair HL from the stack: the caller's pointer.
2188
INC A 3C
Increment Register A from 00H to 01H: the NZ flag tells the caller that the word is not in the table.
2189
RET C9
Return NZ with Register A = 01H and Register Pair HL as the caller gave it.
218AFND3
POP AF F1
Restore Register Pair AF from the stack: the format flag in the Carry flag.
218B
PUSH AF F5
Save Register Pair AF on the stack again, to keep the format flag for 21C0H.
218C
If the table is in the old format (No Carry), jump relative to 219CH (FND3A): no abbreviations there.
218E
DEC HL 2B
Decrement Register Pair HL to the type byte of the enhanced entry.
218F
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.
2191
INC HL 23
Increment Register Pair HL back to the name; INC does not change the Z flag of the BIT.
2192
If no abbreviation is allowed (Z), jump relative to 219CH (FND3A) to compare the whole name.
2194
INC DE 13
Increment Register Pair DE to the second character of the word.
2195
LD A,(DE) 1A
Load Register A with the second character of the word at Register Pair DE.
2196
DEC DE 1B
Decrement Register Pair DE back to the first character.
2197
Call TST09AZ at 2149H: Carry if the second character is not a letter or digit, so the word is the single letter.
219A
If the word is a single letter (Carry), jump relative to 21B6H (FND5A): it is the abbreviation of this name.
219CFND3A
LD B,05H 06 05
Self-Modifying Code
Load Register B with the characters to compare after the first, the operand at 219DH stored at 216FH. The file holds 05H.
219E
PUSH HL E5
Save Register Pair HL (the name) on the stack.
219F
PUSH DE D5
Save Register Pair DE (the word) on the stack.
21A0
LD A,B 78
Copy Register B (the characters still to compare) into Register A, to test it.
21A1
OR A B7
OR Register A with itself, to test Register B for zero (a name of one character).
21A2
If there is nothing more to compare, jump relative to 21B4H (FND5): the word matches.
21A4FND4
INC DE 13
Increment Register Pair DE to the next character of the word.
21A5
INC HL 23
Increment Register Pair HL to the next character of the name.
21A6
LD A,(DE) 1A
Load Register A with the character of the word at Register Pair DE.
21A7
CP 03H FE 03
Compare Register A with 03H (ETX), the end of the word.
21A9
If the word ends here, jump relative to 21CDH (FND7) to see whether the name ends too.
21AB
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of a line.
21AD
If the word ends here, jump relative to 21CDH (FND7).
21AF
CP (HL) BE
Compare Register A with the character of the name at Register Pair HL.
21B0
If they differ, jump relative to 21C8H (FND6).
21B2
Decrement Register B and loop to 21A4H (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 B11).
21B4FND5
POP DE D1
Restore Register Pair DE from the stack: the start of the word.
21B5
POP HL E1
Restore Register Pair HL from the stack: the start of the name.
21B6FND5A
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 21B7H stored at 2173H. The file holds 0006H.
21B9
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL points to the entry's word.
21BA
LD C,L 4D
Copy Register L, the low byte of the address of the word, into Register C.
21BB
LD B,H 44
Copy Register H into Register B: Register Pair BC = the address of the word.
21BC
DEC BC 0B
Decrement Register Pair BC to the byte before the word: the response byte of an enhanced entry.
21BD
LD E,(HL) 5E
Load Register E with the low byte of the word at Register Pair HL.
21BE
INC HL 23
Increment Register Pair HL from the low byte to the high byte of the entry's word.
21BF
LD D,(HL) 56
Load Register D with the high byte at Register Pair HL: Register Pair DE = the entry's word.
21C0
POP AF F1
Restore Register Pair AF from the stack: the format flag in the Carry flag.
21C1
If the table is in the enhanced format (Carry), jump relative to 21C5H with Register Pair BC at the response byte.
21C3
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.
21C5
POP HL E1
Restore Register Pair HL from the stack: the caller's pointer.
21C6
XOR A AF
Clear Register A to 00H and set the Z flag: found.
21C7
RET C9
Return Z with Register Pair DE = the word and Register Pair BC = the response byte.
21C8FND6
Call TST09AZ at 2149H with Register A, the character of the word that differs from the name.
21CB
If it is a letter or digit (No Carry), jump relative to 21D2H (FND8): the word is a different name.
21CDFND7
LD A,(HL) 7E
Load Register A with the character of the name at Register Pair HL, where the word ended.
21CE
CP 20H FE 20
Compare Register A with 20H, the space that pads a name of an old table.
21D0
If the name ends here too (a space), jump relative to 21B4H (FND5): the word matches.
21D2FND8
POP DE D1
Restore Register Pair DE from the stack: the start of the word.
21D3
POP HL E1
Restore Register Pair HL from the stack: the start of the name.
21D4
Jump relative to 217EH (FND2) to step to the next entry.

21D6H - 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 2242H). Parameters are separated by commas; the list ends at the closing parenthesis or, since LS-DOS 6.3.1, 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.

21D6PARAM0
INC HL 23
Increment Register Pair HL past a space before the parameters.
21D7PARAM
LD A,(HL) 7E
Load Register A with the character at Register Pair HL. @PARAM enters here from 1E17H.
21D8
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of the command line.
21DA
RET Z C8
Return Z if the line ends here: there are no parameters, and nothing in the table is changed.
21DB
CP 20H FE 20
Compare Register A with 20H, the space that may come before the parameter list.
21DD
If it is a space, jump relative to 21D6H (PARAM0) to pass over it.
21DF
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis.
21E1
If there is no parenthesis, jump relative to 2240H (PARAM5) to return Z: no parameter list.
21E3
LD A,(DE) 1A
Load Register A with the first byte of the table at Register Pair DE.
21E4
RLCA 07
Rotate Register A left: bit 7 (80H, the enhanced format) goes into the Carry flag.
21E5
If the table is in the old format (No Carry), jump relative to 21FDH (PARAM1): it has no response bytes.
21E7
PUSH DE D5
Save Register Pair DE (the table) on the stack.
21E8
INC DE 13
Increment Register Pair DE past the 80H mark, to the first type byte.
21E9
PUSH HL E5
Save Register Pair HL (the line at the parenthesis) on the stack.
21EA
LD A,(DE) 1A
Load Register A with the type byte at Register Pair DE.
21EB
AND 0FH E6 0F
Mask Register A with 0FH, keeping the length of the name.
21ED
If the length is 0 (the 00H that ends the table), jump relative to 21FBH.
21EF
LD L,A 6F
Copy Register A (the name length) into Register L.
21F0
XOR A AF
Clear Register A to 00H, for Register H and the response byte (a change of LS-DOS 6.3.1).
21F1
LD H,A 67
Copy Register A (00H) into Register H: Register Pair HL = the name length.
21F2
INC L 2C
Increment Register L: the name length plus 1, the distance from the type byte to the response byte.
21F3
ADD HL,DE 19
Add Register Pair DE (the type byte) to Register Pair HL: Register Pair HL points to the response byte.
21F4
LD (HL),A 77
Store Register A (00H) into the response byte at Register Pair HL: no parameter found yet.
21F5
INC HL 23
Increment Register Pair HL past the response byte.
21F6
INC HL 23
Increment Register Pair HL past the low byte of the word.
21F7
INC HL 23
Increment Register Pair HL past the high byte, to the next type byte.
21F8
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE points to the next type byte.
21F9
Jump relative to 21EAH to clear the response byte of the next entry of the table.
21FB
POP HL E1
Restore Register Pair HL from the stack: the line at the parenthesis.
21FC
POP DE D1
Restore Register Pair DE from the stack: the table.
21FDPARAM1
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.
21FE
LD B,0FH 06 0F
Load Register B with 0FH, the most characters of a parameter word.
2200
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.
2203
INC HL 23
Increment Register Pair HL past the parenthesis or the comma.
2204
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.
2207
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 223DH finds the error.
2208
POP DE D1
Restore Register Pair DE from the stack: the table.
2209
If the word was empty (NZ), jump relative to 221EH (ERROUT): Parameter error.
220B
CP 0DH FE 0D
Compare Register A (the separator) with 0DH (ENTER).
220D
If Register A is not 0DH, jump relative to 2210H with Register Pair HL at the separator.
220F
INC HL 23
Increment Register Pair HL again: @PAR1 leaves a 0DH at Register Pair HL, so the decrement at 2207H is undone.
2210
PUSH DE D5
Save Register Pair DE (the table) on the stack.
2211
LD B,D 42
Copy Register D into Register B, the high byte of the table address.
2212
LD C,E 4B
Copy Register E into Register C: Register Pair BC = the table for @FNDPRM.
2213
LD DE,1D00H 11 00 1DLD DE,SBUFF$
Point Register Pair DE to 1D00H (SBUFF$), the word.
2216
Call @FNDPRM at 2157H 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.
2219
PUSH BC C5
Save Register Pair BC (the response byte) on the stack.
221A
If the word is in the table (Z), jump relative to 2221H (PARAM3).
221CPARAM2
POP DE D1
Restore Register Pair DE from the stack: the response pointer is dropped.
221D
POP DE D1
Restore Register Pair DE from the stack: the table.
221EERROUT
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.
2220
RET C9
Return NZ with Register A = 2CH, the error code for a bad parameter.
2221PARAM3
LD A,(HL) 7E
Load Register A with the separator at Register Pair HL.
2222
CP 3DH FE 3D
Compare Register A with 3DH, the equals sign that brings a value.
2224
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value OFF; the LD does not change the Z flag.
2227
If the word is followed by an equals sign, jump relative to 2242H (ASSIGN) to read the value (a change of LS-DOS 6.3.1).
2229
DEC BC 0B
Decrement Register Pair BC to FFFFH: a parameter given without a value means ON.
222APARMSW
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.
222B
SET 6,(HL) CB F6
Set bit 6 of the response byte at Register Pair HL: a flag value was found.
222DPARAM4
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.
222E
LD (HL),C 71
Store Register C, the low byte of the value, at Register Pair HL.
222F
INC HL 23
Increment Register Pair HL from the low byte to the high byte of the value cell.
2230
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).
2231
POP HL E1
Restore Register Pair HL from the stack: the line, at the character after the parameter.
2232
POP DE D1
Restore Register Pair DE from the stack: the table.
2233
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
2234
CP 2CH FE 2C
Compare Register A with 2CH, the comma before another parameter.
2236
If it is a comma, jump relative to 21FDH (PARAM1) for the next parameter.
2238
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of the command line.
223A
RET Z C8
Return Z if the line ends here: a list without its closing parenthesis is accepted (a change of LS-DOS 6.3.1).
223B
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
223D
If it is anything else, jump relative to 221EH (ERROUT): Parameter error.
223F
INC HL 23
Increment Register Pair HL past the closing parenthesis.
2240PARAM5
XOR A AF
Clear Register A to 00H and set the Z flag: the parameters were all right.
2241
RET C9
Return Z with Register Pair HL after the list.

2242H - 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 (222DH) 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.

2242ASSIGN
INC HL 23
Increment Register Pair HL past the equals sign.
2243
LD A,(HL) 7E
Load Register A with the first character of the value at Register Pair HL.
2244
CP 22H FE 22
Compare Register A with 22H, the double quote that starts a string.
2246
If it is a string, jump relative to 2272H (STRING).
2248
CP 41H FE 41
Compare Register A with 41H, the letter A, the first of the capitals.
224A
If Register A is below 41H (a digit, a sign, a comma, the closing parenthesis or 0DH), jump relative to 2261H (ASS3).
224C
RES 5,A CB AF
Clear bit 5 of Register A: a small letter becomes a capital.
224E
CP 58H FE 58
Compare Register A with 58H, the letter X of a hexadecimal value.
2250
If Register A is X, jump relative to 2259H (ASS1) to read a hexadecimal value.
2252
Call ONOFF at 2290H to read Y, N, ON or OFF; it returns Z with Register Pair BC = FFFFH or 0000H.
2255
If the flag word was understood (Z), jump relative to 222AH (PARMSW) to set bit 6 of the response byte and store Register Pair BC.
2257
Otherwise jump relative to 221CH (PARAM2): Parameter error.
2259ASS1
INC HL 23
Increment Register Pair HL past the X, to the opening single quote.
225A
Call HEXVAL at 22B3H to read the quoted hexadecimal digits at Register Pair HL into Register Pair BC (0000H so far); NZ if the opening quote is missing.
225D
If the format is bad (NZ), jump relative to 221CH (PARAM2): Parameter error.
225F
Jump relative to 2268H (ASS3A) with No Carry, so the value is marked as a number.
2261ASS3
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.
2263
PUSH AF F5
Save Register Pair AF (the Carry flag of the test) on the stack across @DECHEX.
2264
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.
2267
POP AF F1
Restore Register Pair AF from the stack: the Carry flag of the test at 2261H.
2268ASS3A
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.
2269
If the value started with a digit (No Carry), jump relative to 226EH (ASS4) to mark it as a number.
226B
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=.
226D
DEFB 3AH 3A
226DH: the byte 3AH, which with the CBH FEH at 226EH-226FH is the instruction LD A,(FECBH). Falling in from 226BH it only loads Register A from FECBH, a value that is not used, and so skips the SET 7 at 226EH; the jump at 2269H enters at 226EH.
226EASS4
SET 7,(HL) CB FE
Set bit 7 of the response byte at Register Pair HL: a numeric value was found.
2270
Jump relative to 222DH (PARAM4) to store the value in Register Pair BC.
2272STRING
INC HL 23
Increment Register Pair HL past the opening double quote.
2273
LD B,H 44
Copy Register H into Register B, the high byte of the address of the string.
2274
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.
2275STR1
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
2276
CP 20H FE 20
Compare Register A with 20H, the space: anything below it is a control character.
2278
If it is a control character (below 20H, as 0DH when the closing quote is missing), jump relative to 221CH (PARAM2): Parameter error.
227A
INC HL 23
Increment Register Pair HL past the character.
227B
CP 22H FE 22
Compare Register A with 22H, the closing double quote.
227D
If it is not the quote, jump relative to 2275H (STR1) for the next character.
227F
PUSH HL E5
Save Register Pair HL (after the closing quote) on the stack.
2280
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.
2282
LD A,L 7D
Copy Register L, the low byte of the length plus 1, into Register A.
2283
DEC A 3D
Decrement Register A: the length of the string, without the quote.
2284
CP 20H FE 20
Compare Register A, the length of the string, with 20H (32).
2286
If the length is below 32, jump relative to 2289H.
2288
XOR A AF
Clear Register A to 00H: a string of 32 or more characters is given the length 0.
2289
POP HL E1
Restore Register Pair HL from the stack: the line after the closing quote.
228A
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.
228B
OR 20H F6 20
OR Register A (the length) with 20H: bit 5, a string was found, with the length in bits 4-0.
228D
LD (HL),A 77
Store Register A into the response byte at Register Pair HL.
228E
Jump relative to 222DH (PARAM4) to store the address of the string in Register Pair BC.
2290ONOFF
SUB 59H D6 59
Subtract 59H (the letter Y) from Register A, the capital first letter of the value.
2292
If it is Y (Register A 00H), jump relative to 22A5H (ONO1) to set the value FFFFH.
2294
ADD A,0BH C6 0B
Add 0BH to Register A: 00H for the letter N (4EH).
2296
If it is N, jump relative to 22A6H (ONO2) with Register Pair BC = 0000H.
2298
DEC A 3D
Decrement Register A: 00H for the letter O (4FH).
2299
RET NZ C0
Return NZ if the value starts with any other character from 41H up (other than X): Parameter error.
229A
INC HL 23
Increment Register Pair HL to the second letter, after the O.
229B
LD A,(HL) 7E
Load Register A with the second letter at Register Pair HL.
229C
RES 5,A CB AF
Clear bit 5 of Register A: a small letter becomes a capital.
229E
CP 46H FE 46
Compare Register A with 46H, the letter F of OFF.
22A0
If it is OFF, jump relative to 22A6H (ONO2) with Register Pair BC = 0000H.
22A2
CP 4EH FE 4E
Compare Register A with 4EH, the letter N of ON.
22A4
RET NZ C0
Return NZ if the second letter is neither F nor N: a Parameter error follows.
22A5ONO1
DEC BC 0B
Decrement Register Pair BC from 0000H to FFFFH: Y, YES and ON mean true (a change of LS-DOS 6.3.1).
22A6ONO2
INC HL 23
Increment Register Pair HL to the next character of the word.
22A7
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
22A8
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
22AA
RET Z C8
Return Z at the closing parenthesis: the rest of the word (ES of YES, F of OFF) has been passed over.
22AB
CP 0DH FE 0D
Compare Register A with 0DH (ENTER), the end of the command line.
22AD
RET Z C8
Return Z at the end of the line, with Register Pair BC holding the flag value.
22AE
CP 2CH FE 2C
Compare Register A with 2CH, the comma before another parameter.
22B0
RET Z C8
Return Z at a comma before the next parameter.
22B1
Jump relative to 22A6H (ONO2) to pass over the next character.
22B3HEXVAL
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, after the X.
22B4
CP 27H FE 27
Compare Register A with 27H, the single quote that must follow the X.
22B6
RET NZ C0
Return NZ if there is no quote: Parameter error.
22B7HEX1
INC HL 23
Increment Register Pair HL past the quote or the last digit.
22B8
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
22B9
SUB 30H D6 30
Subtract 30H from Register A: a digit becomes its value.
22BB
If the character is below 0 (Carry), jump relative to 22C9H (HEX2): the end of the number.
22BD
CP 0AH FE 0A
Compare Register A, the character less 30H, with 0AH, one above the digit 9.
22BF
If it is a digit 0-9 (below 0AH), jump relative to 22D1H (HEX3) to add it.
22C1
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.
22C3
SUB 07H D6 07
Subtract 07H from Register A: A to F become 0AH to 0FH.
22C5
CP 10H FE 10
Compare Register A with 10H, one above the value of the letter F.
22C7
If Register A is below 10H, jump relative to 22D1H (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 B15).
22C9HEX2
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, the one that ended the digits.
22CA
CP 27H FE 27
Compare Register A with 27H, the closing single quote.
22CC
INC HL 23
Increment Register Pair HL past it; INC does not change the flags.
22CD
RET Z C8
Return Z if it was the closing quote, with Register Pair HL after it.
22CE
DEC HL 2B
Decrement Register Pair HL back to the character: without a closing quote the number ends here.
22CF
XOR A AF
Clear Register A to 00H and set the Z flag: a value without its closing quote is accepted too.
22D0
RET C9
Return Z with Register Pair BC = the value and Register Pair HL at the character after it.
22D1HEX3
PUSH BC C5
Save Register Pair BC (the value so far) on the stack.
22D2
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.
22D3
ADD HL,HL 29
Add Register Pair HL to itself: the value times 2.
22D4
ADD HL,HL 29
Add Register Pair HL to itself again: the value times 4.
22D5
ADD HL,HL 29
Add Register Pair HL to itself again: the value times 8.
22D6
ADD HL,HL 29
Add Register Pair HL to itself: times 16; digits beyond the fourth push the first ones out.
22D7
LD B,H 44
Copy Register H into Register B, the high byte of the new value.
22D8
ADD A,L 85
Add Register L (whose low four bits are 0 after the shifts) to Register A, the digit.
22D9
LD C,A 4F
Copy Register A into Register C: Register Pair BC = the value times 16 plus the digit.
22DA
POP HL E1
Restore Register Pair HL from the stack: the line, at the digit.
22DB
Jump relative to 22B7H (HEX1) for the next digit.

22DDH - Texts, Free Space and the Overlay Length

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

22DD-22DFDFTEXT
DEFM "CMD" 43 4D 44
DFTEXT, 22DDH-22DFH: the default extension CMD, which @FEXT puts after a command name that has no extension (1EF2H).
22E0-22E1RDYMSG$
DEFB 0AH, 0EH 0A 0E
RDYMSG$, 22E0H-22E1H: 0AH (line feed, a new line) and 0EH (cursor on), the start of the prompt shown at 1E97H.
22E2-22ED
DEFM "LS-DOS Ready" 4C 53 2D 44 4F 53 20 52 65 61 64 79
22E2H-22EDH: the text LS-DOS Ready, the name of the system and its prompt word.
22EE
DEFB 0DH 0D
22EEH: 0DH, which ends the prompt for @DSPLY; it is shown too, so the command is typed on the line below LS-DOS Ready. The last byte of SYS1/SYS.
22EF-23FD
DEFS 271
22EFH-23FDH: the rest of the overlay area, not loaded by SYS1/SYS; it holds what the overlay loaded before it left there. DIRBUF$ (2300H-23FFH), the directory buffer of SYS0/SYS, lies in it.
23FE-23FF
DEFW 04EFH EF 04
23FEH-23FFH = 04EFH (1263): the length of SYS1, 1E00H to 22EEH (LAST less 1E00H). SYSTEM (SYSRES) reads it (LD BC,(23FEH)) when it copies the overlay into high memory to keep it resident, and stores it back when it brings the copy into 1E00H again.