5200H - JCL
JCL/CMD's transfer address, entered from the DOS command level as JCL (PROC=n,QUEUE=n). This part installs the JCL system: it reads the relocation file JCL/RLD, moves the resident part (5538H-603FH, 0B08H bytes) up to end at HMEM$, below it the queue (QUEUE bytes, 256 as loaded) and the procedure area (PROC bytes, 768 as loaded), lowers HMEM$ below them all, hooks the keyboard (KI) and display (DO) devices and points CMNDI@ (4405H) at the resident part, which then takes the command EX.
5200
PUSH HL E5
Save Register Pair HL, the address of the rest of the command line, to the top of the stack while the heading is shown.
5201
LD HL,5377H 21 77 53
Point Register Pair HL to 5377H, the heading: JCL - DOSPLUS Job control language - 3.50 and the copyright line.
5204
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the heading at Register Pair HL up to its 0DH.
5207
POP HL E1
Restore Register Pair HL, the rest of the command line, from the top of the stack for PARAM@.
5208
LD DE,5407H 11 07 54
Point Register Pair DE to 5407H, the table of the two parameters PROC and QUEUE for PARAM@.
520B
GOSUB to 4454H, PARAM@ in SYS0/SYS: each value given is stored at the address its table entry names (527EH, 5266H).
520E
If the NZ FLAG is set (PARAM@ refused the parameters), JUMP to 536AH to post the error 2EH, Invalid parameter.
5211
LD B,01H 06 01
Load Register B with 01H, the logical record length given to OPEN@ for the relocation file.
5213
LD DE,5418H 11 18 54
Point Register Pair DE to 5418H, the file control block holding the name JCL/RLD, the relocation file.
5216
LD HL,5438H 21 38 54
Point Register Pair HL to 5438H, the 256 byte sector buffer of the file JCL/RLD, not loaded.
5219
GOSUB to 4424H, OPEN@ in SYS0/SYS, to open JCL/RLD with the control block at Register Pair DE.
521C
If the NZ FLAG is set (JCL/RLD not opened), JUMP to 5372H to post the error code in Register A.
521F
LD A,00H 3E 00
Load Register A with 00H, logical device 0, the keyboard (KI), for LOCDCB% below.
5221
GOSUB to 44A0H, LOCDCB% in SYS0/SYS: Register Pair DE returns the address of the KI device control block.
5224
PUSH DE D5
Save Register Pair DE, the address of the KI device control block, to the top of the stack.
5225
POP IX DD E1
Restore Index Register IX from the top of the stack: Index Register IX now points to the KI control block.
5227
LD A,(IX+00H) DD 7E 00
Load Register A with the type byte of the KI device control block at Index Register IX+00H.
522A
AND 30H E6 30
Keep only bits 5 and 4 of Register A (AND 30H): the bits of a device under FORCE or JOIN.
522C
If the NZ FLAG is set (KI is forced or joined), JUMP to 5361H: Can't install JCL under FORCE/JOIN.
522F
LD E,(IX+01H) DD 5E 01
Load Register E with the low byte of the KI driver's address at Index Register IX+01H.
5232
LD D,(IX+02H) DD 56 02
Load Register D with the high byte of the KI driver's address at Index Register IX+02H.
5235
LD (5CF9H),DE ED 53 F9 5C
Store Register Pair DE, the KI driver's address, into 5CF9H-5CFAH, the operand of the JP at 5CF8H.
5239
LD A,01H 3E 01
Load Register A with 01H, logical device 1, the display (DO), for LOCDCB% below.
523B
GOSUB to 44A0H, LOCDCB% in SYS0/SYS: Register Pair DE returns the address of the DO device control block.
523E
PUSH DE D5
Save Register Pair DE, the address of the DO device control block, to the top of the stack.
523F
POP IX DD E1
Restore Index Register IX from the top of the stack: Index Register IX now points to the DO control block.
5241
LD A,(IX+00H) DD 7E 00
Load Register A with the type byte of the DO device control block at Index Register IX+00H.
5244
AND 30H E6 30
Keep only bits 5 and 4 of Register A (AND 30H): the bits of a device under FORCE or JOIN.
5246
If the NZ FLAG is set (DO is forced or joined), JUMP to 5361H: Can't install JCL under FORCE/JOIN.
5249
LD E,(IX+01H) DD 5E 01
Load Register E with the low byte of the DO driver's address at Index Register IX+01H.
524C
LD D,(IX+02H) DD 56 02
Load Register D with the high byte of the DO driver's address at Index Register IX+02H.
524F
LD (5CFCH),DE ED 53 FC 5C
Store Register Pair DE, the DO driver's address, into 5CFCH-5CFDH, the operand of the JP at 5CFBH.
5253
LD HL,4405H 21 05 44
Point Register Pair HL to 4405H, CMNDI@ in SYS0/SYS, whose three bytes LD A,05H / RST 28H are kept.
5256
LD DE,5D08H 11 08 5D
Point Register Pair DE to 5D08H, the place in the resident part that runs CMNDI@ as it was.
5259
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three bytes of the entry point CMNDI@ at 4405H.
525C
LDIR ED B0
Copy the three bytes from Register Pair HL (4405H) to Register Pair DE (5D08H), the count in Register Pair BC.
525E
LD HL,5537H 21 37 55
Point Register Pair HL to 5537H, the last byte below the resident part: the end of the queue.
5261
LD (5EA5H),HL 22 A5 5E
Store Register Pair HL, 5537H, into 5EA5H-5EA6H, the end of the queue (relocated with the resident part).
5264
INC HL 23
INCrement Register Pair HL to 5538H, the start of the resident part, the top of the queue.
5265
LD DE,0100H 11 00 01
Load Register Pair DE with 0100H, the size of the queue: PARAM@ stores QUEUE's value into this operand (5266H).
5268
LD A,10H 3E 10
Load Register A with 10H, the high byte of 1000H, the largest size of the queue and the procedure area.
526A
CP D BA
Compare Register A (10H) against Register D, the high byte of the size: the C FLAG when Register D is above 10H.
526B
If the C FLAG is set (the queue's size is 1100H or more), JUMP to 536DH to post the error 2DH, Invalid data.
526E
SBC HL,DE ED 52
SUBtract Register Pair DE, the queue's size, from Register Pair HL (5538H) with the carry: the start of the queue.
5270
LD (5EA3H),HL 22 A3 5E
Store Register Pair HL, the start of the queue, into 5EA3H-5EA4H, where the queue wraps round to.
5273
LD (5E9FH),HL 22 9F 5E
Store Register Pair HL, the start of the queue, into 5E9FH-5EA0H, the place of the next byte put in (empty).
5276
LD (5EA1H),HL 22 A1 5E
Store Register Pair HL, the start of the queue, into 5EA1H-5EA2H, the place of the next byte taken out.
5279
DEC HL 2B
DECrement Register Pair HL to the byte below the queue, the limit of the procedure area.
527A
LD (5E9DH),HL 22 9D 5E
Store Register Pair HL, the byte below the queue, into 5E9DH-5E9EH, the limit of the procedure area.
527D
LD DE,0300H 11 00 03
Load Register Pair DE with 0300H, the size of the procedure area: PARAM@ stores PROC's value into this operand (527EH).
5280
CP D BA
Compare Register A (10H) against Register D, the high byte of the size: the C FLAG when Register D is above 10H.
5281
If the C FLAG is set (the procedure area is 1100H or more), JUMP to 536DH to post the error 2DH, Invalid data.
5284
SBC HL,DE ED 52
SUBtract Register Pair DE, the size of the area, from Register Pair HL with the carry: the start of the procedure area.
5286
LD (5E99H),HL 22 99 5E
Store Register Pair HL, the start of the procedure area, into 5E99H-5E9AH, the place of the next procedure's frame.
5289
LD (5E9BH),HL 22 9B 5E
Store Register Pair HL, the start of the procedure area, into 5E9BH-5E9CH, kept for a new start after an error.
528C
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE holds the start of the procedure area.
528D
LD HL,6040H 21 40 60
Load Register Pair HL with 6040H, the address after the resident part, the end of all that JCL takes.
5290
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL (6040H) with the carry: the bytes JCL takes in all.
5292
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE holds the bytes JCL takes in all.
5293
LD HL,(4411H) 2A 11 44
Load Register Pair HL with the contents of 4411H-4412H, HMEM$, the highest address programs may use.
5296
SBC HL,DE ED 52
SUBtract Register Pair DE, the bytes JCL takes, from Register Pair HL (HMEM$) with the carry: the new HMEM$.
5298
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE holds the new HMEM$.
5299
LD HL,5BFFH 21 FF 5B
Load Register Pair HL with 5BFFH, the last address of the high overlays, which the new HMEM$ must be above.
529C
SBC HL,DE ED 52
SUBtract Register Pair DE (the new HMEM$) from Register Pair HL (5BFFH) with the carry: NC when it is not above.
529E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL holds the new HMEM$ again.
529F
If the NC FLAG is set (the new HMEM$ is 5BFFH or below), JUMP to 5370H to post the error 21H, No memory.
52A2
LD DE,(4411H) ED 5B 11 44
Load Register Pair DE with the contents of 4411H-4412H, the old HMEM$, where the resident part will end.
52A6
LD (4411H),HL 22 11 44
Store Register Pair HL into 4411H-4412H: HMEM$ is now the byte below the procedure area, the queue and the resident part.
52A9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL holds the old HMEM$.
52AA
LD BC,0B08H 01 08 0B
Load Register Pair BC with 0B08H, the length of the resident part 5538H-603FH.
52AD
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
52AE
SBC HL,BC ED 42
SUBtract Register Pair BC (0B08H) from Register Pair HL (the old HMEM$) with the carry.
52B0
INC HL 23
INCrement Register Pair HL: the resident part's new address, so that its last byte is at the old HMEM$.
52B1
PUSH HL E5
Save Register Pair HL, the resident part's new address, to the top of the stack for the move at 5310H.
52B2
LD BC,5538H 01 38 55
Load Register Pair BC with 5538H, the address the resident part is loaded at.
52B5
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
52B6
SBC HL,BC ED 42
SUBtract Register Pair BC (5538H) from Register Pair HL with the carry: the distance the resident part moves.
52B8
LD C,L 4D
Load Register C with Register L, the low byte of the distance the resident part moves.
52B9
LD B,H 44
Load Register B with Register H: Register Pair BC holds the distance, the value added to each relocated word.
52BA
PUSH BC C5
Save Register Pair BC, the distance, to the top of the stack while the count is read.
52BB
GOSUB to 5355H to read a byte of JCL/RLD into Register A: the low byte of the count of entries.
52BE
LD L,A 6F
Load Register L with Register A, the low byte of the count of relocation entries.
52BF
GOSUB to 5355H to read a byte of JCL/RLD into Register A: the high byte of the count of entries.
52C2
LD H,A 67
Load Register H with Register A: Register Pair HL holds the count of relocation entries (0140H in the file).
52C3
LD B,04H 06 04
Load Register B with 04H, the four bytes of the file's header after the count, which are skipped.
52C5
GOSUB to 5355H to read a byte of JCL/RLD into Register A, a byte of the header that is not used.
52C8
DECrement Register B and loop back to 52C5H until the four bytes of the header are read.
52CA
POP BC C1
Restore Register Pair BC, the distance the resident part moves, from the top of the stack.
52CB
PUSH HL E5
Save Register Pair HL, the count of relocation entries left, to the top of the stack.
52CC
GOSUB to 5355H to read a byte of JCL/RLD into Register A: the low byte of an entry's address.
52CF
LD E,A 5F
Load Register E with Register A, the low byte of the address of the word to relocate.
52D0
GOSUB to 5355H to read a byte of JCL/RLD into Register A: the high byte of an entry's address.
52D3
LD D,A 57
Load Register D with Register A: Register Pair DE holds the address of the word to relocate.
52D4
LD HL,5537H 21 37 55
Load Register Pair HL with 5537H, the last address below the resident part.
52D7
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
52D8
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL (5537H) with the carry: NC for an address in this installing part.
52DA
If the NC FLAG is set (an address of 5537H or below), JUMP to 52E6H: that word is not moved and not changed.
52DC
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the word to relocate.
52DD
LD E,(HL) 5E
Load Register E with the low byte of the word at Register Pair HL.
52DE
INC HL 23
INCrement Register Pair HL to the high byte of the word to relocate.
52DF
LD D,(HL) 56
Load Register D with the high byte of the word at Register Pair HL.
52E0
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL holds the word, Register Pair DE its address plus 1.
52E1
ADD HL,BC 09
ADD Register Pair BC, the distance the resident part moves, to Register Pair HL, the word.
52E2
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE holds the new word, Register Pair HL its high byte's place.
52E3
LD (HL),D 72
Store Register D, the high byte of the relocated word, at Register Pair HL.
52E4
DEC HL 2B
DECrement Register Pair HL to the low byte of the relocated word.
52E5
LD (HL),E 73
Store Register E, the low byte of the relocated word, at Register Pair HL.
52E6
POP HL E1
Restore Register Pair HL, the count of relocation entries left, from the top of the stack.
52E7
DEC HL 2B
DECrement Register Pair HL, the count of relocation entries left, by one.
52E8
LD A,H 7C
Load Register A with Register H, the high byte of the count of entries left.
52E9
OR L B5
OR Register L with Register A: the Z FLAG when the count of entries left is 0000H.
52EA
If the NZ FLAG is set (entries left), JUMP back to 52CBH for the next relocation entry of JCL/RLD.
52EC
LD A,00H 3E 00
Load Register A with 00H, logical device 0, the keyboard (KI), for LOCDCB% below.
52EE
GOSUB to 44A0H, LOCDCB% in SYS0/SYS: Register Pair DE returns the address of the KI device control block.
52F1
PUSH DE D5
Save Register Pair DE, the address of the KI device control block, to the top of the stack.
52F2
POP IX DD E1
Restore Index Register IX from the top of the stack: Index Register IX now points to the KI control block.
52F4
LD HL,5D31H 21 31 5D
Point Register Pair HL to 5D31H, JCL's keyboard driver, the hook that feeds the queue to the programs.
52F7
ADD HL,BC 09
ADD Register Pair BC, the distance the resident part moves, to Register Pair HL: the hook's new address.
52F8
LD (IX+01H),L DD 75 01
Store Register L, the low byte of the hook's address, as the KI driver's address at Index Register IX+01H.
52FB
LD (IX+02H),H DD 74 02
Store Register H, the high byte of the hook's address, as the KI driver's address at Index Register IX+02H.
52FE
LD A,01H 3E 01
Load Register A with 01H, logical device 1, the display (DO), for LOCDCB% below.
5300
GOSUB to 44A0H, LOCDCB% in SYS0/SYS: Register Pair DE returns the address of the DO device control block.
5303
PUSH DE D5
Save Register Pair DE, the address of the DO device control block, to the top of the stack.
5304
POP IX DD E1
Restore Index Register IX from the top of the stack: Index Register IX now points to the DO control block.
5306
LD HL,5D7DH 21 7D 5D
Point Register Pair HL to 5D7DH, JCL's display driver, the hook of the options DSP, DQ and VOFF.
5309
ADD HL,BC 09
ADD Register Pair BC, the distance the resident part moves, to Register Pair HL: the hook's new address.
530A
LD (IX+01H),L DD 75 01
Store Register L, the low byte of the hook's address, as the DO driver's address at Index Register IX+01H.
530D
LD (IX+02H),H DD 74 02
Store Register H, the high byte of the hook's address, as the DO driver's address at Index Register IX+02H.
5310
POP DE D1
Restore Register Pair DE from the top of the stack: the resident part's new address, saved at 52B1H.
5311
PUSH DE D5
Save Register Pair DE, the resident part's new address, to the top of the stack again for 531AH.
5312
LD HL,5538H 21 38 55
Point Register Pair HL to 5538H, the resident part as loaded and relocated.
5315
LD BC,0B08H 01 08 0B
Load Register Pair BC with 0B08H, the length of the resident part 5538H-603FH.
5318
LDIR ED B0
Copy the resident part from Register Pair HL (5538H) to Register Pair DE, its new place, the count in Register Pair BC.
531A
POP HL E1
Restore Register Pair HL from the top of the stack: the resident part's new address, its entry for EX.
531B
LD (4406H),HL 22 06 44
Store Register Pair HL, the resident part's new address, into 4406H-4407H, the operand of the new JP at CMNDI@.
531E
LD A,C3H 3E C3
Load Register A with C3H, the opcode of JP, for the entry point CMNDI@ at 4405H.
5320
LD (4405H),A 32 05 44
Store Register A (C3H) into 4405H: CMNDI@ is now JP to the resident part, which first looks for EX.
5323
PUSH HL E5
Save Register Pair HL, the resident part's new address, to the top of the stack while the text is shown.
5324
LD HL,53D2H 21 D2 53
Point Register Pair HL to 53D2H, the text JCL installed at, ended by 03H.
5327
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the text at Register Pair HL up to its 03H.
532A
POP HL E1
Restore Register Pair HL, the resident part's new address, from the top of the stack.
532B
GOSUB to 5334H to display Register Pair HL, the resident part's new address, as four hexadecimal digits and H.
532E
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the line of JCL installed at nnnnH.
5330
GOSUB to 0033H, the ROM's display routine, to display the character in Register A, the carriage return.
5333
RET C9
RETurn to the caller, the DOS: the JCL system stays in memory above the new HMEM$.
5334H - Displaying a Word
Displays Register Pair HL as four hexadecimal digits followed by H, through 5341H and the ROM's 0033H.
5334
LD A,H 7C
Load Register A with Register H, the high byte of the word to display.
5335
GOSUB to 5341H to display Register A, the high byte, as two hexadecimal digits.
5338
LD A,L 7D
Load Register A with Register L, the low byte of the word to display.
5339
GOSUB to 5341H to display Register A, the low byte, as two hexadecimal digits.
533C
LD A,48H 3E 48
Load Register A with 48H, the letter H, which ends a hexadecimal number.
533E
JUMP to 0033H, the ROM's display routine, to display the H in Register A and return to the caller.
5341H - Displaying a Byte
Displays Register A as two hexadecimal digits: the high four bits first, then the low four by falling into 534AH.
5341
PUSH AF F5
Save Register Pair AF, the byte to display, to the top of the stack for its low four bits.
5342
RRA 1F
Rotate Register A right through the carry, the first of four turns that bring the high four bits down.
5343
RRA 1F
Rotate Register A right through the carry, the second of four turns that bring the high four bits down.
5344
RRA 1F
Rotate Register A right through the carry, the third of four turns that bring the high four bits down.
5345
RRA 1F
Rotate Register A right through the carry, the last turn: the high four bits are now in bits 3 to 0.
5346
GOSUB to 534AH to display bits 3 to 0 of Register A, the high digit, as a hexadecimal digit.
5349
POP AF F1
Restore Register Pair AF, the byte to display, from the top of the stack for its low digit.
534A
AND 0FH E6 0F
Keep only bits 3 to 0 of Register A (AND 0FH), one hexadecimal digit, 00H-0FH.
534C
ADD A,90H C6 90
ADD 90H to Register A, the first step of the DAA trick that makes the digit's character.
534E
DAA 27
Decimal Adjust Register A (DAA) after the addition of 90H.
534F
ADC A,40H CE 40
ADD 40H and the carry to Register A, the second step of the trick: 30H-39H or 41H-46H.
5351
DAA 27
Decimal Adjust Register A (DAA): the character of the hexadecimal digit, 0-9 or A-F.
5352
JUMP to 0033H, the ROM's display routine, to display the digit in Register A and return to the caller.
5355H - Reading a Byte of JCL/RLD
Reads the next byte of the relocation file through the ROM's 0013H with the control block at 5418H; an error or the end of the file is posted.
5355
PUSH DE D5
Save Register Pair DE to the top of the stack: it holds an address of the relocation work.
5356
LD DE,5418H 11 18 54
Point Register Pair DE to 5418H, the file control block of JCL/RLD.
5359
GOSUB to 0013H, the ROM's byte input, to read the next byte of JCL/RLD into Register A.
535C
POP DE D1
Restore Register Pair DE from the top of the stack, unchanged by the read.
535D
If the NZ FLAG is set (an error or the end of JCL/RLD), JUMP to 5372H to post the error code in Register A.
5360
RET C9
RETurn to the caller with the byte of JCL/RLD in Register A and the Z FLAG set.
5361H - The Errors of the Installation
5361H the message Can't install JCL under FORCE/JOIN and ABORT@; 536AH the error 2EH, Invalid parameter; 536DH, inside the LD BC at 536CH, 2DH, Invalid data provided; 5370H, inside the LD BC at 536FH, 21H, No memory space available; 5372H any error code in Register A. Each is posted with bit 6 set (no frame) and bit 7 clear, so ERROR@ ends through ABORT@.
5361
LD HL,53E4H 21 E4 53
Point Register Pair HL to 53E4H, the message Can't install JCL under FORCE/JOIN, ended by 0DH.
5364
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the message at Register Pair HL up to its 0DH.
5367
JUMP to 4030H, ABORT@, back to the DOS: JCL is not installed and JCL/RLD is left open.
536A
LD A,2EH 3E 2E
Load Register A with 2EH, the error code of Invalid parameter, and fall into the LD BC below.
536C
LD BC,2D3EH 01 3E 2D
536DH enters inside this LD BC,2D3EH: its bytes 3EH 2DH read as LD A,2DH, Invalid data provided; from above it only loads Register Pair BC.
536F
LD BC,213EH 01 3E 21
5370H enters inside this LD BC,213EH: its bytes 3EH 21H read as LD A,21H, No memory space available; from above it only loads Register Pair BC.
5372
OR 40H F6 40
Set bit 6 of Register A (OR 40H), the error code: the message is shown without the frame of asterisks.
5374
JUMP to 4409H, ERROR@ in SYS0/SYS, to post the error in Register A and leave through ABORT@.
5377H - The Texts and Tables of the Installation
The heading, the two messages, the table of PARAM@ and the file control block of JCL/RLD with its sector buffer.
5377-53D1
DEFM "JCL - DOSPLUS Job control language - 3.50" / DEFB 0AH / DEFM "(c) Copyright 1983, Micro-Systems Software Inc." / DEFB 0AH,0DH 4A 43 4C 20 2D 20 44 4F 53 50 4C 55 53 20 4A 6F 62 20 63 6F 6E 74 72 6F 6C 20 6C 61 6E 67 75 61 67 65 20 2D 20 33 2E 35 30 0A 28 63 29 20 43 6F 70 79 72 69 67 68 74 20 31 39 38 33 2C 20 4D 69 63 72 6F 2D 53 79 73 74 65 6D 73 20 53 6F 66 74 77 61 72 65 20 49 6E 63 2E 0A 0D
The heading (5201H): JCL - DOSPLUS Job control language - 3.50, a line feed, the copyright line, a line feed and the 0DH at which DSPLY@ stops.
53D2-53E3
DEFM "JCL installed at " / DEFB 03H 4A 43 4C 20 69 6E 73 74 61 6C 6C 65 64 20 61 74 20 03
The text shown after the installation (5324H), followed by the address of the resident part from 532BH; ended by 03H.
53E4-5406
DEFM "Can't install JCL under FORCE/JOIN" / DEFB 0DH 43 61 6E 27 74 20 69 6E 73 74 61 6C 6C 20 4A 43 4C 20 75 6E 64 65 72 20 46 4F 52 43 45 2F 4A 4F 49 4E 0D
The message of 5361H when the keyboard or the display is under FORCE or JOIN, ended by 0DH.
5407-540E
DEFM "PROC " / DEFW 527EH 50 52 4F 43 20 20 7E 52
The first entry of PARAM@'s table (5208H): PROC, the size of the procedure area, stored into the operand 527EH.
540F-5416
DEFM "QUEUE " / DEFW 5266H 51 55 45 55 45 20 66 52
The second entry of PARAM@'s table: QUEUE, the size of the keyboard queue, stored into the operand 5266H.
5417
DEFB 00H 00
The 00H that ends the table of PARAM@ after the two entries PROC and QUEUE.
5418-541F
DEFM "JCL/RLD" / DEFB 03H 4A 43 4C 2F 52 4C 44 03
The file control block of the relocation file (5213H): the name JCL/RLD, ended by 03H, as OPEN@ takes it.
5420-5437
DEFS 24
The rest of the 32 byte file control block of JCL/RLD at 5418H, filled in by OPEN@ (5219H).
5438-5537
DEFS 256
The sector buffer of JCL/RLD (5216H). Before the move, the queue's addresses are worked out below 5538H (525EH-527AH).
5538H - The Resident Part: the Hook of CMNDI@
From here to 603FH the code and data are moved up below the old HMEM$ by the installer (5318H) after the words named in JCL/RLD have been relocated; the addresses on this page are those of the file. 5538H is the new target of CMNDI@ (4405H). A command line comes here with the return address 402DH (EXIT@) on the stack when it was typed at the DOS command level; only then is its name tested for EX. Every other command line goes on to CMNDI@ as it was (5D08H).
5538
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer: Register Pair HL holds the caller's return address.
5539
LD DE,402DH 11 2D 40
Load Register Pair DE with 402DH, EXIT@, the return address of a command typed at the DOS command level.
553C
GOSUB to 5CE9H to compare Register Pair HL, the return address, with Register Pair DE (402DH): the Z FLAG if equal.
553F
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer again: Register Pair HL holds the command line, the flags kept.
5540
If the NZ FLAG is set (not called from the DOS command level), JUMP to 5559H to run the command as before.
5542
PUSH HL E5
Save Register Pair HL, the start of the command line, to the top of the stack.
5543
LD DE,5EBFH 11 BF 5E
Point Register Pair DE to 5EBFH, the line buffer, where FSPEC@ puts the command's name.
5546
GOSUB to 441CH, FSPEC@ in SYS0/SYS, to take the command's name from Register Pair HL into 5EBFH.
5549
If the NZ FLAG is set (no name), JUMP to 5555H to run the command line as before through CMNDI@.
554B
PUSH HL E5
Save Register Pair HL, the place after the name in the command line, to the top of the stack.
554C
LD HL,5E90H 21 90 5E
Point Register Pair HL to 5E90H, the name EX ended by 03H, as FSPEC@ ends a name.
554F
LD B,03H 06 03
Load Register B with 03H, the two letters of EX and the 03H after them, the length to compare.
5551
GOSUB to 5BF3H to compare the Register B bytes at Register Pair HL and Register Pair DE: the Z FLAG for EX.
5554
POP HL E1
Restore Register Pair HL, the place after the name in the command line, from the top of the stack.
5555
POP DE D1
Restore Register Pair DE, the start of the command line, from the top of the stack.
5556
If the Z FLAG is set (the command is EX), JUMP to 555CH to run the procedure named after it.
5558
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the start of the command line again.
5559
JUMP to 5D08H, the three bytes of CMNDI@ as it was (LD A,05H / RST 28H), to run the command line at Register Pair HL.
555CH - EX - Running a Procedure
EX filespec values: the rest of the line is copied to 5EBFH, EXIT@, ABORT@ and ERROR@ are pointed into JCL (5D19H, 5D26H, 5D28H) after their bytes are kept at 5CFEH, the procedure file is opened with the default extension JCL, the options are set to 25H (DSP, QUEUE and CHR on) and the procedure is run as level 1 (55B0H). When the last level ends, the three entry points are set back and EX returns through EXIT@.
555C
LD SP,5FBFH 31 BF 5F
Load the Stack Pointer with 5FBFH, JCL's own stack below the stack of /JUMP.
555F
LD DE,5EBFH 11 BF 5E
Point Register Pair DE to 5EBFH, the line buffer, which receives the rest of the command line.
5562
PUSH DE D5
Save Register Pair DE (5EBFH) to the top of the stack: the procedure's name and values start there.
5563
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H, the 64 bytes of the command line after EX that are copied.
5566
LDIR ED B0
Copy the rest of the command line from Register Pair HL to Register Pair DE (5EBFH), the count in Register Pair BC.
5568
LD HL,402DH 21 2D 40
Point Register Pair HL to 402DH, the entry points EXIT@ (402DH) and ABORT@ (4030H), six bytes.
556B
LD DE,5CFEH 11 FE 5C
Point Register Pair DE to 5CFEH, where the six bytes of EXIT@ and ABORT@ are kept during EX.
556E
LD C,06H 0E 06
Load Register C with 06H, the six bytes of the two jumps EXIT@ and ABORT@.
5570
LDIR ED B0
Copy the six bytes from Register Pair HL (402DH) to Register Pair DE (5CFEH), the count in Register Pair BC.
5572
LD HL,4409H 21 09 44
Point Register Pair HL to 4409H, the entry point ERROR@ (PUSH AF / LD A,43H / RST 28H), four bytes.
5575
LD C,04H 0E 04
Load Register C with 04H, the four bytes of the entry point ERROR@.
5577
LDIR ED B0
Copy the four bytes from Register Pair HL (4409H) to Register Pair DE (5D04H), the count in Register Pair BC.
5579
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE holds 440DH, the byte after ERROR@.
557A
DEC DE 1B
DECrement Register Pair DE to 440CH, the last byte of ERROR@, where the copy downward starts.
557B
LD HL,5CF8H 21 F8 5C
Point Register Pair HL to 5CF8H, the last of the four bytes JP 5D28H / C3H that replace ERROR@.
557E
LD C,04H 0E 04
Load Register C with 04H, the four bytes put over the entry point ERROR@.
5580
LDDR ED B8
Copy downward from Register Pair HL (5CF8H) to Register Pair DE (440CH): ERROR@ is now JP 5D28H; Register Pair BC counts.
5582
LD DE,4032H 11 32 40
Point Register Pair DE to 4032H, the last byte of ABORT@; Register Pair HL goes on down from 5CF4H.
5585
LD C,06H 0E 06
Load Register C with 06H, the six bytes put over the entry points EXIT@ and ABORT@.
5587
LDDR ED B8
Copy downward from Register Pair HL (5CF4H) to Register Pair DE (4032H), Register Pair BC counting: EXIT@ is JP 5D19H, ABORT@ JP 5D26H.
5589
POP HL E1
Restore Register Pair HL from the top of the stack: 5EBFH, the procedure's name and its values.
558A
LD IX,(5E9DH) DD 2A 9D 5E
Load Index Register IX with the contents of 5E9DH-5E9EH, the limit of the area, the frame before level 1.
558E
LD DE,5E8DH 11 8D 5E
Point Register Pair DE to 5E8DH, the default extension JCL of a procedure file.
5591
GOSUB to 5C99H to open the procedure file named at Register Pair HL, with the default extension at Register Pair DE.
5594
LD A,25H 3E 25
Load Register A with 25H, the options at the start of EX: DSP (bit 0), QUEUE (bit 2) and CHR (bit 5) on.
5596
LD (5E96H),A 32 96 5E
Store Register A (25H) into 5E96H, the options of JCL; JCL (the trace), QBYTE and DQ are off.
5599
GOSUB to 55B0H to run the procedure as a new level, level 1; it returns when level 1 ends with /EXIT.
559C
LD DE,402DH 11 2D 40
Load Register Pair DE with 402DH, EXIT@, the address the RET below goes to.
559F
PUSH DE D5
Save Register Pair DE (402DH) to the top of the stack as the return address of EX.
55A0
LD HL,5CFEH 21 FE 5C
Point Register Pair HL to 5CFEH, the six bytes of EXIT@ and ABORT@ kept at 5570H.
55A3
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the six bytes of the two jumps EXIT@ and ABORT@.
55A6
LDIR ED B0
Copy the six bytes from Register Pair HL (5CFEH) back to Register Pair DE (402DH), the count in Register Pair BC.
55A8
LD DE,4409H 11 09 44
Point Register Pair DE to 4409H, ERROR@; Register Pair HL goes on with its four bytes at 5D04H.
55AB
LD C,04H 0E 04
Load Register C with 04H, the four bytes of the entry point ERROR@.
55AD
LDIR ED B0
Copy the four bytes from Register Pair HL (5D04H) back to Register Pair DE (4409H), the count in Register Pair BC.
55AF
RET C9
RETurn to 402DH, EXIT@, as it was again: the end of EX, back at the DOS command level.
55B0H - Starting a Procedure Level
Register Pair HL points to the name of the procedure and the values after it; the file is open with its control block at 5F00H. A frame of 32 bytes is made at 5E99H for the level: +02H the frame before, +08H the second line, +0AH the line run, +0CH the end of the text and the start of the variables, +0EH the next line, +10H the Stack Pointer (the return of this call), +12H the end of the variables, +14H a word of the line, +16H the values and then the end of the line copy, +1CH the next line kept by /JUMP. The file is read in after the frame and ended with a 0DH, its first line must be the procedure's name, its other words are variables that take the values, $LEVEL is set and the lines are run (5678H).
55B0
PUSH HL E5
Save Register Pair HL, the procedure's name and its values, to the top of the stack.
55B1
LD HL,0002H 21 02 00
Load Register Pair HL with 0002H, the distance up to the return address of this call.
55B4
ADD HL,SP 39
ADD the Stack Pointer to Register Pair HL: the place of the return address, the Stack Pointer of this level.
55B5
PUSH HL E5
Save Register Pair HL, the Stack Pointer of this level, to the top of the stack for 55CDH.
55B6
PUSH IX DD E5
Save Index Register IX, the frame of the level that calls, to the top of the stack.
55B8
POP DE D1
Restore Register Pair DE from the top of the stack: the frame of the level that calls (from Index Register IX).
55B9
LD IX,(5E99H) DD 2A 99 5E
Load Index Register IX with the contents of 5E99H-5E9AH, the free place: the new level's frame.
55BD
PUSH IX DD E5
Save Index Register IX, the new frame, to the top of the stack for the free place after it.
55BF
LD (IX+02H),E DD 73 02
Store Register E, the low byte of the frame before, at Index Register IX+02H.
55C2
LD (IX+03H),D DD 72 03
Store Register D, the high byte of the frame before, at Index Register IX+03H.
55C5
POP HL E1
Restore Register Pair HL from the top of the stack: the new frame (from Index Register IX).
55C6
LD DE,0020H 11 20 00
Load Register Pair DE with 0020H, the 32 bytes of a frame.
55C9
ADD HL,DE 19
ADD Register Pair DE (0020H) to Register Pair HL: the place after the frame, where the text is read to.
55CA
LD (5E99H),HL 22 99 5E
Store Register Pair HL, the place after the frame, into 5E99H-5E9AH, the free place.
55CD
POP HL E1
Restore Register Pair HL from the top of the stack: the Stack Pointer of this level, saved at 55B5H.
55CE
LD (IX+10H),L DD 75 10
Store Register L, the low byte of the level's Stack Pointer, at Index Register IX+10H.
55D1
LD (IX+11H),H DD 74 11
Store Register H, the high byte of the level's Stack Pointer, at Index Register IX+11H.
55D4
POP HL E1
Restore Register Pair HL from the top of the stack: the procedure's name and its values.
55D5
GOSUB to 5B15H to pass the first word at Register Pair HL, the procedure's name; Register Pair HL is after it.
55D8
LD (IX+16H),L DD 75 16
Store Register L, the low byte of the place of the values, at Index Register IX+16H.
55DB
LD (IX+17H),H DD 74 17
Store Register H, the high byte of the place of the values, at Index Register IX+17H.
55DE
LD HL,5E98H 21 98 5E
Point Register Pair HL to 5E98H, the level of the procedure being run, 00H with none.
55E1
INC (HL) 34
INCrement the byte at Register Pair HL, the level: 1 for EX, one more for each /RUN.
55E2
LD HL,(5E99H) 2A 99 5E
Load Register Pair HL with the contents of 5E99H-5E9AH, the place after the frame, where the text goes.
55E5
LD (IX+08H),L DD 75 08
Store Register L, the low byte of the start of the text, at Index Register IX+08H.
55E8
LD (IX+09H),H DD 74 09
Store Register H, the high byte of the start of the text, at Index Register IX+09H.
55EB
LD DE,(5E9DH) ED 5B 9D 5E
Load Register Pair DE with the contents of 5E9DH-5E9EH, the limit of the procedure area.
55EF
GOSUB to 5CE9H to compare Register Pair HL, the place of the next byte, with Register Pair DE, the limit.
55F2
LD A,01H 3E 01
Load Register A with 01H, the error of the message Out of memory, for the jump below.
55F4
If the NC FLAG is set (the text has reached the limit), JUMP to 5DA7H: Out of memory.
55F7
LD DE,5F00H 11 00 5F
Point Register Pair DE to 5F00H, the file control block of the procedure file.
55FA
GOSUB to 0013H, the ROM's byte input, to read the next byte of the procedure file into Register A.
55FD
LD (HL),A 77
Store Register A, the byte read (or the code of the read that failed), at Register Pair HL.
55FE
INC HL 23
INCrement Register Pair HL to the place of the next byte of the text.
55FF
If the Z FLAG is set (a byte was read), JUMP to 55EBH for the next byte of the procedure file.
5601
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL after the code of the read that ended the file (1CH at the end of the file).
5603
INC HL 23
INCrement Register Pair HL to the place after the text: the start of the variables of the level.
5604
LD (IX+0CH),L DD 75 0C
Store Register L, the low byte of the end of the text, at Index Register IX+0CH.
5607
LD (IX+0DH),H DD 74 0D
Store Register H, the high byte of the end of the text, at Index Register IX+0DH.
560A
LD (5E99H),HL 22 99 5E
Store Register Pair HL, the end of the text, into 5E99H-5E9AH, the free place.
560D
LD E,(IX+08H) DD 5E 08
Load Register E with the low byte of the start of the text at Index Register IX+08H.
5610
LD D,(IX+09H) DD 56 09
Load Register D with the high byte of the start of the text at Index Register IX+09H.
5613
LD (IX+14H),E DD 73 14
Store Register E, the low byte of the first line, at Index Register IX+14H, the word pointer.
5616
LD (IX+15H),D DD 72 15
Store Register D, the high byte of the first line, at Index Register IX+15H, the word pointer.
5619
GOSUB to 5CD4H to pass the line at Register Pair DE: Register Pair DE points to the second line.
561C
LD (IX+08H),E DD 73 08
Store Register E, the low byte of the second line, at Index Register IX+08H, where /GOTO starts.
561F
LD (IX+09H),D DD 72 09
Store Register D, the high byte of the second line, at Index Register IX+09H, where /GOTO starts.
5622
LD (IX+0AH),E DD 73 0A
Store Register E, the low byte of the second line, at Index Register IX+0AH, the line to run.
5625
LD (IX+0BH),D DD 72 0B
Store Register D, the high byte of the second line, at Index Register IX+0BH, the line to run.
5628
GOSUB to 5CD4H to pass the line at Register Pair DE: Register Pair DE points to the third line.
562B
LD (IX+0EH),E DD 73 0E
Store Register E, the low byte of the third line, at Index Register IX+0EH, the next line.
562E
LD (IX+0FH),D DD 72 0F
Store Register D, the high byte of the third line, at Index Register IX+0FH, the next line.
5631
LD L,(IX+0CH) DD 6E 0C
Load Register L with the low byte of the start of the variables at Index Register IX+0CH.
5634
LD H,(IX+0DH) DD 66 0D
Load Register H with the high byte of the start of the variables at Index Register IX+0DH.
5637
LD (IX+12H),L DD 75 12
Store Register L at Index Register IX+12H, the low byte of the end of the variables: none yet.
563A
LD (IX+13H),H DD 74 13
Store Register H at Index Register IX+13H, the high byte of the end of the variables: none yet.
563D
LD L,(IX+14H) DD 6E 14
Load Register L with the low byte of the first line at Index Register IX+14H.
5640
LD H,(IX+15H) DD 66 15
Load Register H with the high byte of the first line at Index Register IX+15H.
5643
GOSUB to 5C8DH to pass the digits of a line number at Register Pair HL (a file saved by BASIC).
5646
GOSUB to 5B15H to find the first word of the line at Register Pair HL: Register Pair DE its start, Register B its length.
5649
LD A,02H 3E 02
Load Register A with 02H, the error of the message Bad JCL file, for the jump below.
564B
If the Z FLAG is set (the first line has no name), JUMP to 5DA7H: Bad JCL file.
564E
PUSH HL E5
Save Register Pair HL, the place after the name in the first line, to the top of the stack.
564F
LD HL,(5EBCH) 2A BC 5E
Load Register Pair HL with the contents of 5EBCH-5EBDH, the name given to EX or /RUN.
5652
GOSUB to 5BF3H to compare the Register B bytes of the first line's name (Register Pair DE) and Register Pair HL.
5655
POP HL E1
Restore Register Pair HL, the place after the name in the first line, from the top of the stack.
5656
LD A,02H 3E 02
Load Register A with 02H, the error of the message Bad JCL file, for the jump below.
5658
If the NZ FLAG is set (the names differ), JUMP to 5DA7H: Bad JCL file.
565B
LD E,(IX+16H) DD 5E 16
Load Register E with the low byte of the place of the values at Index Register IX+16H.
565E
LD D,(IX+17H) DD 56 17
Load Register D with the high byte of the place of the values at Index Register IX+17H.
5661
GOSUB to 5C6AH to turn every slash, colon, period and comma of the values at Register Pair DE into a space.
5664
GOSUB to 5BC0H to give the variables named at Register Pair HL the values at Register Pair DE, one word each.
5667
LD A,(5E98H) 3A 98 5E
Load Register A with the level from 5E98H, 1 to the depth of /RUN.
566A
OR 30H F6 30
Set bits 5 and 4 of Register A (OR 30H): the digit of the level, 31H for level 1.
566C
LD (5832H),A 32 32 58
Store Register A, the digit of the level, into 5832H, the value of $LEVEL before its 0DH.
566F
LD HL,5823H 21 23 58
Point Register Pair HL to 5823H, the name $LEVEL ended by 0DH.
5672
LD DE,5832H 11 32 58
Point Register Pair DE to 5832H, the digit of the level ended by 0DH.
5675
GOSUB to 5BC0H to give the variable named at Register Pair HL ($LEVEL) the value at Register Pair DE.
5678H - The Main Loop
Runs the line at +0AH of the frame, then steps to the next line, for ever: a procedure ends through /EXIT (5A24H) or an error (5DA7H).
5678
GOSUB to 5680H to prepare and run the line at Index Register IX+0AH, the frame's line to run.
567B
GOSUB to 5698H to step to the next line of the procedure; /JUMP returns here too (5AA0H).
567E
JUMP to 5678H to run the next line of the procedure.
5680H - Running a Line
Keeps the frame at 5EA9H for /JUMP, copies the line to 5EBFH with its variables replaced (56BDH), shows it for the trace (5740H), finds the command (5755H) and jumps to it with Register Pair HL pointing to the word after the command.
5680
LD (5EA9H),IX DD 22 A9 5E
Store Index Register IX, the frame of the level, into 5EA9H-5EAAH, the frame /JUMP works with.
5684
GOSUB to 56BDH to copy the line to 5EBFH and replace each $ and the name after it with the variable's value.
5687
GOSUB to 5740H to show the line at 5EBFH when the trace (the option JCL) is on.
568A
GOSUB to 5755H to find the command of the line: its routine's address is put into 5EA7H.
568D
LD HL,(5EA7H) 2A A7 5E
Load Register Pair HL with the contents of 5EA7H-5EA8H, the address of the command's routine.
5690
PUSH HL E5
Save Register Pair HL, the address of the command's routine, to the top of the stack for the RET below.
5691
LD L,(IX+14H) DD 6E 14
Load Register L with the low byte of the second word of the line at Index Register IX+14H.
5694
LD H,(IX+15H) DD 66 15
Load Register H with the high byte of the second word of the line at Index Register IX+15H.
5697
RET C9
RETurn to the command's routine with Register Pair HL pointing to the word after the command in 5EBFH.
5698H - The Next Line
The next line (+0EH) becomes the line to run (+0AH) and the line after it the next; when that one is the end of the text, EOF encountered.
5698
LD E,(IX+0EH) DD 5E 0E
Load Register E with the low byte of the next line at Index Register IX+0EH.
569B
LD D,(IX+0FH) DD 56 0F
Load Register D with the high byte of the next line at Index Register IX+0FH.
569E
LD (IX+0AH),E DD 73 0A
Store Register E at Index Register IX+0AH: the low byte of the next line is that of the line to run.
56A1
LD (IX+0BH),D DD 72 0B
Store Register D at Index Register IX+0BH: the high byte of the next line is that of the line to run.
56A4
GOSUB to 5CD4H to pass the line at Register Pair DE: Register Pair DE points to the line after it.
56A7
LD (IX+0EH),E DD 73 0E
Store Register E, the low byte of the line after it, at Index Register IX+0EH, the next line.
56AA
LD (IX+0FH),D DD 72 0F
Store Register D, the high byte of the line after it, at Index Register IX+0FH, the next line.
56AD
LD L,(IX+0CH) DD 6E 0C
Load Register L with the low byte of the end of the text at Index Register IX+0CH.
56B0
LD H,(IX+0DH) DD 66 0D
Load Register H with the high byte of the end of the text at Index Register IX+0DH.
56B3
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL holds the next line, Register Pair DE the end.
56B4
GOSUB to 5CE9H to compare Register Pair HL, the next line, with Register Pair DE, the end of the text.
56B7
LD A,03H 3E 03
Load Register A with 03H, the error of the message EOF encountered, for the jump below.
56B9
If the NC FLAG is set (the next line is the end of the text), JUMP to 5DA7H: EOF encountered.
56BC
RET C9
RETurn to the caller with the line to run at Index Register IX+0AH and the next one at +0EH.
56BDH - Preparing a Line
Passes a line number and the spaces at the start, copies the line to 5EBFH and then replaces the variables, the last $ in the line first: the name after the $ is looked up (5B38H, a new empty variable if none) and the $, the name and the rest of the line are replaced by the value and the rest. It stops at a $ at the start of the line (an assignment) or at the 24H kept at 5EBEH below the buffer. A line longer than 5EFFH is Line too long.
56BD
LD L,(IX+0AH) DD 6E 0A
Load Register L with the low byte of the line to run at Index Register IX+0AH.
56C0
LD H,(IX+0BH) DD 66 0B
Load Register H with the high byte of the line to run at Index Register IX+0BH.
56C3
GOSUB to 5C8DH to pass the digits of a line number at Register Pair HL (a file saved by BASIC).
56C6
GOSUB to 5B15H to pass the spaces at Register Pair HL: Register Pair DE returns the start of the first word.
56C9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the start of the first word.
56CA
LD (IX+0AH),L DD 75 0A
Store Register L, the low byte of the line's first word, at Index Register IX+0AH, the line to run.
56CD
LD (IX+0BH),H DD 74 0B
Store Register H, the high byte of the line's first word, at Index Register IX+0BH, the line to run.
56D0
LD DE,5EBFH 11 BF 5E
Point Register Pair DE to 5EBFH, the line buffer, which receives the copy of the line.
56D3
LD A,(HL) 7E
Load Register A with the byte of the line at Register Pair HL, tested below after it is copied.
56D4
LDI ED A0
Copy the byte at Register Pair HL to Register Pair DE and step both on (LDI); Register Pair BC counts down.
56D6
CP 0DH FE 0D
Compare Register A, the byte copied, against 0DH, the carriage return at the end of the line.
56D8
If the NZ FLAG is set (not the end), JUMP to 56D3H to copy the next byte of the line.
56DA
DEC DE 1B
DECrement Register Pair DE to the 0DH at the end of the line copied to 5EBFH.
56DB
LD (IX+16H),E DD 73 16
Store Register E, the low byte of the end of the copy, at Index Register IX+16H.
56DE
LD (IX+17H),D DD 72 17
Store Register D, the high byte of the end of the copy, at Index Register IX+17H.
56E1
LD E,(IX+16H) DD 5E 16
Load Register E with the low byte of the end of the copy at Index Register IX+16H, where the search starts.
56E4
LD D,(IX+17H) DD 56 17
Load Register D with the high byte of the end of the copy at Index Register IX+17H.
56E7
LD A,(DE) 1A
Load Register A with the byte of the copy at Register Pair DE, going down toward its start.
56E8
DEC DE 1B
DECrement Register Pair DE to the byte before, for the search of the last $ of the line.
56E9
CP 24H FE 24
Compare Register A against 24H, the dollar sign before the name of a variable.
56EB
If the NZ FLAG is set (not a dollar sign), JUMP to 56E7H to look at the byte before.
56ED
INC DE 13
INCrement Register Pair DE back to the dollar sign that was found.
56EE
LD (IX+14H),E DD 73 14
Store Register E, the low byte of the dollar sign's place, at Index Register IX+14H.
56F1
LD (IX+15H),D DD 72 15
Store Register D, the high byte of the dollar sign's place, at Index Register IX+15H.
56F4
LD HL,5EBFH 21 BF 5E
Point Register Pair HL to 5EBFH, the start of the line copied to the buffer.
56F7
GOSUB to 5CE9H to compare Register Pair HL (5EBFH) with Register Pair DE, the dollar sign's place.
56FA
RET NC D0
RETurn to the caller if the NC FLAG is set: the dollar sign begins the line (an assignment) or is the 24H at 5EBEH.
56FB
LD L,(IX+14H) DD 6E 14
Load Register L with the low byte of the dollar sign's place at Index Register IX+14H.
56FE
LD H,(IX+15H) DD 66 15
Load Register H with the high byte of the dollar sign's place at Index Register IX+15H.
5701
INC HL 23
INCrement Register Pair HL to the name of the variable after the dollar sign.
5702
GOSUB to 5B38H to find the variable named at Register Pair HL, or make it: Register Pair DE returns its value's place.
5705
PUSH DE D5
Save Register Pair DE, the place of the variable's value, to the top of the stack.
5706
POP IY FD E1
Restore Index Register IY from the top of the stack: Index Register IY points to the length of the value.
5708
LD E,(IY-09H) FD 5E F7
Load Register E with the length of the variable's name at Index Register IY-09H, the first byte of its entry.
570B
LD D,00H 16 00
Load Register D with 00H: Register Pair DE holds the length of the variable's name.
570D
ADD HL,DE 19
ADD Register Pair DE, the length of the name, to Register Pair HL: the place after the name in the line.
570E
LD DE,5F00H 11 00 5F
Point Register Pair DE to 5F00H, the place where the rest of the line is kept for a while.
5711
LD BC,003FH 01 3F 00
Load Register Pair BC with 003FH, the 63 bytes of the rest of the line that are kept.
5714
LDIR ED B0
Copy the rest of the line from Register Pair HL to Register Pair DE (5F00H), the count in Register Pair BC.
5716
LD C,(IY+00H) FD 4E 00
Load Register C with the length of the value at Index Register IY+00H; Register B is 00H after the LDIR.
5719
INC BC 03
INCrement Register Pair BC, the length of the value, for one more byte; the last one is written over below.
571A
LD E,(IX+14H) DD 5E 14
Load Register E with the low byte of the dollar sign's place at Index Register IX+14H.
571D
LD D,(IX+15H) DD 56 15
Load Register D with the high byte of the dollar sign's place at Index Register IX+15H.
5720
PUSH IY FD E5
Save Index Register IY, the place of the value's length, to the top of the stack.
5722
POP HL E1
Restore Register Pair HL from the top of the stack: the place of the value's length (from Index Register IY).
5723
INC HL 23
INCrement Register Pair HL to the first character of the variable's value.
5724
LDIR ED B0
Copy the value from Register Pair HL to Register Pair DE, over the dollar sign and the name, the count in Register Pair BC.
5726
DEC DE 1B
DECrement Register Pair DE to the byte after the value, where the rest of the line goes.
5727
LD HL,5F00H 21 00 5F
Point Register Pair HL to 5F00H, the rest of the line kept at 5714H.
572A
LD A,(HL) 7E
Load Register A with the byte of the rest of the line at Register Pair HL, tested below after it is copied.
572B
LDI ED A0
Copy the byte at Register Pair HL to Register Pair DE and step both on (LDI); Register Pair BC counts down.
572D
CP 0DH FE 0D
Compare Register A, the byte copied, against 0DH, the carriage return at the end of the line.
572F
If the NZ FLAG is set (not the end), JUMP to 572AH to copy the next byte of the rest of the line.
5731
DEC DE 1B
DECrement Register Pair DE to the 0DH at the new end of the line in the buffer.
5732
LD HL,5EFFH 21 FF 5E
Load Register Pair HL with 5EFFH, the last place of the line buffer 5EBFH-5EFFH.
5735
GOSUB to 5CE9H to compare Register Pair HL (5EFFH) with Register Pair DE, the end of the line.
5738
LD A,0AH 3E 0A
Load Register A with 0AH, the error of the message Line too long, for the jump below.
573A
If the C FLAG is set (the end of the line is past 5EFFH), JUMP to 5DA7H: Line too long.
573D
JUMP to 56E1H to look for the next dollar sign, searching down from the end kept at +16H.
5740H - The Trace
With the option JCL on (bit 1 of 5E96H), the line at 5EBFH is shown, with the options set to 01H (DSP only) while it is displayed.
5740
LD HL,5E96H 21 96 5E
Point Register Pair HL to 5E96H, the options of JCL, one bit each.
5743
BIT 1,(HL) CB 4E
Test bit 1 of the byte at Register Pair HL, the option JCL, the trace of the lines run.
5745
RET Z C8
RETurn to the caller if the Z FLAG is set: the trace is off.
5746
LD A,(HL) 7E
Load Register A with the options from Register Pair HL, kept while the line is shown.
5747
PUSH AF F5
Save Register Pair AF, the options, to the top of the stack while the line is shown.
5748
LD (HL),01H 36 01
Store 01H at Register Pair HL, the options: only DSP, so the line is shown and not put into the queue.
574A
LD HL,5EBFH 21 BF 5E
Point Register Pair HL to 5EBFH, the line with its variables replaced.
574D
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the line at Register Pair HL up to its 0DH.
5750
POP AF F1
Restore Register Pair AF, the options, from the top of the stack.
5751
LD (5E96H),A 32 96 5E
Store Register A, the options, back into 5E96H as they were before the trace.
5754
RET C9
RETurn to the caller after the trace of the line.
5755H - Finding the Command
The second word of the line goes to +14H. A first word starting with a period (a remark) or a minus sign (a label) runs 5A23H, a RET; a dollar sign the assignment 5A4CH; a slash the command whose name matches in the table 57AAH; anything else, an empty line included, is Bad /COMMAND. The routine's address is put into 5EA7H.
5755
LD HL,5EBFH 21 BF 5E
Point Register Pair HL to 5EBFH, the line with its variables replaced.
5758
GOSUB to 5B15H to find the first word at Register Pair HL: Register Pair DE its start, Register B its length.
575B
PUSH DE D5
Save Register Pair DE, the start of the first word, to the top of the stack.
575C
GOSUB to 5B15H to find the second word at Register Pair HL: Register Pair DE its start, or the 0DH.
575F
LD (IX+14H),E DD 73 14
Store Register E, the low byte of the second word, at Index Register IX+14H, the word pointer.
5762
LD (IX+15H),D DD 72 15
Store Register D, the high byte of the second word, at Index Register IX+15H, the word pointer.
5765
POP DE D1
Restore Register Pair DE, the start of the first word, from the top of the stack.
5766
LD A,(DE) 1A
Load Register A with the first character of the first word at Register Pair DE.
5767
CP 2EH FE 2E
Compare Register A against 2EH, the period that begins a remark.
5769
If the Z FLAG is set (a remark), JUMP to 57A3H to run 5A23H, which does nothing.
576B
CP 2DH FE 2D
Compare Register A against 2DH, the minus sign that begins a label.
576D
If the Z FLAG is set (a label), JUMP to 57A3H to run 5A23H, which does nothing.
576F
CP 24H FE 24
Compare Register A against 24H, the dollar sign that begins an assignment.
5771
If the Z FLAG is set (an assignment), JUMP to 579EH to run 5A4CH, the assignment.
5773
CP 2FH FE 2F
Compare Register A against 2FH, the slash that begins a command.
5775
LD A,05H 3E 05
Load Register A with 05H, the error of the message Bad /COMMAND, for the jump below.
5777
If the NZ FLAG is set (no slash), JUMP to 5DA7H: Bad /COMMAND.
577A
INC DE 13
INCrement Register Pair DE to the command's name after the slash.
577B
LD HL,57AAH 21 AA 57
Point Register Pair HL to 57AAH, the table of the commands: length, name and the routine's address.
577E
LD A,(HL) 7E
Load Register A with the length of the table entry at Register Pair HL, FFH at the end.
577F
CP FFH FE FF
Compare Register A against FFH, the byte that ends the table of the commands.
5781
LD A,05H 3E 05
Load Register A with 05H, the error of the message Bad /COMMAND, for the jump below.
5783
If the Z FLAG is set (no name matched), JUMP to 5DA7H: Bad /COMMAND.
5786
LD B,(HL) 46
Load Register B with the length of the entry's name at Register Pair HL.
5787
INC HL 23
INCrement Register Pair HL to the first character of the entry's name.
5788
GOSUB to 5BF3H to compare the Register B characters at Register Pair HL and Register Pair DE: the Z FLAG for a match.
578B
LD C,B 48
Load Register C with Register B, the length of the entry's name.
578C
LD B,00H 06 00
Load Register B with 00H: Register Pair BC holds the length of the entry's name.
578E
If the NZ FLAG is set (another name), JUMP to 5799H to step to the next entry of the table.
5790
ADD HL,BC 09
ADD Register Pair BC, the length of the name, to Register Pair HL: the place of the routine's address.
5791
LD C,(HL) 4E
Load Register C with the low byte of the routine's address at Register Pair HL.
5792
INC HL 23
INCrement Register Pair HL to the high byte of the routine's address.
5793
LD B,(HL) 46
Load Register B with the high byte at Register Pair HL: Register Pair BC holds the address of the command's routine.
5794
LD (5EA7H),BC ED 43 A7 5E
Store Register Pair BC, the routine of the command, into 5EA7H-5EA8H for 568DH.
5798
RET C9
RETurn to the caller with the command's routine at 5EA7H.
5799
INC BC 03
INCrement Register Pair BC, the length of the name, for the low byte of the routine's address.
579A
INC BC 03
INCrement Register Pair BC once more for the high byte of the routine's address.
579B
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: the length byte of the next entry of the table.
579C
JUMP to 577EH to try the next entry of the table of the commands.
579E
LD HL,5A4CH 21 4C 5A
Point Register Pair HL to 5A4CH, the assignment of a value to a variable.
57A1
JUMP to 57A6H to store Register Pair HL, the assignment's routine, into 5EA7H.
57A3
LD HL,5A23H 21 23 5A
Point Register Pair HL to 5A23H, a RET: a remark or a label does nothing when it is run.
57A6
LD (5EA7H),HL 22 A7 5E
Store Register Pair HL, the routine of the line, into 5EA7H-5EA8H for 568DH.
57A9
RET C9
RETurn to the caller with the line's routine at 5EA7H.
57AAH - The Table of the Commands
For each command its length, its name and the address of its routine; the name is compared for its own length (5788H), so a longer word that starts with it matches too. /TYPE, /PRINT and /DEBUG go straight to DSPLY@, PRINT@ and DEBUG@ in SYS0/SYS. FFH ends the table. After it, the two words that /QUEUE puts into the queue as one byte, and the names and values of the variables $LEVEL and $ERR.
57AA-57B2
DEFB 06H / DEFM "OPTION" / DEFW 5834H 06 4F 50 54 49 4F 4E 34 58
The command /OPTION, six characters, its routine at 5834H: the switches DSP, JCL, QUEUE, QBYTE, DQ and CHR.
57B3-57B7
DEFB 02H / DEFM "IF" / DEFW 58E2H 02 49 46 E2 58
The command /IF, two characters, its routine at 58E2H: a comparison and the command it runs.
57B8-57BE
DEFB 04H / DEFM "GOTO" / DEFW 599EH 04 47 4F 54 4F 9E 59
The command /GOTO, four characters, its routine at 599EH: the jump to a label.
57BF-57C5
DEFB 04H / DEFM "EXIT" / DEFW 5A24H 04 45 58 49 54 24 5A
The command /EXIT, four characters, its routine at 5A24H: the end of the procedure's level.
57C6-57CC
DEFB 04H / DEFM "READ" / DEFW 58C8H 04 52 45 41 44 C8 58
The command /READ, four characters, its routine at 58C8H: a line from the queue or the keyboard.
57CD-57D3
DEFB 04H / DEFM "TYPE" / DEFW 4467H 04 54 59 50 45 67 44
The command /TYPE, four characters, its routine DSPLY@ at 4467H in SYS0/SYS: the rest of the line is displayed.
57D4-57DB
DEFB 05H / DEFM "QUEUE" / DEFW 59CDH 05 51 55 45 55 45 CD 59
The command /QUEUE, five characters, its routine at 59CDH: the rest of the line goes into the queue.
57DC-57E3
DEFB 05H / DEFM "QLOAD" / DEFW 5A05H 05 51 4C 4F 41 44 05 5A
The command /QLOAD, five characters, its routine at 5A05H: a file goes into the queue.
57E4-57EC
DEFB 06H / DEFM "RESUME" / DEFW 5AD3H 06 52 45 53 55 4D 45 D3 5A
The command /RESUME, six characters, its routine at 5AD3H: back to the program a /JUMP stopped.
57ED-57F4
DEFB 05H / DEFM "PRINT" / DEFW 446AH 05 50 52 49 4E 54 6A 44
The command /PRINT, five characters, its routine PRINT@ at 446AH in SYS0/SYS: the rest of the line is printed.
57F5-57FA
DEFB 03H / DEFM "DOS" / DEFW 58AEH 03 44 4F 53 AE 58
The command /DOS, three characters, its routine at 58AEH: the rest of the line runs as a DOS command.
57FB-5802
DEFB 05H / DEFM "DEBUG" / DEFW 440DH 05 44 45 42 55 47 0D 44
The command /DEBUG, five characters, its routine DEBUG@ at 440DH in SYS0/SYS.
5803-5808
DEFB 03H / DEFM "RUN" / DEFW 5A69H 03 52 55 4E 69 5A
The command /RUN, three characters, its routine at 5A69H: another procedure as the next level.
5809-5810
DEFB 05H / DEFM "PURGE" / DEFW 5A1CH 05 50 55 52 47 45 1C 5A
The command /PURGE, five characters, its routine at 5A1CH: the queue is emptied.
5811-5819
DEFB 06H / DEFM "CANCEL" / DEFW 5AF5H 06 43 41 4E 43 45 4C F5 5A
The command /CANCEL, six characters, its routine at 5AF5H: the program a /JUMP stopped is ended.
581A
DEFB FFH FF
The FFH that ends the table of the commands (577FH), after the fifteen entries.
581B-581E
DEFM "JUMP" 4A 55 4D 50
The word JUMP, which /QUEUE puts into the queue as the byte FFH (59DCH), followed by the label.
581F-5822
DEFM "VOFF" 56 4F 46 46
The word VOFF, which /QUEUE puts into the queue as the byte FEH (59E6H), the echo switched off.
5823-5829
DEFM "$LEVEL" / DEFB 0DH 24 4C 45 56 45 4C 0D
The name $LEVEL ended by 0DH, given its value by 5675H when a level starts.
582A-582E
DEFM "$ERR" / DEFB 0DH 24 45 52 52 0D
The name $ERR ended by 0DH, given its value after /DOS (58C2H) and /RUN (5A82H).
582F-5831
DEFM "00" / DEFB 0DH 30 30 0D
The value of $ERR, two decimal digits ended by 0DH: written by /DOS (58BBH), /EXIT (5A2FH) and the errors (5DC3H).
5832-5833
DEFM "0" / DEFB 0DH 30 0D
The value of $LEVEL, the level's digit ended by 0DH, written by 566CH for each level.
5834H - /OPTION - The Switches
/OPTION name/Y or name/N, any number of them: each word is looked up in the table 5880H by its length less one, and the bit of the option in 5E96H is set by the entry's second mask (Y) or cleared by its first mask (N). Any other switch or name is Bad /OPTION.
5834
GOSUB to 5B15H to find the next word at Register Pair HL: Register Pair DE its start, Register B its length.
5837
RET Z C8
RETurn to the caller if the Z FLAG is set: no word left on the line.
5838
PUSH HL E5
Save Register Pair HL, the place after the word, to the top of the stack.
5839
LD HL,5880H 21 80 58
Point Register Pair HL to 5880H, the table of the options.
583C
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE the table, Register Pair HL the word.
583D
DEC B 05
DECrement Register B, the length of the word, leaving out the Y or N after the slash.
583E
LD A,(DE) 1A
Load Register A with the length of the table entry at Register Pair DE, FFH at the end.
583F
INC DE 13
INCrement Register Pair DE to the first character of the entry's name.
5840
CP FFH FE FF
Compare Register A against FFH, the byte that ends the table of the options.
5842
If the Z FLAG is set (no option matched), JUMP to 587BH: Bad /OPTION.
5844
CP B B8
Compare Register A, the entry's length, against Register B, the length of the word less one.
5845
If the Z FLAG is set (the same length), GOSUB to 5BF3H to compare the Register B characters at Register Pair HL and Register Pair DE.
5848
DEC DE 1B
DECrement Register Pair DE back to the length byte of the entry; the flags are kept.
5849
If the Z FLAG is set (the option is found), JUMP to 5850H to take its switch.
584B
GOSUB to 5873H to step Register Pair DE to the next entry of the table.
584E
JUMP to 583EH to try the next entry of the table of the options.
5850
LD C,B 48
Load Register C with Register B, the length of the option's name.
5851
LD B,00H 06 00
Load Register B with 00H: Register Pair BC holds the length of the option's name.
5853
ADD HL,BC 09
ADD Register Pair BC to Register Pair HL: Register Pair HL points to the switch after the slash.
5854
GOSUB to 5873H to step Register Pair DE past the entry: the next entry, after the two masks.
5857
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE the switch, Register Pair HL after the masks.
5858
LD A,(DE) 1A
Load Register A with the switch at Register Pair DE, Y or N.
5859
LD DE,5E96H 11 96 5E
Point Register Pair DE to 5E96H, the options of JCL, one bit each.
585C
GOSUB to 5C0EH to make Register A, the switch, upper case.
585F
DEC HL 2B
DECrement Register Pair HL to the entry's second mask, the bit to set for Y.
5860
CP 59H FE 59
Compare Register A against 59H, the letter Y.
5862
If the Z FLAG is set (Y), JUMP to 586DH to set the bit of the option.
5864
DEC HL 2B
DECrement Register Pair HL to the entry's first mask, the bits to keep for N.
5865
CP 4EH FE 4E
Compare Register A against 4EH, the letter N.
5867
If the NZ FLAG is set (neither Y nor N), JUMP to 587BH: Bad /OPTION.
5869
LD A,(DE) 1A
Load Register A with the options at Register Pair DE (5E96H).
586A
AND (HL) A6
AND the first mask at Register Pair HL with Register A: the bit of the option is cleared.
586B
JUMP to 586FH to store the options in Register A.
586D
LD A,(DE) 1A
Load Register A with the options at Register Pair DE (5E96H).
586E
OR (HL) B6
OR the second mask at Register Pair HL with Register A: the bit of the option is set.
586F
LD (DE),A 12
Store Register A, the new options, at Register Pair DE (5E96H).
5870
POP HL E1
Restore Register Pair HL, the place after the word, from the top of the stack.
5871
JUMP to 5834H for the next word of the line /OPTION.
5873H - The Next Option
Steps Register Pair DE from the length byte of an entry of 5880H to the next entry: the length, the name and the two masks.
5873
LD A,(DE) 1A
Load Register A with the length of the entry's name at Register Pair DE.
5874
ADD A,03H C6 03
ADD 03H to Register A: the length byte and the two masks with the name.
5876
ADD A,E 83
ADD Register E to Register A, the low byte of the next entry's address.
5877
LD E,A 5F
Load Register E with Register A, the low byte of the next entry.
5878
RET NC D0
RETurn to the caller if the NC FLAG is set: Register Pair DE points to the next entry.
5879
INC D 14
INCrement Register D, the high byte, for the carry of the addition.
587A
RET C9
RETurn to the caller with Register Pair DE at the next entry of the table.
587B
LD A,06H 3E 06
Load Register A with 06H, the error of the message Bad /OPTION, for the jump below.
587D
JUMP to 5DA7H, JCL's error routine, with Register A holding the error 06H, Bad /OPTION.
5880H - The Table of the Options
For each option the length of its name with the slash, the name, the mask that clears its bit (N) and the mask that sets it (Y); FFH ends the table. The bits of 5E96H: 0 DSP, 1 JCL (the trace), 2 QUEUE, 4 QBYTE, 5 CHR, 7 DQ; bit 3 is set while a /JUMP runs and bit 6 while the echo of a line from the queue is off (VOFF).
5880-5886
DEFB 04H / DEFM "CHR/" / DEFB DFH,20H 04 43 48 52 2F DF 20
The option CHR, bit 5: special characters from the queue are kept (Y) or made spaces (N).
5887-588C
DEFB 03H / DEFM "DQ/" / DEFB 7FH,80H 03 44 51 2F 7F 80
The option DQ, bit 7: every character displayed goes into the queue too (Y).
588D-5895
DEFB 06H / DEFM "QBYTE/" / DEFB EFH,10H 06 51 42 59 54 45 2F EF 10
The option QBYTE, bit 4: the queue serves every request for a character (Y), not only those of a line input (N).
5896-589E
DEFB 06H / DEFM "QUEUE/" / DEFB FBH,04H 06 51 55 45 55 45 2F FB 04
The option QUEUE, bit 2: the queue serves the keyboard (Y) or is not used (N).
589F-58A5
DEFB 04H / DEFM "JCL/" / DEFB FDH,02H 04 4A 43 4C 2F FD 02
The option JCL, bit 1: each line is shown before it is run (Y), the trace.
58A6-58AC
DEFB 04H / DEFM "DSP/" / DEFB FEH,01H 04 44 53 50 2F FE 01
The option DSP, bit 0: the display shows what is sent to it (Y) or nothing (N).
58AD
DEFB FFH FF
The FFH that ends the table of the options (5840H), after the six entries.
58AEH - /DOS - Running a DOS Command
The rest of the line is run through CMNDI@ as it was (5D0BH); EXIT@, ABORT@ and ERROR@ come back here with the error code, which is put into $ERR as two decimal digits. 5E97H, the count of /DOS commands, is counted up before the command; the DEC (HL) after it works on the byte at Register Pair HL, the command's text in 5EBFH, so 5E97H is never counted down.
58AE
PUSH HL E5
Save Register Pair HL, the command after /DOS, to the top of the stack.
58AF
LD HL,5E97H 21 97 5E
Point Register Pair HL to 5E97H, the count of /DOS commands, tested by /CANCEL.
58B2
INC (HL) 34
INCrement the byte at Register Pair HL, the count of /DOS commands.
58B3
POP HL E1
Restore Register Pair HL, the command after /DOS, from the top of the stack.
58B4
PUSH HL E5
Save Register Pair HL, the command after /DOS, to the top of the stack again for 58C5H.
58B5
GOSUB to 5D0BH to run the command at Register Pair HL; Register A returns the error code, 00H for none.
58B8
LD HL,582FH 21 2F 58
Point Register Pair HL to 582FH, the value of $ERR, two digits ended by 0DH.
58BB
GOSUB to 5CC3H to write Register A, the error code, at Register Pair HL as two decimal digits.
58BE
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE points to the value of $ERR.
58BF
LD HL,582AH 21 2A 58
Point Register Pair HL to 582AH, the name $ERR ended by 0DH.
58C2
GOSUB to 5BC0H to give the variable named at Register Pair HL ($ERR) the value at Register Pair DE.
58C5
POP HL E1
Restore Register Pair HL from the top of the stack: the command after /DOS, in 5EBFH.
58C6
DEC (HL) 35
DECrement the byte at Register Pair HL, the first character of the command in 5EBFH, not 5E97H.
58C7
RET C9
RETurn to the main loop after the command of /DOS has run.
58C8H - /READ - A Line from the Queue or the Keyboard
/READ $var ...: a line of up to 63 characters is taken through the ROM's line input into 5EBFH, from the queue while it holds characters; its slashes, colons, periods and commas become spaces and its words are given to the variables named in the line as it is in the procedure (+0AH), one word each.
58C8
LD B,3FH 06 3F
Load Register B with 3FH, the 63 characters at most of the line to read.
58CA
LD HL,5EBFH 21 BF 5E
Point Register Pair HL to 5EBFH, the line buffer, which receives the line read.
58CD
PUSH HL E5
Save Register Pair HL (5EBFH), the line read, to the top of the stack.
58CE
GOSUB to 0040H, the ROM's line input, to read a line of up to Register B characters into Register Pair HL.
58D1
LD L,(IX+0AH) DD 6E 0A
Load Register L with the low byte of the line as it is in the procedure at Index Register IX+0AH.
58D4
LD H,(IX+0BH) DD 66 0B
Load Register H with the high byte of the line as it is in the procedure at Index Register IX+0BH.
58D7
GOSUB to 5B15H to pass the word /READ at Register Pair HL: Register Pair HL points to the names after it.
58DA
POP DE D1
Restore Register Pair DE from the top of the stack: 5EBFH, the line read.
58DB
GOSUB to 5C6AH to turn every slash, colon, period and comma of the line at Register Pair DE into a space.
58DE
GOSUB to 5BC0H to give the variables named at Register Pair HL the words at Register Pair DE.
58E1
RET C9
RETurn to the main loop after the line has been read.
58E2H - /IF - A Comparison
/IF value relation value command: the two values are compared first by their lengths (the shorter is the smaller) and then character by character, upper case; the relation is found in 5991H (EQ 1, NE 2, LT 3, LE 4, GT 5, GE 6). When the condition holds, the fifth word of the line as it is in the procedure becomes the next line (5957H), so the command after it runs next. LE (5954H) holds when the first value is greater; GT (5942H) jumps to 5957H with Register Pair AF still on the stack, so the RET at 5972H goes to an address made of the flags and Register A.
58E2
GOSUB to 5B15H to find the first value at Register Pair HL: Register Pair DE its start, Register A its length.
58E5
LD (5EAFH),A 32 AF 5E
Store Register A, the length of the first value, into 5EAFH.
58E8
LD (5EB0H),DE ED 53 B0 5E
Store Register Pair DE, the start of the first value, into 5EB0H-5EB1H.
58EC
GOSUB to 5B15H to find the relation at Register Pair HL: Register Pair DE its start, Register A its length.
58EF
LD (5EB2H),A 32 B2 5E
Store Register A, the length of the relation, into 5EB2H.
58F2
LD (5EB3H),DE ED 53 B3 5E
Store Register Pair DE, the start of the relation, into 5EB3H-5EB4H.
58F6
GOSUB to 5B15H to find the second value at Register Pair HL: Register Pair DE its start, Register A its length.
58F9
LD (5EB5H),A 32 B5 5E
Store Register A, the length of the second value, into 5EB5H.
58FC
LD (5EB6H),DE ED 53 B6 5E
Store Register Pair DE, the start of the second value, into 5EB6H-5EB7H.
5900
LD A,(5EB2H) 3A B2 5E
Load Register A with the length of the relation from 5EB2H.
5903
CP 02H FE 02
Compare Register A against 02H, the two letters of a relation.
5905
LD A,08H 3E 08
Load Register A with 08H, the error of the message Bad /IF, for the jump below.
5907
If the NZ FLAG is set (not two letters), JUMP to 5DA7H: Bad /IF.
590A
LD HL,5991H 21 91 59
Point Register Pair HL to 5991H, the table of the relations EQ, NE, LT, LE, GT and GE.
590D
LD DE,(5EB3H) ED 5B B3 5E
Load Register Pair DE with the contents of 5EB3H-5EB4H, the start of the relation in the line.
5911
GOSUB to 5973H to find the relation at Register Pair DE in the table: Register A returns its number, 0 for none.
5914
LD (5EB2H),A 32 B2 5E
Store Register A, the number of the relation, into 5EB2H in place of its length.
5917
LD A,08H 3E 08
Load Register A with 08H, the error of the message Bad /IF, for the jump below.
5919
If the Z FLAG is set (no such relation), JUMP to 5DA7H: Bad /IF.
591C
LD A,(5EB5H) 3A B5 5E
Load Register A with the length of the second value from 5EB5H.
591F
LD B,A 47
Load Register B with Register A, the length of the second value.
5920
LD A,(5EAFH) 3A AF 5E
Load Register A with the length of the first value from 5EAFH.
5923
CP B B8
Compare Register A, the first length, against Register B, the second: the C FLAG when the first is shorter.
5924
If the NZ FLAG is set (the lengths differ), JUMP to 5931H: the flags of the lengths decide.
5926
LD DE,(5EB0H) ED 5B B0 5E
Load Register Pair DE with the contents of 5EB0H-5EB1H, the start of the first value.
592A
LD HL,(5EB6H) 2A B6 5E
Load Register Pair HL with the contents of 5EB6H-5EB7H, the start of the second value.
592D
LD B,A 47
Load Register B with Register A, the length of both values.
592E
GOSUB to 5BF3H to compare the values: the flags of the first character of Register Pair DE that differs from Register Pair HL.
5931
PUSH AF F5
Save Register Pair AF, the flags of the comparison, to the top of the stack.
5932
LD A,(5EB2H) 3A B2 5E
Load Register A with the number of the relation from 5EB2H, 1 to 6.
5935
DEC A 3D
DECrement Register A, the number of the relation: the Z FLAG for 1, EQ.
5936
If the Z FLAG is set (EQ), JUMP to 5948H to test for equal values.
5938
DEC A 3D
DECrement Register A, the number of the relation: the Z FLAG for 2, NE.
5939
If the Z FLAG is set (NE), JUMP to 594CH to test for values that differ.
593B
DEC A 3D
DECrement Register A, the number of the relation: the Z FLAG for 3, LT.
593C
If the Z FLAG is set (LT), JUMP to 5950H to test for the first value smaller.
593E
DEC A 3D
DECrement Register A, the number of the relation: the Z FLAG for 4, LE.
593F
If the Z FLAG is set (LE), JUMP to 5954H, which holds when the first value is greater.
5941
DEC A 3D
DECrement Register A, the number of the relation: the Z FLAG for 5, GT.
5942
If the Z FLAG is set (GT), JUMP to 5957H as true, with Register Pair AF left on the stack.
5944
POP AF F1
Restore Register Pair AF, the flags of the comparison, for GE, the relation 6.
5945
RET C D8
RETurn to the main loop if the C FLAG is set: GE does not hold, the first value is smaller.
5946
JUMP to 5957H: the condition holds, the command after it runs.
5948
POP AF F1
Restore Register Pair AF, the flags of the comparison, for EQ.
5949
RET NZ C0
RETurn to the main loop if the NZ FLAG is set: EQ does not hold, the values differ.
594A
JUMP to 5957H: the condition holds, the command after it runs.
594C
POP AF F1
Restore Register Pair AF, the flags of the comparison, for NE.
594D
RET Z C8
RETurn to the main loop if the Z FLAG is set: NE does not hold, the values are equal.
594E
JUMP to 5957H: the condition holds, the command after it runs.
5950
POP AF F1
Restore Register Pair AF, the flags of the comparison, for LT.
5951
RET NC D0
RETurn to the main loop if the NC FLAG is set: LT does not hold, the first value is not smaller.
5952
JUMP to 5957H: the condition holds, the command after it runs.
5954
POP AF F1
Restore Register Pair AF, the flags of the comparison, for LE.
5955
RET Z C8
RETurn to the main loop if the Z FLAG is set: the values are equal, so this test of LE fails.
5956
RET C D8
RETurn to the main loop if the C FLAG is set: the first value is smaller, so this test of LE fails.
5957
LD L,(IX+0AH) DD 6E 0A
Load Register L with the low byte of the line as it is in the procedure at Index Register IX+0AH.
595A
LD H,(IX+0BH) DD 66 0B
Load Register H with the high byte of the line as it is in the procedure at Index Register IX+0BH.
595D
GOSUB to 5B15H to pass the first word of the line at Register Pair HL, /IF.
5960
GOSUB to 5B15H to pass the second word of the line at Register Pair HL, the first value.
5963
GOSUB to 5B15H to pass the third word of the line at Register Pair HL, the relation.
5966
GOSUB to 5B15H to pass the fourth word of the line at Register Pair HL, the second value.
5969
GOSUB to 5B15H to find the fifth word at Register Pair HL: Register Pair DE its start, the command to run.
596C
LD (IX+0EH),E DD 73 0E
Store Register E, the low byte of the command, at Index Register IX+0EH: the next line starts there.
596F
LD (IX+0FH),D DD 72 0F
Store Register D, the high byte of the command, at Index Register IX+0FH: the next line starts there.
5972
RET C9
RETurn to the main loop, which runs the command after the condition as the next line.
5973H - Finding a Relation
Compares the two letters at Register Pair DE with each pair of the table at Register Pair HL; Register A returns the number of the pair (1 on) with the NZ FLAG, or 00H with the Z FLAG at the FFH.
5973
PUSH BC C5
Save Register Pair BC to the top of the stack, kept for the caller.
5974
PUSH DE D5
Save Register Pair DE, the relation in the line, to the top of the stack.
5975
PUSH HL E5
Save Register Pair HL, the table of the relations, to the top of the stack.
5976
LD C,01H 0E 01
Load Register C with 01H, the number of the first relation of the table.
5978
LD A,(HL) 7E
Load Register A with the first letter of the table entry at Register Pair HL, FFH at the end.
5979
CP FFH FE FF
Compare Register A against FFH, the byte that ends the table of the relations.
597B
If the Z FLAG is set (no relation matched), JUMP to 5989H to return 00H.
597D
LD B,02H 06 02
Load Register B with 02H, the two letters of a relation to compare.
597F
GOSUB to 5BF3H to compare the Register B letters at Register Pair HL and Register Pair DE.
5982
If the Z FLAG is set (the relation is found), JUMP to 598BH to return its number in Register C.
5984
INC HL 23
INCrement Register Pair HL past the first letter of the entry.
5985
INC HL 23
INCrement Register Pair HL past the second letter: the next entry of the table.
5986
INC C 0C
INCrement Register C, the number of the relation, for the next entry.
5987
JUMP to 5978H to try the next relation of the table.
5989
LD C,00H 0E 00
Load Register C with 00H, the answer when no relation of the table matched.
598B
LD A,C 79
Load Register A with Register C, the number of the relation or 00H.
598C
OR A B7
OR Register A with itself: the Z FLAG when no relation was found.
598D
POP HL E1
Restore Register Pair HL, the table of the relations, from the top of the stack.
598E
POP DE D1
Restore Register Pair DE, the relation in the line, from the top of the stack.
598F
POP BC C1
Restore Register Pair BC from the top of the stack, as the caller had it.
5990
RET C9
RETurn to the caller with the number of the relation in Register A.
5991-599C
DEFM "EQNELTLEGTGE" 45 51 4E 45 4C 54 4C 45 47 54 47 45
The six relations of /IF, two letters each: EQ 1, NE 2, LT 3, LE 4, GT 5, GE 6 (5911H).
599D
DEFB FFH FF
The FFH that ends the table of the relations (5979H), after the six pairs.
599EH - /GOTO - The Jump to a Label
/GOTO -label: the word must start with a minus sign, else Bad -LABEL. From the second line of the procedure on, the first word of each line is compared with the label for that word's length, so a line -LOOP matches /GOTO -LOOP1; the line found becomes the next line. Reaching the end of the text is EOF encountered. /JUMP comes here too (5AD0H).
599E
LD A,(HL) 7E
Load Register A with the first character of the label at Register Pair HL.
599F
CP 2DH FE 2D
Compare Register A against 2DH, the minus sign that begins a label.
59A1
LD A,09H 3E 09
Load Register A with 09H, the error of the message Bad -LABEL, for the jump below.
59A3
If the NZ FLAG is set (no minus sign), JUMP to 5DA7H: Bad -LABEL.
59A6
LD L,(IX+08H) DD 6E 08
Load Register L with the low byte of the second line at Index Register IX+08H.
59A9
LD H,(IX+09H) DD 66 09
Load Register H with the high byte of the second line at Index Register IX+09H.
59AC
LD (IX+0EH),L DD 75 0E
Store Register L at Index Register IX+0EH: the search starts with the second line as the next line.
59AF
LD (IX+0FH),H DD 74 0F
Store Register H at Index Register IX+0FH: the search starts with the second line as the next line.
59B2
LD L,(IX+0EH) DD 6E 0E
Load Register L with the low byte of the next line at Index Register IX+0EH.
59B5
LD H,(IX+0FH) DD 66 0F
Load Register H with the high byte of the next line at Index Register IX+0FH.
59B8
GOSUB to 5C8DH to pass the digits of a line number at Register Pair HL.
59BB
GOSUB to 5B15H to find the line's first word: Register Pair DE its start, Register B its length.
59BE
LD L,(IX+14H) DD 6E 14
Load Register L with the low byte of the label of /GOTO at Index Register IX+14H.
59C1
LD H,(IX+15H) DD 66 15
Load Register H with the high byte of the label of /GOTO at Index Register IX+15H.
59C4
GOSUB to 5BF3H to compare the Register B characters of the line's word (Register Pair DE) with the label (Register Pair HL).
59C7
RET Z C8
RETurn to the main loop if the Z FLAG is set: the line of the label is the next line.
59C8
GOSUB to 5698H to step to the line after it; EOF encountered at the end of the text.
59CB
JUMP to 59B2H to compare the first word of the next line with the label.
59CDH - /QUEUE - Putting a Line into the Queue
The rest of the line and its 0DH go into the queue. A slash followed by the word JUMP or VOFF puts the single byte FFH or FEH in their place; any other slash and its word go in as they are. A full queue is QUEUE full.
59CD
LD A,(HL) 7E
Load Register A with the next character of the line at Register Pair HL.
59CE
INC HL 23
INCrement Register Pair HL to the character after it.
59CF
CP 2FH FE 2F
Compare Register A against 2FH, the slash before JUMP or VOFF.
59D1
If the NZ FLAG is set (not a slash), JUMP to 59F6H to put the character in Register A into the queue.
59D3
LD C,A 4F
Load Register C with Register A, the slash, which goes into the queue unless the word is JUMP or VOFF.
59D4
GOSUB to 5B15H to find the word after the slash: Register Pair DE its start, Register A its length.
59D7
PUSH HL E5
Save Register Pair HL, the place after the word, to the top of the stack.
59D8
CP 04H FE 04
Compare Register A, the length of the word, against 04H, the length of JUMP and VOFF.
59DA
If the NZ FLAG is set (another length), JUMP to 59F3H to put the slash and the word into the queue.
59DC
LD HL,581BH 21 1B 58
Point Register Pair HL to 581BH, the word JUMP.
59DF
GOSUB to 5BF3H to compare the Register B characters at Register Pair HL (JUMP) and Register Pair DE.
59E2
LD A,FFH 3E FF
Load Register A with FFH, the byte that stands for /JUMP in the queue.
59E4
If the Z FLAG is set (the word is JUMP), JUMP to 59F0H to put FFH into the queue in its place.
59E6
LD HL,581FH 21 1F 58
Point Register Pair HL to 581FH, the word VOFF.
59E9
GOSUB to 5BF3H to compare the Register B characters at Register Pair HL (VOFF) and Register Pair DE.
59EC
LD A,FEH 3E FE
Load Register A with FEH, the byte that stands for /VOFF in the queue.
59EE
If the NZ FLAG is set (neither word), JUMP to 59F3H to put the slash and the word into the queue.
59F0
LD C,A 4F
Load Register C with Register A, FFH or FEH, the byte to put into the queue.
59F1
POP DE D1
Restore Register Pair DE from the top of the stack: the place after the word JUMP or VOFF.
59F2
PUSH DE D5
Save Register Pair DE, the place after the word, to the top of the stack again.
59F3
LD A,C 79
Load Register A with Register C, the slash or the byte FFH or FEH.
59F4
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL goes on at the word, or after JUMP or VOFF.
59F5
POP DE D1
Restore Register Pair DE from the top of the stack, the place after the word, no longer needed.
59F6
GOSUB to 5C3EH to put Register A into the queue: the C FLAG when the queue is full.
59F9
If the C FLAG is set (the queue is full), JUMP to 5A00H: QUEUE full.
59FB
CP 0DH FE 0D
Compare Register A, the character put in, against 0DH, the carriage return at the end of the line.
59FD
If the NZ FLAG is set (not the end), JUMP to 59CDH for the next character of the line.
59FF
RET C9
RETurn to the main loop with the line and its carriage return in the queue.
5A00
LD A,0CH 3E 0C
Load Register A with 0CH, the error of the message QUEUE full, for the jump below.
5A02
JUMP to 5DA7H, JCL's error routine, with Register A holding the error 0CH, QUEUE full.
5A05H - /QLOAD - Loading the Queue from a File
/QLOAD filespec: the file is opened with the default extension TXT (5C99H) and every byte of it goes into the queue until a read fails, the end of the file; a full queue is QUEUE full.
5A05
LD DE,5E8AH 11 8A 5E
Point Register Pair DE to 5E8AH, the default extension TXT of the file of /QLOAD.
5A08
GOSUB to 5C99H to open the file named at Register Pair HL, with the default extension at Register Pair DE.
5A0B
LD DE,5F00H 11 00 5F
Point Register Pair DE to 5F00H, the file control block of the file of /QLOAD.
5A0E
GOSUB to 0013H, the ROM's byte input, to read the next byte of the file at Register Pair DE into Register A.
5A11
RET NZ C0
RETurn to the main loop if the NZ FLAG is set: the end of the file, or an error, which is not reported.
5A12
GOSUB to 5C3EH to put Register A, the byte of the file, into the queue: the C FLAG when the queue is full.
5A15
LD A,0CH 3E 0C
Load Register A with 0CH, the error of the message QUEUE full, for the jump below.
5A17
If the C FLAG is set (the queue is full), JUMP to 5DA7H: QUEUE full.
5A1A
JUMP to 5A0EH to read the next byte of the file of /QLOAD.
5A1CH - /PURGE - Emptying the Queue
The place of the next byte taken out is set to that of the next byte put in. Also called by the error routine (5DABH).
5A1C
LD HL,(5E9FH) 2A 9F 5E
Load Register Pair HL with the contents of 5E9FH-5EA0H, the place of the next byte put into the queue.
5A1F
LD (5EA1H),HL 22 A1 5E
Store Register Pair HL into 5EA1H-5EA2H, the place of the next byte taken out: the queue is empty.
5A22
RET C9
RETurn to the caller with the keyboard queue emptied.
5A23H - A Remark or a Label
A line starting with a period or a minus sign comes here (57A3H) and does nothing.
5A23
RET C9
RETurn to the main loop: a remark or a label line does nothing when it is run.
5A24H - /EXIT - The End of a Level
The frame and all after it are given back (5E99H), the level is counted down and the Stack Pointer of the level is taken back, so the RET returns from the call of 55B0H: to EX (5599H) after level 1, else to /RUN (5A79H). Before that, two bytes are meant to be copied from the level's $ERR to 582FH for /RUN; the name is given with its dollar sign (582AH), which no variable has, so 5B38H makes a new empty variable and the two bytes after its length byte are copied, whatever they are.
5A24
LD HL,582AH 21 2A 58
Point Register Pair HL to 582AH, the name $ERR with its dollar sign, ended by 0DH.
5A27
GOSUB to 5B38H to find the variable named at Register Pair HL, or make it: Register Pair DE returns its value's place.
5A2A
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the length of the value.
5A2B
INC HL 23
INCrement Register Pair HL to the first character of the value.
5A2C
LD E,(HL) 5E
Load Register E with the first character of the value at Register Pair HL.
5A2D
INC HL 23
INCrement Register Pair HL to the second character of the value.
5A2E
LD D,(HL) 56
Load Register D with the second character of the value at Register Pair HL.
5A2F
LD (582FH),DE ED 53 2F 58
Store Register Pair DE, the two characters, into 582FH-5830H, the value of $ERR that /RUN takes.
5A33
LD HL,5E98H 21 98 5E
Point Register Pair HL to 5E98H, the level of the procedure being run.
5A36
DEC (HL) 35
DECrement the byte at Register Pair HL, the level: 00H when level 1 ends.
5A37
LD (5E99H),IX DD 22 99 5E
Store Index Register IX, the frame of the level, into 5E99H-5E9AH: the frame and all after it are free.
5A3B
LD L,(IX+10H) DD 6E 10
Load Register L with the low byte of the level's Stack Pointer at Index Register IX+10H.
5A3E
LD H,(IX+11H) DD 66 11
Load Register H with the high byte of the level's Stack Pointer at Index Register IX+11H.
5A41
LD SP,HL F9
Load the Stack Pointer with Register Pair HL: it points to the return address of the call of 55B0H.
5A42
LD E,(IX+02H) DD 5E 02
Load Register E with the low byte of the frame before at Index Register IX+02H.
5A45
LD D,(IX+03H) DD 56 03
Load Register D with the high byte of the frame before at Index Register IX+03H.
5A48
PUSH DE D5
Save Register Pair DE, the frame before, to the top of the stack.
5A49
POP IX DD E1
Restore Index Register IX from the top of the stack: the frame of the level that called.
5A4B
RET C9
RETurn from the call of 55B0H, to EX or to /RUN, with the level ended.
5A4CH - The Assignment
$name = value: the word after the name must start with an equal sign, else Bad assignment; the next word (up to eight characters, none for an empty value) is stored as the variable's value. The name is taken from 5EC0H, after the dollar sign at the start of the line, which 56BDH does not replace.
5A4C
GOSUB to 5B15H to find the word after the name at Register Pair HL: Register Pair DE its start.
5A4F
LD A,(DE) 1A
Load Register A with the first character of that word at Register Pair DE.
5A50
CP 3DH FE 3D
Compare Register A against 3DH, the equal sign of an assignment.
5A52
LD A,07H 3E 07
Load Register A with 07H, the error of the message Bad assignment, for the jump below.
5A54
If the NZ FLAG is set (no equal sign), JUMP to 5DA7H: Bad assignment.
5A57
GOSUB to 5B15H to find the value at Register Pair HL: Register Pair DE its start, Register A its length.
5A5A
PUSH DE D5
Save Register Pair DE, the start of the value, to the top of the stack.
5A5B
PUSH AF F5
Save Register Pair AF, the length of the value, to the top of the stack.
5A5C
LD HL,5EC0H 21 C0 5E
Point Register Pair HL to 5EC0H, the name of the variable after the dollar sign at 5EBFH.
5A5F
GOSUB to 5B38H to find the variable named at Register Pair HL, or make it: Register Pair DE returns its value's place.
5A62
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the place of the value.
5A63
POP AF F1
Restore Register Pair AF, the length of the value, from the top of the stack.
5A64
POP DE D1
Restore Register Pair DE, the start of the value, from the top of the stack.
5A65
GOSUB to 5BAEH to store the Register A characters at Register Pair DE as the value at Register Pair HL.
5A68
RET C9
RETurn to the main loop with the variable's new value stored.
5A69H - /RUN - Another Procedure
/RUN filespec values: the file is opened with the default extension JCL, the free place is set to the end of this level's variables and the procedure is run as the next level (55B0H); when it ends, this level's $ERR takes the value at 582FH (see 5A24H).
5A69
LD DE,5E8DH 11 8D 5E
Point Register Pair DE to 5E8DH, the default extension JCL of a procedure file.
5A6C
GOSUB to 5C99H to open the procedure file named at Register Pair HL, with the default extension at Register Pair DE.
5A6F
LD E,(IX+12H) DD 5E 12
Load Register E with the low byte of the end of the variables at Index Register IX+12H.
5A72
LD D,(IX+13H) DD 56 13
Load Register D with the high byte of the end of the variables at Index Register IX+13H.
5A75
LD (5E99H),DE ED 53 99 5E
Store Register Pair DE, the end of this level's variables, into 5E99H-5E9AH, the free place for the next frame.
5A79
GOSUB to 55B0H to run the procedure at Register Pair HL as the next level; it returns when that level ends.
5A7C
LD HL,582AH 21 2A 58
Point Register Pair HL to 582AH, the name $ERR ended by 0DH.
5A7F
LD DE,582FH 11 2F 58
Point Register Pair DE to 582FH, the value left by /EXIT, two characters ended by 0DH.
5A82
GOSUB to 5BC0H to give the variable named at Register Pair HL ($ERR) the value at Register Pair DE.
5A85
RET C9
RETurn to the main loop of this level after the procedure of /RUN.
5A86H - /JUMP - A Jump Read from the Queue
Entered from JCL's keyboard driver (5D55H) when a program takes the byte FFH from the queue. With no procedure running it goes back to the driver. Else the program's registers and its Stack Pointer are kept (5EADH), the stack of /JUMP at 603FH is taken, bit 3 of the options is set, the next line is kept at +1CH, the rest of the queue's line (the label) is read into 5EBFH and /GOTO runs with it; the main loop goes on there (567BH) until /RESUME or /CANCEL.
5A86
PUSH BC C5
Save Register Pair BC, a register of the program that is stopped, to the top of the stack.
5A87
PUSH DE D5
Save Register Pair DE, a register of the program that is stopped, to the top of the stack.
5A88
PUSH HL E5
Save Register Pair HL, a register of the program that is stopped, to the top of the stack.
5A89
PUSH IX DD E5
Save Index Register IX, a register of the program that is stopped, to the top of the stack.
5A8B
PUSH IY FD E5
Save Index Register IY, a register of the program that is stopped, to the top of the stack.
5A8D
LD (5EADH),SP ED 73 AD 5E
Store the Stack Pointer into 5EADH-5EAEH, the program's stack, taken back by /RESUME and /CANCEL.
5A91
LD A,(5E98H) 3A 98 5E
Load Register A with the level from 5E98H, 00H when no procedure is running.
5A94
OR A B7
OR Register A with itself: the Z FLAG when no procedure is running.
5A95
If the Z FLAG is set (no procedure), JUMP to 5AE7H to give the program its registers back and read on.
5A98
LD SP,603FH 31 3F 60
Load the Stack Pointer with 603FH, the stack of /JUMP at the top of the resident part.
5A9B
LD HL,5E96H 21 96 5E
Point Register Pair HL to 5E96H, the options of JCL, one bit each.
5A9E
SET 3,(HL) CB DE
Set bit 3 of the byte at Register Pair HL: a /JUMP is running, for /RESUME and /CANCEL.
5AA0
LD HL,567BH 21 7B 56
Point Register Pair HL to 567BH, the main loop after a line has run.
5AA3
PUSH HL E5
Save Register Pair HL (567BH) to the top of the stack, where the RET of /GOTO goes.
5AA4
LD IX,(5EA9H) DD 2A A9 5E
Load Index Register IX with the contents of 5EA9H-5EAAH, the frame of the line last run.
5AA8
LD L,(IX+0EH) DD 6E 0E
Load Register L with the low byte of the next line at Index Register IX+0EH.
5AAB
LD H,(IX+0FH) DD 66 0F
Load Register H with the high byte of the next line at Index Register IX+0FH.
5AAE
LD (IX+1CH),L DD 75 1C
Store Register L, the low byte of the next line, at Index Register IX+1CH for /RESUME.
5AB1
LD (IX+1DH),H DD 74 1D
Store Register H, the high byte of the next line, at Index Register IX+1DH for /RESUME.
5AB4
LD HL,5EBFH 21 BF 5E
Point Register Pair HL to 5EBFH, the line buffer, which receives the label from the queue.
5AB7
PUSH HL E5
Save Register Pair HL (5EBFH) to the top of the stack for the search of the label.
5AB8
GOSUB to 5C17H to take the next byte from the queue into Register A.
5ABB
CP FEH FE FE
Compare Register A against FEH: the C FLAG for any byte below FEH.
5ABD
If the NC FLAG is set (FEH or FFH), JUMP to 5AB8H: those bytes are left out.
5ABF
LD (HL),A 77
Store Register A, the byte from the queue, at Register Pair HL in the line buffer.
5AC0
INC HL 23
INCrement Register Pair HL to the next place of the line buffer.
5AC1
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of the queue's line.
5AC3
If the NZ FLAG is set (not the end), JUMP to 5AB8H for the next byte from the queue.
5AC5
POP HL E1
Restore Register Pair HL from the top of the stack: 5EBFH, the line of the label.
5AC6
GOSUB to 5B15H to find the label at Register Pair HL: Register Pair DE its start.
5AC9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the label.
5ACA
LD (IX+14H),L DD 75 14
Store Register L, the low byte of the label, at Index Register IX+14H, the word pointer.
5ACD
LD (IX+15H),H DD 74 15
Store Register H, the high byte of the label, at Index Register IX+15H, the word pointer.
5AD0
JUMP to 599EH, /GOTO, to make the line of the label the next line, with Register Pair HL at the label.
5AD3H - /RESUME - Back to the Program
Only while a /JUMP runs (bit 3): the next line kept at +1CH is taken back, the program's Stack Pointer and registers are restored and JCL's keyboard driver goes on with the program's request (5D31H).
5AD3
LD HL,5E96H 21 96 5E
Point Register Pair HL to 5E96H, the options of JCL, one bit each.
5AD6
BIT 3,(HL) CB 5E
Test bit 3 of the byte at Register Pair HL: set while a /JUMP runs.
5AD8
RET Z C8
RETurn to the main loop if the Z FLAG is set: no /JUMP is running, /RESUME does nothing.
5AD9
RES 3,(HL) CB 9E
Reset bit 3 of the byte at Register Pair HL: the /JUMP ends.
5ADB
LD L,(IX+1CH) DD 6E 1C
Load Register L with the low byte of the next line kept at Index Register IX+1CH.
5ADE
LD H,(IX+1DH) DD 66 1D
Load Register H with the high byte of the next line kept at Index Register IX+1DH.
5AE1
LD (IX+0EH),L DD 75 0E
Store Register L at Index Register IX+0EH: the next line is the one after the line of the stopped program.
5AE4
LD (IX+0FH),H DD 74 0F
Store Register H at Index Register IX+0FH: the next line is the one after the line of the stopped program.
5AE7
LD SP,(5EADH) ED 7B AD 5E
Load the Stack Pointer with the contents of 5EADH-5EAEH, the program's stack kept by 5A8DH.
5AEB
POP IY FD E1
Restore Index Register IY, the program's, from the top of the stack.
5AED
POP IX DD E1
Restore Index Register IX, the program's, from the top of the stack.
5AEF
POP HL E1
Restore Register Pair HL, the program's, from the top of the stack.
5AF0
POP DE D1
Restore Register Pair DE, the program's, from the top of the stack.
5AF1
POP BC C1
Restore Register Pair BC, the program's, from the top of the stack.
5AF2
JUMP to 5D31H, JCL's keyboard driver, to give the program its next character.
5AF5H - /CANCEL - Ending the Stopped Program
Only when 5E97H is not 00H (a /DOS has been run) and a /JUMP runs: the next line kept at +1CH is taken back, the program's stack is taken and EXIT@ (402DH, JP 5D19H during EX) ends the /DOS with 00H, so the procedure goes on after the /DOS line.
5AF5
LD A,(5E97H) 3A 97 5E
Load Register A with the count of /DOS commands from 5E97H.
5AF8
OR A B7
OR Register A with itself: the Z FLAG when no /DOS has been run.
5AF9
RET Z C8
RETurn to the main loop if the Z FLAG is set: /CANCEL does nothing.
5AFA
LD HL,5E96H 21 96 5E
Point Register Pair HL to 5E96H, the options of JCL, one bit each.
5AFD
BIT 3,(HL) CB 5E
Test bit 3 of the byte at Register Pair HL: set while a /JUMP runs.
5AFF
RET Z C8
RETurn to the main loop if the Z FLAG is set: no /JUMP is running, /CANCEL does nothing.
5B00
RES 3,(HL) CB 9E
Reset bit 3 of the byte at Register Pair HL: the /JUMP ends.
5B02
LD L,(IX+1CH) DD 6E 1C
Load Register L with the low byte of the next line kept at Index Register IX+1CH.
5B05
LD H,(IX+1DH) DD 66 1D
Load Register H with the high byte of the next line kept at Index Register IX+1DH.
5B08
LD (IX+0EH),L DD 75 0E
Store Register L at Index Register IX+0EH: the next line is the one after the /DOS line.
5B0B
LD (IX+0FH),H DD 74 0F
Store Register H at Index Register IX+0FH: the next line is the one after the /DOS line.
5B0E
LD SP,(5EADH) ED 7B AD 5E
Load the Stack Pointer with the contents of 5EADH-5EAEH, the stopped program's stack.
5B12
JUMP to 402DH, EXIT@, which during EX is JP 5D19H: the /DOS ends with the error code 00H.
5B15H - The Next Word
Passes the spaces at Register Pair HL and measures the word after them, up to a space or the 0DH: Register Pair DE returns its start, Register B and Register A its length (the Z FLAG for none) and Register Pair HL the space or 0DH after it. With no word, Register Pair DE keeps the place where the search began.
5B15
LD B,00H 06 00
Load Register B with 00H, the length of the word, none so far.
5B17
LD D,H 54
Load Register D with Register H, the high byte of the place where the search begins.
5B18
LD E,L 5D
Load Register E with Register L: Register Pair DE holds the place where the search begins.
5B19
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5B1A
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of the line.
5B1C
If the Z FLAG is set (the end of the line), JUMP to 5B35H to return with no word, Register B 00H.
5B1E
CP 20H FE 20
Compare Register A against 20H, a space before the word.
5B20
INC HL 23
INCrement Register Pair HL to the next character; the flags of the comparison are kept.
5B21
If the Z FLAG is set (a space), JUMP to 5B19H to look at the next character.
5B23
LD D,H 54
Load Register D with Register H, the high byte of the place after the word's first character.
5B24
LD E,L 5D
Load Register E with Register L: Register Pair DE holds the place after the first character.
5B25
DEC DE 1B
DECrement Register Pair DE to the word's first character, the start of the word.
5B26
LD B,01H 06 01
Load Register B with 01H, the length of the word so far, its first character.
5B28
LD A,(HL) 7E
Load Register A with the next character of the word at Register Pair HL.
5B29
CP 20H FE 20
Compare Register A against 20H, the space that ends the word.
5B2B
If the Z FLAG is set (a space), JUMP to 5B35H to return the word's length in Register B.
5B2D
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that ends the word and the line.
5B2F
If the Z FLAG is set (the end of the line), JUMP to 5B35H to return the word's length in Register B.
5B31
INC B 04
INCrement Register B, the length of the word, for this character.
5B32
INC HL 23
INCrement Register Pair HL to the next character of the word.
5B33
JUMP to 5B28H to look at the next character of the word.
5B35
LD A,B 78
Load Register A with Register B, the length of the word, 00H for none.
5B36
OR A B7
OR Register A with itself: the Z FLAG when there is no word.
5B37
RET C9
RETurn to the caller with the word's start in Register Pair DE and its length in Register A and Register B.
5B38H - Finding a Variable
The variables of a level follow its text, from +0CH to +12H of its frame, 18 bytes each: the length of the name, the name (eight places), the length of the value and the value (eight places). The name at Register Pair HL is compared with each name for that name's own length, so a variable FILE is found for FILENAME too. Register Pair DE returns the place of the value's length, Register Pair HL the name. When none matches, the word at Register Pair HL (up to a space) becomes a new variable with an empty value; no word is Bad $VAR.
5B38
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE points to the name looked for.
5B39
LD L,(IX+0CH) DD 6E 0C
Load Register L with the low byte of the start of the variables at Index Register IX+0CH.
5B3C
LD H,(IX+0DH) DD 66 0D
Load Register H with the high byte of the start of the variables at Index Register IX+0DH.
5B3F
PUSH DE D5
Save Register Pair DE, the name looked for, to the top of the stack.
5B40
LD E,(IX+12H) DD 5E 12
Load Register E with the low byte of the end of the variables at Index Register IX+12H.
5B43
LD D,(IX+13H) DD 56 13
Load Register D with the high byte of the end of the variables at Index Register IX+13H.
5B46
GOSUB to 5CE9H to compare Register Pair HL, the entry, with Register Pair DE, the end of the variables.
5B49
POP DE D1
Restore Register Pair DE, the name looked for, from the top of the stack; the flags are kept.
5B4A
If the Z FLAG is set (no entry left), JUMP to 5B5FH to make a new variable.
5B4C
LD B,(HL) 46
Load Register B with the length of the entry's name at Register Pair HL.
5B4D
INC HL 23
INCrement Register Pair HL to the entry's name.
5B4E
GOSUB to 5BF3H to compare the Register B characters of the entry's name (Register Pair HL) with Register Pair DE.
5B51
If the NZ FLAG is set (another name), JUMP to 5B59H to step to the next entry.
5B53
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight places of the name.
5B56
ADD HL,BC 09
ADD Register Pair BC (0008H) to Register Pair HL: the place of the value's length.
5B57
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE the value's place, Register Pair HL the name.
5B58
RET C9
RETurn to the caller with the variable found.
5B59
LD BC,0011H 01 11 00
Load Register Pair BC with 0011H, the 17 bytes of the entry after its length byte.
5B5C
ADD HL,BC 09
ADD Register Pair BC (0011H) to Register Pair HL: the next entry of the variables.
5B5D
JUMP to 5B3FH to compare the next entry with the name looked for.
5B5F
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the name looked for.
5B60
GOSUB to 5B15H to measure the name at Register Pair HL: Register Pair DE its start, Register A its length.
5B63
PUSH AF F5
Save Register Pair AF, the length of the name, to the top of the stack.
5B64
LD A,0BH 3E 0B
Load Register A with 0BH, the error of the message Bad $VAR, for the jump below.
5B66
If the Z FLAG is set (no name), JUMP to 5DA7H: Bad $VAR.
5B69
POP AF F1
Restore Register Pair AF, the length of the name, from the top of the stack.
5B6A
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the start of the name.
5B6B
GOSUB to 5B75H to make a new variable with the Register A characters of the name at Register Pair HL.
5B6E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL the value's place, Register Pair DE the name.
5B6F
XOR A AF
Set Register A to 00H (XOR A), the length of an empty value.
5B70
GOSUB to 5BAEH to store the length 00H in Register A at Register Pair HL: the value is empty.
5B73
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE the value's place, Register Pair HL the name.
5B74
RET C9
RETurn to the caller with the new variable, its value empty.
5B75H - Making a Variable
Puts an entry of 18 bytes at the end of the variables (+12H), with the name at Register Pair HL, Register A characters long (eight at most); Register Pair DE returns the place of the value's length. Out of memory when the entry reaches the limit 5E9DH.
5B75
PUSH HL E5
Save Register Pair HL, the name of the new variable, to the top of the stack.
5B76
LD E,(IX+12H) DD 5E 12
Load Register E with the low byte of the end of the variables at Index Register IX+12H.
5B79
LD D,(IX+13H) DD 56 13
Load Register D with the high byte of the end of the variables at Index Register IX+13H.
5B7C
LD HL,0012H 21 12 00
Load Register Pair HL with 0012H, the 18 bytes of a variable's entry.
5B7F
ADD HL,DE 19
ADD Register Pair DE, the end of the variables, to Register Pair HL: the end after the new entry.
5B80
LD (IX+12H),L DD 75 12
Store Register L, the low byte of the new end of the variables, at Index Register IX+12H.
5B83
LD (IX+13H),H DD 74 13
Store Register H, the high byte of the new end of the variables, at Index Register IX+13H.
5B86
PUSH AF F5
Save Register Pair AF, the length of the name, to the top of the stack.
5B87
PUSH DE D5
Save Register Pair DE, the new entry, to the top of the stack.
5B88
LD DE,(5E9DH) ED 5B 9D 5E
Load Register Pair DE with the contents of 5E9DH-5E9EH, the limit of the procedure area.
5B8C
GOSUB to 5CE9H to compare Register Pair HL, the new end, with Register Pair DE, the limit.
5B8F
LD A,01H 3E 01
Load Register A with 01H, the error of the message Out of memory, for the jump below.
5B91
If the NC FLAG is set (the entry reaches the limit), JUMP to 5DA7H: Out of memory.
5B94
POP DE D1
Restore Register Pair DE, the new entry, from the top of the stack.
5B95
POP AF F1
Restore Register Pair AF, the length of the name, from the top of the stack.
5B96
CP 09H FE 09
Compare Register A, the length of the name, against 09H: the C FLAG for eight or fewer.
5B98
If the C FLAG is set (eight characters or fewer), JUMP to 5B9CH to keep the length.
5B9A
LD A,08H 3E 08
Load Register A with 08H: a longer name keeps its first eight characters.
5B9C
LD (DE),A 12
Store Register A, the length of the name, at Register Pair DE, the first byte of the entry.
5B9D
INC DE 13
INCrement Register Pair DE to the place of the name in the entry.
5B9E
POP HL E1
Restore Register Pair HL, the name of the new variable, from the top of the stack.
5B9F
PUSH HL E5
Save Register Pair HL, the name, to the top of the stack again for the caller.
5BA0
PUSH DE D5
Save Register Pair DE, the place of the name in the entry, to the top of the stack.
5BA1
LD C,A 4F
Load Register C with Register A, the length of the name.
5BA2
LD B,00H 06 00
Load Register B with 00H: Register Pair BC holds the length of the name.
5BA4
LDIR ED B0
Copy the name from Register Pair HL to Register Pair DE, the entry, the count in Register Pair BC.
5BA6
POP DE D1
Restore Register Pair DE, the place of the name in the entry, from the top of the stack.
5BA7
LD HL,0008H 21 08 00
Load Register Pair HL with 0008H, the eight places of the name.
5BAA
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL (0008H): the place of the value's length.
5BAB
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE points to the place of the value's length.
5BAC
POP HL E1
Restore Register Pair HL, the name of the new variable, from the top of the stack.
5BAD
RET C9
RETurn to the caller with the place of the new variable's value in Register Pair DE.
5BAEH - Storing a Value
Stores Register A, the length of the value, at Register Pair HL and the Register A characters at Register Pair DE after it, eight at most.
5BAE
LD (HL),A 77
Store Register A, the length of the value, at Register Pair HL.
5BAF
OR A B7
OR Register A with itself: the Z FLAG for an empty value.
5BB0
RET Z C8
RETurn to the caller if the Z FLAG is set: an empty value has no characters to copy.
5BB1
CP 09H FE 09
Compare Register A, the length of the value, against 09H: the C FLAG for eight or fewer.
5BB3
If the C FLAG is set (eight characters or fewer), JUMP to 5BB7H to keep the length.
5BB5
LD A,08H 3E 08
Load Register A with 08H: a longer value keeps its first eight characters.
5BB7
LD (HL),A 77
Store Register A, the length of the value, at Register Pair HL.
5BB8
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL the value's characters, Register Pair DE the place.
5BB9
INC DE 13
INCrement Register Pair DE to the place of the value's first character.
5BBA
LD C,A 4F
Load Register C with Register A, the length of the value.
5BBB
LD B,00H 06 00
Load Register B with 00H: Register Pair BC holds the length of the value.
5BBD
LDIR ED B0
Copy the value from Register Pair HL to Register Pair DE, the count in Register Pair BC.
5BBF
RET C9
RETurn to the caller with the value stored after its length byte.
5BC0H - Giving Values to Variables
Register Pair HL points to names, each a dollar sign and the name, Register Pair DE to values; each name takes the next word of the values, an empty value when there are no more. A name without the dollar sign, or the dollar sign alone, is Bad $VAR. Used for the first line of a procedure, /READ, $LEVEL and $ERR.
5BC0
LD (5EB8H),HL 22 B8 5E
Store Register Pair HL, the place of the names, into 5EB8H-5EB9H.
5BC3
LD (5EBAH),DE ED 53 BA 5E
Store Register Pair DE, the place of the values, into 5EBAH-5EBBH.
5BC7
LD HL,(5EB8H) 2A B8 5E
Load Register Pair HL with the contents of 5EB8H-5EB9H, the place of the next name.
5BCA
GOSUB to 5B15H to find the next name at Register Pair HL: Register Pair DE its start, Register B its length.
5BCD
RET Z C8
RETurn to the caller if the Z FLAG is set: no name is left.
5BCE
LD (5EB8H),HL 22 B8 5E
Store Register Pair HL, the place after the name, into 5EB8H-5EB9H.
5BD1
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the start of the name.
5BD2
LD A,(HL) 7E
Load Register A with the first character of the name at Register Pair HL.
5BD3
CP 24H FE 24
Compare Register A against 24H, the dollar sign before a variable's name.
5BD5
LD A,0BH 3E 0B
Load Register A with 0BH, the error of the message Bad $VAR, for the jumps below.
5BD7
If the NZ FLAG is set (no dollar sign), JUMP to 5DA7H: Bad $VAR.
5BDA
DEC B 05
DECrement Register B, the length of the word, leaving out the dollar sign.
5BDB
If the Z FLAG is set (the dollar sign alone), JUMP to 5DA7H: Bad $VAR.
5BDE
LD A,B 78
Load Register A with Register B, the length of the name after the dollar sign.
5BDF
INC HL 23
INCrement Register Pair HL to the name after the dollar sign.
5BE0
GOSUB to 5B38H to find the variable named at Register Pair HL, or make it: Register Pair DE returns its value's place.
5BE3
PUSH DE D5
Save Register Pair DE, the place of the variable's value, to the top of the stack.
5BE4
LD HL,(5EBAH) 2A BA 5E
Load Register Pair HL with the contents of 5EBAH-5EBBH, the place of the next value.
5BE7
GOSUB to 5B15H to find the next value at Register Pair HL: Register Pair DE its start, Register A its length.
5BEA
LD (5EBAH),HL 22 BA 5E
Store Register Pair HL, the place after the value, into 5EBAH-5EBBH.
5BED
POP HL E1
Restore Register Pair HL, the place of the variable's value, from the top of the stack.
5BEE
GOSUB to 5BAEH to store the Register A characters at Register Pair DE as the value at Register Pair HL.
5BF1
JUMP to 5BC7H for the next name and its value.
5BF3H - Comparing Characters
Compares Register B characters at Register Pair HL and Register Pair DE, both made upper case: the Z FLAG when they are the same (also for Register B 00H), else the flags of the character at Register Pair DE compared with the one at Register Pair HL. Register Pair BC, Register Pair DE and Register Pair HL are kept.
5BF3
PUSH BC C5
Save Register Pair BC, the count, to the top of the stack, kept for the caller.
5BF4
PUSH DE D5
Save Register Pair DE to the top of the stack, kept for the caller.
5BF5
PUSH HL E5
Save Register Pair HL to the top of the stack, kept for the caller.
5BF6
INC B 04
INCrement Register B, the count, the first half of a test for 00H that keeps Register B.
5BF7
DEC B 05
DECrement Register B, the count, back: the Z FLAG when it is 00H.
5BF8
If the Z FLAG is set (nothing to compare), JUMP to 5C0AH to return with the Z FLAG.
5BFA
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5BFB
GOSUB to 5C0EH to make Register A, the character at Register Pair HL, upper case.
5BFE
LD C,A 4F
Load Register C with Register A, the character at Register Pair HL in upper case.
5BFF
LD A,(DE) 1A
Load Register A with the character at Register Pair DE.
5C00
GOSUB to 5C0EH to make Register A, the character at Register Pair DE, upper case.
5C03
CP C B9
Compare Register A against Register C: the Z FLAG when the two characters are the same.
5C04
If the NZ FLAG is set (they differ), JUMP to 5C0AH to return with the flags of this comparison.
5C06
INC DE 13
INCrement Register Pair DE to the next character at Register Pair DE.
5C07
INC HL 23
INCrement Register Pair HL to the next character at Register Pair HL.
5C08
DECrement Register B and loop back to 5BFAH until all the characters are compared.
5C0A
POP HL E1
Restore Register Pair HL from the top of the stack, as the caller had it.
5C0B
POP DE D1
Restore Register Pair DE from the top of the stack, as the caller had it.
5C0C
POP BC C1
Restore Register Pair BC from the top of the stack, as the caller had it.
5C0D
RET C9
RETurn to the caller with the flags of the comparison.
5C0EH - Upper Case
Makes a lower case letter in Register A (61H-7AH) upper case; any other character is kept.
5C0E
CP 61H FE 61
Compare Register A against 61H, the letter a: the C FLAG for a character below it.
5C10
RET C D8
RETurn to the caller if the C FLAG is set: Register A is below the lower case letters.
5C11
CP 7BH FE 7B
Compare Register A against 7BH, the character after the letter z.
5C13
RET NC D0
RETurn to the caller if the NC FLAG is set: Register A is above the lower case letters.
5C14
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): the lower case letter becomes upper case.
5C16
RET C9
RETurn to the caller with the letter in Register A in upper case.
5C17H - Taking a Byte from the Queue
The queue is a ring from 5EA3H up to the byte before 5EA5H: 5EA1H the place of the next byte taken out, 5E9FH that of the next byte put in. Register A returns the byte with the C FLAG clear, or the C FLAG set when the queue is empty. Register Pair DE and Register Pair HL are kept.
5C17
PUSH DE D5
Save Register Pair DE to the top of the stack, kept for the caller.
5C18
PUSH HL E5
Save Register Pair HL to the top of the stack, kept for the caller.
5C19
LD HL,(5E9FH) 2A 9F 5E
Load Register Pair HL with the contents of 5E9FH-5EA0H, the place of the next byte put in.
5C1C
LD DE,(5EA1H) ED 5B A1 5E
Load Register Pair DE with the contents of 5EA1H-5EA2H, the place of the next byte taken out.
5C20
GOSUB to 5CE9H to compare Register Pair HL with Register Pair DE: the Z FLAG when the queue is empty.
5C23
SCF 37
Set the C FLAG, the answer for an empty queue.
5C24
If the Z FLAG is set (the queue is empty), JUMP to 5C3BH to return with the C FLAG set.
5C26
LD A,(DE) 1A
Load Register A with the byte of the queue at Register Pair DE.
5C27
PUSH AF F5
Save Register Pair AF, the byte taken out, to the top of the stack.
5C28
INC DE 13
INCrement Register Pair DE to the place after the byte taken out.
5C29
LD HL,(5EA5H) 2A A5 5E
Load Register Pair HL with the contents of 5EA5H-5EA6H, the end of the queue.
5C2C
GOSUB to 5CE9H to compare Register Pair HL, the end, with Register Pair DE: the Z FLAG at the end.
5C2F
If the NZ FLAG is set (not the end), JUMP to 5C35H to keep the new place.
5C31
LD DE,(5EA3H) ED 5B A3 5E
Load Register Pair DE with the contents of 5EA3H-5EA4H, the start of the queue, where the ring goes round.
5C35
LD (5EA1H),DE ED 53 A1 5E
Store Register Pair DE into 5EA1H-5EA2H, the place of the next byte taken out.
5C39
POP AF F1
Restore Register Pair AF, the byte taken out of the queue, from the top of the stack.
5C3A
OR A B7
Clear the C FLAG (OR A with Register A itself): a byte was taken out.
5C3B
POP HL E1
Restore Register Pair HL from the top of the stack, as the caller had it.
5C3C
POP DE D1
Restore Register Pair DE from the top of the stack, as the caller had it.
5C3D
RET C9
RETurn to the caller with the byte in Register A, or the C FLAG for an empty queue.
5C3EH - Putting a Byte into the Queue
Puts Register A in at 5E9FH unless the place after it is the next byte to be taken out; then the C FLAG is returned, the queue being full. One place of the ring stays empty, so the queue holds at most QUEUE less 2 bytes. Register A, Register Pair DE and Register Pair HL are kept.
5C3E
PUSH DE D5
Save Register Pair DE to the top of the stack, kept for the caller.
5C3F
PUSH HL E5
Save Register Pair HL to the top of the stack, kept for the caller.
5C40
SCF 37
Set the C FLAG, the answer for a full queue, kept with Register A below.
5C41
PUSH AF F5
Save Register Pair AF, the byte to put in and the C FLAG, to the top of the stack.
5C42
LD HL,(5E9FH) 2A 9F 5E
Load Register Pair HL with the contents of 5E9FH-5EA0H, the place of the next byte put in.
5C45
INC HL 23
INCrement Register Pair HL to the place after it.
5C46
LD DE,(5EA5H) ED 5B A5 5E
Load Register Pair DE with the contents of 5EA5H-5EA6H, the end of the queue.
5C4A
GOSUB to 5CE9H to compare Register Pair HL with Register Pair DE, the end: the Z FLAG at the end.
5C4D
If the NZ FLAG is set (not the end), JUMP to 5C52H to test for a full queue.
5C4F
LD HL,(5EA3H) 2A A3 5E
Load Register Pair HL with the contents of 5EA3H-5EA4H, the start of the queue, where the ring goes round.
5C52
LD DE,(5EA1H) ED 5B A1 5E
Load Register Pair DE with the contents of 5EA1H-5EA2H, the place of the next byte taken out.
5C56
GOSUB to 5CE9H to compare Register Pair HL with Register Pair DE: the Z FLAG when the queue is full.
5C59
If the Z FLAG is set (the queue is full), JUMP to 5C66H to return with the C FLAG set.
5C5B
POP AF F1
Restore Register Pair AF from the top of the stack: Register A holds the byte to put in.
5C5C
LD DE,(5E9FH) ED 5B 9F 5E
Load Register Pair DE with the contents of 5E9FH-5EA0H, the place of the next byte put in.
5C60
LD (DE),A 12
Store Register A, the byte, at Register Pair DE in the queue.
5C61
LD (5E9FH),HL 22 9F 5E
Store Register Pair HL, the place after it, into 5E9FH-5EA0H, the place of the next byte put in.
5C64
OR A B7
Clear the C FLAG (OR A with Register A itself): the byte is in the queue.
5C65
PUSH AF F5
Save Register Pair AF, the byte and the C FLAG clear, to the top of the stack for the POP below.
5C66
POP AF F1
Restore Register Pair AF from the top of the stack: Register A the byte, the C FLAG set when the queue was full.
5C67
POP HL E1
Restore Register Pair HL from the top of the stack, as the caller had it.
5C68
POP DE D1
Restore Register Pair DE from the top of the stack, as the caller had it.
5C69
RET C9
RETurn to the caller, the C FLAG set when the byte did not go into the queue.
5C6AH - Delimiters to Spaces
Turns every slash, colon, period and comma of the line at Register Pair DE, up to its 0DH, into a space, so each part becomes a word for 5BC0H. Register Pair DE is kept.
5C6A
PUSH DE D5
Save Register Pair DE, the start of the line, to the top of the stack.
5C6B
LD A,(DE) 1A
Load Register A with the character of the line at Register Pair DE.
5C6C
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of the line.
5C6E
If the Z FLAG is set (the end of the line), JUMP to 5C87H to return.
5C70
CP 2FH FE 2F
Compare Register A against 2FH, the slash, a delimiter of the line.
5C72
If the Z FLAG is set (a slash), GOSUB to 5C89H to write a space at Register Pair DE.
5C75
CP 3AH FE 3A
Compare Register A against 3AH, the colon, a delimiter of the line.
5C77
If the Z FLAG is set (a colon), GOSUB to 5C89H to write a space at Register Pair DE.
5C7A
CP 2EH FE 2E
Compare Register A against 2EH, the period, a delimiter of the line.
5C7C
If the Z FLAG is set (a period), GOSUB to 5C89H to write a space at Register Pair DE.
5C7F
CP 2CH FE 2C
Compare Register A against 2CH, the comma, a delimiter of the line.
5C81
If the Z FLAG is set (a comma), GOSUB to 5C89H to write a space at Register Pair DE.
5C84
INC DE 13
INCrement Register Pair DE to the next character of the line.
5C85
JUMP to 5C6BH to look at the next character of the line.
5C87
POP DE D1
Restore Register Pair DE, the start of the line, from the top of the stack.
5C88
RET C9
RETurn to the caller with the delimiters of the line made spaces.
5C89
LD A,20H 3E 20
Load Register A with 20H, a space, which no comparison after the call matches.
5C8B
LD (DE),A 12
Store Register A, the space, at Register Pair DE over the delimiter.
5C8C
RET C9
RETurn to the caller with the space written into the line.
5C8DH - Passing a Line Number
Steps Register Pair HL past the digits 0-9 at the start of a line, the number of a file saved by BASIC. The CP 7FH has no effect: its flags are replaced by the next comparison.
5C8D
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5C8E
CP 7FH FE 7F
Compare Register A against 7FH; the flags are not used, the next comparison sets them again.
5C90
CP 30H FE 30
Compare Register A against 30H, the digit 0: the C FLAG for a character below it.
5C92
RET C D8
RETurn to the caller if the C FLAG is set: Register A is not a digit.
5C93
CP 3AH FE 3A
Compare Register A against 3AH, the character after the digit 9.
5C95
RET NC D0
RETurn to the caller if the NC FLAG is set: Register A is not a digit.
5C96
INC HL 23
INCrement Register Pair HL past the digit to the next character.
5C97
JUMP to 5C8DH to look at the next character of the line number.
5C99H - Opening a File
Opens the file named by the first word at Register Pair HL, with the default extension at Register Pair DE, in the control block 5F00H with the buffer 4300H; the name's place is kept at 5EBCH for the test of the first line. Any error is Bad load file. Register Pair HL is kept. The procedure files are only read and are not closed.
5C99
PUSH HL E5
Save Register Pair HL, the name of the file and the values after it, to the top of the stack.
5C9A
PUSH DE D5
Save Register Pair DE, the default extension, to the top of the stack.
5C9B
GOSUB to 5B15H to find the name at Register Pair HL: Register Pair DE its start, Register B its length.
5C9E
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL points to the start of the name.
5C9F
LD (5EBCH),HL 22 BC 5E
Store Register Pair HL, the start of the name, into 5EBCH-5EBDH for the test of the first line (564FH).
5CA2
LD A,04H 3E 04
Load Register A with 04H, the error of the message Bad load file, for the jump below.
5CA4
If the Z FLAG is set (no name), JUMP to 5DA7H: Bad load file.
5CA7
LD DE,5F00H 11 00 5F
Point Register Pair DE to 5F00H, the file control block of the procedure or the file of /QLOAD.
5CAA
GOSUB to 441CH, FSPEC@ in SYS0/SYS, to take the file's name from Register Pair HL into the control block.
5CAD
LD A,04H 3E 04
Load Register A with 04H, the error of the message Bad load file, for the jump below.
5CAF
If the NZ FLAG is set (not a file's name), JUMP to 5DA7H: Bad load file.
5CB2
POP HL E1
Restore Register Pair HL from the top of the stack: the default extension, JCL or TXT.
5CB3
GOSUB to 444BH, FEXT@ in SYS0/SYS, to give the name at Register Pair DE the extension at Register Pair HL if it has none.
5CB6
LD HL,4300H 21 00 43
Point Register Pair HL to 4300H, the 256 bytes used as the file's sector buffer.
5CB9
GOSUB to 4424H, OPEN@ in SYS0/SYS, to open the file at Register Pair DE; Register B, the name's length, is the record length.
5CBC
LD A,04H 3E 04
Load Register A with 04H, the error of the message Bad load file, for the jump below.
5CBE
If the NZ FLAG is set (the file is not opened), JUMP to 5DA7H: Bad load file.
5CC1
POP HL E1
Restore Register Pair HL from the top of the stack: the name of the file and the values after it.
5CC2
RET C9
RETurn to the caller with the file open in the control block at 5F00H.
5CC3H - Two Decimal Digits
Writes Register A (0-99) at Register Pair HL as two decimal digits, the tens counted up from 30H. Register A and Register Pair HL are kept.
5CC3
PUSH AF F5
Save Register Pair AF, the number, to the top of the stack, kept for the caller.
5CC4
LD (HL),30H 36 30
Store 30H, the digit 0, at Register Pair HL, the tens digit counted up below.
5CC6
SUB 0AH D6 0A
SUBtract 0AH from Register A, ten taken off the number: the C FLAG when it goes below 0.
5CC8
If the C FLAG is set (fewer than ten left), JUMP to 5CCDH to write the units digit.
5CCA
INC (HL) 34
INCrement the byte at Register Pair HL, the tens digit, for the ten taken off.
5CCB
JUMP to 5CC6H to take off the next ten from Register A.
5CCD
ADD A,3AH C6 3A
ADD 3AH to Register A: the ten taken off too many and 30H, the units digit's character.
5CCF
INC HL 23
INCrement Register Pair HL to the place of the units digit.
5CD0
LD (HL),A 77
Store Register A, the units digit, at Register Pair HL.
5CD1
DEC HL 2B
DECrement Register Pair HL back to the tens digit, as the caller had it.
5CD2
POP AF F1
Restore Register Pair AF, the number, from the top of the stack.
5CD3
RET C9
RETurn to the caller with the two digits written at Register Pair HL.
5CD4H - Passing a Line
Steps Register Pair DE past the 0DH of the line it points to; a line that runs past the end of the text (+0CH) is EOF encountered.
5CD4
LD A,(DE) 1A
Load Register A with the character of the line at Register Pair DE.
5CD5
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of the line.
5CD7
INC DE 13
INCrement Register Pair DE to the next character; the flags of the comparison are kept.
5CD8
If the NZ FLAG is set (not the end of the line), JUMP to 5CD4H for the next character.
5CDA
LD L,(IX+0CH) DD 6E 0C
Load Register L with the low byte of the end of the text at Index Register IX+0CH.
5CDD
LD H,(IX+0DH) DD 66 0D
Load Register H with the high byte of the end of the text at Index Register IX+0DH.
5CE0
GOSUB to 5CE9H to compare Register Pair HL, the end of the text, with Register Pair DE, the next line.
5CE3
LD A,03H 3E 03
Load Register A with 03H, the error of the message EOF encountered, for the jump below.
5CE5
If the C FLAG is set (the next line is past the end of the text), JUMP to 5DA7H: EOF encountered.
5CE8
RET C9
RETurn to the caller with Register Pair DE pointing to the next line.
5CE9H - Comparing Two Addresses
Compares Register Pair HL with Register Pair DE: the Z FLAG when they are equal, the C FLAG when Register Pair HL is the smaller. Register A is changed.
5CE9
LD A,H 7C
Load Register A with Register H, the high byte of the first address.
5CEA
CP D BA
Compare Register A against Register D, the high bytes of the two addresses.
5CEB
RET NZ C0
RETurn to the caller if the NZ FLAG is set: the high bytes decide.
5CEC
LD A,L 7D
Load Register A with Register L, the low byte of the first address.
5CED
CP E BB
Compare Register A against Register E, the low bytes of the two addresses.
5CEE
RET C9
RETurn to the caller with the flags of the comparison of the low bytes.
5CEFH - The Jumps Put over the Entry Points
5CEFH-5CF4H are copied over EXIT@ and ABORT@, 5CF5H-5CF8H over ERROR@ during EX (5580H-5587H); 5CF8H and 5CFBH are also the way to the keyboard and display drivers JCL found (5235H, 524FH). 5CFEH-5D0AH keep the bytes of EXIT@, ABORT@, ERROR@ and CMNDI@ (00H as loaded); the last two groups are run as code.
5CEF
JUMP to 5D19H: copied over EXIT@ (402DH) during EX, a program's end comes back to the /DOS that ran it.
5CF2
JUMP to 5D26H: copied over ABORT@ (4030H) during EX, an abort ends the /DOS with the error code 3FH.
5CF5
JUMP to 5D28H: copied over ERROR@ (4409H) during EX, an error ends the /DOS with its code.
5CF8
JUMP to 0000H, an operand set to the address of the KI driver JCL found (5235H); its C3H also goes to 440CH.
5CFB
JUMP to 0000H, an operand set to the address of the DO driver JCL found (524FH), the display driver.
5CFE-5D03
DEFB 00H x 6 00 00 00 00 00 00
The six bytes of EXIT@ and ABORT@ (402DH-4032H), kept here during EX (5570H) and put back after it (55A6H).
5D04-5D07
DEFB 00H x 4 00 00 00 00
The four bytes of ERROR@ (4409H-440CH, PUSH AF / LD A,43H / RST 28H), kept here during EX and run by 5D2AH for an error with bit 7 set.
5D08-5D0A
DEFB 00H x 3 00 00 00
The three bytes of CMNDI@ (4405H, LD A,05H / RST 28H), copied here by 525CH: CMNDI@ as it was, entered by 5559H and 5D16H.
5D0BH - Running a DOS Command
Runs the command line at Register Pair HL through CMNDI@ as it was (5D08H), with Index Register IX and the Stack Pointer kept in a chain through 5EABH. The command's return, EXIT@ (5D19H), ABORT@ (5D26H, the code 3FH) and ERROR@ with bit 7 clear (5D28H) all come back to 5D1AH with Register A holding the error code, bits 5-0; ERROR@ with bit 7 set runs as it was (5D04H). During EX an error of a DOS command is therefore not shown, only put into $ERR.
5D0B
PUSH IX DD E5
Save Index Register IX, the frame of the level, to the top of the stack.
5D0D
LD BC,(5EABH) ED 4B AB 5E
Load Register Pair BC with the contents of 5EABH-5EACH, the Stack Pointer of the /DOS before this one.
5D11
PUSH BC C5
Save Register Pair BC, the Stack Pointer of the /DOS before, to the top of the stack.
5D12
LD (5EABH),SP ED 73 AB 5E
Store the Stack Pointer into 5EABH-5EACH, to be taken back when the command ends.
5D16
GOSUB to 5D08H, CMNDI@ as it was, to run the command line at Register Pair HL.
5D19
XOR A AF
Set Register A to 00H (XOR A), no error: the command returned, or EXIT@ (402DH) jumped here.
5D1A
LD SP,(5EABH) ED 7B AB 5E
Load the Stack Pointer with the contents of 5EABH-5EACH, the stack at the start of the command.
5D1E
POP BC C1
Restore Register Pair BC from the top of the stack: the Stack Pointer of the /DOS before.
5D1F
LD (5EABH),BC ED 43 AB 5E
Store Register Pair BC into 5EABH-5EACH, for the /DOS before this one.
5D23
POP IX DD E1
Restore Index Register IX, the frame of the level, from the top of the stack.
5D25
RET C9
RETurn to the caller of 5D0BH with the error code in Register A, 00H for none.
5D26
LD A,3FH 3E 3F
Load Register A with 3FH, the error code for ABORT@ (4030H), which jumps here during EX.
5D28
BIT 7,A CB 7F
Test bit 7 of Register A, the error code: set when ERROR@ is to return to its caller.
5D2A
If the NZ FLAG is set (bit 7 set), JUMP to 5D04H to run ERROR@ as it was, with Register A the error.
5D2D
AND 3FH E6 3F
Keep only bits 5 to 0 of Register A (AND 3FH), the error code without its bits 7 and 6.
5D2F
JUMP to 5D1AH to end the command with the error code in Register A.
5D31H - JCL's Keyboard Driver
The driver of the KI device after the installation. With QUEUE off (bit 2 of 5E96H) the keyboard's own driver runs (5CF8H). With QBYTE off (bit 4) the queue serves only a request whose return address, twelve bytes up the stack, is 004CH, that is one made through the ROM's 0049H, as the ROM's line input does; others go to the keyboard. An empty queue goes to the keyboard. FFH is a /JUMP (5A86H); FEH sets bit 6, the echo off (VOFF), and a 0DH after it is passed. With CHR off (bit 5) the characters 20H-2FH and 3AH-3FH become spaces.
5D31
LD HL,5E96H 21 96 5E
Point Register Pair HL to 5E96H, the options of JCL, one bit each.
5D34
BIT 2,(HL) CB 56
Test bit 2 of the byte at Register Pair HL, the option QUEUE.
5D36
If the Z FLAG is set (QUEUE off), JUMP to 5CF8H, the keyboard's own driver.
5D39
BIT 4,(HL) CB 66
Test bit 4 of the byte at Register Pair HL, the option QBYTE.
5D3B
If the NZ FLAG is set (QBYTE on), JUMP to 5D4EH: the queue serves every request.
5D3D
PUSH HL E5
Save Register Pair HL (5E96H) to the top of the stack while the return address is looked at.
5D3E
LD HL,000CH 21 0C 00
Load Register Pair HL with 000CH, the distance up the stack to the return address tested.
5D41
ADD HL,SP 39
ADD the Stack Pointer to Register Pair HL: the place of the word 12 bytes up the stack.
5D42
LD E,(HL) 5E
Load Register E with the low byte of that return address at Register Pair HL.
5D43
INC HL 23
INCrement Register Pair HL to the high byte of the return address.
5D44
LD D,(HL) 56
Load Register D with the high byte at Register Pair HL: Register Pair DE holds the return address tested.
5D45
LD HL,004CH 21 4C 00
Load Register Pair HL with 004CH, the return address in the ROM's 0049H, which waits for a key.
5D48
GOSUB to 5CE9H to compare Register Pair HL (004CH) with Register Pair DE: the Z FLAG if equal.
5D4B
POP HL E1
Restore Register Pair HL (5E96H), the options, from the top of the stack; the flags are kept.
5D4C
If the NZ FLAG is set (another request), JUMP to 5D7AH, the keyboard's own driver.
5D4E
GOSUB to 5C17H to take the next byte from the queue into Register A: the C FLAG when it is empty.
5D51
If the C FLAG is set (the queue is empty), JUMP to 5D7AH, the keyboard's own driver.
5D53
CP FFH FE FF
Compare Register A against FFH, the byte of /JUMP in the queue.
5D55
If the Z FLAG is set (FFH), JUMP to 5A86H to stop the program and run the procedure at the label.
5D58
CP FEH FE FE
Compare Register A against FEH, the byte of /VOFF in the queue.
5D5A
If the NZ FLAG is set (another byte), JUMP to 5D65H to give the program the character.
5D5C
SET 6,(HL) CB F6
Set bit 6 of the byte at Register Pair HL: the echo is off up to the next carriage return (5D98H).
5D5E
GOSUB to 5C17H to take the next byte from the queue into Register A.
5D61
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that may follow /VOFF in the queue.
5D63
If the Z FLAG is set (a carriage return), JUMP to 5D4EH: it is passed and the next byte taken.
5D65
BIT 5,(HL) CB 6E
Test bit 5 of the byte at Register Pair HL, the option CHR.
5D67
RET NZ C0
RETurn to the program if the NZ FLAG is set: CHR is on, the character in Register A is kept.
5D68
CP 20H FE 20
Compare Register A against 20H, the space: the C FLAG for a control character.
5D6A
RET C D8
RETurn to the program if the C FLAG is set: a control character in Register A is kept.
5D6B
CP 30H FE 30
Compare Register A against 30H, the digit 0: the C FLAG for the characters 20H-2FH.
5D6D
If the C FLAG is set (20H-2FH), JUMP to 5D76H to give a space in its place.
5D6F
CP 3AH FE 3A
Compare Register A against 3AH, the character after the digit 9.
5D71
RET C D8
RETurn to the program if the C FLAG is set: a digit in Register A is kept.
5D72
CP 40H FE 40
Compare Register A against 40H, the at sign: the NC FLAG for 40H and above.
5D74
If the NC FLAG is set (40H or above), JUMP to 5D78H: the character in Register A is kept.
5D76
LD A,20H 3E 20
Load Register A with 20H, a space, in place of the special character.
5D78
OR A B7
OR Register A with itself, which clears the C FLAG, for the character in Register A.
5D79
RET C9
RETurn to the program with the character from the queue in Register A.
5D7A
JUMP to 5CF8H, the keyboard's own driver, which reads the keyboard.
5D7DH - JCL's Display Driver
The driver of the DO device after the installation, with the character in Register C. With DQ on (bit 7 of 5E96H) a 0DH or any character from 20H up goes into the queue too (QUEUE full when it does not fit). With DSP off (bit 0) nothing is shown; while bit 6 is set (VOFF) the characters are not shown up to and including the next 0DH, which clears it. Else the display's own driver runs (5CFBH).
5D7D
LD HL,5E96H 21 96 5E
Point Register Pair HL to 5E96H, the options of JCL, one bit each.
5D80
LD A,C 79
Load Register A with Register C, the character to display.
5D81
BIT 7,(HL) CB 7E
Test bit 7 of the byte at Register Pair HL, the option DQ.
5D83
If the Z FLAG is set (DQ off), JUMP to 5D95H: the character does not go into the queue.
5D85
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return, which goes into the queue.
5D87
If the Z FLAG is set (a carriage return), JUMP to 5D8DH to put it into the queue.
5D89
CP 20H FE 20
Compare Register A against 20H, the space: the C FLAG for a control character.
5D8B
If the C FLAG is set (a control character), JUMP to 5D95H: it does not go into the queue.
5D8D
GOSUB to 5C3EH to put Register A, the character, into the queue: the C FLAG when it is full.
5D90
LD A,0CH 3E 0C
Load Register A with 0CH, the error of the message QUEUE full, for the jump below.
5D92
If the C FLAG is set (the queue is full), JUMP to 5DA7H: QUEUE full.
5D95
BIT 0,(HL) CB 46
Test bit 0 of the byte at Register Pair HL, the option DSP.
5D97
RET Z C8
RETurn to the caller if the Z FLAG is set: DSP is off, nothing is shown.
5D98
BIT 6,(HL) CB 76
Test bit 6 of the byte at Register Pair HL, set by /VOFF from the queue.
5D9A
If the Z FLAG is set (the echo is on), JUMP to 5DA4H to display the character.
5D9D
LD A,C 79
Load Register A with Register C, the character not shown.
5D9E
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that ends the line not shown.
5DA0
RET NZ C0
RETurn to the caller if the NZ FLAG is set: the character is not shown.
5DA1
RES 6,(HL) CB B6
Reset bit 6 of the byte at Register Pair HL: the echo is on again after this line.
5DA3
RET C9
RETurn to the caller: the carriage return of the line from the queue is not shown either.
5DA4
JUMP to 5CFBH, the display's own driver, to show the character in Register C.
5DA7H - JCL's Errors
Register A holds JCL's error number, 01H-0CH. The queue is emptied, the level, the count of /DOS and the options (25H) are set back, the procedure area is free again and $ERR's value is 00; the message, the Register A th text after the 03H at 5DF3H, is shown between two signs %% and EX ends through 559CH, which sets EXIT@, ABORT@ and ERROR@ back.
5DA7
LD SP,5FBFH 31 BF 5F
Load the Stack Pointer with 5FBFH, JCL's own stack, for any depth of levels and /JUMP.
5DAA
PUSH AF F5
Save Register Pair AF, the error number in Register A, to the top of the stack.
5DAB
GOSUB to 5A1CH, /PURGE, to empty the keyboard queue.
5DAE
XOR A AF
Set Register A to 00H (XOR A) for the level and the count of /DOS commands.
5DAF
LD (5E98H),A 32 98 5E
Store Register A (00H) into 5E98H, the level: no procedure is running.
5DB2
LD (5E97H),A 32 97 5E
Store Register A (00H) into 5E97H, the count of /DOS commands.
5DB5
LD A,25H 3E 25
Load Register A with 25H, the options at the start of EX: DSP, QUEUE and CHR on.
5DB7
LD (5E96H),A 32 96 5E
Store Register A (25H) into 5E96H, the options of JCL.
5DBA
LD HL,(5E9BH) 2A 9B 5E
Load Register Pair HL with the contents of 5E9BH-5E9CH, the start of the procedure area.
5DBD
LD (5E99H),HL 22 99 5E
Store Register Pair HL into 5E99H-5E9AH, the free place: the whole area is free again.
5DC0
LD HL,3030H 21 30 30
Load Register Pair HL with 3030H, the two digits 00.
5DC3
LD (582FH),HL 22 2F 58
Store Register Pair HL (3030H) into 582FH-5830H, the value of $ERR: 00.
5DC6
POP BC C1
Restore Register Pair BC from the top of the stack: Register B holds the error number.
5DC7
LD HL,5DF3H 21 F3 5D
Point Register Pair HL to 5DF3H, the 03H before the first of JCL's messages.
5DCA
LD A,(HL) 7E
Load Register A with the next byte of the messages at Register Pair HL.
5DCB
INC HL 23
INCrement Register Pair HL to the byte after it.
5DCC
CP 03H FE 03
Compare Register A against 03H, the byte before each message.
5DCE
If the NZ FLAG is set (not 03H), JUMP to 5DCAH for the next byte of the messages.
5DD0
DECrement Register B, the error number, and loop back to 5DCAH until the message is reached.
5DD2
PUSH HL E5
Save Register Pair HL, the message, to the top of the stack.
5DD3
LD HL,5E93H 21 93 5E
Point Register Pair HL to 5E93H, the two signs %% ended by 03H.
5DD6
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the text at Register Pair HL, the signs %%.
5DD9
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer: Register Pair HL the message, 5E93H kept.
5DDA
LD A,20H 3E 20
Load Register A with 20H, a space after the signs %%.
5DDC
GOSUB to 0033H, the ROM's display routine, to display the space in Register A.
5DDF
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the message at Register Pair HL up to its 03H.
5DE2
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer: Register Pair HL points to 5E93H again.
5DE3
LD A,20H 3E 20
Load Register A with 20H, a space after the message.
5DE5
GOSUB to 0033H, the ROM's display routine, to display the space in Register A.
5DE8
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the text at Register Pair HL, the signs %%.
5DEB
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the line of the error.
5DED
GOSUB to 0033H, the ROM's display routine, to display the carriage return in Register A.
5DF0
JUMP to 559CH to set EXIT@, ABORT@ and ERROR@ back and end EX through EXIT@.
5DF3H - The Texts and the Variables
JCL's twelve messages, each after a 03H and ended by one, then the default extensions, the name EX, the signs %%, the options and the pointers of the procedure area and the queue. The words at 5E99H-5EA6H hold their own addresses as loaded; the installer writes them (5261H-5289H) and JCL/RLD relocates them.
5DF3
DEFB 03H 03
The 03H before the first message, counted by 5DCCH like the 03H that ends each message.
5DF4-5E01
DEFM "Out of memory" / DEFB 03H 4F 75 74 20 6F 66 20 6D 65 6D 6F 72 79 03
Error 01H (55F4H, 5B91H): the text, the variables or a frame reach the queue.
5E02-5E0E
DEFM "Bad JCL file" / DEFB 03H 42 61 64 20 4A 43 4C 20 66 69 6C 65 03
Error 02H (564BH, 5658H): the first line has no name, or not the name of the procedure.
5E0F-5E1E
DEFM "EOF encountered" / DEFB 03H 45 4F 46 20 65 6E 63 6F 75 6E 74 65 72 65 64 03
Error 03H (56B9H, 5CE5H): the end of the text is reached without /EXIT, or by /GOTO.
5E1F-5E2C
DEFM "Bad load file" / DEFB 03H 42 61 64 20 6C 6F 61 64 20 66 69 6C 65 03
Error 04H (5CA4H, 5CAFH, 5CBEH): the file of EX, /RUN or /QLOAD is not named or not opened.
5E2D-5E39
DEFM "Bad /COMMAND" / DEFB 03H 42 61 64 20 2F 43 4F 4D 4D 41 4E 44 03
Error 05H (5777H, 5783H): a line that is not a remark, a label, an assignment or a command of the table.
5E3A-5E45
DEFM "Bad /OPTION" / DEFB 03H 42 61 64 20 2F 4F 50 54 49 4F 4E 03
Error 06H (587BH): an option not in the table 5880H, or a switch other than Y or N.
5E46-5E54
DEFM "Bad assignment" / DEFB 03H 42 61 64 20 61 73 73 69 67 6E 6D 65 6E 74 03
Error 07H (5A54H): the word after the name of an assignment does not start with an equal sign.
5E55-5E5C
DEFM "Bad /IF" / DEFB 03H 42 61 64 20 2F 49 46 03
Error 08H (5907H, 5919H): the relation of /IF is not two letters or not in the table 5991H.
5E5D-5E67
DEFM "Bad -LABEL" / DEFB 03H 42 61 64 20 2D 4C 41 42 45 4C 03
Error 09H (59A3H): the label of /GOTO or /JUMP does not start with a minus sign.
5E68-5E75
DEFM "Line too long" / DEFB 03H 4C 69 6E 65 20 74 6F 6F 20 6C 6F 6E 67 03
Error 0AH (573AH): the line with its variables replaced runs past 5EFFH.
5E76-5E7E
DEFM "Bad $VAR" / DEFB 03H 42 61 64 20 24 56 41 52 03
Error 0BH (5B66H, 5BD7H, 5BDBH): a name without its dollar sign, or a dollar sign with no name.
5E7F-5E89
DEFM "QUEUE full" / DEFB 03H 51 55 45 55 45 20 66 75 6C 6C 03
Error 0CH (5A00H, 5A17H, 5D92H): the queue has no room for the next byte.
5E8A-5E8C
DEFM "TXT" 54 58 54
The default extension TXT of the file of /QLOAD (5A05H), given to FEXT@.
5E8D-5E8F
DEFM "JCL" 4A 43 4C
The default extension JCL of a procedure file for EX (558EH) and /RUN (5A69H).
5E90-5E92
DEFM "EX" / DEFB 03H 45 58 03
The command EX, as FSPEC@ leaves a name with its 03H, compared by 5551H.
5E93-5E95
DEFM "%%" / DEFB 03H 25 25 03
The two signs %% shown before and after the message of an error (5DD3H).
5E96
DEFB 25H 25
The options of JCL, as loaded 25H: bit 0 DSP, 1 JCL, 2 QUEUE, 3 a /JUMP runs, 4 QBYTE, 5 CHR, 6 the echo off, 7 DQ.
5E97
DEFB 00H 00
The count of /DOS commands (58B2H), tested by /CANCEL and set to 00H by an error.
5E98
DEFB 00H 00
The level of the procedure being run (55E1H), 00H with none; its digit is the value of $LEVEL.
5E99-5E9A
DEFW 5E99H 99 5E
The free place of the procedure area (55CAH), where the next frame or text goes; set by 5286H.
5E9B-5E9C
DEFW 5E9BH 9B 5E
The start of the procedure area (5289H), where the free place is set back to after an error (5DBAH).
5E9D-5E9E
DEFW 5E9DH 9D 5E
The limit of the procedure area, the byte below the queue (527AH): Out of memory there.
5E9F-5EA0
DEFW 5E9FH 9F 5E
The place of the next byte put into the queue (5273H, 5C61H).
5EA1-5EA2
DEFW 5EA1H A1 5E
The place of the next byte taken out of the queue (5276H, 5C35H); the queue is empty when it equals 5E9FH.
5EA3-5EA4
DEFW 5EA3H A3 5E
The start of the queue (5270H), where the ring goes round to (5C31H).
5EA5-5EA6
DEFW 5EA5H A5 5E
The end of the queue (5261H), as loaded 5537H relocated: the byte before it is the queue's last.
5EA7-5EA8
DEFS 2
The routine of the line being run (5794H, 57A6H), jumped to by 5697H.
5EA9-5EAA
DEFS 2
The frame of the line last run (5680H), taken by /JUMP (5AA4H).
5EAB-5EAC
DEFS 2
The Stack Pointer of the /DOS command running (5D12H), a chain through the stack for nested commands.
5EAD-5EAE
DEFS 2
The Stack Pointer of the program stopped by /JUMP (5A8DH), taken back by /RESUME and /CANCEL.
5EAF
DEFS 1
The length of the first value of /IF (58E5H).
5EB0-5EB1
DEFS 2
The start of the first value of /IF (58E8H) in the line buffer.
5EB2
DEFS 1
The length of the relation of /IF (58EFH), then its number 1-6 (5914H).
5EB3-5EB4
DEFS 2
The start of the relation of /IF (58F2H) in the line buffer.
5EB5
DEFS 1
The length of the second value of /IF (58F9H).
5EB6-5EB7
DEFS 2
The start of the second value of /IF (58FCH).
5EB8-5EB9
DEFS 2
The place of the next name for 5BC0H (5BCEH).
5EBA-5EBB
DEFS 2
The place of the next value for 5BC0H (5BEAH).
5EBC-5EBD
DEFS 2
The name given to EX, /RUN or /QLOAD (5C9FH), compared with the first line of a procedure.
5EBE
DEFB 24H 24
A dollar sign below the line buffer, loaded as its own block: the search for a $ in 56E7H stops here.
5EBF-5EFF
DEFS 65
The line buffer: the rest of the line of EX, a line with its variables replaced (56D0H), the line of /READ and the label of /JUMP.
5F00-5F3E
DEFS 63
The file control block of the procedure and /QLOAD files (5CA7H), and the rest of a line while a variable is replaced (570EH).
5F3F-5FBE
DEFS 128
JCL's stack, from 5FBFH down (555CH, 5DA7H), for the levels and /DOS.
5FBF-603F
DEFS 129
The stack of /JUMP, from 603FH down (5A98H); 603FH is the last byte of the resident part.