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

Page Customization

Introduction/Summary

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

SYS13/SYS is the overlay that LS-DOS keeps for an Extended Command Interpreter (ECI), a command interpreter of the user's own that would stand in for the LS-DOS Ready prompt, and for commands that start with an asterisk. The release diskette's SYS13 holds no interpreter, only two messages that say so. It is a load module of 700 bytes, 651 of them loaded at 1E00H-208AH, with its transfer address at 1E00H; 532 of the 651 are zero bytes kept as room for a program. Unlike SYS1-SYS5 and SYS9-SYS12, the other overlays that run at 1E00H, it has no length word at 23FEH-23FFH, which SYSTEM (SYSRES) reads to copy an overlay below HIGH$. SYSTEM refuses SYSRES=13 before that, by the number alone (Can't SYSRES requested module, as for 14).

The command interpreter of SYS1/SYS sends SYS13 two kinds of request through RST 28H. Before it shows LS-DOS Ready, CMDCONT tests EFLAG$ (006EH): when it is not zero, the request is EFLAG$ OR 8FH, SYS13 with the function in bits 6-4 of EFLAG$ (1E8EH). A command line whose first character is an asterisk is sent as request FFH, function 7, with Register Pair HL just after the asterisk and Register Pair BC at the line (1ED4H). Function 7 shows No command <*> present, as SYS13 (1E38H), and does not clear EFLAG$, so an EFLAG$ with bits 6-4 = 111 (70H-7FH, F0H-FFH) asks for function 7 at every return to the command level and the system loops (B240); every other function, function 0 included, shows No Extended Command Interpreter Present, as SYS13 and clears EFLAG$, so that the next command line is read as usual (1E29H). Both messages go to the screen and the job log through @LOGOT and end with a line feed and a carriage return, so an empty line follows each (and LS-DOS Ready's own line feed adds a second).

RST28 drops the return address of the RST, so SYS13's RET goes to whatever is under SYS1's entry: @EXIT, pushed by CLEANUP, for a typed line or a line of a DO job. For @CMNDR it is the caller's return address: the program gets Register Pair HL = 1E74H, Register A = 00H and Z. In a DO job @EXIT goes on to SYS11's NEWEXIT (1B0CH = ADH). The ECI request never comes while a DO job runs: SYS11 feeds the lines through @CMNDI and @EXIT reaches NEWEXIT, so CMDCONT is first reached after Job done.

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 SYS13 (SYS13/ASM, titled LS-DOS 6.2), which assembles to this file byte for byte.

Notes

To use SYS13 a program of the user's own would be put into it (the 32 bytes of slack after the first JR, then the 500 at the end, and the overlay area up to 22FFH; 2300H-23FFH is DIRBUF$, which a GAT read writes over) and EFLAG$ set to a non zero value. The interpreter receives EFLAG$ OR 8FH in Register A with Register Pairs HL and BC = 0420H; function 7 is the same request FFH as an asterisk line, which comes with Register Pair HL = 0421H. Nothing in LS-DOS 6.3.1 sets EFLAG$.

There are no hidden instructions and no operands written while SYS13 runs. The asterisk of the command line is not looked at again; Register Pairs HL and BC as SYS1 sends them are not used.

Bugs (listed on the LS-DOS reference page): B239, SYS13 returns with Register Pair HL = the address of its message (@LOGOT keeps it), and @EXIT and @CMNDR pass Register Pair HL on as the return code. Typed at LS-DOS Ready nothing follows from it, as SYS1 ignores the code; in a DO job SYS11 aborts the job on a code that is not zero, so a line starting with an asterisk shows No command <*> present, as SYS13, then Job aborted, and the rest of the job is not run, as for a command that is not found; a program that runs such a line with @CMNDR gets Register Pair HL = 1E74H with Register A = 00H and Z (1E3FH). B240, an EFLAG$ of 70H-7FH or F0H-FFH makes CMDCONT send function 7, which shows its message without clearing EFLAG$: the message repeats without end, SYS1 and SYS13 are read from drive 0 on every pass, and only a reset ends it (1E3FH).

Variables

Memory Used by SYS13/SYS

Address
Size
Contents
006EH
1 byte
EFLAG$
The ECI flag, cleared by every request but function 7 (1E2CH); SYS1 tests it before each LS-DOS Ready.
1E02H-1E21H
32 bytes
Slack
Zero bytes after the first JR, room for a program.
1E97H-208AH
500 bytes
More slack
Zero bytes at the end of the file, room for a program.

Routines of Other Files Called

AddressRoutine
RST 28H, SVC 101@FLAGS (SYS0/SYS): Index Register IY to FLGTAB$ 006AH (1E2BH).
RST 28H, SVC 12@LOGOT (BOOT/SYS, 0500H): shows a line on the screen and writes it to the job log (1E35H, 1E3DH).

Disassembly

1E00H - SYS13: the Extended Command Interpreter and the Asterisk Command

SYS13 is the place for an Extended Command Interpreter (ECI) of the user's own, and for a command that starts with an asterisk. SYS1/SYS's interpreter sends it two kinds of request through RST 28H. When EFLAG$ (006EH) is not zero, CMDCONT (1E8EH on the SYS1/SYS page) sends EFLAG$ OR 8FH instead of showing LS-DOS Ready, so the function in bits 6-4 is the user's own code. A command line that starts with an asterisk sends FFH, function 7 (1ED4H on the SYS1/SYS page), with Register Pair HL just after the asterisk. The release SYS13 holds no interpreter: function 7 shows the No command message and leaves EFLAG$ as it is (B240), any other function shows No Extended Command Interpreter Present and clears EFLAG$, so the next command line is read as usual. Each message goes to the screen and the job log by @LOGOT. SYS13's RET goes, through RST28 at 1A77H, to the address that was on the stack when SYS1 issued its RST 28H: @EXIT (1B0BH, pushed by CLEANUP) for a typed line or a line of a DO job, the program for @CMNDR. Register Pair HL then holds 1E40H or 1E74H, the address of the message, which @LOGOT returns unchanged (B239). The 32 bytes after the first JR and the 500 at the end are zeros kept as room for a program; SYS13 has no length word at 23FEH-23FFH; SYSTEM refuses SYSRES=13 anyway, by its number test (SYS8 2805H: 13 and up, like 0 and 6-8, give Can't SYSRES requested module).

1E00SYS13
SYS13: jump relative to 1E22H (START) over the 32 bytes of slack that follow, room for a patch or a jump to an interpreter of the user's own.
1E02-1E21
DEFB 00H x 32 00 x 32
1E02H-1E21H: 32 zero bytes, the slack of the source (DC 32,0), never run.
1E22START
AND 70H E6 70
START: mask Register A, the request from RST28 (FFH, or EFLAG$ OR 8FH), with 70H, keeping the function number times 10H in bits 6-4.
1E24
CP 70H FE 70
Compare Register A with 70H, function 7, the request FFH that SYS1 sends for a command starting with an asterisk; CMDCONT also sends FFH when EFLAG$ bits 6-4 are 111 (B240).
1E26
Jump to 1E38H (NOCMD) if Register A is 70H: there is no asterisk command.
1E29NOSYS13
LD A,65H 3E 65
NOSYS13: every function but 7 comes here, the ECI request EFLAG$ OR 8FH with bits 6-4 of EFLAG$ from 000 to 110 (8FH-EFH; EFLAG$ 01H-0FH and 80H-8FH give 8FH, function 0). Load Register A with 65H, SVC 101, @FLAGS.
1E2B
RST 28H EF
Issue RST 28H, @FLAGS: Index Register IY points at FLGTAB$ (006AH), the system flags, with AFLAG$ at Index Register IY+00H.
1E2C
LD (IY+04H),00H FD 36 04 00
Store 00H at Index Register IY+04H, EFLAG$ (006EH), the ECI flag: SYS1 shows LS-DOS Ready and reads the next line itself from now on.
1E30
LD HL,1E40H 21 40 1ELD HL,NXCI$
Load Register Pair HL with 1E40H (NXCI$), the message No Extended Command Interpreter Present, as SYS13.
1E33
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, which shows a line ended by 0DH on the screen and writes it to the job log.
1E35
RST 28H EF
Issue RST 28H, @LOGOT, to show and log the message at Register Pair HL (1E40H).
1E36
XOR A AF
Clear Register A to 00H, setting the Zero flag.
1E37
RET C9
Return with Register A 00H, the Zero flag set and Register Pair HL = 1E40H (NXCI$), which @LOGOT returns unchanged. RST28 (1A77H) returns to @EXIT (1B0BH, pushed by CLEANUP) when CMDCONT sent the request, or to the program after a direct one; SYS1 ignores Register Pair HL. No DO job ever sends this request.
1E38NOCMD
LD HL,1E74H 21 74 1ELD HL,NOCMD$
NOCMD: load Register Pair HL with 1E74H (NOCMD$), the message No command, then the asterisk in angle brackets, then present, as SYS13.
1E3B
LD A,0CH 3E 0C
Load Register A with 0CH, SVC 12, @LOGOT, to show the message on the screen and write it to the job log.
1E3D
RST 28H EF
Issue RST 28H, @LOGOT, to show and log the message at Register Pair HL (1E74H).
1E3E
XOR A AF
Clear Register A to 00H, setting the Zero flag.
1E3F
RET C9
Return with Register A 00H, the Zero flag set and Register Pair HL = 1E74H (NOCMD$). RST28 (1A77H) returns to the address on the stack at SYS1's RST 28H: @EXIT (1B0BH) for a typed line or a DO line, the program for @CMNDR. Typed, SYS1 ignores Register Pair HL; in a DO job @EXIT reaches SYS11's NEWEXIT, which shows Job aborted (B239). EFLAG$ is not cleared here (B240).
1E40-1E73NXCI$
DEFM "No Extended Command Interpreter Present, as SYS13 " / DEFB 0AH, 0DH 4E 6F 20 45 78 74 65 6E 64 65 64 20 43 6F 6D 6D 61 6E 64 20 49 6E 74 65 72 70 72 65 74 65 72 20 50 72 65 73 65 6E 74 2C 20 61 73 20 53 59 53 31 33 20 0A 0D
NXCI$, 1E40H-1E73H: the message of an ECI request, with a space, a line feed and the 0DH that ends it for @LOGOT, so an empty line follows.
1E74-1E96NOCMD$
DEFM "No command <*> present, as SYS13 " / DEFB 0AH, 0DH 4E 6F 20 63 6F 6D 6D 61 6E 64 20 3C 2A 3E 20 70 72 65 73 65 6E 74 2C 20 61 73 20 53 59 53 31 33 20 0A 0D
NOCMD$, 1E74H-1E96H: the message of a command starting with an asterisk, with a space, a line feed and the 0DH that ends it.
1E97-208A
DEFB 00H x 500 00 x 500
1E97H-208AH: 500 zero bytes, the More slack of the source (DC 500,0), loaded with the file but never run; room for an interpreter.
208B-23FF
DEFS 885
208BH-23FFH: the rest of the overlay area, not loaded by SYS13/SYS. There is no length word at 23FEH-23FFH; those two bytes keep what was last put there: reached from SYS1, always SYS1's length word 04EFH, which SYS1's load (or the SYSRES copy) stored; a GAT read into 2300H also writes them.