4E00H - The Request Code Dispatcher
The transfer address of SYS1/SYS. The dispatcher of SYS0/SYS (4BA2H) calls it with the request code in Register A: bits 6-4 choose the job, the low four bits (3) name SYS1/SYS. 93H and A3H show DOS READY, B3H runs a command line, C3H parses a file specification, D3H adds a default extension, E3H parses a parameter list.
4E00
AND 70H E6 70
AND Register A, the request code, with 70H to keep bits 6-4, the number of the job: 10H for 93H, 20H for A3H, up to 60H for E3H.
4E02
CP 10H FE 10
Compare Register A, the job, with 10H, the job of request code 93H that DOS READY at 4400H passes.
4E04
If the Z FLAG is set (request code 93H), jump to 4E1FH to show DOS READY and take a command.
4E07
CP 20H FE 20
Compare Register A, the job, with 20H, the job of request code A3H, the abnormal exit at 4030H.
4E09
If the Z FLAG is set (request code A3H), jump to 4E1FH as well: DOS READY treats both exits the same.
4E0B
CP 30H FE 30
Compare Register A, the job, with 30H, the job of request code B3H, which 4405H passes to run a command line.
4E0D
If the Z FLAG is set (request code B3H), jump to 4E4EH to run the command line at Register Pair HL.
4E0F
CP 40H FE 40
Compare Register A, the job, with 40H, the job of request code C3H, which 441CH passes.
4E11
If the Z FLAG is set (request code C3H), jump to 4F56H to parse a file specification from Register Pair HL to Register Pair DE.
4E14
CP 50H FE 50
Compare Register A, the job, with 50H, the job of request code D3H, which 4473H passes.
4E16
If the Z FLAG is set (request code D3H), jump to 4FC0H to add the extension at Register Pair HL to the file specification at Register Pair DE.
4E19
CP 60H FE 60
Compare Register A, the job, with 60H, the job of request code E3H, which 4476H passes.
4E1B
If the Z FLAG is set (request code E3H), jump to 507DH to parse the parameter list at Register Pair HL.
4E1E
RET C9
Return to the caller of the vector entry with Register A the job and the NZ FLAG set: no other request code of SYS1/SYS has a job.
4E1FH - DOS READY
Reached for the request codes 93H and A3H, and from the DEBUG command (5181H). The stack is reset, BREAK is pointed at DEBUG when DEBUG is on, DOS READY is shown and a line of up to 63 characters is taken into 4318H, then run as a command at 4E4EH.
4E1F
EI FB
Enable the interrupts, which the dispatcher and the DEBUG command at 5168H may have left disabled.
4E20
LD SP,41FCH 31 FC 41
Load the Stack Pointer with 41FCH, the stack of DoubleDOS: whatever the program or command left on the stack is dropped.
4E23
LD HL,4359H 21 59 43
Load Register Pair HL with 4359H, the opcode byte of the JP M,nn of the error hook in SYS0/SYS (FAH).
4E26
BIT 5,(HL) CB 6E
Test bit 5 of the byte at Register Pair HL (4359H): the Z FLAG it sets is replaced by the BIT at 4E2BH before any instruction tests it, so this test has no effect.
4E28
LD HL,430FH 21 0F 43
Load Register Pair HL with 430FH, the DEBUG flag byte of SYS0/SYS: bit 7 DEBUG on, bit 5 the BREAK hold test, bit 4 SYS6/SYS in memory.
4E2B
BIT 7,(HL) CB 7E
Test bit 7 of the byte at Register Pair HL (430FH), set by the DEBUG command (516BH): the Z FLAG is set when DEBUG is off.
4E2D
If the Z FLAG is set (DEBUG is off), jump to 4E34H and leave the BREAK flag at 4315H as it is.
4E2F
LD A,C3H 3E C3
Load Register A with C3H, the value that arms the BREAK key: the interrupt routine of SYS0/SYS then goes to the vector at 4316H.
4E31
LD (4315H),A 32 15 43
Store Register A (C3H) at 4315H, the BREAK flag, so that BREAK enters DEBUG through 4316H (400FH) while DOS READY waits.
4E34
BIT 5,(HL) CB 6E
Test bit 5 of the byte at Register Pair HL (430FH): no instruction of the DoubleDOS files sets this bit, so the Z FLAG is set.
4E36
If the Z FLAG is set (bit 5 of 430FH clear), jump to 4E40H to show DOS READY.
4E38
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H, the row of ENTER, CLEAR, BREAK and the arrow keys.
4E3B
AND 04H E6 04
AND Register A with 04H to keep bit 2, the BREAK key: the NZ FLAG is set while BREAK is held.
4E3D
If the NZ FLAG is set (BREAK held), jump to 4030H, which issues A3H and comes back to 4E1FH: DOS READY waits until BREAK is let go.
4E40
LD HL,51B8H 21 B8 51
Load Register Pair HL with 51B8H, the text of a line feed, DOS READY and a carriage return.
4E43
Call 4467H to show the text at Register Pair HL (51B8H) through ROM 0033H up to the 0DH.
4E46
LD HL,4318H 21 18 43
Load Register Pair HL with 4318H, the command line buffer of DoubleDOS.
4E49
LD B,3FH 06 3F
Load Register B with 3FH, 63, the most characters the line may hold: 4318H-4356H and the carriage return at 4357H.
4E4B
Call ROM 0040H to take a line from the keyboard into the buffer at Register Pair HL (4318H), up to Register B characters; the C FLAG set by BREAK is not tested, and the line runs at 4E4EH.
4E4EH - Run a Command Line
Reached from 4E4BH and for request code B3H (4405H) with Register Pair HL the command line. The line is copied to 4318H in capitals and its first word parsed as a file specification into 4480H. A name in the table of 4EA4H (BASIC2, DEBUG, TRACE) runs the routine named there, a name in the table of 4EBDH runs a library command of SYS6/SYS, and any other name is run as a program with the extension CMD through @RUN with the FCB at 4480H. Every command returns to 402DH.
4E4E
LD BC,402DH 01 2D 40
Load Register Pair BC with 402DH, the program exit of SYS0/SYS that jumps to DOS READY at 4400H.
4E51
PUSH BC C5
Save Register Pair BC (402DH) on the stack as the return address of the command: a command that returns goes to DOS READY.
4E52
LD DE,4480H 11 80 44
Load Register Pair DE with 4480H, the 32 bytes of SYS0/SYS's file specification text, used here as the buffer of the command's name and as the FCB of a program.
4E55
Call 51C9H to copy the line at Register Pair HL to 4318H in capitals and parse its first word into the buffer at Register Pair DE (4480H): the NZ FLAG on a bad line, Register Pair HL past the word.
4E58
If the NZ FLAG is set (the line or the name is not valid), jump to 4E87H to show WHAT?.
4E5B
LD A,(DE) 1A
Load Register A with the first character of the parsed name at Register Pair DE (4480H).
4E5C
CP 2AH FE 2A
Compare Register A with 2AH, an asterisk: @FSPEC accepts an asterisk and two characters, the form of a device name.
4E5E
If the Z FLAG is set (a device name), jump to 4E87H to show WHAT?: a device cannot be run as a command.
4E61
PUSH HL E5
Save Register Pair HL, the address in 4318H after the command's name, on the stack.
4E62
LD BC,4EA4H 01 A4 4E
Load Register Pair BC with 4EA4H, the table of the commands of SYS1/SYS: BASIC2, DEBUG and TRACE.
4E65
Call 502AH to look up the name at Register Pair DE (4480H) in the table at Register Pair BC (4EA4H): the Z FLAG when found, with Register Pair DE the routine.
4E68
If the Z FLAG is set (a command of SYS1/SYS), jump to 4E84H to run the routine at Register Pair DE.
4E6A
LD BC,4EBDH 01 BD 4E
Load Register Pair BC with 4EBDH, the table of the library commands of SYS6/SYS, APPEND to VERIFY.
4E6D
Call 502AH to look up the name at Register Pair DE (4480H) in the table at Register Pair BC (4EBDH): Register C returns the number of the command.
4E70
If the Z FLAG is set (a library command), jump to 4E84H to run 4E90H, the entry of SYS6/SYS, with Register C the command's number.
4E72
LD A,(430FH) 3A 0F 43
Load Register A with the DEBUG flag byte at 430FH: the name is a program, which @RUN loads over 5200H.
4E75
RES 4,A CB A7
Reset bit 4 of Register A: SYS6/SYS will no longer be in memory at 5200H once the program is loaded.
4E77
LD (430FH),A 32 0F 43
Store Register A, the flags with bit 4 clear, back at 430FH, so that the next library command loads SYS6/SYS again (4E93H).
4E7A
LD HL,51B5H 21 B5 51
Load Register Pair HL with 51B5H, the three characters CMD, the default extension of a program.
4E7D
Call 4FC0H to add /CMD to the file specification at Register Pair DE (4480H) unless it has an extension; Register Pair DE is kept.
4E80
POP HL E1
Restore Register Pair HL, the address after the command's name, from the stack: the program finds its parameters there.
4E81
Jump to @RUN at 4433H to load and run the program of the FCB at Register Pair DE (4480H); it returns to 402DH on the stack.
4E84
POP HL E1
Restore Register Pair HL, the address after the command's name, from the stack for the routine.
4E85
PUSH DE D5
Save Register Pair DE, the address of the routine taken from the table, on the stack.
4E86
RET C9
Return to the routine whose address Register Pair DE put on the stack, with Register Pair HL the rest of the line and Register C the command's number; it returns to 402DH.
4E87H - Show WHAT?
Reached when the command line or its name is not valid.
4E87
LD HL,51C3H 21 C3 51
Load Register Pair HL with 51C3H, the text WHAT? and a carriage return.
4E8A
Call 4467H to show the text at Register Pair HL (51C3H) through ROM 0033H up to the 0DH.
4E8D
Jump to 4030H, the abnormal exit: request code A3H brings back DOS READY at 4E1FH, or DEBUG when DEBUG is on (4030H is then CALL 400FH).
4E90H - Run a Library Command of SYS6/SYS
The routine of every name in the table of 4EBDH, reached from 4E86H with Register C the number of the command (1 for APPEND to 19 for VERIFY) and Register Pair HL the rest of the line. SYS6/SYS is overlay 8, request code 88H, loaded at 5200H; bit 4 of 430FH tells that it is still there, and then it is entered at 5200H without a load.
4E90
LD A,(430FH) 3A 0F 43
Load Register A with the DEBUG flag byte at 430FH to test bit 4, SYS6/SYS in memory.
4E93
BIT 4,A CB 67
Test bit 4 of Register A: the NZ FLAG is set when SYS6/SYS was loaded for an earlier library command and nothing has been loaded over it since.
4E95
JP NZ,5200H C2 00 52
If the NZ FLAG is set (SYS6/SYS in memory), jump to 5200H, the transfer address of SYS6/SYS, with Register C the command's number.
4E98
LD A,(430FH) 3A 0F 43
Load Register A with the DEBUG flag byte at 430FH again to set bit 4.
4E9B
SET 4,A CB E7
Set bit 4 of Register A: SYS6/SYS is about to be loaded at 5200H.
4E9D
LD (430FH),A 32 0F 43
Store Register A, the flags with bit 4 set, back at 430FH.
4EA0
LD A,88H 3E 88
Load Register A with 88H, the request code of SYS6/SYS (overlay 8, directory record 20H); this RST 28H is the only one that loads SYS6/SYS.
4EA2
PUSH AF F5
Save Register Pair AF on the stack: nothing takes this word off again, since SYS6/SYS ends through 402DH and DOS READY resets the Stack Pointer (4E20H).
4EA3
RST 28H EF
RST 28H: the dispatcher at 4BA2H loads SYS6/SYS and calls it at 5200H with Register C the command's number and Register Pair HL the rest of the line.
4EA4H - The Commands of SYS1/SYS
The first table that 4E65H searches: eight bytes an entry, a name of six characters padded with spaces and the address of its routine, ended by 00H.
4EA4-4EAB
DEFM "BASIC2" / DEFW 514CH 42 41 53 49 43 32 4C 51
The entry of BASIC2 at 4EA4H: the name BASIC2 and the routine 514CH, which starts the BASIC of the ROM as a machine without disks would.
4EAC-4EB3
DEFM "DEBUG " / DEFW 5162H 44 45 42 55 47 20 62 51
The entry of DEBUG at 4EACH: the name DEBUG and a space, and the routine 5162H, which turns DEBUG on, or off with (OFF), (NO) or (N).
4EB4-4EBB
DEFM "TRACE " / DEFW 5191H 54 52 41 43 45 20 91 51
The entry of TRACE at 4EB4H: the name TRACE and a space, and the routine 5191H, which puts the trace task 4CD9H in slot 11 or takes it out.
4EBC
DEFB 00H 00
The 00H at 4EBCH that ends the table of 4EA4H: the lookup at 503AH-503CH stops when the first byte of an entry is 00H.
4EBDH - The Library Commands of SYS6/SYS
The second table that 4E6DH searches, in the same form: every entry has the routine 4E90H, which passes the entry's number (1-19) in Register C to SYS6/SYS. The names copy (entry 5) and double (entry 7) are in small letters; 51C9H puts every command line in capitals, so they never match, and COPY and DOUBLE are run as the programs COPY/CMD and DOUBLE/CMD. DEVICE is not in the table, as section 3.2.3 of the manual says.
4EBD-4EC4
DEFM "APPEND" / DEFW 4E90H 41 50 50 45 4E 44 90 4E
Library command 1 at 4EBDH: the name APPEND and the routine 4E90H, which loads SYS6/SYS and passes 1 in Register C.
4EC5-4ECC
DEFM "ATTRIB" / DEFW 4E90H 41 54 54 52 49 42 90 4E
Library command 2 at 4EC5H: the name ATTRIB and the routine 4E90H, which loads SYS6/SYS and passes 2 in Register C.
4ECD-4ED4
DEFM "AUTO " / DEFW 4E90H 41 55 54 4F 20 20 90 4E
Library command 3 at 4ECDH: the name AUTO and spaces and the routine 4E90H, which loads SYS6/SYS and passes 3 in Register C.
4ED5-4EDC
DEFM "CLOCK " / DEFW 4E90H 43 4C 4F 43 4B 20 90 4E
Library command 4 at 4ED5H: the name CLOCK and spaces and the routine 4E90H, which loads SYS6/SYS and passes 4 in Register C.
4EDD-4EE4
DEFM "copy " / DEFW 4E90H 63 6F 70 79 20 20 90 4E
Library command 5 at 4EDDH: the name copy and spaces and the routine 4E90H, which loads SYS6/SYS and passes 5 in Register C. The name is in small letters, which no command line has after 51C9H, so this entry is never found and SYS6/SYS never gets 5 from SYS1/SYS.
4EE5-4EEC
DEFM "DATE " / DEFW 4E90H 44 41 54 45 20 20 90 4E
Library command 6 at 4EE5H: the name DATE and spaces and the routine 4E90H, which loads SYS6/SYS and passes 6 in Register C.
4EED-4EF4
DEFM "double" / DEFW 4E90H 64 6F 75 62 6C 65 90 4E
Library command 7 at 4EEDH: the name double and the routine 4E90H, which loads SYS6/SYS and passes 7 in Register C. The name is in small letters, which no command line has after 51C9H, so this entry is never found and SYS6/SYS never gets 7 from SYS1/SYS.
4EF5-4EFC
DEFM "DIR " / DEFW 4E90H 44 49 52 20 20 20 90 4E
Library command 8 at 4EF5H: the name DIR and spaces and the routine 4E90H, which loads SYS6/SYS and passes 8 in Register C.
4EFD-4F04
DEFM "DUMP " / DEFW 4E90H 44 55 4D 50 20 20 90 4E
Library command 9 at 4EFDH: the name DUMP and spaces and the routine 4E90H, which loads SYS6/SYS and passes 9 in Register C.
4F05-4F0C
DEFM "FREE " / DEFW 4E90H 46 52 45 45 20 20 90 4E
Library command 10 at 4F05H: the name FREE and spaces and the routine 4E90H, which loads SYS6/SYS and passes 10 in Register C.
4F0D-4F14
DEFM "KILL " / DEFW 4E90H 4B 49 4C 4C 20 20 90 4E
Library command 11 at 4F0DH: the name KILL and spaces and the routine 4E90H, which loads SYS6/SYS and passes 11 in Register C.
4F15-4F1C
DEFM "LIB " / DEFW 4E90H 4C 49 42 20 20 20 90 4E
Library command 12 at 4F15H: the name LIB and spaces and the routine 4E90H, which loads SYS6/SYS and passes 12 in Register C.
4F1D-4F24
DEFM "LIST " / DEFW 4E90H 4C 49 53 54 20 20 90 4E
Library command 13 at 4F1DH: the name LIST and spaces and the routine 4E90H, which loads SYS6/SYS and passes 13 in Register C.
4F25-4F2C
DEFM "LOAD " / DEFW 4E90H 4C 4F 41 44 20 20 90 4E
Library command 14 at 4F25H: the name LOAD and spaces and the routine 4E90H, which loads SYS6/SYS and passes 14 in Register C.
4F2D-4F34
DEFM "PRINT " / DEFW 4E90H 50 52 49 4E 54 20 90 4E
Library command 15 at 4F2DH: the name PRINT and spaces and the routine 4E90H, which loads SYS6/SYS and passes 15 in Register C.
4F35-4F3C
DEFM "PROT " / DEFW 4E90H 50 52 4F 54 20 20 90 4E
Library command 16 at 4F35H: the name PROT and spaces and the routine 4E90H, which loads SYS6/SYS and passes 16 in Register C.
4F3D-4F44
DEFM "RENAME" / DEFW 4E90H 52 45 4E 41 4D 45 90 4E
Library command 17 at 4F3DH: the name RENAME and the routine 4E90H, which loads SYS6/SYS and passes 17 in Register C.
4F45-4F4C
DEFM "TIME " / DEFW 4E90H 54 49 4D 45 20 20 90 4E
Library command 18 at 4F45H: the name TIME and spaces and the routine 4E90H, which loads SYS6/SYS and passes 18 in Register C.
4F4D-4F54
DEFM "VERIFY" / DEFW 4E90H 56 45 52 49 46 59 90 4E
Library command 19 at 4F4DH: the name VERIFY and the routine 4E90H, which loads SYS6/SYS and passes 19 in Register C.
4F55
DEFB 00H 00
The 00H at 4F55H that ends the table of library commands: nineteen entries of eight bytes from 4EBDH to 4F54H.
4F56H - Parse a File Specification (request code C3H)
Reached for request code C3H (441CH) and from 51EAH, with Register Pair HL the text and Register Pair DE a buffer of at least 24 bytes. The name (up to eight characters), then /extension (three), .password (eight) and :drive (one) are copied into the buffer, each part with its separator, and ended by 03H; characters past a part's limit are dropped. A name of none of these characters may be an asterisk and up to two characters, a device. The words TO, ON and OVER are passed over and the next word is parsed in their place. Returns the Z FLAG and Register A 00H, or the NZ FLAG for an empty part, with Register Pair HL past the character that ended the specification and Register Pair DE kept.
4F56
PUSH DE D5
Save Register Pair DE, the start of the buffer, on the stack.
4F57
LD B,08H 06 08
Load Register B with 08H, the most characters of a name.
4F59
Call 4FF4H to copy up to Register B characters (letters and digits) from Register Pair HL to Register Pair DE: Register A returns the character that ended the name, the NZ FLAG when there was none.
4F5C
If the NZ FLAG is set (no name), jump to 4F98H to test for an asterisk, the start of a device name.
4F5E
CP 2FH FE 2F
Compare Register A, the character after the name, with 2FH, a slash, which starts the extension.
4F60
If the NZ FLAG is set (no slash), jump to 4F6BH to test for a period.
4F62
LD (DE),A 12
Store Register A (2FH, the slash) at Register Pair DE, over the 03H that 4FF4H left after the name.
4F63
INC DE 13
Increment Register Pair DE past the slash, to the first place of the extension.
4F64
LD B,03H 06 03
Load Register B with 03H, the most characters of an extension.
4F66
Call 4FF4H to copy up to Register B characters of the extension from Register Pair HL to Register Pair DE: Register A returns the character after it.
4F69
If the NZ FLAG is set (a slash with no extension), jump to 4FA5H to return with the NZ FLAG set.
4F6B
CP 2EH FE 2E
Compare Register A, the character after the name or extension, with 2EH, a period, which starts the password.
4F6D
If the NZ FLAG is set (no period), jump to 4F78H to test for a colon.
4F6F
LD (DE),A 12
Store Register A (2EH, the period) at Register Pair DE, over the 03H.
4F70
INC DE 13
Increment Register Pair DE past the period, to the first place of the password.
4F71
LD B,08H 06 08
Load Register B with 08H, the most characters of a password.
4F73
Call 4FF4H to copy up to Register B characters of the password from Register Pair HL to Register Pair DE: Register A returns the character after it.
4F76
If the NZ FLAG is set (a period with no password), jump to 4FA5H to return with the NZ FLAG set.
4F78
CP 3AH FE 3A
Compare Register A, the character after the specification so far, with 3AH, a colon, which comes before the drive number.
4F7A
If the NZ FLAG is set (no colon), jump to 4F85H to end the specification.
4F7C
LD (DE),A 12
Store Register A (3AH, the colon) at Register Pair DE, over the 03H.
4F7D
INC DE 13
Increment Register Pair DE past the colon, to the place of the drive number.
4F7E
LD B,01H 06 01
Load Register B with 01H: the drive is one character.
4F80
Call 4FF4H to copy the drive character from Register Pair HL to Register Pair DE: Register A returns the character after it.
4F83
If the NZ FLAG is set (a colon with no drive), jump to 4FA5H to return with the NZ FLAG set.
4F85
LD C,A 4F
Copy Register A, the character that ended the specification, into Register C.
4F86
LD A,03H 3E 03
Load Register A with 03H, the byte that ends a file specification.
4F88
LD (DE),A 12
Store Register A (03H) at Register Pair DE, after the last part copied.
4F89
XOR A AF
Clear Register A to 00H; the LD at 4F8AH replaces it at once.
4F8A
LD A,C 79
Copy Register C, the character that ended the specification, back into Register A.
4F8B
POP DE D1
Restore Register Pair DE, the start of the buffer, from the stack.
4F8C
PUSH DE D5
Save Register Pair DE, the start of the buffer, on the stack again for the return.
4F8D
LD BC,4FA7H 01 A7 4F
Load Register Pair BC with 4FA7H, the table of the words TO, ON and OVER.
4F90
Call 502AH to look up the word in the buffer at Register Pair DE in the table at Register Pair BC (4FA7H): the Z FLAG when it is TO, ON or OVER.
4F93
POP DE D1
Restore Register Pair DE, the start of the buffer, from the stack.
4F94
If the Z FLAG is set (TO, ON or OVER), jump back to 4F56H to parse the next word at Register Pair HL into the same buffer.
4F96
XOR A AF
Clear Register A to 00H and set the Z FLAG: the file specification is good.
4F97
RET C9
Return with the Z FLAG set, Register A 00H, Register Pair DE the buffer and Register Pair HL past the specification.
4F98
CP 2AH FE 2A
Compare Register A, the character that stopped the name, with 2AH, an asterisk, the start of a device name such as a two letter one.
4F9A
If the NZ FLAG is set (neither a name nor an asterisk), jump to 4FA5H to return with the NZ FLAG set.
4F9C
LD (DE),A 12
Store Register A (2AH, the asterisk) at Register Pair DE in the buffer.
4F9D
INC DE 13
Increment Register Pair DE past the asterisk.
4F9E
LD B,02H 06 02
Load Register B with 02H, the most characters after the asterisk.
4FA0
Call 4FF4H to copy up to Register B characters of the device name from Register Pair HL to Register Pair DE.
4FA3
If the Z FLAG is set (at least one character), jump to 4F85H to end the specification with 03H.
4FA5
POP DE D1
Restore Register Pair DE, the start of the buffer, from the stack.
4FA6
RET C9
Return with the NZ FLAG set: a part of the file specification is empty.
4FA7H - The Words Passed Over
The table that 4F90H searches, in the form of the command tables: six characters and a word, ended by 00H. The words are TO, ON and OVER, so that COPY A TO B and the like parse as two file specifications. The address words are 0000H, since only the Z FLAG of the lookup is used.
4FA7-4FAE
DEFM "TO " / DEFW 0000H 54 4F 20 20 20 20 00 00
The entry of TO at 4FA7H: the word TO, four spaces, and an address of 0000H that 4F90H does not use.
4FAF-4FB6
DEFM "ON " / DEFW 0000H 4F 4E 20 20 20 20 00 00
The entry of ON at 4FAFH: the word ON, four spaces, and an address of 0000H that 4F90H does not use.
4FB7-4FBE
DEFM "OVER " / DEFW 0000H 4F 56 45 52 20 20 00 00
The entry of OVER at 4FB7H: the word OVER, two spaces, and an address of 0000H that 4F90H does not use.
4FBF
DEFB 00H 00
The 00H at 4FBFH that ends the table of 4FA7H for the lookup at 503AH-503CH.
4FC0H - Add a Default Extension (request code D3H)
Reached for request code D3H (4473H) and from 4E7DH, with Register Pair DE a parsed file specification and Register Pair HL three characters. When the name, from its second character on, ends without a slash, the rest of the specification (16 bytes) is moved up four places and a slash and the three characters are put in after the name. Register Pair DE is kept; Register Pair HL is kept only when nothing is added.
4FC0
PUSH DE D5
Save Register Pair DE, the file specification, on the stack.
4FC1
PUSH HL E5
Save Register Pair HL, the three characters of the extension, on the stack.
4FC2
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL is the file specification.
4FC3
INC HL 23
Increment Register Pair HL past the first character of the name.
4FC4
LD B,09H 06 09
Load Register B with 09H, the most characters to look at: the rest of a name of eight and the character after it.
4FC6
LD A,(HL) 7E
Load Register A with the character of the specification at Register Pair HL.
4FC7
CP 2FH FE 2F
Compare Register A with 2FH, the slash before an extension.
4FC9
If the Z FLAG is set (the specification has an extension), jump to 4FD8H to return without a change.
4FCB
If the C FLAG is set (below 2FH: a period, an asterisk or the 03H at the end), jump to 4FDBH to put the extension in here.
4FCD
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9.
4FCF
If the C FLAG is set (a digit), jump to 4FD5H to go on to the next character of the name.
4FD1
CP 41H FE 41
Compare Register A with 41H, the letter A, the lowest character of a name above the digits.
4FD3
If the C FLAG is set (3AH to 40H, the colon before a drive), jump to 4FDBH to put the extension in here.
4FD5
INC HL 23
Increment Register Pair HL to the next character of the specification.
4FD6
Decrement Register B and jump back to 4FC6H while it is not 00H.
4FD8
POP HL E1
Restore Register Pair HL, the extension, from the stack.
4FD9
POP DE D1
Restore Register Pair DE, the file specification, from the stack.
4FDA
RET C9
Return with the file specification at Register Pair DE as it was.
4FDB
LD BC,000FH 01 0F 00
Load Register Pair BC with 000FH, the offset of the last of the 16 bytes from the end of the name on.
4FDE
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL is the last byte to move, 15 bytes after the end of the name.
4FDF
LD D,H 54
Copy Register H into Register D for the destination of the move.
4FE0
LD E,L 5D
Copy Register L into Register E: Register Pair DE is Register Pair HL.
4FE1
INC DE 13
Increment Register Pair DE, the first of four.
4FE2
INC DE 13
Increment Register Pair DE, the second of four.
4FE3
INC DE 13
Increment Register Pair DE, the third of four.
4FE4
INC DE 13
Increment Register Pair DE, the fourth: Register Pair DE is four bytes above Register Pair HL, room for a slash and three characters.
4FE5
INC BC 03
Increment Register Pair BC to 0010H, the 16 bytes to move.
4FE6
LDDR ED B8
Move Register Pair BC (16) bytes from Register Pair HL down to the end of the name to Register Pair DE, four places higher, last byte first.
4FE8
POP HL E1
Restore Register Pair HL, the three characters of the extension, from the stack.
4FE9
INC HL 23
Increment Register Pair HL past the first character of the extension.
4FEA
INC HL 23
Increment Register Pair HL to the third character of the extension, the first one moved.
4FEB
LD C,03H 0E 03
Load Register C with 03H: Register Pair BC is 0003H after the LDDR, three characters.
4FED
LDDR ED B8
Move Register Pair BC (3) bytes from Register Pair HL to Register Pair DE, last first: the extension goes after the slash's place.
4FEF
LD A,2FH 3E 2F
Load Register A with 2FH, the slash that goes before the added extension.
4FF1
LD (DE),A 12
Store Register A (2FH) at Register Pair DE, the end of the name, before the extension.
4FF2
POP DE D1
Restore Register Pair DE, the file specification, from the stack.
4FF3
RET C9
Return with the extension added; the extension's address is not restored and Register Pair HL is the byte before it.
4FF4H - Copy a Part of a File Specification
Called with Register Pair HL the text, Register Pair DE the buffer and Register B the most characters. Letters (as capitals) and digits are copied to Register Pair DE; characters past the limit are passed over. The first other character ends the part; 03H is stored after the characters copied, without moving Register Pair DE. Returns that character in Register A, the Z FLAG when one character or more was copied, and Register Pair HL past the character (on the 03H or 0DH that ends a line).
4FF4
LD A,B 78
Copy Register B, the most characters of the part, into Register A.
4FF5
LD (5026H),A 32 26 50
Store Register A at 5026H, the operand of the LD A,nn at 5025H: it stays not 00H unless a character is copied.
4FF8
INC B 04
Increment Register B for the DEC B at 5013H, which counts the characters.
4FF9
LD A,(HL) 7E
Load Register A with the character of the text at Register Pair HL.
4FFA
CP 03H FE 03
Compare Register A with 03H, a byte that ends a line.
4FFC
If the Z FLAG is set (03H), jump to 5021H to end the part with Register Pair HL on the 03H.
4FFE
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return that ends a line.
5000
If the Z FLAG is set (0DH), jump to 5021H to end the part with Register Pair HL on the 0DH.
5002
INC HL 23
Increment Register Pair HL past the character at Register Pair HL.
5003
CP 30H FE 30
Compare Register A, the character, with 30H, the digit 0.
5005
If the C FLAG is set (below 30H: a space, a slash, a period, an asterisk), jump to 5021H to end the part.
5007
CP 3AH FE 3A
Compare Register A, the character, with 3AH, the character after the digit 9.
5009
If the C FLAG is set (a digit), jump to 5013H to copy it.
500B
LD C,A 4F
Copy Register A, the character, into Register C, the character to return if it ends the part.
500C
RES 5,A CB AF
Reset bit 5 of Register A, which turns a small letter into a capital.
500E
Call 51EDH to test Register A for a letter A-Z: the C FLAG is set for a letter.
5011
If the NC FLAG is set (not a letter), jump to 5022H to end the part with Register C the character.
5013
DEC B 05
Decrement Register B, the room left in the part.
5014
If the Z FLAG is set (the part is full), jump to 501EH to pass over the character.
5016
LD (DE),A 12
Store Register A, the letter or digit, at Register Pair DE in the buffer.
5017
XOR A AF
Clear Register A to 00H, the mark that a character was copied.
5018
LD (5026H),A 32 26 50
Store Register A (00H) at 5026H, the operand of the LD A,nn at 5025H.
501B
INC DE 13
Increment Register Pair DE to the next place in the buffer.
501C
Jump back to 4FF9H for the next character at Register Pair HL.
501E
INC B 04
Increment Register B back to 01H, so that the next letter or digit is passed over as well.
501F
Jump back to 4FF9H for the next character at Register Pair HL.
5021
LD C,A 4F
Copy Register A, the character that ended the part, into Register C.
5022
LD A,03H 3E 03
Load Register A with 03H, the byte that ends a file specification.
5024
LD (DE),A 12
Store Register A (03H) at Register Pair DE after the characters copied; Register Pair DE is not moved, so the next separator goes over it.
5025
LD A,00H 3E 00
Load Register A with the operand stored at 5026H: 00H when a character was copied, else the starting value of Register B.
5027
OR A B7
OR Register A with itself: the Z FLAG is set when a character was copied.
5028
LD A,C 79
Copy Register C, the character that ended the part, into Register A; LD does not change the flags.
5029
RET C9
Return with Register A the ending character and the Z FLAG set when the part is not empty.
502AH - Look Up a Word in a Table
Called with Register Pair DE a word ended by 03H, 0DH or any character other than a letter or digit, and Register Pair BC a table of eight byte entries (six characters, spaces after a short name, and an address) ended by 00H. A word matches an entry when its six characters agree, or when the word ends where the entry has a space. Returns the Z FLAG, Register A 00H, Register C the number of the entry (from 1) and Register Pair DE the entry's address, or the NZ FLAG when no entry matches. Register Pair HL is kept.
502A
PUSH HL E5
Save Register Pair HL on the stack for the return.
502B
LD H,B 60
Copy Register B, the high byte of the table's address, into Register H.
502C
LD L,C 69
Copy Register C into Register L: Register Pair HL is the first entry of the table.
502D
LD C,01H 0E 01
Load Register C with 01H, the number of the first entry.
502F
LD A,(DE) 1A
Load Register A with the first character of the word at Register Pair DE.
5030
CP (HL) BE
Compare Register A with the first character of the entry at Register Pair HL.
5031
If the Z FLAG is set (the first characters agree), jump to 5042H to compare the rest.
5033
PUSH BC C5
Save Register Pair BC, the number of the entry in Register C, on the stack.
5034
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the length of an entry.
5037
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: Register Pair HL is the next entry.
5038
POP BC C1
Restore Register Pair BC, the number of the entry in Register C, from the stack.
5039
INC C 0C
Increment Register C, the number of the next entry.
503A
LD A,(HL) 7E
Load Register A with the first byte of the entry at Register Pair HL.
503B
OR A B7
OR Register A with itself: the Z FLAG is set at the 00H that ends the table.
503C
If the NZ FLAG is set (another entry), jump back to 502FH to compare its first character.
503E
POP HL E1
Restore Register Pair HL, the caller's, from the stack.
503F
OR 01H F6 01
OR Register A (00H) with 01H to set the NZ FLAG: the word is in no entry of the table.
5041
RET C9
Return with the NZ FLAG set and Register A 01H.
5042
LD B,05H 06 05
Load Register B with 05H, the characters still to compare after the first.
5044
PUSH HL E5
Save Register Pair HL, the entry, on the stack.
5045
PUSH DE D5
Save Register Pair DE, the word, on the stack.
5046
INC DE 13
Increment Register Pair DE to the next character of the word.
5047
INC HL 23
Increment Register Pair HL to the next character of the entry.
5048
LD A,(DE) 1A
Load Register A with the character of the word at Register Pair DE.
5049
CP 03H FE 03
Compare Register A with 03H, the byte that ends a parsed word.
504B
If the Z FLAG is set (the word has ended), jump to 5074H: it matches when the entry has a space here.
504D
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return.
504F
If the Z FLAG is set (the word has ended), jump to 5074H: it matches when the entry has a space here.
5051
CP (HL) BE
Compare Register A, the character of the word, with the character of the entry at Register Pair HL.
5052
If the NZ FLAG is set (they differ), jump to 5064H to see whether the word has ended.
5054
Decrement Register B and jump back to 5046H while characters are left: six characters that agree are a match.
5056
POP DE D1
Restore Register Pair DE, the word, from the stack.
5057
LD A,C 79
Copy Register C, the number of the entry, into Register A.
5058
POP BC C1
Restore the entry's address from the stack into Register Pair BC.
5059
LD HL,0006H 21 06 00
Load Register Pair HL with 0006H, the offset of the address word in an entry.
505C
ADD HL,BC 09
Add Register Pair BC, the entry, to Register Pair HL: Register Pair HL is the address word of the entry.
505D
LD C,A 4F
Copy Register A, the number of the entry, back into Register C.
505E
LD E,(HL) 5E
Load Register E with the low byte of the address at Register Pair HL.
505F
INC HL 23
Increment Register Pair HL to the high byte of the address.
5060
LD D,(HL) 56
Load Register D with the high byte at Register Pair HL: Register Pair DE is the address of the entry.
5061
POP HL E1
Restore Register Pair HL, the caller's, from the stack.
5062
XOR A AF
Clear Register A to 00H and set the Z FLAG: the word was found.
5063
RET C9
Return with the Z FLAG set, Register Pair DE the entry's address and Register C its number.
5064
CP 30H FE 30
Compare Register A, the character of the word, with 30H, the digit 0.
5066
If the C FLAG is set (below 30H, a separator), jump to 5074H: the word has ended here.
5068
CP 3AH FE 3A
Compare Register A with 3AH, the character after the digit 9.
506A
If the C FLAG is set (a digit that differs), jump to 5079H: this entry does not match.
506C
CP 41H FE 41
Compare Register A, the character of the word, with 41H, the letter A.
506E
If the C FLAG is set (3AH to 40H, a separator), jump to 5074H: the word has ended here.
5070
CP 5BH FE 5B
Compare Register A with 5BH, the character after the letter Z.
5072
If the C FLAG is set (a letter that differs), jump to 5079H: this entry does not match.
5074
LD A,(HL) 7E
Load Register A with the character of the entry at Register Pair HL, where the word has ended.
5075
CP 20H FE 20
Compare Register A with 20H, the space that pads a short name.
5077
If the Z FLAG is set (the entry's name ends here too), jump to 5056H: the word matches.
5079
POP DE D1
Restore Register Pair DE, the word, from the stack.
507A
POP HL E1
Restore Register Pair HL, the entry, from the stack.
507B
Jump back to 5033H to go on to the next entry.
507DH - Parse a Parameter List (request code E3H)
Reached for request code E3H (4476H) with Register Pair HL the text after a command's name and Register Pair DE a table of parameters in the form of the command tables (six characters and the address of a word). Spaces are passed over; the end of the line returns the Z FLAG with nothing set. A list in parentheses, NAME or NAME=value separated by commas, stores each value in the word whose address the parameter's entry holds: FFFFH for a NAME alone, YES or ON, 0000H for NO or OFF, a decimal number, or X'hex'. Returns the Z FLAG with Register Pair HL past the closing parenthesis, or the NZ FLAG for an unknown parameter or a list that is not well formed. Each name is copied to 51AFH-51B4H (and its 03H to 51B5H).
507D
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
507E
CP 0DH FE 0D
Compare Register A with 0DH, the carriage return that ends the line.
5080
RET Z C8
Return with the Z FLAG set if Register A is 0DH: the command has no parameters and no word is changed.
5081
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis of a parameter list.
5083
If the Z FLAG is set (a parenthesis), jump to 508EH to parse the first parameter.
5085
CP 20H FE 20
Compare Register A, the character, with 20H, a space before the parameter list.
5087
If the Z FLAG is set (a space), jump to 508BH to pass over it.
5089
OR A B7
OR Register A, the character, with itself: it is not 00H, so the NZ FLAG is set.
508A
RET C9
Return with the NZ FLAG set: something other than a parameter list follows the command.
508B
INC HL 23
Increment Register Pair HL past the space to the next character of the text.
508C
Jump back to 507DH to look at the next character at Register Pair HL.
508E
PUSH DE D5
Save Register Pair DE, the parameter table, on the stack.
508F
LD B,06H 06 06
Load Register B with 06H, the most characters of a parameter's name.
5091
LD DE,51AFH 11 AF 51
Load Register Pair DE with 51AFH, the six bytes of SYS1/SYS's buffer for the name (51AFH-51B4H).
5094
INC HL 23
Increment Register Pair HL past the parenthesis or the comma.
5095
Call 4FF4H to copy up to Register B characters of the name from Register Pair HL to Register Pair DE (51AFH): 03H follows the name, at 51B5H after six characters, over the C of CMD.
5098
DEC HL 2B
Decrement Register Pair HL back to the character that ended the name.
5099
POP DE D1
Restore Register Pair DE, the parameter table, from the stack.
509A
RET NZ C0
Return with the NZ FLAG set if the name was empty.
509B
PUSH DE D5
Save Register Pair DE, the parameter table, on the stack.
509C
LD B,D 42
Copy Register D, the high byte of the table's address, into Register B.
509D
LD C,E 4B
Copy Register E into Register C: Register Pair BC is the parameter table.
509E
LD DE,51AFH 11 AF 51
Load Register Pair DE with 51AFH, the name just copied.
50A1
Call 502AH to look up the name at Register Pair DE (51AFH) in the table at Register Pair BC: the Z FLAG when found, with Register Pair DE the address of the parameter's word.
50A4
If the Z FLAG is set (a known parameter), jump to 50A8H to take its value.
50A6
POP DE D1
Restore Register Pair DE, the parameter table, from the stack.
50A7
RET C9
Return with the NZ FLAG set: an unknown parameter or a value that is not valid.
50A8
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, after the parameter's name.
50A9
CP 3DH FE 3D
Compare Register A with 3DH, the equals sign before a value.
50AB
If the Z FLAG is set (a value follows), jump to 50C1H to read it.
50AD
LD BC,FFFFH 01 FF FF
Load Register Pair BC with FFFFH, the value of a parameter named alone.
50B0
LD A,C 79
Copy Register C, the low byte of the value, into Register A.
50B1
LD (DE),A 12
Store Register A, the low byte of the value, at Register Pair DE, the parameter's word.
50B2
INC DE 13
Increment Register Pair DE to the high byte of the parameter's word.
50B3
LD A,B 78
Copy Register B, the high byte of the value, into Register A.
50B4
LD (DE),A 12
Store Register A, the high byte of the value, at Register Pair DE.
50B5
POP DE D1
Restore Register Pair DE, the parameter table, from the stack.
50B6
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, after the parameter.
50B7
CP 2CH FE 2C
Compare Register A with 2CH, the comma before another parameter.
50B9
If the Z FLAG is set (a comma), jump back to 508EH to parse the next parameter.
50BB
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis of the list.
50BD
RET NZ C0
Return with the NZ FLAG set if Register A is not 29H: the list is not well formed.
50BE
INC HL 23
Increment Register Pair HL past the closing parenthesis.
50BF
XOR A AF
Clear Register A to 00H and set the Z FLAG: every parameter was taken.
50C0
RET C9
Return with the Z FLAG set and Register Pair HL past the parameter list.
50C1
INC HL 23
Increment Register Pair HL past the equals sign.
50C2
LD A,(HL) 7E
Load Register A with the first character of the value at Register Pair HL.
50C3
CP 58H FE 58
Compare Register A with 58H, the letter X before a hexadecimal value in quotes.
50C5
If the Z FLAG is set (an X), jump to 50D2H to read a hexadecimal value.
50C7
CP 41H FE 41
Compare Register A, the first character of the value, with 41H, the letter A.
50C9
If the C FLAG is set (below A: a digit), jump to 50DAH to read a decimal value.
50CB
Call 50DFH to read YES, NO, ON or OFF at Register Pair HL into Register Pair BC: the Z FLAG when it is one of them.
50CE
If the Z FLAG is set (a word value), jump to 50B0H to store Register Pair BC.
50D0
Jump to 50A6H to return with the NZ FLAG set: the value is not valid.
50D2
INC HL 23
Increment Register Pair HL past the X to the opening quote of the hexadecimal value.
50D3
Call 511FH to read the hexadecimal value in quotes at Register Pair HL into Register Pair BC.
50D6
If the Z FLAG is set (a value was read), jump to 50B0H to store Register Pair BC.
50D8
Jump to 50A6H to return with the NZ FLAG set: no quote after the X.
50DA
Call 5104H to read the decimal value at Register Pair HL into Register Pair BC.
50DD
Jump to 50B0H to store Register Pair BC, the decimal value, whatever flags 5104H returns.
50DFH - Read YES, NO, ON or OFF
Called with Register Pair HL a word. A word starting with Y, or ON, gives Register Pair BC FFFFH; a word starting with N, or OFF, gives 0000H. Then the rest of the word is passed over up to a comma or a closing parenthesis, with the Z FLAG. Any other word returns the NZ FLAG and Register Pair BC 0000H.
50DF
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value of NO and OFF.
50E2
LD A,(HL) 7E
Load Register A with the first character of the word at Register Pair HL.
50E3
CP 59H FE 59
Compare Register A with 59H, the letter Y of YES.
50E5
If the Z FLAG is set (Y), jump to 50F7H to give Register Pair BC FFFFH.
50E7
CP 4EH FE 4E
Compare Register A with 4EH, the letter N of NO.
50E9
If the Z FLAG is set (N), jump to 50FAH with Register Pair BC 0000H.
50EB
CP 4FH FE 4F
Compare Register A with 4FH, the letter O of ON and OFF.
50ED
RET NZ C0
Return with the NZ FLAG set if Register A is not 4FH: the word is not a value.
50EE
INC HL 23
Increment Register Pair HL to the second character of the word.
50EF
LD A,(HL) 7E
Load Register A with the second character at Register Pair HL.
50F0
CP 46H FE 46
Compare Register A with 46H, the letter F of OFF.
50F2
If the Z FLAG is set (OF), jump to 50FAH with Register Pair BC 0000H.
50F4
CP 4EH FE 4E
Compare Register A with 4EH, the letter N of ON.
50F6
RET NZ C0
Return with the NZ FLAG set if Register A is not 4EH: the word is not a value.
50F7
LD BC,FFFFH 01 FF FF
Load Register Pair BC with FFFFH, the value of YES and ON.
50FA
INC HL 23
Increment Register Pair HL to the next character of the word.
50FB
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
50FC
CP 29H FE 29
Compare Register A with 29H, the closing parenthesis.
50FE
RET Z C8
Return with the Z FLAG set if Register A is 29H, with Register Pair HL on the parenthesis.
50FF
CP 2CH FE 2C
Compare Register A with 2CH, the comma before the next parameter.
5101
RET Z C8
Return with the Z FLAG set if Register A is 2CH, with Register Pair HL on the comma.
5102
Jump back to 50FAH: the search for 29H or 2CH has no other end and goes on past a 0DH.
5104H - Read a Decimal Number
Called with Register Pair HL the first digit. Returns the number in Register Pair BC (no test for more than 65535) with Register Pair HL on the first character that is not a digit.
5104
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the number so far.
5107
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5108
SUB 30H D6 30
Subtract 30H, the digit 0, from Register A: a digit becomes 00H-09H.
510A
RET C D8
Return with the C FLAG set if Register A was below 30H: the number ends here.
510B
CP 0AH FE 0A
Compare Register A with 0AH, one more than the largest digit.
510D
RET NC D0
Return with the NC FLAG set if Register A is 0AH or more: the number ends here.
510E
PUSH HL E5
Save Register Pair HL, the text, on the stack.
510F
LD H,B 60
Copy Register B into Register H for the multiplication.
5110
LD L,C 69
Copy Register C into Register L: Register Pair HL is the number so far.
5111
ADD HL,HL 29
Add Register Pair HL to itself: twice the number.
5112
ADD HL,HL 29
Add Register Pair HL to itself: four times the number.
5113
ADD HL,BC 09
Add Register Pair BC to Register Pair HL: five times the number.
5114
ADD HL,HL 29
Add Register Pair HL to itself: ten times the number.
5115
LD B,00H 06 00
Load Register B with 00H, the high byte of the digit.
5117
LD C,A 4F
Copy Register A, the digit, into Register C: Register Pair BC is the digit.
5118
ADD HL,BC 09
Add Register Pair BC, the digit, to Register Pair HL.
5119
LD B,H 44
Copy Register H, the high byte of the new number, into Register B.
511A
LD C,L 4D
Copy Register L into Register C: Register Pair BC is the new number.
511B
POP HL E1
Restore Register Pair HL, the text, from the stack.
511C
INC HL 23
Increment Register Pair HL to the next character.
511D
Jump back to 5107H to take the next digit at Register Pair HL.
511FH - Read a Hexadecimal Number in Quotes
Called with Register Pair HL after the X of X'hex'. Returns the number in Register Pair BC, the Z FLAG and Register Pair HL past the closing quote; without the opening quote it returns the NZ FLAG. A character that is not a digit ends the number with the Z FLAG as well, and Register Pair HL on that character. The characters 3AH-40H pass the test as the digits 3-9.
511F
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the number so far.
5122
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5123
CP 27H FE 27
Compare Register A with 27H, the quote that opens the hexadecimal digits.
5125
RET NZ C0
Return with the NZ FLAG set if Register A is not 27H: no opening quote.
5126
INC HL 23
Increment Register Pair HL past the opening quote.
5127
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5128
SUB 30H D6 30
Subtract 30H, the digit 0, from Register A: a digit 0-9 becomes 00H-09H.
512A
If the C FLAG is set (below 30H), jump to 5136H: the number ends here.
512C
CP 0AH FE 0A
Compare Register A with 0AH, one more than the largest decimal digit.
512E
If the C FLAG is set (a digit 0-9), jump to 513EH to add it.
5130
SUB 07H D6 07
Subtract 07H from Register A: the letters A-F become 0AH-0FH, and 3AH-40H become 03H-09H.
5132
CP 10H FE 10
Compare Register A with 10H, one more than the largest hexadecimal digit.
5134
If the C FLAG is set (below 10H), jump to 513EH to add it.
5136
LD A,(HL) 7E
Load Register A with the character at Register Pair HL again.
5137
CP 27H FE 27
Compare Register A with 27H, the closing quote.
5139
INC HL 23
Increment Register Pair HL past the character; INC does not change the flags.
513A
RET Z C8
Return with the Z FLAG set if Register A is 27H: Register Pair HL is past the closing quote.
513B
DEC HL 2B
Decrement Register Pair HL back to the character that ended the number.
513C
XOR A AF
Clear Register A to 00H and set the Z FLAG: the number is taken without a closing quote.
513D
RET C9
Return with the Z FLAG set and Register Pair HL on the character after the number.
513E
PUSH HL E5
Save Register Pair HL, the text, on the stack.
513F
LD H,B 60
Copy Register B into Register H for the shift.
5140
LD L,C 69
Copy Register C into Register L: Register Pair HL is the number so far.
5141
ADD HL,HL 29
Add Register Pair HL to itself: the number times 2.
5142
ADD HL,HL 29
Add Register Pair HL to itself: the number times 4.
5143
ADD HL,HL 29
Add Register Pair HL to itself: the number times 8.
5144
ADD HL,HL 29
Add Register Pair HL to itself: the number times 16, with Register L's low four bits 0000.
5145
LD B,H 44
Copy Register H into Register B, the high byte of the new number.
5146
ADD A,L 85
Add Register L to Register A, the digit, into the low four bits.
5147
LD C,A 4F
Copy Register A into Register C: Register Pair BC is the new number.
5148
POP HL E1
Restore Register Pair HL, the text, from the stack.
5149
INC HL 23
Increment Register Pair HL to the next character.
514A
Jump back to 5127H to take the next character at Register Pair HL.
514CH - BASIC2
The routine of the command BASIC2: it leaves DoubleDOS for the BASIC of the ROM, doing what the ROM's start-up does at 0674H-0691H when BREAK is held (Register Pair HL is not used).
514C
LD HL,06D2H 21 D2 06
Load Register Pair HL with ROM 06D2H, the table the ROM copies to 4000H when it starts.
514F
LD DE,4000H 11 00 40
Load Register Pair DE with 4000H, the start of the communication region.
5152
LD BC,0036H 01 36 00
Load Register Pair BC with 0036H, 54 bytes, the length of the table.
5155
LDIR ED B0
Move Register Pair BC bytes from Register Pair HL (06D2H) to Register Pair DE (4000H): the vectors and device control blocks of the ROM at 4000H-4035H replace those of DoubleDOS.
5157
XOR A AF
Clear Register A to 00H for the bytes after the table.
5158
LD B,27H 06 27
Load Register B with 27H, the 39 bytes of 4036H-405CH.
515A
LD (DE),A 12
Store Register A (00H) at Register Pair DE, from 4036H on.
515B
INC DE 13
Increment Register Pair DE to the next byte of the communication region.
515C
Decrement Register B and jump back to 515AH while it is not 00H: 4036H-405CH are cleared.
515E
DI F3
Disable the interrupts: the interrupt vector at 4012H now holds the ROM's.
515F
Jump to ROM 0075H, the start of BASIC, which asks MEMORY SIZE? and gives READY.
5162H - DEBUG
The routine of the command DEBUG with Register Pair HL after the name: DEBUG alone or DEBUG (ON), (YES) or (Y) turns DEBUG on, DEBUG (OFF), (NO) or (N) turns it off. On, bit 7 of 430FH is set, BREAK goes to DEBUG (4315H C3H, 4316H 400FH) and the abnormal exit at 4030H becomes CALL 400FH; off, they are put back. DOS READY follows.
5162
Call 51A0H to read the option at Register Pair HL: the Z FLAG for OFF or NO.
5165
LD HL,430FH 21 0F 43
Load Register Pair HL with 430FH, the DEBUG flag byte.
5168
DI F3
Disable the interrupts while the BREAK vector and 4030H are changed; 517DH enables them again.
5169
If the Z FLAG is set (OFF), jump to 5184H to turn DEBUG off.
516B
SET 7,(HL) CB FE
Set bit 7 of the byte at Register Pair HL (430FH): DEBUG is on, and @RUN enters DEBUG before a program (SYS0/SYS 4C0EH).
516D
LD HL,400FH 21 0F 40
Load Register Pair HL with 400FH, the RST 30H vector, JP 44B4H, the entry of DEBUG.
5170
LD A,C3H 3E C3
Load Register A with C3H, the value that arms the BREAK flag.
5172
LD (4316H),HL 22 16 43
Store Register Pair HL (400FH) at 4316H-4317H, the BREAK vector: the interrupt routine goes to DEBUG when BREAK is pressed.
5175
LD (4315H),A 32 15 43
Store Register A (C3H) at 4315H, the BREAK flag.
5178
LD A,CDH 3E CD
Load Register A with CDH, the opcode of CALL nn, for 4030H: with Register Pair HL (400FH) it makes CALL 400FH.
517A
LD (4031H),HL 22 31 40
Store Register Pair HL at 4031H-4032H, the operand of the instruction at 4030H: 400FH, or EFA3H (A3H and RST 28H) from 518CH.
517D
EI FB
Enable the interrupts again: the BREAK flag and its vector are both set.
517E
LD (4030H),A 32 30 40
Store Register A at 4030H, the opcode: CDH (CALL 400FH, DEBUG) or 3EH (LD A,A3H, RST 28H, DOS READY).
5181
Jump to 4E1FH, DOS READY, which arms BREAK again when DEBUG is on.
5184
RES 7,(HL) CB BE
Reset bit 7 of the byte at Register Pair HL (430FH): DEBUG is off.
5186
XOR A AF
Clear Register A to 00H, the value of the BREAK flag that turns BREAK off.
5187
LD (4315H),A 32 15 43
Store Register A (00H) at 4315H: BREAK no longer goes to the vector at 4316H.
518A
LD A,3EH 3E 3E
Load Register A with 3EH, the opcode of LD A,nn, to put back the abnormal exit at 4030H.
518C
LD HL,EFA3H 21 A3 EF
Load Register Pair HL with EFA3H: the operand A3H and EFH, RST 28H, the bytes 4031H and 4032H of LD A,A3H and RST 28H.
518F
Jump back to 517AH to store Register Pair HL and Register A at 4030H-4032H.
5191H - TRACE
The routine of the command TRACE with Register Pair HL after the name: TRACE alone or TRACE (ON), (YES) or (Y) puts the trace task 4CD9H of SYS0/SYS in slot 11 (0BH), which shows the address the program is at on the top line every 25 ms; TRACE (OFF), (NO) or (N) takes it out. It returns to 402DH, DOS READY.
5191
Call 51A0H to read the option at Register Pair HL: the Z FLAG for OFF or NO.
5194
LD DE,4CD9H 11 D9 4C
Load Register Pair DE with 4CD9H, the header of the trace task in SYS0/SYS.
5197
LD A,0BH 3E 0B
Load Register A with 0BH, slot 11, one of the slots 8-11 run on every clock interrupt, which the trace task needs.
5199
If the Z FLAG is set (OFF), jump to 4413H to take the task out of slot Register A (0BH).
519C
Jump to 4410H to put the task header at Register Pair DE (4CD9H) in slot Register A (0BH).
519FH - Read the Option of DEBUG and TRACE
Called with Register Pair HL after the command's name. Spaces are passed over; anything but an opening parenthesis returns the NZ FLAG (on). Else the word in the parentheses is read by 50DFH: the Z FLAG for OFF or NO, and for a word that is not a value; the NZ FLAG for ON or YES.
519F
INC HL 23
Increment Register Pair HL past the space to the next character of the line.
51A0
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
51A1
CP 20H FE 20
Compare Register A, the character, with 20H, a space before the option.
51A3
If the Z FLAG is set (a space), jump back to 519FH to pass over it.
51A5
CP 28H FE 28
Compare Register A with 28H, the opening parenthesis.
51A7
RET NZ C0
Return with the NZ FLAG set if Register A is not 28H: no option, the command turns its function on.
51A8
INC HL 23
Increment Register Pair HL past the parenthesis.
51A9
Call 50DFH to read YES, NO, ON or OFF at Register Pair HL into Register Pair BC (FFFFH or 0000H).
51AC
LD A,B 78
Copy Register B, the high byte of the value, into Register A.
51AD
OR A B7
OR Register A with itself: the Z FLAG is set for 0000H, OFF or NO.
51AE
RET C9
Return with the Z FLAG set for off and the NZ FLAG set for on.
51AF-51B4
DEFS 6
Not in the file: the six bytes between the load blocks 4E00H-51AEH and 51B5H-51F3H, the buffer of a parameter's name at 51AFH-51B4H (5091H, 509EH).
51B5H - The Texts of SYS1/SYS
The default extension of a program and the two messages of the command level.
51B5-51B7
DEFM "CMD" 43 4D 44
The three characters CMD at 51B5H-51B7H, the extension that 4E7DH adds to a command's name. A parameter name of six characters leaves its 03H at 51B5H (5095H).
51B8-51C2
DEFB 0AH / DEFM "DOS READY" / DEFB 0DH 0A 44 4F 53 20 52 45 41 44 59 0D
The prompt at 51B8H-51C2H that 4E43H shows: 0AH (a new line), DOS READY and 0DH, which ends the text for 4467H.
51C3-51C8
DEFM "WHAT?" / DEFB 0DH 57 48 41 54 3F 0D
The message at 51C3H-51C8H that 4E8AH shows for a command line that is not valid: WHAT? and 0DH.
51C9H - Copy the Command Line and Parse Its Name
Called from 4E55H with Register Pair HL the command line and Register Pair DE the buffer of the name (4480H). Up to 64 bytes, ended by 0DH or 03H, are copied to 4318H with small letters made capitals (in place when the line is already there), then the first word is parsed by 4F56H from 4318H. Returns the NZ FLAG when no 0DH or 03H is found in 64 bytes.
51C9
PUSH DE D5
Save Register Pair DE, the buffer of the name, on the stack.
51CA
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE is the command line.
51CB
LD HL,4318H 21 18 43
Load Register Pair HL with 4318H, the command line buffer.
51CE
PUSH HL E5
Save Register Pair HL (4318H) on the stack for the parse.
51CF
LD B,40H 06 40
Load Register B with 40H, 64, the most bytes of a command line: 4318H-4357H.
51D1
LD A,(DE) 1A
Load Register A with the byte of the command line at Register Pair DE.
51D2
LD (HL),A 77
Store Register A at Register Pair HL in the buffer.
51D3
SUB 61H D6 61
Subtract 61H, the letter a, from Register A: a small letter becomes 00H-19H.
51D5
CP 1AH FE 1A
Compare Register A with 1AH, the number of letters.
51D7
If the NC FLAG is set (not a small letter), jump to 51DBH to leave the byte as it is.
51D9
RES 5,(HL) CB AE
Reset bit 5 of the byte at Register Pair HL: the small letter becomes a capital.
51DB
INC DE 13
Increment Register Pair DE to the next byte of the command line.
51DC
INC HL 23
Increment Register Pair HL to the next byte of the buffer.
51DD
CP ACH FE AC
Compare Register A with ACH, the carriage return 0DH less 61H.
51DF
If the Z FLAG is set (the 0DH was copied), jump to 51E7H to parse the line.
51E1
CP A2H FE A2
Compare Register A with A2H, the byte 03H less 61H.
51E3
If the Z FLAG is set (the 03H was copied), jump to 51E7H to parse the line.
51E5
Decrement Register B and jump back to 51D1H while it is not 00H.
51E7
POP HL E1
Restore Register Pair HL (4318H), the copied line, from the stack.
51E8
POP DE D1
Restore Register Pair DE, the buffer of the name, from the stack.
51E9
RET NZ C0
Return with the NZ FLAG set if the line had no end in 64 bytes.
51EA
Jump to 4F56H to parse the file specification at Register Pair HL into Register Pair DE; it returns to the caller of 51C9H.
51EDH - Test for a Letter
Called from 500EH with a character in Register A. Returns the C FLAG for A-Z (41H-5AH) and the NC FLAG for any other character.
51ED
CP 41H FE 41
Compare Register A with 41H, the letter A: the C FLAG is set below it.
51EF
CCF 3F
Complement the C FLAG: it is set for 41H and above, clear below.
51F0
RET NC D0
Return with the NC FLAG set if Register A is below 41H: not a letter.
51F1
CP 5BH FE 5B
Compare Register A with 5BH, the character after Z: the C FLAG is set for a letter.
51F3
RET C9
Return with the C FLAG set for 41H-5AH and the NC FLAG for 5BH and above.