5200H - Entry: the Memory Test and the Copy of the Command Line
LDOS Ready loads HELP/CMD at 5200H-5AEFH (with three small blocks beyond it at 5B18H, 5C90H and 6093H-6098H) and jumps to 5200H, the transfer address, with Register Pair HL at the rest of the command line after the word HELP and the spaces after it. The command is HELP [filespec [keyword]] [(P,V,B,S)], or HELP followed by an asterisk and a keyword for the global scan (M-40-060). HIGH$ must be at least 6497H, 1024 bytes above 6097H, the first byte after the file's cells; else Not enough Memory for HELP and @ABORT. Index Register IY points at the two flag bytes at 5AE5H for the whole program. The command line up to its 0DH is copied to 5B19H, so that the category and keyword prompts can later put a new line in the same place.
5200
PUSH HL E5
Save Register Pair HL (the pointer to the command line after HELP) to the stack across the memory test.
5201
LD HL,0400H 21 00 04
Load Register Pair HL with 0400H, the 1024 bytes HELP wants free above its last cell, for the list of the HELP files and the blink table.
5204
LD DE,6097H 11 97 60
Load Register Pair DE with 6097H, the byte after the cells 6093H-6096H: the place where the blink table starts when no file list is built.
5207
ADD HL,DE 19
ADD Register Pair DE (6097H) to Register Pair HL (0400H): Register Pair HL = 6497H, the lowest HIGH$ that leaves HELP enough room.
5208
LD DE,(4411H) ED 5B 11 44
Fetch HIGH$ from 4411H-4412H into Register Pair DE: the highest address a program may use.
520C
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair HL = HIGH$, Register Pair DE = 6497H.
520D
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
520E
SBC HL,DE ED 52
Subtract Register Pair DE (6497H) from Register Pair HL (HIGH$): the CARRY FLAG when HIGH$ is below 6497H.
5210
If the CARRY FLAG is set (too little memory), JUMP to 5928H to display Not enough Memory for HELP and end at @ABORT.
5213
POP HL E1
Restore Register Pair HL from the stack: the pointer to the command line.
5214
LD IY,5AE5H FD 21 E5 5A
Point Index Register IY to 5AE5H, the first of the two flag bytes: IY+00H the options and the state of the command, IY+01H the state of the text display.
5218
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H: Register C counts the characters of the command line, Register B stays 00H for the LDIR below.
521B
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
521C
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the command line.
521E
If the Z FLAG is set (the end of the line), JUMP to 5224H with Register C = the length of the line.
5220
INC C 0C
INCrement Register C, the count of the characters of the command line.
5221
INC HL 23
INCrement Register Pair HL to the next character of the command line.
5222
JUMP back to 521BH to look at the next character.
5224
LD A,C 79
Copy Register C (the length of the command line) into Register A.
5225
PUSH HL E5
Save Register Pair HL (the address of the 0DH) to the stack: 57C1H takes this word back when HELP alone was typed.
5226
OR A B7
Set the flags from Register A (OR A), the length: the Z FLAG for HELP with nothing after it.
5227
If the Z FLAG is set (no file, no keyword, no parameter), JUMP to 531DH to save the screen and list the HELP files on line.
522A
POP HL E1
Restore Register Pair HL from the stack: the address of the 0DH.
522B
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
522C
SBC HL,BC ED 42
Subtract Register Pair BC (the length) from Register Pair HL: Register Pair HL = the first character of the command line again.
522E
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the 64 byte line buffer beyond the file where HELP keeps the line it works on.
5231
LDIR ED B0
Copy the command line from Register Pair HL to 5B19H at Register Pair DE, Register Pair BC the count (LDIR); Register Pair DE ends after it.
5233
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, for the end of the copy at 5B19H.
5235
LD (DE),A 12
Store Register A (0DH) at Register Pair DE, after the copy: the line at 5B19H ends with 0DH as the original did.
5236H - The First Word of the Line
Register Pair HL goes over the spaces of the line at 5B19H. The line is taken from here again when an answer to the category prompt has been typed (5718H). An empty line, or one that starts with an asterisk, goes to 531DH with the pointer on the stack: there 57C1H finds the asterisk and starts the global scan with the word after it. A line that starts with an opening parenthesis has only parameters. Anything else is the file specification.
5236
LD HL,5B19H 21 19 5B
Point Register Pair HL to 5B19H, the copy of the command line (or the answer to the category prompt).
5239
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
523A
CP 20H FE 20
Compare Register A (the character) against 20H, a space.
523C
If the NZ FLAG is set (not a space), JUMP to 5241H to look at the character.
523E
INC HL 23
INCrement Register Pair HL past the space, to the next character of the line.
523F
JUMP back to 5239H to look at the next character.
5241
CP 0DH FE 0D
Compare Register A (the first character after the spaces) against 0DH, the end of the line.
5243
PUSH HL E5
Save Register Pair HL (the first character after the spaces) to the stack: 57C1H takes it back to test it for an asterisk.
5244
If the Z FLAG is set (an empty line), JUMP to 531DH with the pointer on the stack, to list the HELP files on line.
5247
CP 2AH FE 2A
Compare Register A (the character) against 2AH, the asterisk of the global scan.
5249
If the Z FLAG is set (an asterisk), JUMP to 531DH with the pointer on the stack: 57C2H starts the global scan after the file list is built.
524C
POP HL E1
Restore Register Pair HL from the stack: the first character after the spaces.
524D
CP 28H FE 28
Compare Register A (the character) against 28H, an opening parenthesis.
524F
If the NZ FLAG is set (not a parenthesis), JUMP to 5299H to take the word as the file specification.
5251H - The Parameters
The letters inside the parentheses are taken one at a time, made capitals with RES 5: P (output to the printer as well, IY+00H bit 7 set), V (no restore of the screen, bit 6 cleared), S (search mode, bit 4 set) and B (no blinking, bit 5 cleared). Each letter must be followed by 0DH, a closing parenthesis or a comma (58B8H), else Parameter Error. Any other character, a comma or a letter such as R, is passed over without an error. A closing parenthesis or 0DH ends the list. Bit 6 and bit 5 are set in the file (60H at 5AE5H), so the screen is restored and the marked characters blink unless V or B is given.
5251
INC HL 23
INCrement Register Pair HL to the next character inside the parentheses.
5252
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5253
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
5255
If the Z FLAG is set (the line ends), JUMP to 531DH to save the screen and go on with what has been taken.
5258
CP 29H FE 29
Compare Register A (the character) against 29H, the closing parenthesis.
525A
If the Z FLAG is set (the end of the parameters), JUMP to 531DH to save the screen and go on.
525D
RES 5,A CB AF
Reset bit 5 of Register A: a small letter becomes a capital (and other characters change too, which none of the tests below then matches).
525F
CP 50H FE 50
Compare Register A (the letter) against 50H, the letter P.
5261
If the NZ FLAG is set (not P), JUMP to 526DH to test for V.
5263
GOSUB to 58B8H to test that the character after P ends the parameter: the Z FLAG and Register A = 00H when it does.
5266
If the NZ FLAG is set (P followed by another letter), JUMP to 591BH to display Parameter Error and end.
5269
SET 7,(IY+00H) FD CB 00 FE
Set bit 7 of IY+00H (5AE5H, Index Register IY): every character displayed is also sent to the printer (5456H).
526D
CP 56H FE 56
Compare Register A (the letter, or 00H after P) against 56H, the letter V.
526F
If the NZ FLAG is set (not V), JUMP to 527BH to test for S.
5271
GOSUB to 58B8H to test that the character after V ends the parameter: the Z FLAG and Register A = 00H when it does.
5274
If the NZ FLAG is set (V followed by another letter), JUMP to 591BH to display Parameter Error and end.
5277
RES 6,(IY+00H) FD CB 00 B6
Reset bit 6 of IY+00H (5AE5H, Index Register IY): the screen is not saved at 531DH nor restored at the end.
527B
CP 53H FE 53
Compare Register A (the letter, or 00H) against 53H, the letter S.
527D
If the NZ FLAG is set (not S), JUMP to 5289H to test for B.
527F
GOSUB to 58B8H to test that the character after S ends the parameter: the Z FLAG and Register A = 00H when it does.
5282
If the NZ FLAG is set (S followed by another letter), JUMP to 591BH to display Parameter Error and end.
5285
SET 4,(IY+00H) FD CB 00 E6
Set bit 4 of IY+00H (5AE5H, Index Register IY): search mode, the directory lists only the keywords that start with the word given.
5289
CP 42H FE 42
Compare Register A (the letter, or 00H) against 42H, the letter B.
528B
If the NZ FLAG is set (not B, or any other character), JUMP to 5251H to take the next character inside the parentheses.
528D
GOSUB to 58B8H to test that the character after B ends the parameter: the Z FLAG and Register A = 00H when it does.
5290
If the NZ FLAG is set (B followed by another letter), JUMP to 591BH to display Parameter Error and end.
5293
RES 5,(IY+00H) FD CB 00 AE
Reset bit 5 of IY+00H (5AE5H, Index Register IY): the characters marked with 7FH in the text do not blink.
5297
JUMP back to 5251H to take the next character inside the parentheses.
5299H - The HELP File and the Keyword
The word at Register Pair HL is taken by @FSPEC into the file control block at 5AF0H; a word that is not a file specification is dropped and HELP lists the files on line. The first characters of the line taken, at most 8, are copied from the specification in the control block to 5B10H for the heading Directory for HELP file. Then the keyword: during the global scan it is already at 5B59H; otherwise it is the next word of the line, up to 0DH or an opening parenthesis, with small letters made capitals in place. It is copied to 5B59H, one space at its end is dropped, and it gets 0DH; IY+00H bit 1 says a keyword was given. A keyword may hold a space, as DEBUG EXT does in DOS/HLP.
5299
LD DE,5AF0H 11 F0 5A
Point Register Pair DE to 5AF0H, the file control block of the HELP file, beyond the file.
529C
GOSUB to 441CH, @FSPEC, to take the word at Register Pair HL as a file specification into the control block at Register Pair DE (5AF0H): the Z FLAG when it is one, Register Pair HL after it.
529F
If the NZ FLAG is set (not a file specification), JUMP to 531DH to save the screen and list the HELP files on line.
52A2
SET 2,(IY+00H) FD CB 00 D6
Set bit 2 of IY+00H (5AE5H, Index Register IY): a file was named, 5348H will open it.
52A6
PUSH HL E5
Save Register Pair HL (the text after the file specification) to the stack.
52A7
PUSH DE D5
Save Register Pair DE (5AF0H, the specification as @FSPEC stored it) to the stack.
52A8
LD BC,5B19H 01 19 5B
Load Register Pair BC with 5B19H, the start of the line buffer.
52AB
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
52AC
SBC HL,BC ED 42
Subtract Register Pair BC (5B19H) from Register Pair HL: Register Pair HL = the number of characters taken from the line, spaces before the word included.
52AE
PUSH HL E5
Save Register Pair HL (the count) to the stack, to move it into Register Pair BC.
52AF
POP BC C1
Restore it into Register Pair BC: Register Pair BC = the count of the characters taken.
52B0
LD A,08H 3E 08
Load Register A with 08H, the most characters of the name kept for the heading.
52B2
CP C B9
Compare Register A (08H) against Register C, the count: the CARRY FLAG when the count is above 8.
52B3
If the NO CARRY FLAG is set (8 or fewer), JUMP to 52B8H with the count in Register Pair BC.
52B5
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H: only the first 8 characters are kept.
52B8
LD HL,5B10H 21 10 5B
Point Register Pair HL to 5B10H, the 8 bytes beyond the file for the name of the HELP file.
52BB
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = 5B10H, Register Pair HL = 5AF0H, the specification in the control block.
52BC
LDIR ED B0
Copy Register Pair BC bytes of the specification from Register Pair HL (5AF0H) to Register Pair DE (5B10H), LDIR: capitals, as @FSPEC stored them.
52BE
LD A,0DH 3E 0D
Load Register A with 0DH, the end of the name.
52C0
LD (DE),A 12
Store Register A (0DH) at Register Pair DE, after the name: 559FH displays 5B10H up to this 0DH.
52C1
POP DE D1
Restore Register Pair DE from the stack: 5AF0H, the control block.
52C2
POP HL E1
Restore Register Pair HL from the stack: the text after the file specification.
52C3
BIT 3,(IY+00H) FD CB 00 5E
Test bit 3 of IY+00H (5AE5H, Index Register IY), the global scan, which 580CH sets.
52C7
If the Z FLAG is set (no global scan), JUMP to 52CEH to take the keyword from the line.
52C9
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the keyword the global scan copied there (580CH).
52CC
JUMP to 52E0H to make it capitals and end it, as a keyword from the line.
52CE
LD A,(HL) 7E
Fetch the character at Register Pair HL (after the file specification) into Register A.
52CF
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
52D1
If the Z FLAG is set (no keyword), JUMP to 531DH to save the screen and open the file for its directory.
52D4
CP 28H FE 28
Compare Register A (the character) against 28H, an opening parenthesis.
52D6
If the Z FLAG is set (parameters, no keyword), JUMP to 5251H to take the parameters.
52D9
CP 20H FE 20
Compare Register A (the character) against 20H, a space.
52DB
If the NZ FLAG is set (the first character of the keyword), JUMP to 52E0H to take the keyword.
52DD
INC HL 23
INCrement Register Pair HL past the space, to the next character after the file specification.
52DE
JUMP back to 52CEH to look at the next character.
52E0
PUSH HL E5
Save Register Pair HL (the first character of the keyword) to the stack, to copy it into Register Pair DE.
52E1
POP DE D1
Restore it into Register Pair DE: Register Pair DE goes along the keyword, Register Pair HL stays at its start.
52E2
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H: Register C counts the characters of the keyword, Register B stays 00H for the LDIR.
52E5
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
52E6
CP 61H FE 61
Compare Register A (the character) against 61H, a small a.
52E8
If the CARRY FLAG is set (below a small a), JUMP to 52F1H with the character as it is.
52EA
CP 7BH FE 7B
Compare Register A (the character) against 7BH, the character after a small z.
52EC
If the NO CARRY FLAG is set (above a small z), JUMP to 52F1H with the character as it is.
52EE
RES 5,A CB AF
Reset bit 5 of Register A: the small letter becomes a capital.
52F0
LD (DE),A 12
Store Register A (the capital) back at Register Pair DE, over the small letter.
52F1
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
52F3
If the Z FLAG is set (the end), JUMP to 52FDH with Register C = the length of the keyword.
52F5
CP 28H FE 28
Compare Register A (the character) against 28H, an opening parenthesis.
52F7
If the Z FLAG is set (the parameters start), JUMP to 52FDH: the keyword ends before them.
52F9
INC C 0C
INCrement Register C, the length of the keyword.
52FA
INC DE 13
INCrement Register Pair DE to the next character of the keyword.
52FB
JUMP back to 52E5H to look at the next character.
52FD
LD DE,5B59H 11 59 5B
Point Register Pair DE to 5B59H, the place of the keyword (the same place during the global scan).
5300
LDIR ED B0
Copy the keyword from Register Pair HL to 5B59H at Register Pair DE, Register Pair BC the length (LDIR); Register Pair HL ends at the 0DH or parenthesis, Register Pair DE after the copy.
5302
DEC DE 1B
DECrement Register Pair DE to the last character of the keyword.
5303
LD A,(DE) 1A
Fetch the last character of the keyword at Register Pair DE into Register A.
5304
CP 20H FE 20
Compare Register A (the last character) against 20H, a space before the parameters.
5306
If the Z FLAG is set (a space), JUMP to 5309H to put the end over it.
5308
INC DE 13
INCrement Register Pair DE past the last character of the keyword.
5309
LD A,0DH 3E 0D
Load Register A with 0DH, the end of the keyword.
530B
LD (DE),A 12
Store Register A (0DH) at Register Pair DE: the keyword at 5B59H ends with 0DH.
530C
SET 1,(IY+00H) FD CB 00 CE
Set bit 1 of IY+00H (5AE5H, Index Register IY): a keyword was given, 5379H looks it up in the index.
5310
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A: after the keyword in the line.
5311
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
5313
If the Z FLAG is set (the end), JUMP to 531DH to save the screen and open the file.
5315
CP 28H FE 28
Compare Register A (the character) against 28H, an opening parenthesis.
5317
If the Z FLAG is set (parameters after the keyword), JUMP to 5251H to take them.
531A
INC HL 23
INCrement Register Pair HL to the next character.
531B
JUMP back to 5310H to look at the next character.
531DH - Save the Screen, Open the File, Find the Index
Unless V was given (IY+00H bit 6 clear) or the screen is already saved (bit 0), the 1024 bytes of video memory 3C00H-3FFFH are copied to 5C91H-6090H and the cursor address of the video device control block (4020H-4021H) to 5AECH-5AEDH, so that 5734H can put them back at the end. With no file named, HELP lists the HELP files on line (579DH). Else the default extension HLP is added (@FEXT) and the file is opened with a record length of 1 and the buffer 5B90H; a file that does not open also leads to the list. The last two bytes of a HELP file hold the offset of its keyword index: @PEOF moves to the end, two @BKSP move back two bytes, and 58D8H reads the word and moves there with @POSN.
531D
BIT 6,(IY+00H) FD CB 00 76
Test bit 6 of IY+00H (5AE5H, Index Register IY), the restore of the screen (cleared by V).
5321
If the Z FLAG is set (V was given), JUMP to 5348H: the screen is not saved.
5323
BIT 0,(IY+00H) FD CB 00 46
Test bit 0 of IY+00H (5AE5H, Index Register IY): set once the screen has been saved.
5327
If the NZ FLAG is set (already saved), JUMP to 5348H: a second pass from a prompt keeps the first copy.
5329
LD HL,3C00H 21 00 3C
Point Register Pair HL to 3C00H, the start of the video memory.
532C
LD DE,5C91H 11 91 5C
Point Register Pair DE to 5C91H, the 1024 bytes beyond the file for the copy of the screen.
532F
LD BC,0400H 01 00 04
Load Register Pair BC with 0400H, the 1024 bytes of the video memory, 16 lines of 64 characters.
5332
LDIR ED B0
Copy the screen from 3C00H at Register Pair HL to 5C91H at Register Pair DE, Register Pair BC the count (LDIR).
5334
LD IX,401DH DD 21 1D 40
Point Index Register IX to 401DH, the video device control block (DODCB$).
5338
LD A,(IX+03H) DD 7E 03
Fetch IX+03H, the low byte of the cursor address (4020H), from the block at Index Register IX into Register A.
533B
LD DE,5AECH 11 EC 5A
Point Register Pair DE to 5AECH, the two bytes that keep the cursor address.
533E
LD (DE),A 12
Store Register A (the low byte of the cursor address) at 5AECH, Register Pair DE.
533F
INC DE 13
INCrement Register Pair DE to 5AEDH, the place of the high byte of the cursor address.
5340
LD A,(IX+04H) DD 7E 04
Fetch IX+04H, the high byte of the cursor address (4021H), from the block at Index Register IX into Register A.
5343
LD (DE),A 12
Store Register A (the high byte of the cursor address) at 5AEDH, Register Pair DE.
5344
SET 0,(IY+00H) FD CB 00 C6
Set bit 0 of IY+00H (5AE5H, Index Register IY): the screen is saved at 5C91H.
5348
BIT 2,(IY+00H) FD CB 00 56
Test bit 2 of IY+00H (5AE5H, Index Register IY): set at 52A2H when a file was named.
534C
If the Z FLAG is set (no file named), JUMP to 579DH to build and display the list of the HELP files on line.
534F
LD HL,5AE9H 21 E9 5A
Point Register Pair HL to 5AE9H, the default extension HLP.
5352
LD DE,5AF0H 11 F0 5A
Point Register Pair DE to 5AF0H, the file control block of the HELP file.
5355
GOSUB to 444BH, @FEXT, to add the extension at Register Pair HL (HLP) to the specification at Register Pair DE (5AF0H) when it has none.
5358
LD B,01H 06 01
Load Register B with 01H, the record length: every @READ gives one byte.
535A
LD HL,5B90H 21 90 5B
Point Register Pair HL to 5B90H, the 256 byte sector buffer of the file, beyond the file.
535D
GOSUB to 4424H, @OPEN, to open the file at Register Pair DE (5AF0H) with the buffer at Register Pair HL (5B90H) and the record length in Register B: the Z FLAG on success.
5360
If the NZ FLAG is set (the file does not open), JUMP to 579DH to list the HELP files on line.
5363
GOSUB to 4448H, @PEOF, to move the file at Register Pair DE (5AF0H) to its end: Register A = 1CH, end of file.
5366
CP 1CH FE 1C
Compare Register A (the result) against 1CH, end of file.
5368
If the NZ FLAG is set (another result), JUMP to 5931H to display Source File Read Error and end.
536B
GOSUB to 4445H, @BKSP, to move the file at Register Pair DE back one record, one byte.
536E
GOSUB to 4445H, @BKSP, to move back one more byte, to the two bytes at the end of the file.
5371
If the NZ FLAG is set (the second @BKSP gave an error), JUMP back to 5368H: an end of file there backs up two more bytes, any other error ends at 5931H.
5373
GOSUB to 58CFH to set the alternate Register Pairs: DE' = 5AF0H, the control block, HL' = 5C90H, the byte read.
5376
GOSUB to 58D8H to read the two bytes at the end of the file and move the file to that offset, the start of its keyword index.
5379H - Look Up the Keyword in the Index
Without a keyword, or in search mode, HELP goes to the directory of the file (5580H). Else the keyword at 5B59H is made capitals (again) and compared with the index, which holds each keyword with bit 7 set on its last letter, followed by the two byte offset of its text. The keywords of the index are in alphabetical order, so the search ends at the first keyword that sorts after the one asked for: then, or at the end of the file, the keyword is not there and the directory is displayed instead (the manual: the list of all keywords displays again). Register C = 01H marks the last letter of the index keyword being compared.
5379
BIT 1,(IY+00H) FD CB 00 4E
Test bit 1 of IY+00H (5AE5H, Index Register IY): a keyword was given.
537D
If the Z FLAG is set (no keyword), JUMP to 5580H to display the directory of the file.
5380
BIT 4,(IY+00H) FD CB 00 66
Test bit 4 of IY+00H (5AE5H, Index Register IY), search mode (S).
5384
If the NZ FLAG is set (search mode), JUMP to 5580H: the directory lists the keywords that start with the word given.
5387
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the keyword.
538A
LD A,(HL) 7E
Fetch the character of the keyword at Register Pair HL into Register A.
538B
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the keyword.
538D
If the Z FLAG is set (the end), JUMP to 539CH to search the index.
538F
CP 61H FE 61
Compare Register A (the character) against 61H, a small a.
5391
If the CARRY FLAG is set (below a small a), JUMP to 5399H with the character as it is.
5393
CP 7BH FE 7B
Compare Register A (the character) against 7BH, the character after a small z.
5395
If the NO CARRY FLAG is set (above a small z), JUMP to 5399H with the character as it is.
5397
RES 5,(HL) CB AE
Reset bit 5 of the character at Register Pair HL: the small letter becomes a capital in place.
5399
INC HL 23
INCrement Register Pair HL to the next character of the keyword.
539A
JUMP back to 538AH to look at the next character.
539C
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the first character of the keyword, for the next keyword of the index.
539F
LD C,00H 0E 00
Load Register C with 00H: the letter of the index being compared is not its last.
53A1
GOSUB to 58EBH to read the next byte of the index into Register A (1CH at the end of the file).
53A4
CP 80H FE 80
Compare Register A (the byte) against 80H, the bit that marks the last letter of an index keyword.
53A6
If the CARRY FLAG is set (not the last letter), JUMP to 53ACH to compare it.
53A8
XOR 80H EE 80
XOR Register A with 80H: the last letter without its mark.
53AA
LD C,01H 0E 01
Load Register C with 01H: this is the last letter of the index keyword.
53AC
CP (HL) BE
Compare Register A (the letter of the index) against the letter of the keyword at Register Pair HL: the CARRY FLAG when the index letter is smaller.
53AD
If the NZ FLAG is set (the letters differ), JUMP to 53BBH.
53AF
INC HL 23
INCrement Register Pair HL to the next letter of the keyword.
53B0
LD A,(HL) 7E
Fetch the next letter of the keyword at Register Pair HL into Register A.
53B1
CP 0DH FE 0D
Compare Register A (the letter) against 0DH, the end of the keyword.
53B3
If the Z FLAG is set (the keyword is used up), JUMP to 53D6H to see whether the index keyword ends too.
53B5
INC C 0C
INCrement Register C, the last letter mark, to set the flags from it.
53B6
DEC C 0D
DECrement Register C back: the Z FLAG when Register C is 00H.
53B7
If the NZ FLAG is set (the index keyword ended, the keyword goes on), JUMP to 53CEH to pass over its offset and try the next.
53B9
JUMP back to 53A1H to compare the next letters.
53BB
If the NO CARRY FLAG is set (the index letter sorts after the keyword's), JUMP to 5580H: the keyword is not in the file, the directory is displayed.
53BE
INC C 0C
INCrement Register C, the last letter mark, to set the flags from it.
53BF
DEC C 0D
DECrement Register C back: the Z FLAG when Register C is 00H.
53C0
If the NZ FLAG is set (that was the last letter), JUMP to 53CEH to pass over the offset.
53C2
GOSUB to 58EBH to read the next byte of the index keyword into Register A, passing over the rest of it.
53C5
CP 1CH FE 1C
Compare Register A (the byte) against 1CH, end of file.
53C7
If the Z FLAG is set (the end of the file), JUMP to 5580H: the keyword is not in the file.
53CA
CP 80H FE 80
Compare Register A (the byte) against 80H, the mark of the last letter.
53CC
If the CARRY FLAG is set (not the last letter), JUMP back to 53C2H to read on.
53CE
GOSUB to 58EBH to read the low byte of the offset of the text, which is passed over.
53D1
GOSUB to 58EBH to read the high byte of the offset, passed over as well.
53D4
JUMP back to 539CH to compare the next keyword of the index.
53D6
INC C 0C
INCrement Register C, the last letter mark, to set the flags from it.
53D7
DEC C 0D
DECrement Register C back: the Z FLAG when Register C is 00H.
53D8
If the Z FLAG is set (the index keyword is longer than the keyword), JUMP to 53C2H to pass over the rest of it and its offset.
53DAH - Display the Text of a Keyword
The keyword was found: the two bytes after it are the offset of its text, and the file is moved there. The screen is cleared, the keyword is displayed as the first line, and with P the banner and the keyword go to the printer as well. Then the text is read byte by byte up to its 0CH. The text is compressed: a byte of 80H or more is a character (without bit 7) followed by a space, and a second such byte straight after it (IY+01H bit 0 set) is a run of that many spaces; 7FH marks the place where the cursor is as one that blinks; 8DH at the bottom line is a line end (54C8H). Every character goes through 54B6H, which stops at the bottom of the screen.
53DA
GOSUB to 58D8H to read the two byte offset after the keyword and move the file to its text with @POSN.
53DD
LD HL,5936H 21 36 59
Point Register Pair HL to 5936H, the text 1CH 1FH 03H: cursor home and clear to the end of the screen.
53E0
GOSUB to 4467H, @DSPLY, to send the text at Register Pair HL (5936H) to the video up to its 03H: the screen is cleared.
53E3
LD IX,(6093H) DD 2A 93 60
Load Index Register IX from 6093H-6094H: the start of the blink table, where 541CH writes the places to blink.
53E7
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the keyword ended by 0DH.
53EA
GOSUB to 4467H, @DSPLY, to display the keyword at Register Pair HL (5B59H) and its 0DH, the first line of the screen.
53ED
BIT 7,(IY+00H) FD CB 00 7E
Test bit 7 of IY+00H (5AE5H, Index Register IY), the printer (P).
53F1
If the Z FLAG is set (no printer), JUMP to 5404H to display the text.
53F3
LD A,0DH 3E 0D
Load Register A with 0DH, a new line for the printer.
53F5
GOSUB to 003BH, the ROM's printer routine, to print the character in Register A (0DH).
53F8
LD HL,593BH 21 3B 59
Point Register Pair HL to 593BH, the banner without the two screen codes: Help System Display Mode Version 5.3.1 and the copyright line.
53FB
GOSUB to 446AH, @PRINT, to print the text at Register Pair HL (593BH) up to its 0DH.
53FE
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the keyword.
5401
GOSUB to 446AH, @PRINT, to print the keyword at Register Pair HL (5B59H) up to its 0DH.
5404
GOSUB to 58EBH to read the next byte of the text into Register A.
5407
LD HL,(4020H) 2A 20 40
Fetch the cursor address from 4020H-4021H into Register Pair HL, for the test of the bottom of the screen.
540A
GOSUB to 54B6H to test the cursor at Register Pair HL: at the bottom of the screen it waits for a key and returns with Register A = the byte.
540D
CP 0CH FE 0C
Compare Register A (the byte) against 0CH, the end of the text of a keyword.
540F
If the Z FLAG is set (the end of the text), JUMP to 54E8H to wait for a key and prompt.
5412
CP 7FH FE 7F
Compare Register A (the byte) against 7FH, the mark of a place that blinks.
5414
If the NZ FLAG is set (not the mark), JUMP to 5432H.
5416
BIT 5,(IY+00H) FD CB 00 6E
Test bit 5 of IY+00H (5AE5H, Index Register IY), blinking on (cleared by B).
541A
If the Z FLAG is set (no blinking), JUMP to 542CH: the mark is dropped.
541C
LD (IX+00H),L DD 75 00
Store Register L (the low byte of the cursor address) at IX+00H, Index Register IX the next entry of the blink table.
541F
INC IX DD 23
INCrement Index Register IX to the second byte of the entry.
5421
LD (IX+00H),H DD 74 00
Store Register H (the high byte of the cursor address) at IX+00H, Index Register IX.
5424
INC IX DD 23
INCrement Index Register IX to the third byte of the entry.
5426
LD (IX+00H),20H DD 36 00 20
Store 20H, a space, at IX+00H, Index Register IX: the character the place shows in the other half of the blink.
542A
INC IX DD 23
INCrement Index Register IX to the next entry of the blink table.
542C
RES 0,(IY+01H) FD CB 01 86
Reset bit 0 of IY+01H (5AE6H, Index Register IY): the byte before the next one was not a character with a space.
5430
JUMP back to 5404H to read the next byte of the text.
5432
CP 80H FE 80
Compare Register A (the byte) against 80H: the CARRY FLAG for a plain character.
5434
If the CARRY FLAG is set (below 80H, a plain character), JUMP to 5481H to display it.
5436
XOR 80H EE 80
XOR Register A with 80H: the character, or the number of spaces, without bit 7.
5438
BIT 0,(IY+01H) FD CB 01 46
Test bit 0 of IY+01H (5AE6H, Index Register IY): the byte before was a character with a space.
543C
If the NZ FLAG is set (it was), JUMP to 5495H: this byte is a run of Register A spaces.
543E
SET 0,(IY+01H) FD CB 01 C6
Set bit 0 of IY+01H (5AE6H, Index Register IY): a character with a space is being displayed.
5442
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
5445
GOSUB to 5456H to send the character in Register A to the printer as well when P was given.
5448
LD A,20H 3E 20
Load Register A with 20H, the space that goes with the character.
544A
INC HL 23
INCrement Register Pair HL, the cursor address as 5407H read it, to the place of the space.
544B
GOSUB to 54B6H to test the cursor at Register Pair HL for the bottom of the screen, with Register A = 20H.
544E
GOSUB to 0033H, the ROM's display routine, to display the space in Register A.
5451
GOSUB to 5456H to send the space in Register A to the printer as well when P was given.
5454
JUMP back to 5404H to read the next byte of the text.
5456H - Send a Character to the Printer
With P (IY+00H bit 7) every character displayed is also printed through ROM 003BH. 5AEEH counts the columns of the printer line from 01H: when it reaches 41H, 64 characters printed, a 0DH is printed first. A 0DH sets the count back to 01H.
5456
BIT 7,(IY+00H) FD CB 00 7E
Test bit 7 of IY+00H (5AE5H, Index Register IY), the printer (P).
545A
RET Z C8
RETurn if the Z FLAG is set (no printer): Register A is kept.
545B
PUSH AF F5
Save Register Pair AF (the character in Register A) to the stack across the column test.
545C
LD A,(5AEEH) 3A EE 5A
Fetch the column count of the printer from 5AEEH into Register A.
545F
CP 41H FE 41
Compare Register A (the column) against 41H: 64 characters have been printed on the line.
5461
If the NZ FLAG is set (the line is not full), JUMP to 546DH to print the character.
5463
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a printer line.
5465
GOSUB to 003BH, the ROM's printer routine, to print the character in Register A (0DH).
5468
LD A,01H 3E 01
Load Register A with 01H, the first column of the new line.
546A
LD (5AEEH),A 32 EE 5A
Store Register A (01H) at 5AEEH, the column count.
546D
POP AF F1
Restore Register Pair AF from the stack: Register A = the character.
546E
PUSH AF F5
Save Register Pair AF (the character in Register A) to the stack again, across the print.
546F
GOSUB to 003BH, the ROM's printer routine, to print the character in Register A.
5472
POP AF F1
Restore Register Pair AF from the stack: Register A = the character.
5473
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of a line.
5475
LD A,01H 3E 01
Load Register A with 01H, the column after a 0DH; the flags of the CP are kept.
5477
If the Z FLAG is set (the character was 0DH), JUMP to 547DH to store 01H.
5479
LD A,(5AEEH) 3A EE 5A
Fetch the column count from 5AEEH into Register A.
547C
INC A 3C
INCrement Register A, the column count, for the character printed.
547D
LD (5AEEH),A 32 EE 5A
Store Register A (the new column count) at 5AEEH.
5480
RET C9
RETurn to the caller; Register A holds the column count, not the character.
5481H - A Plain Character, or a Run of Spaces
A byte below 80H is displayed as it is. When the last byte before the bottom line was 8DH (IY+01H bit 1, set by 54D6H), a space is displayed first. A byte of 80H or more straight after a character with a space is a run of spaces: Register B = the byte without bit 7, one more after an 8DH; each space goes through the test of the bottom of the screen.
5481
BIT 1,(IY+01H) FD CB 01 4E
Test bit 1 of IY+01H (5AE6H, Index Register IY), set by 54D6H for the 8DH met at the bottom line.
5485
If the NZ FLAG is set (an 8DH came before), GOSUB to 588BH to display the space it stands for first.
5488
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
548B
RES 0,(IY+01H) FD CB 01 86
Reset bit 0 of IY+01H (5AE6H, Index Register IY): the character had no space with it.
548F
GOSUB to 5456H to send the character in Register A to the printer as well when P was given.
5492
JUMP back to 5404H to read the next byte of the text.
5495
LD B,A 47
Copy Register A (the byte without bit 7, the number of spaces) into Register B, the count.
5496
BIT 1,(IY+01H) FD CB 01 4E
Test bit 1 of IY+01H (5AE6H, Index Register IY), the 8DH flag.
549A
If the Z FLAG is set (no 8DH before), JUMP to 54A1H with the count in Register B.
549C
RES 1,(IY+01H) FD CB 01 8E
Reset bit 1 of IY+01H (5AE6H, Index Register IY): the space of the 8DH is counted here.
54A0
INC B 04
INCrement Register B: one more space for the 8DH.
54A1
LD A,20H 3E 20
Load Register A with 20H, a space, the character of the run that is displayed.
54A3
INC HL 23
INCrement Register Pair HL, the cursor address, to the place of this space.
54A4
GOSUB to 54B6H to test the cursor at Register Pair HL for the bottom of the screen, with Register A = 20H.
54A7
GOSUB to 0033H, the ROM's display routine, to display the space in Register A.
54AA
GOSUB to 5456H to send the space in Register A to the printer as well when P was given.
54AD
DECrement Register B and JUMP to 54A1H while it is not zero: the next space of the run.
54AF
RES 0,(IY+01H) FD CB 01 86
Reset bit 0 of IY+01H (5AE6H, Index Register IY): the run ends the pair.
54B3
JUMP to 5404H to read the next byte of the text.
54B6H - The Bottom of the Screen
Register A = the byte about to be displayed, Register Pair HL = the cursor address. While the cursor address is below 3FBFH the routine returns at once. From 3FBFH on, the last place of line 15 and line 16, a 0DH or 0AH (and an 8DH that does not follow a character with a space) ends the screen there, and so does a character when the cursor is at 3FFEH: the character is kept at 5AEFH (00H for the line end) and 54E8H waits for a key. The CALL is then answered by 5571H with the byte in Register A, or the byte is dropped and the text read on (5579H).
54B6
LD C,A 4F
Copy Register A (the byte) into Register C, to keep it across the tests.
54B7
LD DE,3FBFH 11 BF 3F
Load Register Pair DE with 3FBFH, the last place of the fifteenth line of the screen.
54BA
OR A B7
Clear the CARRY FLAG (OR A) for the SBC; Register A is kept.
54BB
PUSH HL E5
Save Register Pair HL (the cursor address) to the stack across the subtraction.
54BC
SBC HL,DE ED 52
Subtract Register Pair DE (3FBFH) from Register Pair HL: the CARRY FLAG while the cursor address is below 3FBFH.
54BE
POP HL E1
Restore Register Pair HL from the stack: the cursor address.
54BF
RET C D8
RETurn if the CARRY FLAG is set (the cursor address is below 3FBFH) with Register A = the byte.
54C0
CP 0DH FE 0D
Compare Register A (the byte) against 0DH, the end of a line.
54C2
If the Z FLAG is set (0DH), JUMP to 54E3H: the screen ends here.
54C4
CP 0AH FE 0A
Compare Register A (the byte) against 0AH, a new line.
54C6
If the Z FLAG is set (0AH), JUMP to 54E3H: the screen ends here.
54C8
CP 8DH FE 8D
Compare Register A (the byte) against 8DH, a 0DH with bit 7 set.
54CA
If the NZ FLAG is set (not 8DH), JUMP to 54DCH.
54CC
BIT 0,(IY+01H) FD CB 01 46
Test bit 0 of IY+01H (5AE6H, Index Register IY): straight after a character with a space, 8DH is a run of 13 spaces.
54D0
If the NZ FLAG is set (a run of spaces), JUMP to 54DCH.
54D2
SET 0,(IY+01H) FD CB 01 C6
Set bit 0 of IY+01H (5AE6H, Index Register IY): the 8DH stands for a character with a space.
54D6
SET 1,(IY+01H) FD CB 01 CE
Set bit 1 of IY+01H (5AE6H, Index Register IY): 5481H or 5495H displays the space of the 8DH on the next screen.
54DA
JUMP to 54E7H: the screen ends here, Register A becomes 00H for 5AEFH.
54DC
LD A,L 7D
Copy Register L (the low byte of the cursor address) into Register A.
54DD
CP FEH FE FE
Compare Register A (the low byte) against FEH: the cursor at 3FFEH, the place before the last one of the screen.
54DF
LD A,C 79
Copy Register C (the byte) back into Register A; the flags of the CP are kept.
54E0
If the Z FLAG is set (the cursor at 3FFEH), JUMP to 54E8H to keep the byte and end the screen.
54E2
RET C9
RETurn with Register A = the byte, to display it.
54E3
RES 0,(IY+01H) FD CB 01 86
Reset bit 0 of IY+01H (5AE6H, Index Register IY): a line end is no pair.
54E7
XOR A AF
Clear Register A (XOR A): 00H, the line end, is kept at 5AEFH.
54E8H - The End of a Screen: Blink and Wait
Register A = 0CH at the end of the text, 00H for a line end, or the byte held back. The blink table gets 0000H at its end. Without P, the places of the table are made to blink: each entry's character and the one kept in it are swapped, the keyboard is scanned (ROM 002BH) and ROM 0060H waits about 0.38 second (BC = 6400H, 30 T-states a count at 2.03 MHz), until a key is pressed. With no entries the program waits for a key with ROM 0049H, only when the cursor is on the last line. BREAK (01H) ends HELP. Else the screen is cleared (1CH, 1FH) and the text goes on; at the end of the text the prompt follows (56DDH).
54E8
LD (5AEFH),A 32 EF 5A
Store Register A (0CH, 00H or the byte held back) at 5AEFH, why the screen ends.
54EB
LD (IX+00H),00H DD 36 00 00
Store 00H at IX+00H, Index Register IX the end of the blink table.
54EF
INC IX DD 23
INCrement Index Register IX to the second byte of the end mark.
54F1
LD (IX+00H),00H DD 36 00 00
Store 00H at IX+00H, Index Register IX: the table ends with 0000H.
54F5
LD C,00H 0E 00
Load Register C with 00H, the count of the blink entries.
54F7
BIT 7,(IY+00H) FD CB 00 7E
Test bit 7 of IY+00H (5AE5H, Index Register IY), the printer (P).
54FB
If the NZ FLAG is set (P: the display does not pause), JUMP to 554DH.
54FD
LD HL,(6093H) 2A 93 60
Fetch the start of the blink table from 6093H-6094H into Register Pair HL.
5500
LD A,(HL) 7E
Fetch the first byte of the entry at Register Pair HL into Register A.
5501
CP 00H FE 00
Compare Register A (the byte) against 00H, the first byte of the end mark 0000H.
5503
If the Z FLAG is set (00H), JUMP to 550BH to test the second byte.
5505
INC C 0C
INCrement Register C, the count of the entries.
5506
INC HL 23
INCrement Register Pair HL to the second byte of the entry.
5507
INC HL 23
INCrement Register Pair HL to the third byte of the entry.
5508
INC HL 23
INCrement Register Pair HL to the next entry.
5509
JUMP back to 5500H to look at the next entry.
550B
INC HL 23
INCrement Register Pair HL to the second byte of the entry.
550C
CP (HL) BE
Compare Register A (00H) against the byte at Register Pair HL: the Z FLAG for the end mark 0000H.
550D
DEC HL 2B
DECrement Register Pair HL back to the first byte of the entry.
550E
If the NZ FLAG is set (a place whose low byte is 00H, such as 3D00H), JUMP to 5505H to count it.
5510
CP C B9
Compare Register A (00H) against Register C, the count of the entries.
5511
If the NZ FLAG is set (places to blink), JUMP to 5523H to blink them while it waits.
5513
LD HL,(4020H) 2A 20 40
Fetch the cursor address from 4020H-4021H into Register Pair HL.
5516
LD DE,3FC0H 11 C0 3F
Load Register Pair DE with 3FC0H, the start of the last line of the screen.
5519
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
551A
SBC HL,DE ED 52
Subtract Register Pair DE (3FC0H) from Register Pair HL (the cursor address): the CARRY FLAG while the cursor address is below 3FC0H.
551C
If the CARRY FLAG is set (not on the last line), JUMP to 554DH with Register A = 00H: no wait.
551E
GOSUB to 0049H, the ROM's wait for a key: Register A = the key.
5521
JUMP to 554DH with the key in Register A, to test it for BREAK.
5523
LD IX,(6093H) DD 2A 93 60
Load Index Register IX from 6093H-6094H: the first entry of the blink table.
5527
LD B,C 41
Copy Register C (the count of the entries) into Register B, the loop count.
5528
LD L,(IX+00H) DD 6E 00
Fetch IX+00H, the low byte of the place, from the entry at Index Register IX into Register L.
552B
LD H,(IX+01H) DD 66 01
Fetch IX+01H, the high byte of the place, from the entry at Index Register IX into Register H: Register Pair HL = the place on the screen.
552E
LD E,(IX+02H) DD 5E 02
Fetch IX+02H, the character kept in the entry at Index Register IX, into Register E.
5531
LD A,(HL) 7E
Fetch the character on the screen at Register Pair HL into Register A.
5532
LD (HL),E 73
Store Register E (the character kept) on the screen at Register Pair HL.
5533
LD (IX+02H),A DD 77 02
Store Register A (the character that was on the screen) at IX+02H, Index Register IX: the next pass puts it back.
5536
INC IX DD 23
INCrement Index Register IX to the second byte of the entry.
5538
INC IX DD 23
INCrement Index Register IX to the third byte of the entry.
553A
INC IX DD 23
INCrement Index Register IX to the next entry.
553C
DECrement Register B and JUMP to 5528H while it is not zero: the next place.
553E
GOSUB to 002BH, the ROM's keyboard scan: Register A = the key, and HELP takes the NZ FLAG as a key pressed.
5541
If the NZ FLAG is set (a key), JUMP to 554DH with the key in Register A; the places keep the half of the blink they show.
5543
PUSH BC C5
Save Register Pair BC (Register C = the count) to the stack across the delay.
5544
LD BC,6400H 01 00 64
Load Register Pair BC with 6400H, the count of the delay.
5547
GOSUB to 0060H, the ROM's delay (JP 01FBH on the Model III), which counts Register Pair BC down: about 0.38 second.
554A
POP BC C1
Restore Register Pair BC from the stack: Register C = the count of the entries.
554B
JUMP back to 5523H to swap the characters again.
554D
CP 01H FE 01
Compare Register A (the key, or 00H) against 01H, BREAK.
554F
If the Z FLAG is set (BREAK), JUMP to 5722H to end HELP.
5552
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, for the printer line of the screen just shown.
5554
GOSUB to 5456H to end the printer line when P was given.
5557
RES 2,(IY+01H) FD CB 01 96
Reset bit 2 of IY+01H (5AE6H, Index Register IY), the flag that more of the directory is to come.
555B
LD A,(5AEFH) 3A EF 5A
Fetch from 5AEFH why the screen ended into Register A.
555E
CP 00H FE 00
Compare Register A against 00H, the line end at the bottom.
5560
If the Z FLAG is set (a line end), JUMP to 5579H: the byte is dropped and the text read on.
5562
CP 0CH FE 0C
Compare Register A against 0CH, the end of the text.
5564
If the Z FLAG is set (the end of the text), JUMP to 56DDH for the prompt.
5567
LD A,1CH 3E 1C
Load Register A with 1CH, the code that puts the cursor home.
5569
GOSUB to 0033H, the ROM's display routine, to send the code in Register A (1CH).
556C
LD A,1FH 3E 1F
Load Register A with 1FH, the code that clears to the end of the screen.
556E
GOSUB to 0033H, the ROM's display routine, to send the code in Register A (1FH): the screen is empty.
5571
LD A,(5AEFH) 3A EF 5A
Fetch the byte held back from 5AEFH into Register A.
5574
LD IX,(6093H) DD 2A 93 60
Load Index Register IX from 6093H-6094H: the blink table starts again for the new screen.
5578
RET C9
RETurn: to the caller of 54B6H with Register A = the byte, or to 5404H (5579H).
5579
POP HL E1
Restore Register Pair HL from the stack: the return address of the CALL of 54B6H is dropped.
557A
LD HL,5404H 21 04 54
Point Register Pair HL to 5404H, the place that reads the next byte of the text.
557D
PUSH HL E5
Save Register Pair HL (5404H) to the stack as the return address of 5578H.
557E
JUMP to 5567H to clear the screen and return to 5404H.
5580H - The Directory of a HELP File
Shown when no keyword was given, when the keyword is not in the file, and in search mode. During the global scan a file without the keyword is simply passed over (5872H). The screen is cleared, the banner and Directory for HELP file : with the name kept at 5B10H are displayed (and printed with P). Then the index is read from its start: each keyword is collected at 5B19H, Register C its length, and padded with spaces to the next 16 column place. A keyword of up to 15 characters takes one column of 16; a longer one goes on to the next multiple of 16 (5665H). In search mode only the keywords whose first letters are the word given are shown (58FBH). The last line of the screen is kept for the prompt: when a keyword would reach 3FBFH, IY+01H bit 2 says the directory goes on, and the prompt follows.
5580
BIT 3,(IY+00H) FD CB 00 5E
Test bit 3 of IY+00H (5AE5H, Index Register IY), the global scan.
5584
If the NZ FLAG is set (global scan: the keyword is not in this file), JUMP to 5872H to close it and try the next file.
5587
LD HL,5939H 21 39 59
Point Register Pair HL to 5939H, 1CH 1FH and the banner: Help System Display Mode Version 5.3.1, the copyright line.
558A
GOSUB to 4467H, @DSPLY, to clear the screen and display the banner at Register Pair HL (5939H) up to its 0DH.
558D
LD HL,59BCH 21 BC 59
Point Register Pair HL to 59BCH, the text Directory for HELP file : ended by 03H.
5590
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (59BCH); the cursor stays after it.
5593
BIT 7,(IY+00H) FD CB 00 7E
Test bit 7 of IY+00H (5AE5H, Index Register IY), the printer (P).
5597
If the Z FLAG is set (no printer), JUMP to 559CH.
5599
GOSUB to 446AH, @PRINT, to print the text at Register Pair HL, still 59BCH: @DSPLY gives Register Pair HL back unchanged.
559C
LD HL,5B10H 21 10 5B
Point Register Pair HL to 5B10H, the name of the HELP file kept at 52BCH.
559F
LD A,(HL) 7E
Fetch the character of the name at Register Pair HL into Register A.
55A0
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the name.
55A2
If the Z FLAG is set (the end), JUMP to 55ADH.
55A4
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
55A7
GOSUB to 5456H to send the character in Register A to the printer as well when P was given.
55AA
INC HL 23
INCrement Register Pair HL to the next character of the name.
55AB
JUMP back to 559FH to display the next character.
55AD
LD A,0DH 3E 0D
Load Register A with 0DH, the end of the heading line.
55AF
GOSUB to 0033H, the ROM's display routine, to display the character in Register A (0DH).
55B2
GOSUB to 5456H to end the printer line as well when P was given.
55B5
EXX D9
EXchange to the alternate Register Pairs: DE' = 5AF0H, the file control block of the HELP file.
55B6
GOSUB to 4448H, @PEOF, to move the file at Register Pair DE (5AF0H) to its end: Register A = 1CH.
55B9
CP 1CH FE 1C
Compare Register A (the result) against 1CH, end of file.
55BB
If the NZ FLAG is set (another result: error 26H for a file that is not open), JUMP to 5931H to display Source File Read Error and end.
55BE
GOSUB to 4445H, @BKSP, to move the file at Register Pair DE back one byte.
55C1
GOSUB to 4445H, @BKSP, to move back one more byte, to the offset of the index.
55C4
If the NZ FLAG is set (an error), JUMP to 5931H to display Source File Read Error and end.
55C7
EXX D9
EXchange back to the main Register Pairs from the alternate set.
55C8
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the place where each keyword is collected.
55CB
GOSUB to 58D8H to read the offset of the index at the end of the file and move the file there.
55CE
LD C,00H 0E 00
Load Register C with 00H, the length of the keyword collected.
55D0
GOSUB to 58EBH to read the next byte of the index into Register A (1CH at the end of the file).
55D3
CP 1CH FE 1C
Compare Register A (the byte) against 1CH, end of file.
55D5
If the Z FLAG is set (the end of the index), JUMP to 56DDH for the prompt.
55D8
CP 80H FE 80
Compare Register A (the byte) against 80H, the mark of the last letter of a keyword.
55DA
If the CARRY FLAG is set (not the last letter), JUMP to 55E0H to collect it.
55DC
XOR 80H EE 80
XOR Register A with 80H: the last letter without its mark.
55DE
JUMP to 55E5H with the last letter in Register A.
55E0
INC C 0C
INCrement Register C, the length of the keyword.
55E1
LD (DE),A 12
Store Register A (the letter) at Register Pair DE, in the keyword at 5B19H.
55E2
INC DE 13
INCrement Register Pair DE to the next place of the keyword.
55E3
JUMP back to 55D0H to read the next letter of the keyword of the index.
55E5
PUSH AF F5
Save Register Pair AF (the last letter in Register A) to the stack across the read.
55E6
GOSUB to 58EBH to read the byte after the keyword, the low byte of its offset, into Register A.
55E9
If the Z FLAG is set (the byte was read), JUMP to 55F3H.
55EB
CP 1CH FE 1C
Compare Register A (the result) against 1CH, end of file.
55ED
If the NZ FLAG is set (another error, which is passed over), JUMP to 55F3H.
55EF
POP AF F1
Restore Register Pair AF from the stack: the last letter is dropped.
55F0
JUMP to 56DDH for the prompt: the index ended inside a keyword.
55F3
EXX D9
EXchange to the alternate Register Pairs: DE' = 5AF0H, the file control block.
55F4
GOSUB to 4445H, @BKSP, to move the file at Register Pair DE back one byte: 564CH reads the offset again.
55F7
EXX D9
EXchange back to the main Register Pairs from the alternate set.
55F8
POP AF F1
Restore Register Pair AF from the stack: Register A = the last letter of the keyword.
55F9
INC C 0C
INCrement Register C, the length of the keyword, for its last letter.
55FA
LD HL,(4020H) 2A 20 40
Fetch the cursor address from 4020H-4021H into Register Pair HL.
55FD
LD (DE),A 12
Store Register A (the last letter) at Register Pair DE: the keyword at 5B19H is complete.
55FE
BIT 4,(IY+00H) FD CB 00 66
Test bit 4 of IY+00H (5AE5H, Index Register IY), search mode (S).
5602
If the NZ FLAG is set (search mode), GOSUB to 58FBH to compare the keyword at 5B19H with the word at 5B59H: the CARRY FLAG when it does not start with it.
5605
If the CARRY FLAG is set (not a match in search mode), JUMP to 564CH to pass over the offset and take the next keyword.
5607
LD A,0FH 3E 0F
Load Register A with 0FH, the most letters of a keyword that fits one column.
5609
SBC A,C 99
Subtract Register C (the length) and the CARRY FLAG (clear) from Register A: the CARRY FLAG for a keyword of 16 letters or more.
560A
If the CARRY FLAG is set (a long keyword), JUMP to 5665H.
560C
INC A 3C
INCrement Register A: 16 less the length, the spaces that fill the column.
560D
LD B,A 47
Copy Register A (the spaces) into Register B, the count.
560E
LD A,20H 3E 20
Load Register A with 20H, a space, to fill the column after the keyword.
5610
INC DE 13
INCrement Register Pair DE past the last character of the keyword.
5611
LD (DE),A 12
Store Register A (a space) at Register Pair DE, after the keyword.
5612
DECrement Register B and JUMP to 5610H while it is not zero: the column is filled.
5614
LD C,10H 0E 10
Load Register C with 10H, the 16 places of a column (Register B is 00H).
5616
ADD HL,BC 09
ADD Register Pair BC (0010H) to Register Pair HL (the cursor address): the cursor after this column.
5617
LD A,H 7C
Copy Register H (the high byte of that address) into Register A.
5618
CP 3FH FE 3F
Compare Register A against 3FH, the page of the last 4 lines of the screen.
561A
If the NZ FLAG is set (above 3F00H), JUMP to 563BH to display the column.
561C
LD A,L 7D
Copy Register L (the low byte of that address) into Register A.
561D
CP BFH FE BF
Compare Register A against BFH: the column would reach 3FBFH, the last line of the screen.
561F
If the CARRY FLAG is set (below 3FBFH), JUMP to 563BH to display the column.
5621
SET 2,(IY+01H) FD CB 01 D6
Set bit 2 of IY+01H (5AE6H, Index Register IY): the screen is full, the directory goes on after the prompt.
5625
DEC C 0D
DECrement Register C to 0FH: only 15 places are displayed, so that the cursor does not move to the last line.
5626
LD B,C 41
Copy Register C (0FH) into Register B, the count.
5627
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the keyword and its spaces.
562A
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
562B
PUSH DE D5
Save Register Pair DE (the place in the keyword) to the stack across the display.
562C
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
562F
GOSUB to 5456H to send the character in Register A to the printer as well when P was given.
5632
POP DE D1
Restore Register Pair DE from the stack: the place in the keyword.
5633
INC DE 13
INCrement Register Pair DE to the next character.
5634
DECrement Register B and JUMP to 562AH while it is not zero: the next character.
5636
LD A,FFH 3E FF
Load Register A with FFH: the keyword has been displayed, 56CCH changes the jump at 5785H.
5638
JUMP to 56CCH for the end of the screen, with Register A = FFH.
563B
LD B,10H 06 10
Load Register B with 10H, the 16 places of the column.
563D
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the keyword and its spaces.
5640
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
5641
PUSH DE D5
Save Register Pair DE (the place in the keyword) to the stack across the display.
5642
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
5645
GOSUB to 5456H to send the character in Register A to the printer as well when P was given.
5648
POP DE D1
Restore Register Pair DE from the stack: the place in the keyword.
5649
INC DE 13
INCrement Register Pair DE to the next character.
564A
DECrement Register B and JUMP to 5640H while it is not zero: the next character.
564C
LD B,03H 06 03
Load Register B with 03H: the two bytes of the offset and the first byte of the next keyword.
564E
GOSUB to 58EBH to read the next byte of the index into Register A.
5651
DECrement Register B and JUMP to 564EH while it is not zero: Register A = the first byte of the next keyword.
5653
CP 1CH FE 1C
Compare Register A (the byte) against 1CH, end of file.
5655
If the Z FLAG is set (the end of the file), JUMP to 56DDH for the prompt.
5658
CP 80H FE 80
Compare Register A (the byte) against 80H, the mark of the last letter of a keyword.
565A
If the NO CARRY FLAG is set (80H or more: the offset word at the end of the file, or a keyword of one letter), JUMP to 56DDH: the directory ends.
565D
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the start of the place for the next keyword.
5660
LD C,00H 0E 00
Load Register C with 00H, the length of the next keyword.
5662
JUMP to 55D8H to take the byte in Register A as the first letter of the next keyword.
5665H - A Keyword Longer than 15 Letters
Register C = the length, Register Pair HL = the cursor address. The keyword fits the line when the column count, from the low byte of the cursor address, does not reach a multiple of 64 within Register C places; it is then padded to the next multiple of 16 after it (Register C grows by the padding). A keyword that does not fit starts a new line (56BDH). When the screen would be full, the keyword is held back at 5B19H (IY+01H bit 2, and bit 3 for one that needs a new line, with Register Pairs DE and BC on the stack) and displayed on the next screen.
5665
LD A,L 7D
Copy Register L (the low byte of the cursor address) into Register A.
5666
LD B,C 41
Copy Register C (the length of the keyword) into Register B, the count.
5667
INC A 3C
INCrement Register A, the place one further along.
5668
AND 3FH E6 3F
Mask Register A with 3FH: the column on the line, 00H at the start of the next line.
566A
If the Z FLAG is set (the keyword reaches the end of the line), JUMP to 56A4H to start a new line.
566C
DECrement Register B and JUMP to 5667H while it is not zero: the next place of the keyword.
566E
LD B,A 47
Copy Register A (the column after the keyword) into Register B.
566F
XOR A AF
Clear Register A (XOR A), the column of 16 being looked for.
5670
ADD A,10H C6 10
ADD 10H to Register A: the next column of 16.
5672
CP B B8
Compare Register A against Register B (the column after the keyword).
5673
If the CARRY FLAG is set (Register A is still below it), JUMP back to 5670H.
5675
If the Z FLAG is set (Register A equals it), JUMP back to 5670H: the keyword gets at least one space.
5677
SUB B 90
Subtract Register B from Register A: the spaces up to the column of 16.
5678
LD B,A 47
Copy Register A (the spaces) into Register B, the count.
5679
ADD A,C 81
ADD Register C (the length) to Register A: the places the keyword takes with its spaces.
567A
LD C,A 4F
Copy Register A into Register C, the count of the places to display.
567B
LD A,20H 3E 20
Load Register A with 20H, a space, to fill up to the column of 16.
567D
INC DE 13
INCrement Register Pair DE past the last character of the keyword.
567E
LD (DE),A 12
Store Register A (a space) at Register Pair DE, after the keyword.
567F
DECrement Register B and JUMP to 567DH while it is not zero: the spaces are stored.
5681
ADD HL,BC 09
ADD Register Pair BC (Register C the places, Register B 00H) to Register Pair HL: the cursor address after the keyword.
5682
LD A,H 7C
Copy Register H (the high byte of that address) into Register A.
5683
CP 3FH FE 3F
Compare Register A against 3FH, the page of the last 4 lines of the screen.
5685
If the NZ FLAG is set (above 3F00H), JUMP to 5692H to display the keyword.
5687
LD A,L 7D
Copy Register L (the low byte of that address) into Register A.
5688
CP BFH FE BF
Compare Register A against BFH, the low byte of 3FBFH.
568A
If the CARRY FLAG is set (below 3FBFH), JUMP to 5692H to display the keyword.
568C
SET 2,(IY+01H) FD CB 01 D6
Set bit 2 of IY+01H (5AE6H, Index Register IY): the screen is full, the keyword waits at 5B19H for the next screen.
5690
JUMP to 56CCH with Register A not FFH: the jump at 5785H keeps its 5696H, which displays the keyword.
5692
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the keyword and its spaces.
5695
LD B,C 41
Copy Register C (the places) into Register B, the count.
5696
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
5697
PUSH DE D5
Save Register Pair DE (the place in the keyword) to the stack across the display.
5698
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
569B
GOSUB to 5456H to send the character in Register A to the printer as well when P was given.
569E
POP DE D1
Restore Register Pair DE from the stack: the place in the keyword.
569F
INC DE 13
INCrement Register Pair DE to the next character.
56A0
DECrement Register B and JUMP to 5696H while it is not zero: the next character.
56A2
JUMP to 564CH to pass over the offset and take the next keyword.
56A4
LD B,00H 06 00
Load Register B with 00H, so that Register Pair BC = the length in Register C.
56A6
ADD HL,BC 09
ADD Register Pair BC (the length) to Register Pair HL (the cursor address): where the keyword would end.
56A7
LD A,H 7C
Copy Register H (the high byte of that address) into Register A.
56A8
CP 3FH FE 3F
Compare Register A against 3FH, the page of the last 4 lines of the screen.
56AA
If the NZ FLAG is set (above 3F00H), JUMP to 56BDH to start a new line.
56AC
LD A,L 7D
Copy Register L (the low byte of that address) into Register A.
56AD
CP BFH FE BF
Compare Register A against BFH, the low byte of 3FBFH.
56AF
If the CARRY FLAG is set (below 3FBFH), JUMP to 56BDH to start a new line.
56B1
SET 2,(IY+01H) FD CB 01 D6
Set bit 2 of IY+01H (5AE6H, Index Register IY): the screen is full, the directory goes on after the prompt.
56B5
SET 3,(IY+01H) FD CB 01 DE
Set bit 3 of IY+01H (5AE6H, Index Register IY): the keyword is taken again at 5665H on the next screen.
56B9
PUSH DE D5
Save Register Pair DE (the end of the keyword) to the stack for 5794H.
56BA
PUSH BC C5
Save Register Pair BC (Register C the length) to the stack for 5794H.
56BB
JUMP to 56CCH, for the end of the screen, with Register A not FFH.
56BD
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, to start a new line for the keyword.
56BF
PUSH DE D5
Save Register Pair DE (the end of the keyword) to the stack across the display.
56C0
GOSUB to 0033H, the ROM's display routine, to display the character in Register A (0DH): a new line.
56C3
GOSUB to 5456H to end the printer line as well when P was given.
56C6
POP DE D1
Restore Register Pair DE from the stack: the end of the keyword.
56C7
LD HL,(4020H) 2A 20 40
Fetch the cursor address from 4020H-4021H into Register Pair HL, at the start of the new line.
56CA
JUMP back to 5665H to place the keyword on the new line.
56CCH - The End of a Screen of the Directory, and the Prompt
Register A = FFH when the last keyword has been displayed: the jump at 5785H is then pointed at 5788H, which does not display it again. With P the next screen follows without a prompt (5765H). The prompt is Press <BREAK>,<ENTER> or type keyword, or during the global scan Press <BREAK> to exit or <ENTER> to continue Global Scan (5860H). The answer is taken by ROM 0040H at 5B59H, 53 characters at most: BREAK ends HELP, ENTER alone shows the next screen of the directory (or the directory again from its start), and a keyword is looked up in the same file (5363H). The category prompt of 57FAH enters at 56F3H with Register Pair HL = 5B19H and Register B = 08H: its answer is a new command line (5236H).
56CC
CP FFH FE FF
Compare Register A against FFH, the mark that the last keyword was displayed.
56CE
If the NZ FLAG is set (it was not, or this is the end of a text), JUMP to 56DDH for the prompt.
56D0
LD HL,5788H 21 88 57
Point Register Pair HL to 5788H, the place that passes over the display of the last keyword.
56D3
LD (5786H),HL 22 86 57
Store Register Pair HL (5788H) at 5786H-5787H, the operand of JP 5696H at 5785H.
56D6
BIT 7,(IY+00H) FD CB 00 7E
Test bit 7 of IY+00H (5AE5H, Index Register IY), the printer (P).
56DA
If the NZ FLAG is set (P: no pause), JUMP to 5765H to clear the screen and go on with the directory.
56DD
BIT 3,(IY+00H) FD CB 00 5E
Test bit 3 of IY+00H (5AE5H, Index Register IY), the global scan.
56E1
If the NZ FLAG is set (global scan), JUMP to 5860H for its own prompt.
56E4
LD HL,59D7H 21 D7 59
Point Register Pair HL to 59D7H, the text 0AH Press <BREAK>,<ENTER> or type keyword and 03H.
56E7
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL (59D7H) on the last line.
56EA
RES 4,(IY+00H) FD CB 00 A6
Reset bit 4 of IY+00H (5AE5H, Index Register IY): search mode ends with the first directory.
56EE
LD B,35H 06 35
Load Register B with 35H, the 53 characters the answer may have.
56F0
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the place of the keyword.
56F3
GOSUB to 0040H, the ROM's line input, to take up to Register B characters at Register Pair HL: Register B = the count, the CARRY FLAG after BREAK.
56F6
If the CARRY FLAG is set (BREAK), JUMP to 5722H to end HELP.
56F8
INC B 04
INCrement Register B, the count of the characters typed, to set the flags from it.
56F9
DEC B 05
DECrement Register B back: the Z FLAG for ENTER alone.
56FA
If the Z FLAG is set (nothing typed), JUMP to 575EH for the next screen of the directory.
56FC
LD A,L 7D
Copy Register L (the low byte of the start of the answer) into Register A.
56FD
ADD A,B 80
ADD Register B (the count) to Register A: the low byte of the place after the answer.
56FE
If the NO CARRY FLAG is set (the same page), JUMP to 5701H.
5700
INC H 24
INCrement Register H for the carry into the high byte.
5701
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the place after the answer.
5702
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, for the end of the answer.
5704
LD (HL),A 77
Store Register A (0DH) at Register Pair HL, after the answer.
5705
BIT 3,(IY+01H) FD CB 01 5E
Test bit 3 of IY+01H (5AE6H, Index Register IY): a held back keyword left Register Pairs DE and BC on the stack at 56B9H.
5709
If the Z FLAG is set (nothing on the stack), JUMP to 570DH.
570B
POP DE D1
Restore Register Pair DE from the stack: the word saved from Register Pair BC is dropped.
570C
POP DE D1
Restore Register Pair DE from the stack: the word saved from Register Pair DE is dropped.
570D
LD DE,5AF0H 11 F0 5A
Point Register Pair DE to 5AF0H, the file control block of the HELP file.
5710
RES 3,(IY+01H) FD CB 01 9E
Reset bit 3 of IY+01H (5AE6H, Index Register IY): no keyword is held back any more.
5714
BIT 2,(IY+00H) FD CB 00 56
Test bit 2 of IY+00H (5AE5H, Index Register IY): a HELP file is open (cleared at 5805H for the category prompt).
5718
If the Z FLAG is set (the answer to the category prompt), JUMP to 5236H to take the answer at 5B19H as a new command line.
571B
SET 1,(IY+00H) FD CB 00 CE
Set bit 1 of IY+00H (5AE5H, Index Register IY): the answer at 5B59H is a keyword.
571F
JUMP to 5363H to find the index of the open file again and look the keyword up.
5722H - The End of HELP
BREAK, ENTER at the category prompt, a parameter error and a read error end here. The HELP file is closed when one was opened. Unless V was given the screen is copied back from 5C91H and the cursor address put back into 4020H-4021H. When 402DH, @EXIT, does not hold C3H (no program such as BASIC has put a JP there, so HELP was typed at LDOS Ready), three 1BH codes move the cursor up three lines, so that the HELP command itself is written over (the manual: the screen is restored less the help command). The printer line is ended and HELP goes to @EXIT.
5722
BIT 2,(IY+00H) FD CB 00 56
Test bit 2 of IY+00H (5AE5H, Index Register IY): a HELP file was opened.
5726
If the Z FLAG is set (no file open), JUMP to 572DH.
5728
EXX D9
EXchange to the alternate Register Pairs: DE' = 5AF0H, the file control block.
5729
GOSUB to 4428H, @CLOSE, to close the HELP file at Register Pair DE (5AF0H).
572C
EXX D9
EXchange back to the main Register Pairs from the alternate set.
572D
BIT 6,(IY+00H) FD CB 00 76
Test bit 6 of IY+00H (5AE5H, Index Register IY), the restore of the screen.
5731
If the Z FLAG is set (V was given), JUMP to 402DH, @EXIT, with the screen as HELP left it.
5734
LD DE,3C00H 11 00 3C
Point Register Pair DE to 3C00H, the start of the video memory.
5737
LD HL,5C91H 21 91 5C
Point Register Pair HL to 5C91H, the copy of the screen made at 5332H.
573A
LD BC,0400H 01 00 04
Load Register Pair BC with 0400H, the 1024 bytes of the screen.
573D
LDIR ED B0
Copy the screen back from 5C91H at Register Pair HL to 3C00H at Register Pair DE, Register Pair BC the count (LDIR).
573F
LD HL,(5AECH) 2A EC 5A
Fetch the cursor address kept at 5AECH-5AEDH into Register Pair HL.
5742
LD (4020H),HL 22 20 40
Store Register Pair HL (the cursor address) at 4020H-4021H, the cursor of the video device control block.
5745
LD HL,402DH 21 2D 40
Point Register Pair HL to 402DH, @EXIT, whose first byte tells who called HELP.
5748
LD A,C3H 3E C3
Load Register A with C3H, the opcode of JP, for the compare with the byte at 402DH.
574A
CP (HL) BE
Compare Register A (C3H) against the byte at Register Pair HL (402DH): the Z FLAG when a program has put a JP into @EXIT.
574B
If the Z FLAG is set (a JP at 402DH), JUMP to 5756H: the cursor stays where it was.
574D
LD B,03H 06 03
Load Register B with 03H, the three lines the cursor is moved up.
574F
LD A,1BH 3E 1B
Load Register A with 1BH, the code that moves the cursor up one line.
5751
GOSUB to 0033H, the ROM's display routine, to send the code in Register A (1BH).
5754
DECrement Register B and JUMP to 574FH while it is not zero: the cursor goes up three lines.
5756
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, for the printer when P was given.
5758
GOSUB to 5456H to end the printer line when P was given (the screen gets nothing).
575B
JUMP to 402DH, @EXIT, to end HELP without an error: back to LDOS Ready or to the program.
575EH - ENTER Alone: the Next Screen of the Directory
When the directory has more (IY+01H bit 2), the screen is cleared and the listing goes on: the keyword held back is displayed at the top through the jump at 5785H (5696H, or 5788H when it was already displayed); one that needed a new line (IY+01H bit 3) is placed again by 5665H with the Register Pairs pushed at 56B9H. Without more, the directory starts again from the beginning (5580H). At the category prompt this way reads the file named last, or none: 55B6H then ends with Source File Read Error, which the restored screen covers again unless V was given.
575E
BIT 2,(IY+01H) FD CB 01 56
Test bit 2 of IY+01H (5AE6H, Index Register IY): the directory has more to show.
5762
If the Z FLAG is set (no more), JUMP to 5580H to display the directory from its start.
5765
LD A,1CH 3E 1C
Load Register A with 1CH, the code that puts the cursor home.
5767
GOSUB to 0033H, the ROM's display routine, to send the code in Register A (1CH).
576A
LD A,1FH 3E 1F
Load Register A with 1FH, the code that clears to the end of the screen.
576C
GOSUB to 0033H, the ROM's display routine, to send the code in Register A (1FH).
576F
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, for the printer when P was given.
5771
GOSUB to 5456H to end the printer line when P was given.
5774
LD HL,3C00H 21 00 3C
Point Register Pair HL to 3C00H, the cursor address at the top of the screen, for the tests of 5665H and 564CH.
5777
LD B,C 41
Copy Register C (the places of the keyword held back) into Register B, the count for 5696H.
5778
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the keyword held back.
577B
RES 2,(IY+01H) FD CB 01 96
Reset bit 2 of IY+01H (5AE6H, Index Register IY): the new screen is not full yet.
577F
BIT 3,(IY+01H) FD CB 01 5E
Test bit 3 of IY+01H (5AE6H, Index Register IY): the keyword held back needs a new line.
5783
If the NZ FLAG is set (it does), JUMP to 5794H.
5785
JUMP to 5696H to display the keyword held back; 56D3H changes the operand 5786H-5787H to 5788H when it was displayed already.
5788
LD HL,5696H 21 96 56
Point Register Pair HL to 5696H, the operand the jump at 5785H has in the file.
578B
LD (5786H),HL 22 86 57
Store Register Pair HL (5696H) back at 5786H-5787H, the operand of the JP at 5785H.
578E
LD HL,3C00H 21 00 3C
Point Register Pair HL to 3C00H, the cursor address at the top of the screen.
5791
JUMP to 564CH to pass over the offset of the keyword displayed last and take the next one.
5794
RES 3,(IY+01H) FD CB 01 9E
Reset bit 3 of IY+01H (5AE6H, Index Register IY): the keyword is placed now.
5798
POP BC C1
Restore Register Pair BC from the stack (56BAH): Register C = the length of the keyword.
5799
POP DE D1
Restore Register Pair DE from the stack (56B9H): the end of the keyword at 5B19H.
579A
JUMP to 5665H to place the keyword at the top of the screen, Register Pair HL = 3C00H.
579DH - The HELP Files on Line
When no file was named, or the file named does not open. The list is built at 6095H: for each drive 0-7 that @CKDRV finds ready, @DODIR with Register B = 03H (the records of the files whose extension matches the mask) puts 18 bytes of the directory record of each /HLP file into the list and ends it with FFH. The mask, HLP, is copied to the place of each FFH before the next drive; the address after the last FFH becomes the start of the blink table (6093H). The word on the stack is then taken back: when it points at an asterisk the global scan starts (580CH). Else the screen shows the banner, Help Categories presently on line are: and the 8 characters of each name, four to a line (a column of 16), and the category prompt.
579D
LD HL,6095H 21 95 60
Point Register Pair HL to 6095H, the start of the list of the HELP files, beyond the file.
57A0
GOSUB to 589BH to copy the mask HLP from 5AE9H to Register Pair HL (6095H); Register Pair HL is kept.
57A3
LD B,08H 06 08
Load Register B with 08H, the count of the drives.
57A5
LD A,B 78
Copy Register B (the count of the drives left, 08H down to 01H) into Register A.
57A6
SUB 08H D6 08
Subtract 08H from Register A: 00H for the first drive, F9H for the last.
57A8
NEG ED 44
NEGate Register A: the drive number, 0 for Register B = 08H up to 7 for Register B = 01H.
57AA
LD C,A 4F
Copy Register A (the drive number) into Register C, the drive for @CKDRV and @DODIR.
57AB
PUSH BC C5
Save Register Pair BC (Register B the count, Register C the drive) to the stack.
57AC
GOSUB to 4209H, @CKDRV, to test whether drive Register C is ready: the Z FLAG when it is.
57AF
If the NZ FLAG is set (not ready), JUMP to 57BCH to try the next drive.
57B1
LD B,03H 06 03
Load Register B with 03H, the function of @DODIR: the records of the files whose extension matches the mask, into the buffer.
57B3
GOSUB to 4419H, @DODIR, to put the records of the /HLP files of drive Register C into the buffer at Register Pair HL, 18 bytes each, ended by FFH.
57B6
GOSUB to 58AAH to find the FFH at the end of the list: Register Pair HL = the FFH, (6093H) = the byte after it.
57B9
GOSUB to 589BH to copy the mask HLP over the FFH at Register Pair HL, for the next drive.
57BC
POP BC C1
Restore Register Pair BC from the stack: Register B the count, Register C the drive.
57BD
DECrement Register B and JUMP to 57A5H while it is not zero: the next drive.
57BF
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, over the mask: the end of the whole list.
57C1
POP HL E1
Restore Register Pair HL from the stack: the word pushed at 5225H or 5243H, the first character of the line (on the other ways here the top word of the stack).
57C2
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
57C3
CP 2AH FE 2A
Compare Register A (the character) against 2AH, the asterisk of the global scan.
57C5
If the Z FLAG is set (an asterisk), JUMP to 580CH to start the global scan.
57C7
LD HL,5939H 21 39 59
Point Register Pair HL to 5939H, 1CH 1FH and the banner.
57CA
GOSUB to 4467H, @DSPLY, to clear the screen and display the banner at Register Pair HL (5939H).
57CD
LD HL,5995H 21 95 59
Point Register Pair HL to 5995H, the text Help Categories presently on line are: ended by 0DH.
57D0
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5995H) and its 0DH.
57D3
LD HL,6095H 21 95 60
Point Register Pair HL to 6095H, the first entry of the list.
57D6
LD A,(HL) 7E
Fetch the first byte of the entry at Register Pair HL into Register A.
57D7
CP FFH FE FF
Compare Register A (the byte) against FFH, the end of the list.
57D9
If the Z FLAG is set (the end), JUMP to 57FAH for the category prompt.
57DB
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the place of the name in the record.
57DE
ADD HL,BC 09
ADD Register Pair BC (0005H) to Register Pair HL: the name of the file, +05H of its record.
57DF
LD B,08H 06 08
Load Register B with 08H, the 8 characters of a name.
57E1
LD A,(HL) 7E
Fetch the character of the name at Register Pair HL into Register A.
57E2
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
57E5
INC HL 23
INCrement Register Pair HL to the next character of the name.
57E6
DECrement Register B and JUMP to 57E1H while it is not zero: the next character.
57E8
PUSH HL E5
Save Register Pair HL (+0DH of the record, the extension) to the stack.
57E9
LD HL,(4020H) 2A 20 40
Fetch the cursor address from 4020H-4021H into Register Pair HL.
57EC
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the 8 places of space after the name.
57EF
ADD HL,BC 09
ADD Register Pair BC (0008H) to Register Pair HL: the next column of 16.
57F0
LD (4020H),HL 22 20 40
Store Register Pair HL at 4020H-4021H, the cursor address, which moves without writing to the screen.
57F3
POP HL E1
Restore Register Pair HL from the stack: +0DH of the record.
57F4
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the bytes left of the 18 byte entry.
57F7
ADD HL,BC 09
ADD Register Pair BC (0005H) to Register Pair HL: the next entry of the list.
57F8
JUMP back to 57D6H to display the name of the next entry of the list.
57FA
LD HL,59FFH 21 FF 59
Point Register Pair HL to 59FFH, the text 0AH Press ENTER to exit or enter category and 03H.
57FD
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL (59FFH).
5800
LD HL,5B19H 21 19 5B
Point Register Pair HL to 5B19H, the line buffer, where the category typed goes.
5803
LD B,08H 06 08
Load Register B with 08H, the 8 characters a category may have.
5805
RES 2,(IY+00H) FD CB 00 96
Reset bit 2 of IY+00H (5AE5H, Index Register IY): no file is open, so 5718H takes the answer as a command line.
5809
JUMP to 56F3H to take the answer with ROM 0040H.
580CH - The Global Scan
HELP, an asterisk and a keyword: the keyword after the asterisk is copied to 5B59H up to its 0DH, and IY+00H bit 3 is set. For each entry of the list at 6095H the screen is cleared, Global Search in File: and the name are displayed at the top (the name at 3C18H), the name is copied to 5B19H and opened as a new file specification at 5299H, which takes the keyword already at 5B59H (52C9H). The address of the next entry is kept on the stack. A file without the keyword is closed and the next one tried (5872H); after a text the prompt asks for BREAK (end) or ENTER (go on). After the last entry: End of Global Scan and the category prompt. Each name is opened without a drive, so @OPEN takes the first drive that has a file of that name.
580C
SET 3,(IY+00H) FD CB 00 DE
Set bit 3 of IY+00H (5AE5H, Index Register IY), the global scan.
5810
LD DE,5B59H 11 59 5B
Point Register Pair DE to 5B59H, the place of the keyword.
5813
INC HL 23
INCrement Register Pair HL past the asterisk, to the next character.
5814
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
5815
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
5817
If the Z FLAG is set (the end), JUMP to 581DH.
5819
LD (DE),A 12
Store Register A (the character) at Register Pair DE, in the keyword at 5B59H.
581A
INC DE 13
INCrement Register Pair DE to the next place of the keyword.
581B
JUMP back to 5813H to copy the next character.
581D
LD (DE),A 12
Store Register A (0DH) at Register Pair DE: the keyword ends with 0DH.
581E
LD HL,6095H 21 95 60
Point Register Pair HL to 6095H, the first entry of the list of the HELP files.
5821
PUSH HL E5
Save Register Pair HL (the entry) to the stack across the display.
5822
LD HL,5A7DH 21 7D 5A
Point Register Pair HL to 5A7DH, the text 1CH 1FH Global Search in File: and 03H.
5825
GOSUB to 4467H, @DSPLY, to clear the screen and display the text at Register Pair HL (5A7DH).
5828
POP HL E1
Restore Register Pair HL from the stack: the entry.
5829
LD A,(HL) 7E
Fetch the first byte of the entry at Register Pair HL into Register A.
582A
CP FFH FE FF
Compare Register A (the byte) against FFH, the end of the list.
582C
If the Z FLAG is set (no more files), JUMP to 587AH to end the scan.
582E
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the place of the name in the record.
5831
ADD HL,BC 09
ADD Register Pair BC (0005H) to Register Pair HL: the name of the file.
5832
PUSH HL E5
Save Register Pair HL (the name) to the stack, for 5844H.
5833
PUSH HL E5
Save Register Pair HL (the name) to the stack again, for 583AH.
5834
LD HL,3C18H 21 18 3C
Load Register Pair HL with 3C18H, the 25th place of the top line, after the text.
5837
LD (4020H),HL 22 20 40
Store Register Pair HL (3C18H) at 4020H-4021H, the cursor address.
583A
POP HL E1
Restore Register Pair HL from the stack: the name.
583B
LD B,08H 06 08
Load Register B with 08H, the 8 characters of a name.
583D
LD A,(HL) 7E
Fetch the character of the name at Register Pair HL into Register A.
583E
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
5841
INC HL 23
INCrement Register Pair HL to the next character of the name.
5842
DECrement Register B and JUMP to 583DH while it is not zero: the next character.
5844
POP HL E1
Restore Register Pair HL from the stack: the name again.
5845
LD BC,000DH 01 0D 00
Load Register Pair BC with 000DH, the bytes from the name to the next entry.
5848
ADD HL,BC 09
ADD Register Pair BC (000DH) to Register Pair HL: the next entry of the list.
5849
PUSH HL E5
Save Register Pair HL (the next entry) to the stack, for 5872H.
584A
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
584B
SBC HL,BC ED 42
Subtract Register Pair BC (000DH) from Register Pair HL: the name again.
584D
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, after the name of the file being scanned.
584F
GOSUB to 0033H, the ROM's display routine, to display the character in Register A (0DH).
5852
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the 8 characters of a name.
5855
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the line buffer.
5858
LDIR ED B0
Copy the name from Register Pair HL to 5B19H at Register Pair DE, Register Pair BC the count (LDIR).
585A
LD HL,5B19H 21 19 5B
Point Register Pair HL to 5B19H, the name as a file specification.
585D
JUMP to 5299H to take it with @FSPEC, open it and look the keyword up.
5860
LD HL,5A97H 21 97 5A
Point Register Pair HL to 5A97H, the text 0AH Press <BREAK> to exit or <ENTER> to continue Global Scan and 0DH.
5863
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL (5A97H).
5866
GOSUB to 0049H, the ROM's wait for a key: Register A = the key.
5869
CP 01H FE 01
Compare Register A (the key) against 01H, BREAK.
586B
If the Z FLAG is set (BREAK), JUMP to 5722H to end HELP.
586E
CP 0DH FE 0D
Compare Register A (the key) against 0DH, ENTER.
5870
If the NZ FLAG is set (another key), JUMP back to 5860H to ask again.
5872
POP HL E1
Restore Register Pair HL from the stack: the next entry of the list, pushed at 5849H.
5873
EXX D9
EXchange to the alternate Register Pairs: DE' = 5AF0H, the file control block.
5874
GOSUB to 4428H, @CLOSE, to close the HELP file at Register Pair DE (5AF0H).
5877
EXX D9
EXchange back to the main Register Pairs from the alternate set.
5878
JUMP back to 5821H to scan the next file of the list at Register Pair HL.
587A
LD HL,5AD1H 21 D1 5A
Point Register Pair HL to 5AD1H, the text 0AH End of Global Scan and 0DH.
587D
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5AD1H).
5880
RES 3,(IY+00H) FD CB 00 9E
Reset bit 3 of IY+00H (5AE5H, Index Register IY): the global scan is over.
5884
RES 1,(IY+00H) FD CB 00 8E
Reset bit 1 of IY+00H (5AE5H, Index Register IY): no keyword.
5888
JUMP to 57FAH for the category prompt Press ENTER to exit or enter category.
588BH - Small Routines
588BH displays the space of an 8DH held over from the bottom line; 589BH copies the mask HLP; 58AAH finds the end of the file list; 58B8H tests the end of a parameter letter; 58CFH sets the alternate Register Pairs for the file; 58D8H reads a two byte offset and moves the file there; 58EBH reads one byte of the file; 58FBH compares a keyword of the directory with the word of search mode.
588B
PUSH AF F5
Save Register Pair AF (the character in Register A) to the stack across the space.
588C
INC HL 23
INCrement Register Pair HL, the cursor address, past the place of the space.
588D
LD A,20H 3E 20
Load Register A with 20H, the space that the 8DH stands for.
588F
GOSUB to 0033H, the ROM's display routine, to display the space in Register A.
5892
GOSUB to 5456H to send the space in Register A to the printer as well when P was given.
5895
RES 1,(IY+01H) FD CB 01 8E
Reset bit 1 of IY+01H (5AE6H, Index Register IY): the space of the 8DH is done.
5899
POP AF F1
Restore Register Pair AF from the stack: Register A = the character.
589A
RET C9
RETurn to the caller, 5488H, which displays the character.
589B
LD DE,5AE9H 11 E9 5A
Point Register Pair DE to 5AE9H, the three characters HLP.
589E
LD B,03H 06 03
Load Register B with 03H, the count of the three characters of the mask.
58A0
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
58A1
LD (HL),A 77
Store Register A (the character) at Register Pair HL.
58A2
INC HL 23
INCrement Register Pair HL to the next place.
58A3
INC DE 13
INCrement Register Pair DE to the next character of HLP.
58A4
DECrement Register B and JUMP to 58A0H while it is not zero: the next character.
58A6
DEC HL 2B
DECrement Register Pair HL back towards the start of the mask.
58A7
DEC HL 2B
DECrement Register Pair HL again, towards the first character of the mask.
58A8
DEC HL 2B
DECrement Register Pair HL to the first character of the mask, as the caller gave it.
58A9
RET C9
RETurn with Register Pair HL at the mask, as the caller gave it.
58AA
LD A,FFH 3E FF
Load Register A with FFH, the end of the list @DODIR builds.
58AC
CP (HL) BE
Compare Register A (FFH) against the byte at Register Pair HL.
58AD
If the Z FLAG is set (the FFH), JUMP to 58B2H.
58AF
INC HL 23
INCrement Register Pair HL to the next byte of the list built by @DODIR.
58B0
JUMP back to 58ACH to look at the next byte of the list for the FFH.
58B2
INC HL 23
INCrement Register Pair HL past the FFH, to the byte after the list.
58B3
LD (6093H),HL 22 93 60
Store Register Pair HL (the byte after the list) at 6093H-6094H, the start of the blink table.
58B6
DEC HL 2B
DECrement Register Pair HL back to the FFH at the end of the list.
58B7
RET C9
RETurn with Register Pair HL at the FFH, the place of the next mask.
58B8
INC HL 23
INCrement Register Pair HL past the parameter letter.
58B9
LD A,(HL) 7E
Fetch the character after the letter at Register Pair HL into Register A.
58BA
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
58BC
If the Z FLAG is set (0DH), JUMP to 58CAH: the parameter ends.
58BE
CP 29H FE 29
Compare Register A (the character) against 29H, the closing parenthesis.
58C0
If the Z FLAG is set (a parenthesis), JUMP to 58CAH: the parameter ends.
58C2
CP 2CH FE 2C
Compare Register A (the character) against 2CH, a comma.
58C4
If the Z FLAG is set (a comma), JUMP to 58CAH: the parameter ends.
58C6
LD A,01H 3E 01
Load Register A with 01H: the letter goes on, an error.
58C8
JUMP to 58CCH to set the flags from Register A (01H): the NZ FLAG.
58CA
DEC HL 2B
DECrement Register Pair HL back to the letter: 5251H takes the character after it next.
58CB
XOR A AF
Clear Register A (XOR A): the parameter is good.
58CC
INC A 3C
INCrement Register A, to set the flags from it.
58CD
DEC A 3D
DECrement Register A back: the Z FLAG for 00H, the NZ FLAG for 01H.
58CE
RET C9
RETurn with the result in the flags: the Z FLAG when the parameter ends.
58CF
EXX D9
EXchange to the alternate Register Pairs, the ones the file routines below use.
58D0
LD DE,5AF0H 11 F0 5A
Point Register Pair DE to 5AF0H, the file control block of the HELP file (DE').
58D3
LD HL,5C90H 21 90 5C
Point Register Pair HL to 5C90H, the byte @READ fills (HL').
58D6
EXX D9
EXchange back to the main Register Pairs from the alternate set.
58D7
RET C9
RETurn to the caller with the alternate Register Pairs DE' and HL' set.
58D8
GOSUB to 58EBH to read the low byte of the offset into Register A.
58DB
LD C,A 4F
Copy Register A (the low byte) into Register C.
58DC
GOSUB to 58EBH to read the high byte of the offset into Register A.
58DF
LD B,A 47
Copy Register A (the high byte) into Register B: Register Pair BC = the offset.
58E0
PUSH BC C5
Save Register Pair BC (the offset) to the stack, to move it into the alternate set.
58E1
EXX D9
EXchange to the alternate Register Pairs: DE' = 5AF0H, the file control block.
58E2
POP BC C1
Restore Register Pair BC from the stack: the offset, the record number for @POSN.
58E3
GOSUB to 4442H, @POSN, to move the file at Register Pair DE to the record Register Pair BC, the byte at that offset.
58E6
EXX D9
EXchange back to the main Register Pairs from the alternate set.
58E7
RET Z C8
RETurn if the Z FLAG is set (the file was moved).
58E8
JUMP to 5931H to display Source File Read Error and end.
58EB
EXX D9
EXchange to the alternate Register Pairs: DE' = 5AF0H, the file control block, HL' = 5C90H.
58EC
GOSUB to 4436H, @READ, to read the next record of the file at Register Pair DE, one byte, into Register Pair HL (5C90H).
58EF
If the Z FLAG is set (the byte was read), JUMP to 58F8H to fetch it.
58F1
CP 1CH FE 1C
Compare Register A (the error) against 1CH, end of file.
58F3
If the NZ FLAG is set (another error), JUMP to 58F8H: the byte at 5C90H is fetched with the NZ FLAG, and the error is not reported.
58F5
OR A B7
Set the flags from Register A (OR A): the NZ FLAG with Register A = 1CH.
58F6
JUMP to 58F9H with Register A = 1CH and the NZ FLAG, the end of the file.
58F8
LD A,(HL) 7E
Fetch the byte read from Register Pair HL (5C90H) into Register A.
58F9
EXX D9
EXchange back to the main Register Pairs from the alternate set.
58FA
RET C9
RETurn with the byte (or 1CH at the end of the file) in Register A.
58FB
PUSH HL E5
Save Register Pair HL (the cursor address) to the stack.
58FC
PUSH DE D5
Save Register Pair DE (the end of the keyword) to the stack.
58FD
LD DE,5B19H 11 19 5B
Point Register Pair DE to 5B19H, the keyword of the directory.
5900
LD HL,5B59H 21 59 5B
Point Register Pair HL to 5B59H, the word given for search mode, ended by 0DH.
5903
LD A,(HL) 7E
Fetch the character of the word at Register Pair HL into Register A.
5904
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the word.
5906
If the Z FLAG is set (the whole word matched), JUMP to 5911H.
5908
LD B,A 47
Copy Register A (the character of the word) into Register B.
5909
LD A,(DE) 1A
Fetch the character of the keyword at Register Pair DE into Register A.
590A
CP B B8
Compare Register A (the keyword's character) against Register B (the word's character).
590B
If the NZ FLAG is set (they differ), JUMP to 5916H.
590D
INC HL 23
INCrement Register Pair HL to the next character of the word.
590E
INC DE 13
INCrement Register Pair DE to the next character of the keyword.
590F
JUMP back to 5903H to compare the next characters.
5911
POP DE D1
Restore Register Pair DE from the stack: the end of the keyword.
5912
POP HL E1
Restore Register Pair HL from the stack: the cursor address.
5913
RET NC D0
RETurn if the NO CARRY FLAG is set, as it is after the CP of 0DH: a match.
5914
CCF 3F
Complement the CARRY FLAG (CCF); never reached, as 5913H always returns.
5915
RET C9
RETurn to the caller with the CARRY FLAG as CCF left it at 5914H.
5916
POP DE D1
Restore Register Pair DE from the stack: the end of the keyword.
5917
POP HL E1
Restore Register Pair HL from the stack: the cursor address.
5918
RET C D8
RETurn if the CARRY FLAG is set: no match, the keyword is passed over.
5919
CCF 3F
Complement the CARRY FLAG (CCF): set, no match.
591A
RET C9
RETurn with the CARRY FLAG set: the keyword does not start with the word.
591BH - The Error Messages
A parameter error and a read error display their text and end HELP through 5722H (BIT 5 of IY+00H is cleared on the way, which only stops the blinking); too little memory ends at @ABORT before anything was changed.
591B
LD HL,5A27H 21 27 5A
Point Register Pair HL to 5A27H, the text 0AH Parameter Error, System Aborted and 0DH.
591E
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5A27H or 5A65H).
5921
RES 5,(IY+00H) FD CB 00 AE
Reset bit 5 of IY+00H (5AE5H, Index Register IY): no blinking.
5925
JUMP to 5722H to end HELP: the file is closed and the screen restored.
5928
LD HL,5A49H 21 49 5A
Point Register Pair HL to 5A49H, the text 0AH Not enough Memory for HELP and 0DH.
592B
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5A49H).
592E
JUMP to 4030H, @ABORT, to end the command with an error.
5931
LD HL,5A65H 21 65 5A
Point Register Pair HL to 5A65H, the text 0AH Source File Read Error and 0DH.
5934
JUMP to 591EH to display the text at Register Pair HL (5A65H) and end HELP.
5936H - The Texts
The screen codes and the texts of HELP: 1CH puts the cursor home, 1FH clears to the end of the screen, 0AH starts a new line, 03H ends a text for @DSPLY without being sent, 0DH ends a text after it has been sent.
5936-5938
DEFB 1CH, 1FH, 03H 1C 1F 03
5936H-5938H: cursor home, clear to the end of the screen and the end of the text: 53DDH clears the screen before the text of a keyword.
5939-593A
DEFB 1CH, 1FH 1C 1F
5939H-593AH: cursor home and clear to the end of the screen, before the banner displayed by 5587H and 57C7H.
593B-5960
DEFM "Help System Display Mode Version 5.3.1" 48 65 6C 70 20 53 79 73 74 65 6D 20 44 69 73 70 6C 61 79 20 4D 6F 64 65 20 56 65 72 73 69 6F 6E 20 35 2E 33 2E 31
593BH-5960H: the name of the program and its version; 53F8H prints the banner from here, without the screen codes.
5961
DEFB 0AH 0A
5961H: 0AH, a new line: the copyright goes on the next line of the banner.
5962-5992
DEFM "Copyright 1991 MISOSYS, Inc., All rights reserved" 43 6F 70 79 72 69 67 68 74 20 31 39 39 31 20 4D 49 53 4F 53 59 53 2C 20 49 6E 63 2E 2C 20 41 6C 6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 64
5962H-5992H: the copyright line, the same text as the copyright record of the file.
5993-5994
DEFB 0AH, 0DH 0A 0D
5993H-5994H: 0AH, a new line, and 0DH, the end of the banner.
5995-59BA
DEFM "Help Categories presently on line are:" 48 65 6C 70 20 43 61 74 65 67 6F 72 69 65 73 20 70 72 65 73 65 6E 74 6C 79 20 6F 6E 20 6C 69 6E 65 20 61 72 65 3A
5995H-59BAH: the heading of the list of the HELP files on line, displayed by 57D0H.
59BB
DEFB 0DH 0D
59BBH: 0DH, the end of the line and of the text: the names follow on the next line.
59BC-59D5
DEFM "Directory for HELP file : " 44 69 72 65 63 74 6F 72 79 20 66 6F 72 20 48 45 4C 50 20 66 69 6C 65 20 3A 20
59BCH-59D5H: the heading of the directory of a file, displayed by 5590H before the name kept at 5B10H.
59D6
DEFB 03H 03
59D6H: 03H, the end of the text for @DSPLY: the cursor stays after the colon and the space.
59D7
DEFB 0AH 0A
59D7H: 0AH, a new line before the prompt of the directory, displayed by 56E7H.
59D8-59FD
DEFM "Press <BREAK>,<ENTER> or type keyword " 50 72 65 73 73 20 3C 42 52 45 41 4B 3E 2C 3C 45 4E 54 45 52 3E 20 6F 72 20 74 79 70 65 20 6B 65 79 77 6F 72 64 20
59D8H-59FDH: the prompt after a screen of the directory or the end of a text; the manual gives it as <ENTER>, <BREAK>, or type keyword?
59FE
DEFB 03H 03
59FEH: 03H, the end of the text for @DSPLY: the answer is typed after the prompt.
59FF
DEFB 0AH 0A
59FFH: 0AH, a new line before the category prompt, displayed by 57FDH.
5A00-5A25
DEFM "Press ENTER to exit or enter category " 50 72 65 73 73 20 45 4E 54 45 52 20 74 6F 20 65 78 69 74 20 6F 72 20 65 6E 74 65 72 20 63 61 74 65 67 6F 72 79 20
5A00H-5A25H: the category prompt after the list of the HELP files on line and after the global scan.
5A26
DEFB 03H 03
5A26H: 03H, the end of the text for @DSPLY: the category is typed after the prompt.
5A27
DEFB 0AH 0A
5A27H: 0AH, a new line before the text of 591BH.
5A28-5A47
DEFM "Parameter Error - System Aborted" 50 61 72 61 6D 65 74 65 72 20 45 72 72 6F 72 20 2D 20 53 79 73 74 65 6D 20 41 62 6F 72 74 65 64
5A28H-5A47H: the text of a parameter letter followed by another letter; HELP then ends through @EXIT, not @ABORT.
5A48
DEFB 0DH 0D
5A48H: 0DH, the end of the line and of the text of the parameter error.
5A49
DEFB 0AH 0A
5A49H: 0AH, a new line before the text of 5928H.
5A4A-5A63
DEFM "Not enough Memory for HELP" 4E 6F 74 20 65 6E 6F 75 67 68 20 4D 65 6D 6F 72 79 20 66 6F 72 20 48 45 4C 50
5A4AH-5A63H: the text of 5928H, when HIGH$ is below 6497H; HELP then ends at @ABORT.
5A64
DEFB 0DH 0D
5A64H: 0DH, the end of the line and of the text of the memory error.
5A65
DEFB 0AH 0A
5A65H: 0AH, a new line before the text of 5931H.
5A66-5A7B
DEFM "Source File Read Error" 53 6F 75 72 63 65 20 46 69 6C 65 20 52 65 61 64 20 45 72 72 6F 72
5A66H-5A7BH: the text of 5931H, for an error of @PEOF, @BKSP or @POSN on the HELP file.
5A7C
DEFB 0DH 0D
5A7CH: 0DH, the end of the line and of the text of the read error.
5A7D-5A7E
DEFB 1CH, 1FH 1C 1F
5A7DH-5A7EH: cursor home and clear to the end of the screen, before the heading of the global scan.
5A7F-5A95
DEFM "Global Search in File: " 47 6C 6F 62 61 6C 20 53 65 61 72 63 68 20 69 6E 20 46 69 6C 65 3A 20
5A7FH-5A95H: the heading of the global scan, displayed by 5825H on the top line; the name goes at 3C18H.
5A96
DEFB 03H 03
5A96H: 03H, the end of the text for @DSPLY: the name of the file follows on the same line.
5A97
DEFB 0AH 0A
5A97H: 0AH, a new line before the prompt of the global scan, displayed by 5863H.
5A98-5ACF
DEFM "Press <BREAK> to exit or <ENTER> to continue Global Scan" 50 72 65 73 73 20 3C 42 52 45 41 4B 3E 20 74 6F 20 65 78 69 74 20 6F 72 20 3C 45 4E 54 45 52 3E 20 74 6F 20 63 6F 6E 74 69 6E 75 65 20 47 6C 6F 62 61 6C 20 53 63 61 6E
5A98H-5ACFH: the prompt after the text of a keyword found by the global scan; ROM 0049H then waits for the key.
5AD0
DEFB 0DH 0D
5AD0H: 0DH, the end of the line and of the text of the prompt of the global scan.
5AD1
DEFB 0AH 0A
5AD1H: 0AH, a new line before the text of 587AH, after the last file.
5AD2-5AE3
DEFM "End of Global Scan" 45 6E 64 20 6F 66 20 47 6C 6F 62 61 6C 20 53 63 61 6E
5AD2H-5AE3H: the text of 587AH, displayed when every file of the list has been scanned.
5AE4
DEFB 0DH 0D
5AE4H: 0DH, the end of the line and of the text; the category prompt follows.
5AE5H - The Flags and the Cells of the File
Index Register IY points at 5AE5H. IY+00H: bit 0 the screen is saved, bit 1 a keyword was given, bit 2 a file was named (open), bit 3 the global scan, bit 4 search mode (S), bit 5 blinking (cleared by B), bit 6 restore the screen (cleared by V), bit 7 the printer (P). IY+01H: bit 0 the last byte was a character with a space, bit 1 an 8DH at the bottom line, bit 2 the directory goes on, bit 3 a keyword waits for a new line.
5AE5
DEFB 60H 60
5AE5H: IY+00H, the options and the state: 60H in the file, bit 6 (restore the screen) and bit 5 (blink) set.
5AE6
DEFB 00H 00
5AE6H: IY+01H, the state of the display of a text and of the directory, 00H in the file.
5AE7-5AE8
DEFB 00H, 00H 00 00
5AE7H-5AE8H: two bytes of 00H that no instruction of HELP reads or writes.
5AE9-5AEB
DEFM "HLP" 48 4C 50
5AE9H-5AEBH: the default extension for @FEXT (534FH) and the mask of the extension for @DODIR (589BH).
5AEC-5AED
DEFB 00H, 00H 00 00
5AECH-5AEDH: the cursor address of the video device control block kept by 533BH and put back by 573FH.
5AEE
DEFB 01H 01
5AEEH: the column count of the printer line, 01H at the start of a line (5456H).
5AEF
DEFB 00H 00
5AEFH: why a screen of text ended (54E8H): 00H a line end, 0CH the end of the text, else the byte held back.
5AF0H - The Work Areas Beyond the File
The file control block, the name, the line buffer, the keyword, the sector buffer, the byte read, the copy of the screen, the pointer to the blink table and the list of the HELP files. The three one, one and six byte load blocks of the file give 5B18H, 5C90H and 6093H-6098H their first values.
5AF0-5B0F
DEFS 32
5AF0H-5B0FH: not in the file. The file control block of the HELP file: the specification from @FSPEC (5299H), then the open file (535DH).
5B10-5B17
DEFS 8
5B10H-5B17H: not in the file. The first characters of the file specification, at most 8, shown by 559CH after Directory for HELP file.
5B18
DEFB 0DH 0D
5B18H: a load block of one byte, 0DH: the end of the name at 5B10H when it has 8 characters (52C0H stores the end of a shorter one).
5B19-5B58
DEFS 64
5B19H-5B58H: not in the file. The line buffer: the copy of the command line (5231H), the category typed, the keyword of the directory (55E1H), the name of the global scan (5858H).
5B59-5B8F
DEFS 55
5B59H-5B8FH: not in the file. The keyword or the word of search mode, ended by 0DH: from the line (5300H), the global scan (5819H) or the keyword prompt (56F0H).
5B90-5C8F
DEFS 256
5B90H-5C8FH: not in the file. The sector buffer of the HELP file, given to @OPEN at 535AH.
5C90
DEFB 00H 00
5C90H: a load block of one byte, 00H: the record of one byte that @READ fills for 58EBH (HL' = 5C90H).
5C91-6090
DEFS 1024
5C91H-6090H: not in the file. The copy of the screen 3C00H-3FFFH made at 5332H and put back at 573DH.
6091-6092
DEFS 2
6091H-6092H: not in the file. Two bytes between the copy of the screen and the load block at 6093H that HELP does not use.
6093-6094
DEFW 6097H 97 60
6093H-6094H: the start of the blink table, 6097H in the file; 58B3H sets it after the list of the HELP files.
6095-6096
DEFW 0000H 00 00
6095H-6096H: the start of the list of the HELP files (579DH); the mask HLP is written over the 0000H of the file.
6097-6098
DEFW 6097H 97 60
6097H-6098H: in the file 97H 60H, the first bytes of the blink table when no list is built; 54EBH writes the end mark there.
6099-6496
DEFS 1022
6099H-6496H: not in the file. The rest of the 1024 bytes above 6097H that 5200H asks for: the list of the HELP files, 18 bytes a file, then the blink table, 3 bytes a place.