4E00H - The Routine Table
Data: SYS1/SYS's table of routines 2-11, one word each. The overlay request handler in SYS0/SYS (its 49C9H-49DCH) takes routine number n from bits 3-0 of the request code and runs the word at 4E00H + 2 x (n - 2). The request codes of SYS1/SYS have 0 in bits 7-4: 03H CMD@ (4400H), 05H CMNDI@ (4405H), 06H FSPEC@ (441CH), 07H FEXT@ (4473H) and 08H PARAM@ (4476H) come from SYS0/SYS's entry points, 0AH (BOOT) and 0BH (CLS) from the library table at 51B8H.
4E00-4E01
DEFW 4E14H 14 4E
Routine 2: 4E14H, XOR A and RET. SYS0/SYS's record locator loads the low overlay it displaced back and requests its routine 2 (its 4D55H-4D62H), and every low overlay answers with Register A = 00H.
4E02-4E03
DEFW 4E16H 16 4E
Routine 3: 4E16H, the DOSPLUS command level, requested by CMD@ (4400H) with code 03H. EXIT@ (402DH) and ABORT@ (4030H) jump to CMD@.
4E04-4E05
DEFW 4E14H 14 4E
Routine 4: 4E14H, the same XOR A and RET as routine 2. No file of this diskette loads Register A with 04H for a RST 28H.
4E06-4E07
DEFW 4E88H 88 4E
Routine 5: 4E88H, CMNDI@, which runs the command line at Register Pair HL; requested by 4405H with code 05H.
4E08-4E09
DEFW 4EC7H C7 4E
Routine 6: 4EC7H, FSPEC@, which moves a file specification from Register Pair HL into the file control block at Register Pair DE; requested by 441CH with code 06H.
4E0A-4E0B
DEFW 4F13H 13 4F
Routine 7: 4F13H, FEXT@, which adds the default extension at Register Pair HL to the file specification at Register Pair DE; requested by 4473H with code 07H.
4E0C-4E0D
DEFW 5019H 19 50
Routine 8: 5019H, PARAM@, which reads the parameters at Register Pair HL by the keyword table at Register Pair DE; requested by 4476H with code 08H.
4E0E-4E0F
DEFW 50F1H F1 50
Routine 9: 50F1H, which returns Register Pair HL = 5106H, the library command table. No file of this diskette loads Register A with 09H for a RST 28H.
4E10-4E11
DEFW 50F8H F8 50
Routine 10: 50F8H, the BOOT command (request code 0AH in the library table at 51BDH), which resets the computer.
4E12-4E13
DEFW 50F5H F5 50
Routine 11: 50F5H, the CLS command (request code 0BH in the library table at 51C3H), which clears the screen.
4E14H - Routines 2 and 4
The routine SYS0/SYS's record locator runs when it loads SYS1/SYS back after SYS4/SYS (its 4D55H-4D62H): nothing to do.
4E14
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: routines 2 and 4 have no work to do.
4E15
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH) and through it to the caller with Register A = 00H.
4E16H - CMD@ - The DOSPLUS Command Level
Routine 3, reached through CMD@ (4400H) from EXIT@ (402DH), ABORT@ (4030H) and the start-up's last return. It resets the stack, EXIT@'s return and the ABORT@ and BREAK$ vectors, then runs the next command of a command line that holds several (separated by semicolons), or displays the DOS PLUS prompt and reads a new line.
4E16
EI FB
Enable interrupts. SYS0/SYS's start-up runs with them disabled (its 4E00H); this is where they are turned on, and every return to the command level turns them on again.
4E17
LD SP,41FCH 31 FC 41
Load the Stack Pointer with 41FCH, the system stack, so whatever the program before left on the stack is dropped.
4E1A
LD HL,402DH 21 2D 40
Load Register Pair HL with 402DH, EXIT@, the return to the command level.
4E1D
PUSH HL E5
Save Register Pair HL (402DH) to the top of the stack: when the command run below returns, it goes to EXIT@ and so back to here.
4E1E
LD A,C3H 3E C3
Load Register A with C3H, the code of a JP instruction.
4E20
LD (4030H),A 32 30 40
Store Register A (C3H) to 4030H, the opcode of the ABORT@ vector, in case a program has changed it.
4E23
LD A,C9H 3E C9
Load Register A with C9H, the code of a RET instruction.
4E25
LD (4312H),A 32 12 43
Store Register A (C9H) to BREAK$ at 4312H: the BREAK vector returns at once until a program sets its own.
4E28
LD A,(4302H) 3A 02 43
Load Register A with SFLAG1$, the system flags at 4302H.
4E2B
BIT 2,A CB 57
Test bit 2 of Register A (SFLAG1$), the DEBUG flag that the DEBUG command sets.
4E2D
If the Z FLAG is set (DEBUG is off), JUMP to 4E37H with Register Pair HL = 402DH (EXIT@), the address ABORT@ goes to.
4E2F
LD HL,440DH 21 0D 44
DEBUG is on: load Register Pair HL with 440DH, DEBUG@, the address ABORT@ goes to instead.
4E32
LD A,FFH 3E FF
Load Register A with FFH, to switch on DEBUG at the BREAK key.
4E34
LD (4308H),A 32 08 43
Store Register A (FFH) to 4308H, the DEBUG on BREAK switch: the interrupt handler enters DEBUG@ when BREAK is pressed.
4E37
LD (4031H),HL 22 31 40
Store Register Pair HL (402DH, or 440DH with DEBUG on) to 4031H-4032H, the operand of the ABORT@ vector: ABORT@ = JP 402DH (EXIT@) or JP 440DH (DEBUG@).
4E3A
LD HL,(4310H) 2A 10 43
Load Register Pair HL with the command buffer pointer at 4310H, the start of the command that has just run.
4E3D
GOSUB to 4FD8H to skip spaces and commas: Register A returns the character at Register Pair HL, with the C FLAG set when it ends the command (a control character or a semicolon).
4E40
INC HL 23
INCrement Register Pair HL by 1, past the character in Register A.
4E41
If the NC FLAG is set (Register A is a character of the command), JUMP back to 4E3DH: the loop runs to the end of the command that has just run.
4E43
LD (4310H),HL 22 10 43
Store Register Pair HL, the address after the character that ended the command, to the command buffer pointer at 4310H.
4E46
CP 20H FE 20
Compare Register A, the character that ended the command, against 20H. The NC FLAG is set when it is the semicolon (3BH) and another command follows on the line.
4E48
If the NC FLAG is set, JUMP to 4405H (CMNDI@) to run the next command at Register Pair HL, the address after the semicolon.
4E4B
LD HL,4318H 21 18 43
The line is done: point Register Pair HL to 4318H, INPBUF$, the command buffer.
4E4E
LD (4310H),HL 22 10 43
Store Register Pair HL (4318H) to the command buffer pointer at 4310H: the next command starts at the beginning of INPBUF$.
4E51H - The Prompt and the Command Line
Displays the prompt (unless a DO file is running), reads a line of up to 63 characters into 4200H, ignores an empty line, a line that starts with a control character and a line that starts with a period, repeats the last command for a slash, and otherwise copies the line to INPBUF$ and runs it through CMNDI@.
4E51
LD HL,51E0H 21 E0 51
Point Register Pair HL to 51E0H, the prompt text: a line feed, DOS PLUS and a carriage return.
4E54
LD A,(4302H) 3A 02 43
Load Register A with SFLAG1$, the system flags at 4302H.
4E57
BIT 5,A CB 6F
Test bit 5 of Register A (SFLAG1$), the flag of an active DO file. The Z FLAG is set when no DO file is running.
4E59
If the Z FLAG is set, GOSUB to 4467H (DSPLY@) to display the prompt at Register Pair HL (51E0H). The commands of a DO file are read without a prompt.
4E5C
LD B,3FH 06 3F
Load Register B with 3FH, the most characters (63) the line may have.
4E5E
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system sector buffer, which takes the line as it is typed.
4E61
GOSUB to the ROM's line input at 0040H (KEYIN@): it reads up to Register B (63) characters into the buffer at Register Pair HL (4200H), ends them with 0DH and returns Register Pair HL = 4200H. The keyboard driver of SYS0/SYS (4DC0H) gives the lines of a DO file here.
4E64
PUSH HL E5
Save Register Pair HL (4200H, the line) to the top of the stack.
4E65
GOSUB to 4FD8H to skip the spaces and commas at the start of the line: Register A returns its first other character, with the C FLAG set when that ends the line.
4E68
POP HL E1
Restore Register Pair HL (4200H, the start of the line) from the top of the stack.
4E69
CP 20H FE 20
Compare Register A, the first character of the line, against 20H. The C FLAG is set for a control character: the line is empty (0DH) or BREAK ended it.
4E6B
If the C FLAG is set, JUMP back to 4E51H for the prompt and a new line.
4E6D
CP 2EH FE 2E
Compare Register A, the first character of the line, against 2EH (a period).
4E6F
If the Z FLAG is set (a period: the line is a comment), JUMP back to 4E51H without running it.
4E71
CP 2FH FE 2F
Compare Register A, the first character of the line, against 2FH (a slash).
4E73
If the NZ FLAG is set (not a slash), JUMP to 4E7BH to copy the line at Register Pair HL (4200H) into INPBUF$.
4E75
LD HL,4318H 21 18 43
A slash repeats the last command: point Register Pair HL to 4318H, INPBUF$, which still holds the last line run.
4E78
GOSUB to 4467H (DSPLY@) to display the last command at Register Pair HL (4318H). DSPLY@ keeps Register Pair HL, so the copy below moves INPBUF$ onto itself.
4E7B
LD DE,4318H 11 18 43
Point Register Pair DE to 4318H, INPBUF$, where the line is to go.
4E7E
PUSH DE D5
Save Register Pair DE (4318H) to the top of the stack.
4E7F
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H, the length of INPBUF$ (64 bytes).
4E82
LDIR ED B0
Copy Register Pair BC (64) bytes from Register Pair HL (4200H, the new line, or 4318H for a slash) to Register Pair DE (4318H, INPBUF$).
4E84
POP HL E1
Restore Register Pair HL from the top of the stack: 4318H, the line in INPBUF$.
4E85
JUMP to 4405H (CMNDI@) to run the command line at Register Pair HL (4318H). The command returns to EXIT@ (402DH), which comes back to 4E16H.
4E88H - CMNDI@ - Run a Command
Routine 5, requested by CMNDI@ (4405H) with Register Pair HL pointing to a command line. The command name goes through FSPEC@ into the file control block at 43DEH; a name found in the library table (5106H) becomes the request code of its library command, any other name is run as a program with the default extension CMD. On entry the stack holds 49DDH (the overlay request handler's return) and the word it saved from 4307H-4308H; both are taken off here, so the command returns straight to the caller of CMNDI@.
4E88
POP AF F1
Restore Register Pair AF from the top of the stack: it drops 49DDH, the return into SYS0/SYS's overlay request handler, so the handler's end (49DDH-49E2H) does not run.
4E89
POP AF F1
Restore Register Pair AF from the top of the stack: the word the handler saved from 4307H-4308H, so Register A = the old value of 4308H, the DEBUG on BREAK switch that the handler cleared for the request.
4E8A
LD (4308H),A 32 08 43
Store Register A, the old DEBUG on BREAK switch, back to 4308H, the step the handler's end would have made.
4E8D
GOSUB to 4FD8H to skip spaces and commas: Register A returns the first other character at Register Pair HL, with the C FLAG set when it ends the line.
4E90
RET C D8
If the C FLAG is set (nothing to run), RETurn to the caller of CMNDI@ with Register A = the character that ends the line.
4E91
LD DE,43DEH 11 DE 43
Point Register Pair DE to 43DEH, the file control block that takes the command name (inside the system file control block at 43CEH).
4E94
GOSUB to 441CH (FSPEC@, routine 6 at 4EC7H) to move the command name at Register Pair HL into the file control block at Register Pair DE (43DEH). Register Pair HL returns past it; the NZ FLAG is set when it is not a file specification.
4E97
LD A,53H 3E 53
Load Register A with 53H, the error code for ERROR@: 13H (the manual's Improper file name) with bit 6 set, the plain form of the message; bit 7 is clear, so ERROR@ ends through ABORT@.
4E99
If the NZ FLAG is set (FSPEC@ found no name), JUMP to 4409H (ERROR@) with Register A = 53H.
4E9C
LD A,(DE) 1A
Load Register A with the first character of the name in the file control block at Register Pair DE (43DEH).
4E9D
GOSUB to 4FEFH: the C FLAG returns set when Register A is a digit, a letter or one of the characters # $ % & + < > ? ! and 2AH (the asterisk), which a name may start with.
4EA0
LD A,6CH 3E 6C
Load Register A with 6CH, the error code for ERROR@: 2CH (the manual's Illegal filespec) with bit 6 set, the plain form of the message.
4EA2
If the NC FLAG is set (the specification starts with @ or a colon: a device or a drive alone), JUMP to 4409H (ERROR@) with Register A = 6CH.
4EA5
PUSH HL E5
Save Register Pair HL, the command line after the command name, to the top of the stack.
4EA6
LD HL,5106H 21 06 51
Point Register Pair HL to 5106H, the table of library command names.
4EA9
GOSUB to 4FB0H to look the name in the file control block at Register Pair DE (43DEH) up in the table at Register Pair HL (5106H). Register A returns the number of the entry (1-39) with the NZ FLAG, or 00H with the Z FLAG when it is not a library command.
4EAC
If the Z FLAG is set (not a library command), JUMP to 4EB8H to run it as a program.
4EAE
LD HL,51B8H 21 B8 51
Point Register Pair HL to 51B8H, the byte before the request codes of the library commands (51B9H-51DFH).
4EB1
LD E,A 5F
Load Register E with Register A, the number of the library command (1-39).
4EB2
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = the number of the command.
4EB4
ADD HL,DE 19
ADD Register Pair DE (the number) to Register Pair HL (51B8H): Register Pair HL points to the command's request code.
4EB5
LD A,(HL) 7E
Load Register A with the request code of the library command at Register Pair HL: the overlay in bits 7-4 (SYS1 0, SYS9 8 ... SYS16 F) and its routine in bits 3-0.
4EB6
POP HL E1
Restore Register Pair HL from the top of the stack: the command line after the command name, which the library command reads for its parameters.
4EB7
RST 28H EF
RST 28H to 400CH and the overlay request handler (4984H) with Register A = the request code: the overlay is loaded and its routine runs the command. The handler drops the address this RST pushes, so the command returns to the caller of CMNDI@.
4EB8
LD HL,51EAH 21 EA 51
A program: point Register Pair HL to 51EAH, the text CMD, the default extension.
4EBB
GOSUB to 4473H (FEXT@, routine 7 at 4F13H) to give the name in the file control block at Register Pair DE (43DEH) the extension at Register Pair HL (CMD) when it has none.
4EBE
LD A,FFH 3E FF
Load Register A with FFH, the value that names no overlay.
4EC0
LD (430BH),A 32 0B 43
Store Register A (FFH) to OVLYH$ at 430BH: the program loads over 5200H, so no high overlay stays resident.
4EC3
POP HL E1
Restore Register Pair HL from the top of the stack: the command line after the program name, which the program gets in Register Pair HL.
4EC4
JUMP to 4433H (RUN@) to load and run the program whose file control block Register Pair DE (43DEH) points to.
4EC7H - FSPEC@ - Move a File Specification
Routine 6, requested by FSPEC@ (441CH). Register Pair HL points to the text, Register Pair DE to the file control block. The name (up to 8 characters), the extension after a slash (3), the password after a period (8) and the drive after a colon (2) are copied with their separators and an 03H at the end; a device specification is @ and up to 2 characters. A specification that is one of the words TO, FROM and USING (51EDH) is skipped and the next one is taken. On return the Z FLAG is set when a specification was moved; Register Pair HL points past it.
4EC7
PUSH DE D5
Save Register Pair DE, the file control block, to the top of the stack.
4EC8
GOSUB to 4FD8H to skip spaces and commas at Register Pair HL: Register A returns the next other character.
4ECB
LD B,08H 06 08
Load Register B with 08H, the most characters a file name has.
4ECD
GOSUB to 4F41H to copy up to Register B (8) characters of the name from Register Pair HL to Register Pair DE (the file control block). Register A returns the character that ended the name; the NZ FLAG is set when there were none.
4ED0
If the NZ FLAG is set (no name), JUMP to 4F09H, where @ (a device) and a colon (a drive alone) are taken.
4ED2
CP 2FH FE 2F
Compare Register A, the character after the name, against 2FH (a slash, the start of an extension).
4ED4
If the NZ FLAG is set (no extension), JUMP to 4EDFH.
4ED6
LD (DE),A 12
Store Register A (the slash) to the file control block at Register Pair DE, after the name.
4ED7
INC DE 13
INCrement Register Pair DE by 1, where the extension goes.
4ED8
LD B,03H 06 03
Load Register B with 03H, the most characters an extension has.
4EDA
GOSUB to 4F41H to copy up to Register B (3) characters of the extension from Register Pair HL to Register Pair DE. Register A returns the character after it; the NZ FLAG is set when there were none.
4EDD
If the NZ FLAG is set (a slash with no extension), JUMP to 4F11H to return with the NZ FLAG.
4EDF
CP 2EH FE 2E
Compare Register A, the character after the name or extension, against 2EH (a period, the start of a password).
4EE1
If the NZ FLAG is set (no password), JUMP to 4EECH.
4EE3
LD (DE),A 12
Store Register A (the period) to the file control block at Register Pair DE.
4EE4
INC DE 13
INCrement Register Pair DE by 1, where the password goes.
4EE5
LD B,08H 06 08
Load Register B with 08H, the most characters a password has.
4EE7
GOSUB to 4F41H to copy up to Register B (8) characters of the password from Register Pair HL to Register Pair DE. Register A returns the character after it; the NZ FLAG is set when there were none.
4EEA
If the NZ FLAG is set (a period with no password), JUMP to 4F11H to return with the NZ FLAG.
4EEC
CP 3AH FE 3A
Compare Register A, the character after the specification so far, against 3AH (a colon, the start of a drive number).
4EEE
If the NZ FLAG is set (no drive), JUMP to 4EF9H to end the specification.
4EF0
LD (DE),A 12
Store Register A (the colon, or the @ of a device from 4F0BH) to the file control block at Register Pair DE.
4EF1
INC DE 13
INCrement Register Pair DE by 1, where the drive or device name goes.
4EF2
LD B,02H 06 02
Load Register B with 02H, the most characters a drive or device name has.
4EF4
GOSUB to 4F41H to copy up to Register B (2) characters from Register Pair HL to Register Pair DE. Register A returns the character after them; the NZ FLAG is set when there were none.
4EF7
If the NZ FLAG is set (a colon or @ with nothing after it), JUMP to 4F11H to return with the NZ FLAG.
4EF9
LD A,03H 3E 03
Load Register A with 03H, the character that ends a file specification.
4EFB
LD (DE),A 12
Store Register A (03H) to the file control block at Register Pair DE, after the last part. 4F41H left an 03H there too; this one stays when nothing follows.
4EFC
POP DE D1
Restore Register Pair DE from the top of the stack: the start of the file control block.
4EFD
PUSH HL E5
Save Register Pair HL, the text after the specification, to the top of the stack.
4EFE
LD HL,51EDH 21 ED 51
Point Register Pair HL to 51EDH, the list of the words TO, FROM and USING.
4F01
GOSUB to 4FB0H to look the specification in the file control block at Register Pair DE up in the list at Register Pair HL (51EDH). The NZ FLAG returns set when it is one of the three words.
4F04
POP HL E1
Restore Register Pair HL from the top of the stack: the text after the specification.
4F05
If the NZ FLAG is set (TO, FROM or USING), JUMP back to 4EC7H to take the next specification at Register Pair HL in place of the word.
4F07
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: a file specification was moved.
4F08
RET C9
RETurn to the caller with the Z FLAG set, Register Pair DE = the file control block and Register Pair HL past the specification.
4F09
CP 40H FE 40
No name: compare Register A, the character that stopped it, against 40H (@, a device specification).
4F0B
If the Z FLAG is set, JUMP to 4EF0H to store the @ and up to 2 characters of the device name.
4F0D
CP 3AH FE 3A
Compare Register A, the character that stopped the name, against 3AH (a colon: a drive number alone).
4F0F
If the Z FLAG is set, JUMP to 4EF0H to store the colon and the drive number.
4F11
POP DE D1
Restore Register Pair DE from the top of the stack: the start of the file control block.
4F12
RET C9
RETurn to the caller with the NZ FLAG set: no file specification. Register A holds the character that stopped the scan.
4F13H - FEXT@ - Add a Default Extension
Routine 7, requested by FEXT@ (4473H) with Register Pair DE pointing to a file specification (as FSPEC@ leaves it) and Register Pair HL to a 3 character extension. When the name has no extension, the rest of the specification is moved up by 4 bytes and a slash and the extension are put after the name. The NZ FLAG returns set when the extension was added. All registers but Register Pair AF are kept by SYS0/SYS's wrapper at 4525H.
4F13
GOSUB to 4525H, SYS0/SYS's register saving wrapper: it saves Register Pairs BC, DE, HL and Index Registers IX and IY, calls the code at 4F16H and, when it returns, restores them and returns to the caller of FEXT@ with Register Pair AF as 4F16H-4F40H leave it.
4F16
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the file specification, Register Pair DE = the default extension.
4F17
LD B,09H 06 09
Load Register B with 09H, the most bytes to look at: the 8 characters of a name and the one after it.
4F19
LD A,(HL) 7E
Load Register A with the byte of the specification at Register Pair HL.
4F1A
CP 2FH FE 2F
Compare Register A against 2FH (a slash): the name already has an extension.
4F1C
RET Z C8
If the Z FLAG is set, RETurn with the Z FLAG: the extension is left as it is.
4F1D
GOSUB to 4FEFH: the C FLAG returns set when Register A is a digit, a letter or one of the characters a name may hold.
4F20
If the NC FLAG is set (03H, a period or a colon: the end of the name), JUMP to 4F27H to put the extension at Register Pair HL.
4F22
INC HL 23
INCrement Register Pair HL by 1 to the next byte of the name.
4F23
DECrement Register B and loop back to 4F19H while Register B is not zero.
4F25
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: no end of the name within 9 bytes, nothing is added.
4F26
RET C9
RETurn to the wrapper (4534H) with the Z FLAG set: the specification is unchanged.
4F27
PUSH DE D5
Save Register Pair DE, the default extension, to the top of the stack.
4F28
LD BC,0010H 01 10 00
Load Register Pair BC with 0010H (16), the distance to the last byte that moves.
4F2B
ADD HL,BC 09
ADD Register Pair BC (16) to Register Pair HL (the byte after the name): Register Pair HL = the last of the 17 bytes from there that are to move.
4F2C
LD D,H 54
Load Register D with Register H, the high byte of that address.
4F2D
LD E,L 5D
Load Register E with Register L: Register Pair DE = Register Pair HL.
4F2E
INC DE 13
INCrement Register Pair DE by 1, the first of four.
4F2F
INC DE 13
INCrement Register Pair DE by 1 again, the second of the four bytes of room.
4F30
INC DE 13
INCrement Register Pair DE by 1 again, the third of the four bytes of room.
4F31
INC DE 13
INCrement Register Pair DE by 1, the fourth: Register Pair DE = Register Pair HL + 4, where the last byte goes.
4F32
INC BC 03
INCrement Register Pair BC by 1 to 0011H, the 17 bytes from the end of the name on.
4F33
LDDR ED B8
Copy Register Pair BC (17) bytes from Register Pair HL to Register Pair DE, from the last byte down: the rest of the specification (password, drive and the 03H) moves up 4 bytes. Register Pair DE ends at the byte after the name + 3 and Register Pair HL one below the byte after the name.
4F35
POP HL E1
Restore Register Pair HL from the top of the stack: the default extension.
4F36
INC HL 23
INCrement Register Pair HL by 1 to the second character of the extension.
4F37
INC HL 23
INCrement Register Pair HL by 1 to the third, the last one.
4F38
LD C,03H 0E 03
Load Register C with 03H: Register Pair BC = 0003H (Register B is 00H after the LDDR), the 3 characters of the extension.
4F3A
LDDR ED B8
Copy Register Pair BC (3) bytes from Register Pair HL (the extension) to Register Pair DE, from the last byte down: the extension goes into bytes 2-4 after the name, and Register Pair DE ends at the byte after the name.
4F3C
LD A,2FH 3E 2F
Load Register A with 2FH, the slash that goes before the extension.
4F3E
LD (DE),A 12
Store Register A (the slash) to Register Pair DE, the byte after the name, before the extension.
4F3F
OR A B7
OR Register A (2FH) with itself to set the NZ FLAG: the extension was added.
4F40
RET C9
RETurn to the wrapper (4534H) with the NZ FLAG set.
4F41H - Copy a Field
Copies the letters, digits and name characters (4FEFH) at Register Pair HL to Register Pair DE, at most Register B of them (more are passed over), and ends them with 03H, which is not counted in Register Pair DE. The field stops at the end of the line, an open parenthesis, a comma or any other character; that character is passed when it is not one of the first three. Register A returns the character that stopped the field; the Z FLAG is set when the field had at least one character.
4F41
LD A,B 78
Load Register A with Register B, the most characters the field may have (never 00H).
4F42
LD (4F6DH),A 32 6D 4F
Store Register A to 4F6DH, the operand of the LD A,00H at 4F6CH: it stays not zero, and so gives the NZ FLAG at the end, unless a character is stored.
4F45
INC B 04
INCrement Register B by 1, so the count below lets Register B characters in.
4F46
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
4F47
GOSUB to 4FE6H: the C FLAG returns set when Register A is a control character or a semicolon, the end of the line.
4F4A
If the C FLAG is set, JUMP to 4F68H to end the field with Register Pair HL at the end of the line.
4F4C
CP 28H FE 28
Compare Register A against 28H (an open parenthesis, the start of the parameters).
4F4E
If the Z FLAG is set, JUMP to 4F68H to end the field with Register Pair HL at the parenthesis.
4F50
CP 2CH FE 2C
Compare Register A against 2CH (a comma, which separates the parts of a command).
4F52
If the Z FLAG is set, JUMP to 4F68H to end the field with Register Pair HL at the comma.
4F54
INC HL 23
INCrement Register Pair HL by 1 past the character in Register A.
4F55
GOSUB to 4FEFH: the C FLAG returns set when Register A is a digit, a letter (made upper case) or a name character.
4F58
If the NC FLAG is set (a separator, such as a space, a slash, a period, a colon or an equals sign), JUMP to 4F68H to end the field; Register Pair HL is past the separator.
4F5A
DEC B 05
DECrement Register B, the room left in the field.
4F5B
If the Z FLAG is set (the field is full), JUMP to 4F65H to pass over the character.
4F5D
LD (DE),A 12
Store Register A, the character (upper case for a letter), to Register Pair DE.
4F5E
XOR A AF
Set Register A to 00H by XORing it with itself.
4F5F
LD (4F6DH),A 32 6D 4F
Store Register A (00H) to 4F6DH, the operand of the LD A,00H at 4F6CH: the field has a character, so the end gives the Z FLAG.
4F62
INC DE 13
INCrement Register Pair DE by 1 to the next byte of the field.
4F63
JUMP back to 4F46H for the next character of the field at Register Pair HL.
4F65
INC B 04
INCrement Register B back to 1, so each further character of the field is passed over too.
4F66
JUMP back to 4F46H for the next character, which is passed over in the same way.
4F68
LD C,A 4F
Load Register C with Register A, the character that stopped the field.
4F69
LD A,03H 3E 03
Load Register A with 03H, the end of field character.
4F6B
LD (DE),A 12
Store Register A (03H) to Register Pair DE, after the field. Register Pair DE is not moved, so the next part stored overwrites it.
4F6C
LD A,00H 3E 00
Load Register A with the byte at 4F6DH.
Self-Modifying Code
The operand is 00H in the file; 4F42H stores the field's length there at the start and 4F5FH stores 00H when a character is copied, so Register A = 00H for a field with characters and the length for an empty one.
4F6E
OR A B7
OR Register A with itself: the Z FLAG is set when the field has characters, the NZ FLAG when it is empty.
4F6F
LD A,C 79
Load Register A with Register C, the character that stopped the field; the flags stay as 4F6EH set them.
4F70
RET C9
RETurn with Register A = the stopping character and the Z FLAG for a field with characters.
4F71H - Find a Parameter Keyword
Used by PARAM@ (503FH). Register Pair DE points to the parameter name (ended by 03H) and Register Pair BC to a keyword table of 8 byte entries: 6 characters, then the address where the value goes; a 00H after the last entry ends it. The name matches the first entry that begins with it, so a name may be shortened. On a match the Z FLAG is set and Register Pair DE returns the entry's address word; otherwise the NZ FLAG is set and Register A = FFH. Register Pair HL is kept.
4F71
PUSH HL E5
Save Register Pair HL, the parameter text, to the top of the stack.
4F72
LD H,B 60
Load Register H with Register B, the high byte of the keyword table.
4F73
LD L,C 69
Load Register L with Register C: Register Pair HL = the keyword table.
4F74
LD A,(DE) 1A
Load Register A with the first character of the parameter name at Register Pair DE.
4F75
GOSUB to 4FF6H to make Register A upper case when it is a letter.
4F78
CP (HL) BE
Compare Register A against the first character of the table entry at Register Pair HL.
4F79
If the Z FLAG is set (the first characters agree), JUMP to 4F87H to compare the rest.
4F7B
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the length of an entry.
4F7E
ADD HL,BC 09
ADD Register Pair BC (8) to Register Pair HL: Register Pair HL points to the next entry.
4F7F
LD A,(HL) 7E
Load Register A with the first byte of the entry at Register Pair HL.
4F80
OR A B7
OR Register A with itself to test it for 00H, the end of the table.
4F81
If the NZ FLAG is set (another entry), JUMP back to 4F74H to try it.
4F83
POP HL E1
Restore Register Pair HL from the top of the stack: the parameter text.
4F84
OR FFH F6 FF
OR Register A with FFH: Register A = FFH and the NZ FLAG is set, the name is not in the table.
4F86
RET C9
RETurn to PARAM@ (5042H) with the NZ FLAG set and Register A = FFH.
4F87
PUSH HL E5
Save Register Pair HL, the entry whose first character agrees, to the top of the stack.
4F88
PUSH DE D5
Save Register Pair DE, the parameter name, to the top of the stack.
4F89
LD B,05H 06 05
Load Register B with 05H, the other five characters of the entry.
4F8B
INC DE 13
INCrement Register Pair DE by 1 to the next character of the name.
4F8C
INC HL 23
INCrement Register Pair HL by 1 to the next character of the entry.
4F8D
LD A,(DE) 1A
Load Register A with the character of the name at Register Pair DE.
4F8E
GOSUB to 4FE6H: the C FLAG returns set when Register A is a control character (the 03H at the end of the name) or a semicolon.
4F91
If the C FLAG is set (the name ended and all of it agreed), JUMP to 4F9BH: a match.
4F93
GOSUB to 4FF6H to make Register A upper case when it is a letter.
4F96
CP (HL) BE
Compare Register A against the character of the entry at Register Pair HL.
4F97
If the NZ FLAG is set (they differ), JUMP to 4FA7H.
4F99
DECrement Register B and loop back to 4F8BH while Register B is not zero: all six characters agreed when it ends.
4F9B
POP DE D1
Restore Register Pair DE from the top of the stack: the parameter name.
4F9C
POP BC C1
Restore Register Pair BC from the top of the stack: the start of the matching entry.
4F9D
LD HL,0006H 21 06 00
Load Register Pair HL with 0006H, the offset of the entry's address word.
4FA0
ADD HL,BC 09
ADD Register Pair BC (the entry) to Register Pair HL: Register Pair HL points to the word at entry+06H.
4FA1
LD E,(HL) 5E
Load Register E with the low byte of the word at Register Pair HL.
4FA2
INC HL 23
INCrement Register Pair HL by 1 to the high byte.
4FA3
LD D,(HL) 56
Load Register D with the high byte at Register Pair HL: Register Pair DE = the address where the parameter's value goes.
4FA4
POP HL E1
Restore Register Pair HL from the top of the stack: the parameter text, as it was on entry.
4FA5
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: the keyword was found.
4FA6
RET C9
RETurn with the Z FLAG set and Register Pair DE = the value's address.
4FA7
The characters differ: GOSUB to 4FEFH, which returns the C FLAG when Register A (the name's character) is a digit, a letter or a name character.
4FAA
If the NC FLAG is set (the name's character is a separator), JUMP to 4F9BH: the name ended and is a match.
4FAC
POP DE D1
Restore Register Pair DE from the top of the stack: the start of the parameter name.
4FAD
POP HL E1
Restore Register Pair HL from the top of the stack: the entry that did not match.
4FAE
JUMP to 4F7BH to try the next entry of the keyword table after Register Pair HL.
4FB0H - Look a Word Up in a Name Table
Register Pair HL points to a table of words, each with bit 7 set on its first character, ended by 80H; Register Pair DE points to the word, ended by 03H (as 4F41H leaves a field). Used for the library commands (5106H) and the words TO, FROM and USING (51EDH). Register A returns the number of the matching entry, counted from 1, with the NZ FLAG; or 00H with the Z FLAG when no entry matches all of the word.
4FB0
LD B,00H 06 00
Load Register B with 00H, the entry count, which 4FB2H counts up from 1.
4FB2
INC B 04
INCrement Register B by 1, the number of the entry about to be compared.
4FB3
LD A,(HL) 7E
Load Register A with the byte of the table at Register Pair HL.
4FB4
INC HL 23
INCrement Register Pair HL by 1 to the byte after it.
4FB5
OR A B7
OR Register A with itself to test bit 7, the mark of an entry's first character.
4FB6
If the P FLAG is set (bit 7 clear: the rest of an entry that did not match), JUMP back to 4FB3H to pass over it.
4FB9
AND 7FH E6 7F
AND Register A with 7FH to drop the mark: Register A = the first character of the entry, or 00H for the 80H that ends the table.
4FBB
RET Z C8
If the Z FLAG is set (the end of the table), RETurn with Register A = 00H and the Z FLAG: the word is not in the table.
4FBC
PUSH DE D5
Save Register Pair DE, the start of the word, to the top of the stack.
4FBD
LD C,A 4F
Load Register C with Register A, the character of the entry to compare.
4FBE
LD A,(DE) 1A
Load Register A with the character of the word at Register Pair DE.
4FBF
GOSUB to 4FF6H to make Register A upper case when it is a letter.
4FC2
CP C B9
Compare Register A, the character of the word, against Register C, the character of the entry.
4FC3
If the NZ FLAG is set (they differ, or Register C is the marked first character of the next entry), JUMP to 4FCAH.
4FC5
LD A,(HL) 7E
Load Register A with the next byte of the table at Register Pair HL.
4FC6
INC DE 13
INCrement Register Pair DE by 1 to the next character of the word.
4FC7
INC HL 23
INCrement Register Pair HL by 1 past the byte in Register A.
4FC8
JUMP back to 4FBDH to compare that byte of the table with the next character of the word.
4FCA
POP DE D1
Restore Register Pair DE from the top of the stack: the start of the word.
4FCB
BIT 7,C CB 79
Test bit 7 of Register C. It is set when the whole entry agreed and Register C is the first character of the next entry (or the 80H at the end).
4FCD
If the Z FLAG is set (a character differed), JUMP back to 4FB2H for the next entry; Register Pair HL is already past the differing byte.
4FCF
CP 03H FE 03
Compare Register A, the character of the word after the entry's last, against 03H, the end of the word.
4FD1
DEC HL 2B
DECrement Register Pair HL by 1, back to the marked byte of the next entry. The flags stay as the compare set them.
4FD2
If the NZ FLAG is set (the word is longer than the entry), JUMP back to 4FB2H; the next entry is read from Register Pair HL.
4FD4
LD A,B 78
Load Register A with Register B, the number of the matching entry.
4FD5
OR A B7
OR Register A with itself to set the NZ FLAG: the word was found.
4FD6
RET C9
RETurn with Register A = the entry number and the NZ FLAG set.
4FD7H - Character Tests
4FD8H skips spaces and commas; 4FE6H tests for the end of a line; 4FEFH tests for a character a name may hold; 4FF6H tests for a letter and makes it upper case; 4FFFH tests for one of the ten name characters at 500FH.
4FD7
INC HL 23
INCrement Register Pair HL by 1 past the space or comma.
4FD8
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
4FD9
GOSUB to 4FE6H: the C FLAG returns set when Register A ends the line (a control character or a semicolon).
4FDC
RET C D8
If the C FLAG is set, RETurn with Register A = the character that ends the line and the C FLAG.
4FDD
CP 2CH FE 2C
Compare Register A against 2CH (a comma), which is skipped like a space.
4FDF
If the Z FLAG is set, JUMP back to 4FD7H to pass over it.
4FE1
CP 20H FE 20
Compare Register A against 20H (a space), which is skipped.
4FE3
If the Z FLAG is set, JUMP back to 4FD7H to pass over it.
4FE5
RET C9
RETurn with Register A = the first other character, the NC FLAG set and Register Pair HL pointing to it.
4FE6
CP 20H FE 20
Compare Register A against 20H. The C FLAG is set for a control character (00H-1FH), which ends a line.
4FE8
RET C D8
If the C FLAG is set, RETurn with the C FLAG: the end of the line.
4FE9
CP 3BH FE 3B
Compare Register A against 3BH (a semicolon, which ends one command of a line of several).
4FEB
SCF 37
Set the C FLAG, keeping the Z FLAG of the compare.
4FEC
RET Z C8
If the Z FLAG is set (a semicolon), RETurn with the C FLAG: the end of the command.
4FED
CCF 3F
Complement the C FLAG to NC: Register A does not end the line.
4FEE
RET C9
RETurn with the NC FLAG set and Register A unchanged: not the end of the line.
4FEF
CP 30H FE 30
Compare Register A against 30H, the character 0. The C FLAG is set below it.
4FF1
If the C FLAG is set, JUMP to 4FFFH to test Register A against the name characters.
4FF3
CP 3AH FE 3A
Compare Register A against 3AH, one past the character 9.
4FF5
RET C D8
If the C FLAG is set (a digit), RETurn with the C FLAG.
4FF6
CP 41H FE 41
Compare Register A against 41H, the character A. The C FLAG is set below it.
4FF8
If the C FLAG is set, JUMP to 4FFFH to test Register A against the name characters.
4FFA
AND 5FH E6 5F
AND Register A with 5FH, clearing bits 7 and 5: a lower case letter becomes upper case.
4FFC
CP 5BH FE 5B
Compare Register A against 5BH, one past the character Z. The C FLAG is set for a letter.
4FFE
RET C9
RETurn with Register A = the character (upper case) and the C FLAG set for a letter.
4FFF
PUSH BC C5
Save Register Pair BC to the top of the stack.
5000
PUSH HL E5
Save Register Pair HL to the top of the stack.
5001
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the number of name characters in the table.
5004
LD HL,500FH 21 0F 50
Point Register Pair HL to 500FH, the table of name characters.
5007
CPIR ED B1
Compare Register A with the bytes at Register Pair HL (500FH), INCrementing Register Pair HL and DECrementing Register Pair BC (10), until one agrees (the Z FLAG) or Register Pair BC is zero.
5009
POP HL E1
Restore Register Pair HL from the top of the stack, as it was.
500A
POP BC C1
Restore Register Pair BC from the top of the stack, as it was.
500B
SCF 37
Set the C FLAG, keeping the Z FLAG of the search.
500C
RET Z C8
If the Z FLAG is set (Register A is in the table), RETurn with the C FLAG.
500D
CCF 3F
Complement the C FLAG to NC: Register A is not a name character.
500E
RET C9
RETurn with the NC FLAG set and Register A unchanged.
500F-5018
DEFB 23H,24H,25H,26H,2BH,3CH,3EH,3FH,2AH,21H 23 24 25 26 2B 3C 3E 3F 2A 21
Data: the ten characters 4FFFH accepts in a name besides letters and digits: # $ % & + < > ? and 2AH and 21H (the asterisk and the exclamation mark).
5019H - PARAM@ - Read the Parameters
Routine 8, requested by PARAM@ (4476H) with Register Pair HL pointing to the parameters and Register Pair DE to the caller's keyword table (8 byte entries: 6 characters, then the address of the value word; 00H ends the table). The parameters may be in parentheses and are separated by commas: NAME=value or NAME alone. A value is Y, YES, ON (FFFFH), N, NO, OFF (0000H), a hexadecimal number with an H after it, or a decimal number; NAME alone stores FFFFH. Each value goes to the 2 bytes the keyword's entry names. The Z FLAG returns set when all the parameters were taken (or there are none); the NZ FLAG for a name that is missing or not in the table, or a bad character after a value.
5019
GOSUB to 4FD8H to skip spaces and commas: Register A returns the first other character at Register Pair HL, with the C FLAG set when the line ends there.
501C
If the C FLAG is set (no parameters), JUMP to 5062H to return with the Z FLAG.
501E
CP 28H FE 28
Compare Register A, the first character of the parameters, against 28H (an open parenthesis).
5020
If the Z FLAG is set, JUMP to 5023H with Register Pair HL at the parenthesis, which 5029H passes.
5022
DEC HL 2B
No parenthesis: DECrement Register Pair HL by 1, so the INC HL at 5029H comes back to the first character.
5023
PUSH DE D5
Save Register Pair DE, the keyword table, to the top of the stack.
5024
LD B,06H 06 06
Load Register B with 06H, the most characters of a parameter name.
5026
LD DE,4200H 11 00 42
Point Register Pair DE to 4200H, the system sector buffer, which takes the name.
5029
INC HL 23
INCrement Register Pair HL by 1, past the parenthesis or the comma before the name.
502A
GOSUB to 4F41H to copy up to Register B (6) characters of the parameter name from Register Pair HL to Register Pair DE (4200H), ended by 03H. Register A returns the character after the name; the NZ FLAG is set when there was none.
502D
POP DE D1
Restore Register Pair DE from the top of the stack: the keyword table.
502E
RET NZ C0
If the NZ FLAG is set (no name), RETurn with the NZ FLAG and Register A = the character found in its place.
502F
GOSUB to 4FE6H: the C FLAG returns set when Register A, the character after the name, ends the line.
5032
If the C FLAG is set, JUMP to 5039H; 4F41H left Register Pair HL at that character.
5034
CP 2CH FE 2C
Compare Register A, the character after the name, against 2CH (a comma).
5036
If the Z FLAG is set, JUMP to 5039H; 4F41H left Register Pair HL at the comma.
5038
DEC HL 2B
Any other character (an equals sign, a close parenthesis) was passed by 4F41H: DECrement Register Pair HL by 1 back to it.
5039
PUSH DE D5
Save Register Pair DE, the keyword table, to the top of the stack.
503A
LD B,D 42
Load Register B with Register D, the high byte of the keyword table.
503B
LD C,E 4B
Load Register C with Register E: Register Pair BC = the keyword table.
503C
LD DE,4200H 11 00 42
Point Register Pair DE to 4200H, the parameter name.
503F
GOSUB to 4F71H to find the name at Register Pair DE (4200H) in the table at Register Pair BC. On a match the Z FLAG is set and Register Pair DE returns the address of the value.
5042
If the Z FLAG is set (the keyword was found), JUMP to 5046H with Register Pair DE = the value address.
5044
POP DE D1
Restore Register Pair DE from the top of the stack: the keyword table.
5045
RET C9
RETurn with the NZ FLAG set and Register A = FFH: the parameter is not in the table.
5046
LD A,(HL) 7E
Load Register A with the character after the name at Register Pair HL.
5047
CP 3DH FE 3D
Compare Register A against 3DH (an equals sign, which a value follows).
5049
If the Z FLAG is set, JUMP to 5064H to read the value.
504B
LD BC,FFFFH 01 FF FF
A name alone: load Register Pair BC with FFFFH, the value of a switch that is named (on).
504E
LD A,C 79
Load Register A with Register C, the low byte of the value.
504F
LD (DE),A 12
Store Register A, the low byte, to the value's address at Register Pair DE.
5050
INC DE 13
INCrement Register Pair DE by 1 to the high byte of the value.
5051
LD A,B 78
Load Register A with Register B, the high byte of the value.
5052
LD (DE),A 12
Store Register A, the high byte, to Register Pair DE.
5053
POP DE D1
Restore Register Pair DE from the top of the stack: the keyword table.
5054
LD A,(HL) 7E
Load Register A with the character after the parameter at Register Pair HL.
5055
CP 2CH FE 2C
Compare Register A against 2CH (a comma: another parameter follows).
5057
If the Z FLAG is set, JUMP back to 5023H for the next parameter.
5059
GOSUB to 4FE6H: the C FLAG returns set when Register A ends the line.
505C
If the C FLAG is set (the end of the line), JUMP to 5062H to return with the Z FLAG.
505E
CP 29H FE 29
Compare Register A against 29H (a close parenthesis, the end of the parameters).
5060
RET NZ C0
If the NZ FLAG is set (any other character), RETurn with the NZ FLAG and Register A = that character.
5061
INC HL 23
INCrement Register Pair HL by 1 past the close parenthesis.
5062
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: the parameters were taken.
5063
RET C9
RETurn with the Z FLAG set and Register Pair HL past the parameters.
5064
INC HL 23
INCrement Register Pair HL by 1 past the equals sign, to the value.
5065
PUSH HL E5
Save Register Pair HL, the value's text, to the top of the stack.
5066
GOSUB to 507EH to read Y, YES, N, NO, ON or OFF at Register Pair HL. The Z FLAG returns set with the value in Register Pair BC (FFFFH or 0000H) when it is one of them.
5069
If the NZ FLAG is set (not one of the words), JUMP to 506EH to try a number.
506B
POP AF F1
Restore Register Pair AF from the top of the stack: it drops the saved address of the value's text, as Register Pair HL is past the word.
506C
JUMP back to 504EH to store Register Pair BC (FFFFH or 0000H).
506E
POP HL E1
Restore Register Pair HL from the top of the stack: the start of the value's text.
506F
PUSH HL E5
Save Register Pair HL, the value's text, to the top of the stack again.
5070
GOSUB to 50C3H to read a hexadecimal number at Register Pair HL. The Z FLAG returns set with the number in Register Pair BC when the digits end with H.
5073
If the NZ FLAG is set (no H after the digits), JUMP to 5078H to read the value as a decimal number.
5075
POP AF F1
Restore Register Pair AF from the top of the stack: it drops the saved address of the value's text, as Register Pair HL is past the H.
5076
JUMP back to 504EH to store Register Pair BC, the hexadecimal number.
5078
POP HL E1
Restore Register Pair HL from the top of the stack: the start of the value's text.
5079
GOSUB to 50A8H to read a decimal number at Register Pair HL into Register Pair BC (0000H when no digit is there).
507C
JUMP back to 504EH to store Register Pair BC, the decimal number.
507EH - Read a Yes or No Value
Register Pair HL points to the value. Y or ON gives Register Pair BC = FFFFH, N or OFF 0000H, with the Z FLAG; the rest of the word (YES, NO) is passed. Any other value gives the NZ FLAG.
507E
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value of N, NO and OFF.
5081
LD A,(HL) 7E
Load Register A with the first character of the value at Register Pair HL.
5082
GOSUB to 4FF6H to make Register A upper case when it is a letter.
5085
CP 59H FE 59
Compare Register A against 59H (Y, the start of Y or YES).
5087
If the Z FLAG is set (Y or YES), JUMP to 509CH to load Register Pair BC with FFFFH.
5089
CP 4EH FE 4E
Compare Register A against 4EH (N, the start of N or NO).
508B
If the Z FLAG is set (N or NO), JUMP to 509FH with Register Pair BC = 0000H.
508D
CP 4FH FE 4F
Compare Register A against 4FH (O, the start of ON or OFF).
508F
RET NZ C0
If the NZ FLAG is set (none of these), RETurn with the NZ FLAG.
5090
INC HL 23
INCrement Register Pair HL by 1 to the second character.
5091
LD A,(HL) 7E
Load Register A with the second character at Register Pair HL.
5092
GOSUB to 4FF6H to make Register A upper case when it is a letter.
5095
CP 46H FE 46
Compare Register A against 46H (F, the second character of OFF).
5097
If the Z FLAG is set, JUMP to 509FH with Register Pair BC = 0000H.
5099
CP 4EH FE 4E
Compare Register A against 4EH (N, the second character of ON).
509B
RET NZ C0
If the NZ FLAG is set (neither), RETurn with the NZ FLAG.
509C
LD BC,FFFFH 01 FF FF
Load Register Pair BC with FFFFH, the value of Y, YES and ON.
509F
INC HL 23
INCrement Register Pair HL by 1 to the next character of the word.
50A0
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
50A1
GOSUB to 4FEFH: the C FLAG returns set when Register A is a digit, a letter or a name character.
50A4
If the C FLAG is set (still the word), JUMP back to 509FH to pass over it.
50A6
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: the value is in Register Pair BC.
50A7
RET C9
RETurn with the Z FLAG and Register Pair HL past the word.
50A8H - Read a Decimal Number
Register Pair HL points to the digits; Register Pair BC returns their value (the low 16 bits) and Register Pair HL the first character that is not a digit.
50A8
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value so far.
50AB
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
50AC
SUB 30H D6 30
SUBtract 30H from Register A: a digit becomes 0-9.
50AE
RET C D8
If the C FLAG is set (below the character 0), RETurn with Register Pair BC = the number.
50AF
CP 0AH FE 0A
Compare Register A against 0AH. The NC FLAG is set for a character above 9.
50B1
RET NC D0
If the NC FLAG is set, RETurn with Register Pair BC = the number.
50B2
PUSH HL E5
Save Register Pair HL, the text, to the top of the stack.
50B3
LD H,B 60
Load Register H with Register B, the high byte of the value so far.
50B4
LD L,C 69
Load Register L with Register C: Register Pair HL = the value so far.
50B5
ADD HL,HL 29
ADD Register Pair HL to itself: twice the value.
50B6
ADD HL,HL 29
ADD Register Pair HL to itself: four times the value.
50B7
ADD HL,BC 09
ADD Register Pair BC (the value) to Register Pair HL: five times the value.
50B8
ADD HL,HL 29
ADD Register Pair HL to itself: ten times the value.
50B9
LD B,00H 06 00
Load Register B with 00H, the high byte of the digit to add.
50BB
LD C,A 4F
Load Register C with Register A, the digit: Register Pair BC = the digit.
50BC
ADD HL,BC 09
ADD Register Pair BC (the digit) to Register Pair HL (ten times the value).
50BD
LD B,H 44
Load Register B with Register H, the high byte of the new value.
50BE
LD C,L 4D
Load Register C with Register L: Register Pair BC = the new value.
50BF
POP HL E1
Restore Register Pair HL from the top of the stack: the text.
50C0
INC HL 23
INCrement Register Pair HL by 1 to the next character.
50C1
JUMP back to 50ABH for the next digit at Register Pair HL.
50C3H - Read a Hexadecimal Number
Register Pair HL points to the digits (0-9, A-F). When they end with H, Register Pair BC returns their value (the low 16 bits) with the Z FLAG and Register Pair HL past the H; otherwise the NZ FLAG is returned.
50C3
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value so far.
50C6
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
50C7
GOSUB to 4FF6H to make Register A upper case when it is a letter.
50CA
SUB 30H D6 30
SUBtract 30H from Register A: the digits 0-9 become 00H-09H.
50CC
RET C D8
If the C FLAG is set (below the character 0), RETurn with the NZ FLAG: no H ends the number.
50CD
CP 0AH FE 0A
Compare Register A against 0AH. The C FLAG is set for 0-9.
50CF
If the C FLAG is set, JUMP to 50E3H to add the digit in Register A.
50D1
SUB 07H D6 07
SUBtract 07H from Register A: the letters A-F become 0AH-0FH.
50D3
CP 0AH FE 0A
Compare Register A against 0AH. The C FLAG is set for the characters between 9 and A.
50D5
RET C D8
If the C FLAG is set, RETurn with the NZ FLAG: not a hexadecimal number.
50D6
CP 10H FE 10
Compare Register A against 10H. The C FLAG is set for A-F.
50D8
If the C FLAG is set, JUMP to 50E3H to add the digit in Register A.
50DA
LD A,(HL) 7E
Load Register A with the character after the digits at Register Pair HL.
50DB
GOSUB to 4FF6H to make Register A upper case when it is a letter.
50DE
CP 48H FE 48
Compare Register A against 48H (H, the mark of a hexadecimal number).
50E0
RET NZ C0
If the NZ FLAG is set (no H), RETurn with the NZ FLAG.
50E1
INC HL 23
INCrement Register Pair HL by 1 past the H that ends the number.
50E2
RET C9
RETurn with the Z FLAG set and Register Pair BC = the number.
50E3
PUSH HL E5
Save Register Pair HL, the text, to the top of the stack.
50E4
LD H,B 60
Load Register H with Register B, the high byte of the value so far.
50E5
LD L,C 69
Load Register L with Register C: Register Pair HL = the value so far.
50E6
ADD HL,HL 29
ADD Register Pair HL to itself: twice the value.
50E7
ADD HL,HL 29
ADD Register Pair HL to itself: 4 times the value so far.
50E8
ADD HL,HL 29
ADD Register Pair HL to itself: 8 times the value so far.
50E9
ADD HL,HL 29
ADD Register Pair HL to itself: 16 times the value, with the low four bits 0.
50EA
LD B,H 44
Load Register B with Register H, the high byte of 16 times the value.
50EB
ADD A,L 85
ADD Register L to Register A (the digit, 00H-0FH): the low four bits of Register L are 0, so no carry comes out.
50EC
LD C,A 4F
Load Register C with Register A: Register Pair BC = 16 times the value + the digit.
50ED
POP HL E1
Restore Register Pair HL from the top of the stack: the text.
50EE
INC HL 23
INCrement Register Pair HL by 1 to the next character.
50EF
JUMP back to 50C6H for the next digit at Register Pair HL.
50F1H - Routine 9 - The Library Table's Address
Returns the address of the library command names.
50F1
LD HL,5106H 21 06 51
Point Register Pair HL to 5106H, the table of library command names.
50F4
RET C9
RETurn to the overlay request handler (49DDH), which keeps Register Pair HL as the routine leaves it, so the caller gets 5106H.
50F5H - Routine 11 - CLS
The CLS command (request code 0BH, 51C3H).
50F5
JUMP to the ROM's 01C9H, which clears the screen and homes the cursor; its RET goes back to the overlay request handler (49DDH) and the caller of CMNDI@.
50F8H - Routine 10 - BOOT
The BOOT command (request code 0AH, 51BDH): it selects single density on the double density adapter, deselects the drives and jumps to the ROM's reset at 0000H, which boots the diskette in drive 0 again.
50F8
DI F3
Disable interrupts, so no task runs while the computer is reset.
50F9
LD A,FEH 3E FE
Load Register A with FEH, the command that sets the double density adapter to single density.
50FB
LD (37ECH),A 32 EC 37
Store Register A (FEH) to 37ECH, the command register of the floppy disk controller, which the double density adapter watches: the ROM's boot reads single density. The DO file RS/TXT of this diskette changes 50F9H-50FDH to LD A,A0H / LD (37EEH),A for the Radio Shack double density kit.
50FE
LD A,00H 3E 00
Load Register A with 00H, no drive selected. The last load block of the file (50FEH-5105H) loads 50FEH-5105H a second time with the same bytes.
5100
LD (37E1H),A 32 E1 37
Store Register A (00H) to 37E1H, the drive select latch: every drive is deselected and its motor stops.
5103
JUMP to the ROM's 0000H, the reset: the ROM boots the diskette in drive 0.
5106H - The Library Commands
Data: the names of the 39 library commands, in alphabetical order, each with bit 7 set on its first character; the 80H at 51B8H ends the table. CMNDI@ looks the command name up here with 4FB0H (4EA9H), which gives the entry's number n, and takes the request code at 51B8H + n (4EAEH-4EB5H).
5106-510B
DEFB C1H / DEFM "PPEND" C1 50 50 45 4E 44
Entry 1: APPEND, with bit 7 set on the A (C1H). Its request code is at 51B9H.
510C-5111
DEFB C1H / DEFM "SSIGN" C1 53 53 49 47 4E
Entry 2: ASSIGN, with bit 7 set on the A (C1H). Its request code is at 51BAH.
5112-5117
DEFB C1H / DEFM "TTRIB" C1 54 54 52 49 42
Entry 3: ATTRIB, with bit 7 set on the A (C1H). Its request code is at 51BBH.
5118-511B
DEFB C1H / DEFM "UTO" C1 55 54 4F
Entry 4: AUTO, with bit 7 set on the A (C1H). Its request code is at 51BCH.
511C-511F
DEFB C2H / DEFM "OOT" C2 4F 4F 54
Entry 5: BOOT, with bit 7 set on the B (C2H). Its request code is at 51BDH.
5120-5124
DEFB C2H / DEFM "REAK" C2 52 45 41 4B
Entry 6: BREAK, with bit 7 set on the B (C2H). Its request code is at 51BEH.
5125-5129
DEFB C2H / DEFM "UILD" C2 55 49 4C 44
Entry 7: BUILD, with bit 7 set on the B (C2H). Its request code is at 51BFH.
512A-512C
DEFB C3H / DEFM "AT" C3 41 54
Entry 8: CAT, with bit 7 set on the C (C3H). Its request code is at 51C0H.
512D-5131
DEFB C3H / DEFM "LEAR" C3 4C 45 41 52
Entry 9: CLEAR, with bit 7 set on the C (C3H). Its request code is at 51C1H.
5132-5136
DEFB C3H / DEFM "LOCK" C3 4C 4F 43 4B
Entry 10: CLOCK, with bit 7 set on the C (C3H). Its request code is at 51C2H.
5137-5139
DEFB C3H / DEFM "LS" C3 4C 53
Entry 11: CLS, with bit 7 set on the C (C3H). Its request code is at 51C3H.
513A-513F
DEFB C3H / DEFM "ONFIG" C3 4F 4E 46 49 47
Entry 12: CONFIG, with bit 7 set on the C (C3H). Its request code is at 51C4H.
5140-5143
DEFB C3H / DEFM "OPY" C3 4F 50 59
Entry 13: COPY, with bit 7 set on the C (C3H). Its request code is at 51C5H.
5144-5149
DEFB C3H / DEFM "REATE" C3 52 45 41 54 45
Entry 14: CREATE, with bit 7 set on the C (C3H). Its request code is at 51C6H.
514A-514D
DEFB C4H / DEFM "ATE" C4 41 54 45
Entry 15: DATE, with bit 7 set on the D (C4H). Its request code is at 51C7H.
514E-5152
DEFB C4H / DEFM "EBUG" C4 45 42 55 47
Entry 16: DEBUG, with bit 7 set on the D (C4H). Its request code is at 51C8H.
5153-5155
DEFB C4H / DEFM "IR" C4 49 52
Entry 17: DIR, with bit 7 set on the D (C4H). Its request code is at 51C9H.
5156-5157
DEFB C4H / DEFM "O" C4 4F
Entry 18: DO, with bit 7 set on the D (C4H). Its request code is at 51CAH.
5158-515B
DEFB C4H / DEFM "UMP" C4 55 4D 50
Entry 19: DUMP, with bit 7 set on the D (C4H). Its request code is at 51CBH.
515C-5160
DEFB C5H / DEFM "RROR" C5 52 52 4F 52
Entry 20: ERROR, with bit 7 set on the E (C5H). Its request code is at 51CCH.
5161-5166
DEFB C6H / DEFM "ILTER" C6 49 4C 54 45 52
Entry 21: FILTER, with bit 7 set on the F (C6H). Its request code is at 51CDH.
5167-516B
DEFB C6H / DEFM "ORCE" C6 4F 52 43 45
Entry 22: FORCE, with bit 7 set on the F (C6H). Its request code is at 51CEH.
516C-5170
DEFB C6H / DEFM "ORMS" C6 4F 52 4D 53
Entry 23: FORMS, with bit 7 set on the F (C6H). Its request code is at 51CFH.
5171-5174
DEFB C6H / DEFM "REE" C6 52 45 45
Entry 24: FREE, with bit 7 set on the F (C6H). Its request code is at 51D0H.
5175
DEFB C9H C9
Entry 25: I, with bit 7 set on the I (C9H). Its request code is at 51D1H.
5176-5179
DEFB CAH / DEFM "OIN" CA 4F 49 4E
Entry 26: JOIN, with bit 7 set on the J (CAH). Its request code is at 51D2H.
517A-517D
DEFB CBH / DEFM "ILL" CB 49 4C 4C
Entry 27: KILL, with bit 7 set on the K (CBH). Its request code is at 51D3H.
517E-5180
DEFB CCH / DEFM "IB" CC 49 42
Entry 28: LIB, with bit 7 set on the L (CCH). Its request code is at 51D4H.
5181-5184
DEFB CCH / DEFM "IST" CC 49 53 54
Entry 29: LIST, with bit 7 set on the L (CCH). Its request code is at 51D5H.
5185-5188
DEFB CCH / DEFM "OAD" CC 4F 41 44
Entry 30: LOAD, with bit 7 set on the L (CCH). Its request code is at 51D6H.
5189-518D
DEFB D0H / DEFM "AUSE" D0 41 55 53 45
Entry 31: PAUSE, with bit 7 set on the P (D0H). Its request code is at 51D7H.
518E-5191
DEFB D0H / DEFM "ROT" D0 52 4F 54
Entry 32: PROT, with bit 7 set on the P (D0H). Its request code is at 51D8H.
5192-5197
DEFB D2H / DEFM "ENAME" D2 45 4E 41 4D 45
Entry 33: RENAME, with bit 7 set on the R (D2H). Its request code is at 51D9H.
5198-519C
DEFB D2H / DEFM "ESET" D2 45 53 45 54
Entry 34: RESET, with bit 7 set on the R (D2H). Its request code is at 51DAH.
519D-51A1
DEFB D2H / DEFM "S232" D2 53 32 33 32
Entry 35: RS232, with bit 7 set on the R (D2H). Its request code is at 51DBH.
51A2-51A7
DEFB D3H / DEFM "CREEN" D3 43 52 45 45 4E
Entry 36: SCREEN, with bit 7 set on the S (D3H). Its request code is at 51DCH.
51A8-51AD
DEFB D3H / DEFM "YSTEM" D3 59 53 54 45 4D
Entry 37: SYSTEM, with bit 7 set on the S (D3H). Its request code is at 51DDH.
51AE-51B1
DEFB D4H / DEFM "IME" D4 49 4D 45
Entry 38: TIME, with bit 7 set on the T (D4H). Its request code is at 51DEH.
51B2-51B7
DEFB D6H / DEFM "ERIFY" D6 45 52 49 46 59
Entry 39: VERIFY, with bit 7 set on the V (D6H). Its request code is at 51DFH.
51B8
DEFB 80H 80
The end of the name table: 4FB0H stops at a byte with bit 7 set and nothing else (4FB9H-4FBBH). The same byte is the place before the request codes: the code of entry n is at 51B8H + n.
51B9H - The Request Codes of the Library Commands
Data: one byte for each entry of the name table, in the same order. Bits 7-4 name the overlay (0 SYS1/SYS, 8 SYS9/SYS ... F SYS16/SYS: the system number less 1) and bits 3-0 the routine in its table. CMNDI@ gives the code to RST 28H at 4EB7H.
51B9
DEFB 94H 94
The APPEND command: request code 94H, routine 4 of SYS10/SYS.
51BA
DEFB A5H A5
The ASSIGN command: request code A5H, routine 5 of SYS11/SYS.
51BB
DEFB D3H D3
The ATTRIB command: request code D3H, routine 3 of SYS14/SYS.
51BC
DEFB B3H B3
The AUTO command: request code B3H, routine 3 of SYS12/SYS.
51BD
DEFB 0AH 0A
The BOOT command: request code 0AH, routine 10 of SYS1/SYS.
51BE
DEFB B4H B4
The BREAK command: request code B4H, routine 4 of SYS12/SYS.
51BF
DEFB E3H E3
The BUILD command: request code E3H, routine 3 of SYS15/SYS.
51C0
DEFB 83H 83
The CAT command: request code 83H, routine 3 of SYS9/SYS.
51C1
DEFB E4H E4
The CLEAR command: request code E4H, routine 4 of SYS15/SYS.
51C2
DEFB B5H B5
The CLOCK command: request code B5H, routine 5 of SYS12/SYS.
51C3
DEFB 0BH 0B
The CLS command: request code 0BH, routine 11 of SYS1/SYS.
51C4
DEFB F3H F3
The CONFIG command: request code F3H, routine 3 of SYS16/SYS.
51C5
DEFB 93H 93
The COPY command: request code 93H, routine 3 of SYS10/SYS.
51C6
DEFB E5H E5
The CREATE command: request code E5H, routine 5 of SYS15/SYS.
51C7
DEFB B6H B6
The DATE command: request code B6H, routine 6 of SYS12/SYS.
51C8
DEFB B7H B7
The DEBUG command: request code B7H, routine 7 of SYS12/SYS.
51C9
DEFB 84H 84
The DIR command: request code 84H, routine 4 of SYS9/SYS.
51CA
DEFB C3H C3
The DO command: request code C3H, routine 3 of SYS13/SYS.
51CB
DEFB E6H E6
The DUMP command: request code E6H, routine 6 of SYS15/SYS.
51CC
DEFB B8H B8
The ERROR command: request code B8H, routine 8 of SYS12/SYS.
51CD
DEFB A7H A7
The FILTER command: request code A7H, routine 7 of SYS11/SYS.
51CE
DEFB A3H A3
The FORCE command: request code A3H, routine 3 of SYS11/SYS.
51CF
DEFB C4H C4
The FORMS command: request code C4H, routine 4 of SYS13/SYS.
51D0
DEFB 85H 85
The FREE command: request code 85H, routine 5 of SYS9/SYS.
51D1
DEFB B9H B9
The I command: request code B9H, routine 9 of SYS12/SYS.
51D2
DEFB A6H A6
The JOIN command: request code A6H, routine 6 of SYS11/SYS.
51D3
DEFB D4H D4
The KILL command: request code D4H, routine 4 of SYS14/SYS.
51D4
DEFB BAH BA
The LIB command: request code BAH, routine 10 of SYS12/SYS.
51D5
DEFB 95H 95
The LIST command: request code 95H, routine 5 of SYS10/SYS.
51D6
DEFB E7H E7
The LOAD command: request code E7H, routine 7 of SYS15/SYS.
51D7
DEFB BBH BB
The PAUSE command: request code BBH, routine 11 of SYS12/SYS.
51D8
DEFB D5H D5
The PROT command: request code D5H, routine 5 of SYS14/SYS.
51D9
DEFB E8H E8
The RENAME command: request code E8H, routine 8 of SYS15/SYS.
51DA
DEFB A4H A4
The RESET command: request code A4H, routine 4 of SYS11/SYS.
51DB
DEFB C5H C5
The RS232 command: request code C5H, routine 5 of SYS13/SYS.
51DC
DEFB BCH BC
The SCREEN command: request code BCH, routine 12 of SYS12/SYS.
51DD
DEFB F4H F4
The SYSTEM command: request code F4H, routine 4 of SYS16/SYS.
51DE
DEFB BDH BD
The TIME command: request code BDH, routine 13 of SYS12/SYS.
51DF
DEFB BEH BE
The VERIFY command: request code BEH, routine 14 of SYS12/SYS.
51E0H - Texts
Data: the prompt, the default extension of a command program, and the three words a file specification may be preceded by.
51E0-51E9
DEFB 0AH / DEFM "DOS PLUS" / DEFB 0DH 0A 44 4F 53 20 50 4C 55 53 0D
The prompt, displayed by DSPLY@ at 4E59H: a line feed starts a new line, then DOS PLUS, and the carriage return ends the text and puts the cursor at the start of the next line, where the command is typed.
51EA-51EC
DEFM "CMD" 43 4D 44
The default extension of a command program: FEXT@ adds /CMD to a command name that is not a library command and has no extension (4EB8H-4EBBH).
51ED-51EE
DEFB D4H / DEFM "O" D4 4F
The word TO, with bit 7 set on the T (D4H): FSPEC@ passes over a specification that is this word (4EFEH-4F05H), so a command may read COPY A TO B.
51EF-51F2
DEFB C6H / DEFM "ROM" C6 52 4F 4D
The word FROM, with bit 7 set on the F (C6H): FSPEC@ passes over a specification that is this word (4EFEH-4F05H), so a command may read COPY A TO B.
51F3-51F7
DEFB D5H / DEFM "SING" D5 53 49 4E 47
The word USING, with bit 7 set on the U (D5H): FSPEC@ passes over a specification that is this word (4EFEH-4F05H), so a command may read COPY A TO B.
51F8
DEFB 80H 80
The end of the list of words for 4FB0H. A load block of its own (51F8H, 1 byte) loads it; it is the last byte of SYS1/SYS.