DOSPLUS 3.5 for the Model III - REF/CMD Disassembled

Page Customization

Introduction/Summary

DOSPLUS 3.5 REF/CMD Disassembly - CMD"REF", the Cross Reference of a BASIC Program (Model III)

REF/CMD is the cross referencer of Extended Disk BASIC, CMD"REF"; its heading reads REF - BASIC Program refrencer - 1.7. It is a load module of 4 blocks, 992 bytes, at 5200H-55DFH, with the transfer address 5200H, after the two comment records (the name REF and the copyright notice). The Model I and Model III files are identical byte for byte, and so are the two pages apart from their links.

It runs only from Extended Disk BASIC: BASIC/CMD's CMD (5C48H) passes REF to CMNDI@ as a DOS command, the DOS loads REF/CMD at 5200H and calls it, and REF takes BASIC's text pointer off the stack (5216H). It ends at the ROM's READY, which resets the stack and sends the output back to the display. From the DOS command level it only shows its heading. TBASIC cannot run it, since its CMD runs no DOS commands.

The Statement

CMD"REF",option,... with the options L (every number in the program, as line numbers), V (the variables), K (the keywords) and P (the output to the printer, through the ROM's 409CH), in any order; or CMD"REF",S=item[,P] for one line number, variable or keyword. The lists come in the order line numbers, variables, keywords, whatever the order of the options (52CAH). Each item is shown in a column of 8 characters, then the numbers of the lines it occurs in, nine to a row (5472H).

The Parts of REF/CMD

AddressContents
5200H-5296HThe start and S= with one item (5200H, 526BH).
5297H-532EHThe options and the passes over the program for each kind (5297H, 52CAH).
532FH-5400HThe scan of a line for numbers, variables and keywords (532FH).
5401H-5471HA key offered: the least key of the pass and the list of its lines (5401H).
5472H-54F9HThe listing of an item and its lines (5472H).
54FAH-5589HThe keys of a variable and of a number, the number as text, the character class, the output (54FAH, 5539H, 5560H, 5572H, 557AH).
558AH-5BFEHThe heading, the flags, the keys and the list of lines (558AH).

How REF Works

REF keeps no table of the items. For each kind it passes over the whole program again and again: every item met is offered as a key of 4 bytes (5401H); a pass keeps the least key above the one listed last, with the lines it occurs in, and when the pass ends that key is listed and becomes the one listed last (52F8H). The keys are a line number in its two bytes followed by 80H 00H, a keyword's token followed by 00H 80H 00H, and a variable's first letter, second character, suffix and the ( of an array, a space for each part that is missing (54FAH); so the variables are listed in the order of these bytes (A, then the array A(, then A$), and a variable and the array of the same name are two items. The text of a line is read with the ROM's RST 10H code (1D78H), so spaces do not count; strings in quotes are passed over, the rest of a line after DATA or REM is passed over, and in a FIELD statement the word AS is not taken as a variable (53C3H). A line holding an item several times is listed once. The list of the lines of one item has room for 774 lines, up to 5BFEH, below BASIC/CMD's code at 5C00H; more lines are not listed (545EH).

Differences from the Manual

The manual (Disk BASIC, REF) gives the options as the bytes take them. What it does not say: the lists always come in the order L, V, K; after S= only P may follow (anything else is Illegal function call); a number above 65529 is not referenced (and after S= is a Syntax error); keywords and variables in DATA and REM lines are not referenced after the DATA or REM; a variable and an array of the same name are listed apart; and no more than 774 lines are listed for one item.

Variables

REF/CMD Variables

Address
Size
Contents
55DEH
1 byte
Flags
Bit 0 K, 1 V, 2 L, 3 P, 4 lines collected, 5 the rest of the line passed over, 6 FIELD, 7 S= (55DEH).
55DFH
1 byte
Kind
03H line numbers, 02H variables, 01H keywords (55DFH).
55E0H-55E1H
2 bytes
Line number
The line being scanned (5336H).
55E2H-55E3H
2 bytes
Last place
The place of the last line in the list (5466H).
55E4H-55E7H
4 bytes
Current key
The least key of the pass so far (5436H).
55E8H-55EBH
4 bytes
Key listed last
No key at or below it is taken again (5301H).
55ECH-55F2H
7 bytes
Number text
A line number as decimal text (5560H).
55F3H-5BFEH
1548 bytes
Line list
The lines of the current key, two bytes each (5444H).

Memory Outside REF/CMD

Address
Size
Contents
409CH
1 byte
Output device
01H, the printer, for the option P (52BCH).
40A2H-40A3H
2 bytes
Current line number
Set to FFFFH, the direct mode (52CDH).
4121H-4122H
2 bytes
Accumulator
The integer converted to text (5561H).

Outside Routines

AddressContents
4467HSYS0/SYS: DSPLY@, the heading (520CH).
402DHSYS0/SYS: EXIT@ (520FH).
1D78HROM: the RST 10H code, the next character of the text (533EH and others).
1650HROM: the table of the reserved words (5491H).
132FHROM: an integer as decimal digits (556CH).
032AHROM: output a character (5585H).
1D9BHROM: test BREAK and SHIFT @ (5325H, 54F2H).
1A19HROM: READY (528FH, 52D4H).

Disassembly

5200H - CMD"REF"

REF/CMD's transfer address. REF is the cross referencer of BASIC programs, run from Extended Disk BASIC as CMD"REF",option,...: BASIC/CMD's CMD passes REF to CMNDI@ as a DOS command, and the DOS loads REF/CMD at 5200H and calls it. From the DOS command level (return address 402DH) it only shows its heading. From BASIC it takes the options L (line numbers), V (variables), K (keywords) and P (printer), or S= with one line number, variable or keyword, and lists each item in order with the lines it occurs in. It ends at the ROM's READY.

5200
POP HL E1
Restore Register Pair HL with the return address on the top of the stack: 402DH (EXIT@) from the DOS command level, else the return into the caller of CMNDI@.
5201
LD DE,402DH 11 2D 40
Load Register Pair DE with 402DH, EXIT@, the return address that the DOS command level gives a program.
5204
OR A B7
OR Register A against itself, to clear the C FLAG for the SBC below.
5205
SBC HL,DE ED 52
SUBtract Register Pair DE (402DH) from Register Pair HL with the C FLAG: the Z FLAG when REF was run from the DOS command level.
5207
If the NZ FLAG is set (run from a program, BASIC's CMD), JUMP to 5212H.
5209
LD HL,558AH 21 8A 55
Point Register Pair HL to 558AH, REF's heading and copyright line, ended by 0DH.
520C
GOSUB to 4467H, DSPLY@, to show the text at Register Pair HL.
520F
JUMP to 402DH, EXIT@, back to the DOS: REF works only from BASIC.
5212
LD IX,55DEH DD 21 DE 55
Point Index Register IX to 55DEH, REF's flags (Index Register IX+00H) and the kind of item being listed (Index Register IX+01H).
5216
POP HL E1
Restore Register Pair HL from the top of the stack: BASIC's text pointer after the string "REF".
5217
POP AF F1
Restore Register Pair AF with the next word of the stack, the ROM's return into its statement loop, which REF does not use.
5218
RST 08H => 2CH CF 2C
RST 08H: the next character of the text at Register Pair HL must be 2CH, the comma before the first option; Register A returns the character after it.
521A
CP 53H FE 53
Compare Register A against 53H, the letter S of S=.
521C
If the NZ FLAG is set (not S), JUMP to 5297H to take the options L, V, K and P.
521E
SET 7,(IX+00H) DD CB 00 FE
SET bit 7 of the flags at Index Register IX+00H: one item only (S=).
5222
RST 10H D7
RST 10H: increment Register Pair HL and load Register A with the character after the S.
5223
RST 08H => D5H CF D5
RST 08H: the next character of the text at Register Pair HL must be D5H, the token of =; Register A returns the character after it, with the C FLAG for a digit.
5225
If the C FLAG is set (a digit: a line number), JUMP to 524CH.
5227
GOSUB to 5572H to classify the character in Register A: the C FLAG below the letter A, the Z FLAG for a letter, else a token.
522A
If the C FLAG is set (neither a letter nor a token), JUMP to 1997H, the ROM's Syntax error.
522D
If the Z FLAG is set (a letter: a variable), JUMP to 523FH.
522F
SET 0,(IX+00H) DD CB 00 C6
SET bit 0 of the flags at Index Register IX+00H: a keyword.
5233
LD (IX+01H),01H DD 36 01 01
Store 01H at Index Register IX+01H: the kind of item, a keyword.
5237
LD BC,8000H 01 00 80
Load Register Pair BC with 8000H, the last two bytes of a keyword's key.
523A
LD E,00H 1E 00
Load Register E with 00H, the second byte of a keyword's key.
523C
LD D,(HL) 56
Load Register D with the token at Register Pair HL, the first byte of the key.
523D
JUMP to 525AH for a P option or the end of the statement.
523F
SET 1,(IX+00H) DD CB 00 CE
SET bit 1 of the flags at Index Register IX+00H: a variable.
5243
LD (IX+01H),02H DD 36 01 02
Store 02H at Index Register IX+01H: the kind of item, a variable.
5247
GOSUB to 54FAH to take the variable's name at Register Pair HL as a key in Register Pairs DE and BC.
524A
JUMP to 525AH for a P option or the end of the statement.
524C
SET 2,(IX+00H) DD CB 00 D6
SET bit 2 of the flags at Index Register IX+00H: a line number.
5250
LD (IX+01H),03H DD 36 01 03
Store 03H at Index Register IX+01H: the kind of item, a line number.
5254
GOSUB to 5539H to take the line number at Register Pair HL as a key: Register Pair DE the number, Register Pair BC 8000H; the C FLAG when it is above 65529.
5257
If the C FLAG is set (too large), JUMP to 1997H, the ROM's Syntax error.
525A
RST 10H D7
RST 10H: increment Register Pair HL and load Register A with the next character of the text: the Z FLAG at the end of the statement.
525B
If the Z FLAG is set (the end), JUMP to 526BH to list the item.
525D
RST 08H => 2CH CF 2C
RST 08H: the next character of the text at Register Pair HL must be 2CH, a comma; Register A returns the character after it.
525F
CP 50H FE 50
Compare Register A against 50H, the letter P: the output to the printer, the only option after S=.
5261
If the NZ FLAG is set (another option), JUMP to 1E4AH, the ROM's Illegal function call error.
5264
LD A,01H 3E 01
Load Register A with 01H, the printer for the ROM's output.
5266
LD (409CH),A 32 9C 40
Store Register A (01H) to 409CH, the ROM's output device: the printer.
5269
JUMP back to 525AH for the end of the statement.

526BH - One Item

S=: the key is stored as the current one (55E4H), the current line number is set to FFFFH, and every line of the program is scanned (532FH); the lines that hold the item are collected (5401H) and, if there are any, listed (5472H). The end is READY.

526B
LD HL,55E4H 21 E4 55
Point Register Pair HL to 55E4H, the current key.
526E
LD (HL),C 71
Store Register C, the key's last byte, at Register Pair HL.
526F
INC HL 23
INCrement Register Pair HL by 1, to the next byte of the key.
5270
LD (HL),B 70
Store Register B, the key's third byte, at Register Pair HL.
5271
INC HL 23
INCrement Register Pair HL by 1, to the next byte of the key.
5272
LD (HL),E 73
Store Register E, the key's second byte, at Register Pair HL.
5273
INC HL 23
INCrement Register Pair HL by 1, to the first byte of the key.
5274
LD (HL),D 72
Store Register D, the key's first byte, at Register Pair HL: the key at 55E4H-55E7H.
5275
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the line number of the direct mode.
5278
LD (40A2H),HL 22 A2 40
Store Register Pair HL (FFFFH) into 40A2H-40A3H, the ROM's current line number: an error shows as in the direct mode.
527B
LD HL,(40A4H) 2A A4 40
Load Register Pair HL with TXTTAB from 40A4H-40A5H, the first line of the program.
527E
RES 4,(IX+00H) DD CB 00 A6
RESET bit 4 of the flags at Index Register IX+00H: no line collected yet.
5282
LD A,(HL) 7E
Load Register A with the low byte of the line's link at Register Pair HL.
5283
INC HL 23
INCrement Register Pair HL by 1, to the high byte of the link.
5284
OR (HL) B6
OR Register A with the high byte of the link at Register Pair HL: the Z FLAG for the end of the program.
5285
INC HL 23
INCrement Register Pair HL by 1, to the line number.
5286
If the NZ FLAG is set (a line), JUMP to 5292H to scan it.
5288
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of the flags at Index Register IX+00H: the NZ FLAG when lines were collected.
528C
If the NZ FLAG is set, GOSUB to 5472H to list the item and its lines.
528F
JUMP to 1A19H, the ROM's READY, which also sets the output back to the display.
5292
GOSUB to 532FH to scan the line at Register Pair HL for the item; Register Pair HL returns the next line.
5295
JUMP back to 5282H for the next line of the program.

5297H - The Options

L, V and K set bits 2, 1 and 0 of the flags; P sets bit 3 and sends the output to the printer (409CH = 01H); anything else is Illegal function call. The options are separated by commas.

5297
CP 4CH FE 4C
Compare Register A against 4CH, the letter L: the line numbers.
5299
If the NZ FLAG is set (not L), JUMP to 52A1H.
529B
SET 2,(IX+00H) DD CB 00 D6
SET bit 2 of the flags at Index Register IX+00H: list the line numbers.
529F
JUMP to 52C3H for the next option after a comma.
52A1
CP 56H FE 56
Compare Register A against 56H, the letter V: the variables.
52A3
If the NZ FLAG is set (not V), JUMP to 52ABH.
52A5
SET 1,(IX+00H) DD CB 00 CE
SET bit 1 of the flags at Index Register IX+00H: list the variables.
52A9
JUMP to 52C3H for the next option after a comma.
52AB
CP 4BH FE 4B
Compare Register A against 4BH, the letter K: the keywords.
52AD
If the NZ FLAG is set (not K), JUMP to 52B5H.
52AF
SET 0,(IX+00H) DD CB 00 C6
SET bit 0 of the flags at Index Register IX+00H: list the keywords.
52B3
JUMP to 52C3H for the next option after a comma.
52B5
CP 50H FE 50
Compare Register A against 50H, the letter P: the output to the printer.
52B7
If the NZ FLAG is set (no option REF knows), JUMP to 1E4AH, the ROM's Illegal function call error.
52BA
LD A,01H 3E 01
Load Register A with 01H, the printer for the ROM's output.
52BC
LD (409CH),A 32 9C 40
Store Register A (01H) to 409CH, the ROM's output device: the printer.
52BF
SET 3,(IX+00H) DD CB 00 DE
SET bit 3 of the flags at Index Register IX+00H: the printer is used.
52C3
RST 10H D7
RST 10H: increment Register Pair HL and load Register A with the next character of the text: the Z FLAG at the end of the statement.
52C4
If the Z FLAG is set (the end), JUMP to 52CAH to list.
52C6
RST 08H => 2CH CF 2C
RST 08H: the next character of the text at Register Pair HL must be 2CH, a comma; Register A returns the next option.
52C8
JUMP back to 5297H to take the option letter in Register A.

52CAH - The Lists

The kinds are taken in the order 3, 2, 1 (Index Register IX+01H, 03H as loaded): line numbers, variables, keywords; a kind whose option was not given is passed over. For a kind, each pass over the program finds the least key above the one listed last (55E8H) and collects the lines it occurs in; the key and its lines are listed and the next pass begins, until a pass finds no key.

52CA
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the line number of the direct mode.
52CD
LD (40A2H),HL 22 A2 40
Store Register Pair HL (FFFFH) into 40A2H-40A3H, the ROM's current line number: an error shows as in the direct mode.
52D0
LD A,(IX+01H) DD 7E 01
Load Register A with the kind of item at Index Register IX+01H.
52D3
DEC A 3D
DECrement Register A by 1: 2 for line numbers, 1 for variables, 0 for keywords, FFH when all kinds are done.
52D4
If the M FLAG is set (all done), JUMP to 1A19H, the ROM's READY.
52D7
RLCA 07
Rotate Register A left (RLCA), the first of three: the kind less 1 times 8 when done.
52D8
RLCA 07
Rotate Register A left (RLCA) again, the second of the three.
52D9
RLCA 07
Rotate Register A left (RLCA) again: the bit number 0, 1 or 2 in bits 5-3.
52DA
OR 46H F6 46
OR Register A with 46H, the opcode byte of BIT 0,(IX+00H): BIT 2, BIT 1 or BIT 0 for the kind.
52DC
LD (52E2H),A 32 E2 52
Store Register A into 52E2H, the last byte of the BIT instruction below, which then tests this kind's option.
52DF
BIT 0,(IX+00H) DD CB 00 46
Test the bit of this kind's option in the flags at Index Register IX+00H (the bit number is written into this instruction at 52DCH; BIT 0 in the file).
52E3
If the NZ FLAG is set (the option was given), JUMP to 52EAH to list this kind.
52E5
DEC (IX+01H) DD 35 01
DECrement the kind at Index Register IX+01H by 1, to the next kind.
52E8
JUMP back to 52D0H for the next kind of item.
52EA
LD HL,55E4H 21 E4 55
Point Register Pair HL to 55E4H, the current key.
52ED
LD (HL),00H 36 00
Store 00H at Register Pair HL, the last byte of the key.
52EF
INC HL 23
INCrement Register Pair HL by 1, to the next byte of the key.
52F0
LD (HL),00H 36 00
Store 00H at Register Pair HL, the third byte of the key.
52F2
INC HL 23
INCrement Register Pair HL by 1, to the next byte of the key.
52F3
LD (HL),00H 36 00
Store 00H at Register Pair HL, the second byte of the key.
52F5
INC HL 23
INCrement Register Pair HL by 1, to the first byte of the key.
52F6
LD (HL),00H 36 00
Store 00H at Register Pair HL: the key 00000000H, below every key, as the last one listed.
52F8
LD BC,0004H 01 04 00
Load Register Pair BC with 0004H, the length of a key.
52FB
LD HL,55E4H 21 E4 55
Point Register Pair HL to 55E4H, the current key.
52FE
LD DE,55E8H 11 E8 55
Point Register Pair DE to 55E8H, the key listed last.
5301
LDIR ED B0
Copy the current key to the key listed last by LDIR, from Register Pair HL to Register Pair DE, counted by Register Pair BC.
5303
DEC HL 2B
DECrement Register Pair HL by 1, back to the first byte of the current key (55E7H).
5304
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the first byte of the current key.
5306
DEC HL 2B
DECrement Register Pair HL by 1, to the next byte.
5307
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the second byte of the current key.
5309
DEC HL 2B
DECrement Register Pair HL by 1, to the next byte.
530A
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the third byte of the current key.
530C
DEC HL 2B
DECrement Register Pair HL by 1, to the last byte (55E4H).
530D
LD (HL),FFH 36 FF
Store FFH at Register Pair HL: the current key FFFFFFFFH, above every key, until a smaller one is found.
530F
LD HL,(40A4H) 2A A4 40
Load Register Pair HL with TXTTAB from 40A4H-40A5H, the first line of the program.
5312
RES 4,(IX+00H) DD CB 00 A6
RESET bit 4 of the flags at Index Register IX+00H: no key found in this pass yet.
5316
LD A,(HL) 7E
Load Register A with the low byte of the line's link at Register Pair HL.
5317
INC HL 23
INCrement Register Pair HL by 1, to the high byte of the link.
5318
OR (HL) B6
OR Register A with the high byte of the link at Register Pair HL: the Z FLAG for the end of the program.
5319
INC HL 23
INCrement Register Pair HL by 1, to the line number.
531A
If the NZ FLAG is set (a line), JUMP to 532AH to scan it.
531C
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of the flags at Index Register IX+00H: the Z FLAG when the pass found no key.
5320
If the Z FLAG is set (no key left of this kind), JUMP to 52E5H for the next kind.
5322
GOSUB to 5472H to list the key found and its lines.
5325
GOSUB to 1D9BH, the ROM's test of BREAK and of SHIFT @ (a pause) between the items.
5328
JUMP back to 52F8H for the next pass: the key just listed becomes the key listed last.
532A
GOSUB to 532FH to scan the line at Register Pair HL; Register Pair HL returns the next line.
532D
JUMP back to 5316H for the next line of the program.

532FH - Scan a Line

Register Pair HL at the line number of a line. Its number is kept (55E0H) and its text is read with the ROM's 1D78H (spaces passed over): quoted strings are passed over; a digit starts a number, taken as a line number for the kind 3; a letter starts a variable for the kind 2 (after FIELD the word AS is passed over); a token is a keyword for the kind 1, and after DATA or REM the rest of the line is passed over. Each item of the kind being listed is offered to 5401H. Returns Register Pair HL at the next line.

532F
RES 5,(IX+00H) DD CB 00 AE
RESET bit 5 of the flags at Index Register IX+00H: the rest of the line is to be read.
5333
LD E,(HL) 5E
Load Register E with the low byte of the line number at Register Pair HL.
5334
INC HL 23
INCrement Register Pair HL by 1, to the high byte.
5335
LD D,(HL) 56
Load Register D with the high byte of the line number at Register Pair HL.
5336
LD (55E0H),DE ED 53 E0 55
Store Register Pair DE, the line number, into 55E0H-55E1H.
533A
RES 6,(IX+00H) DD CB 00 B6
RESET bit 6 of the flags at Index Register IX+00H: no FIELD in this statement yet.
533E
GOSUB to 1D78H, the ROM's RST 10H code: Register Pair HL to the next character that is not a space, in Register A; the Z FLAG for 00H or a colon, the C FLAG for a digit.
5341
If the NZ FLAG is set (not the end of a statement), JUMP to 5349H.
5343
OR A B7
OR Register A against itself: the NZ FLAG for the colon.
5344
If the NZ FLAG is set (a colon: a new statement), JUMP back to 533AH.
5346
JUMP to 53FBH: the 00H at the end of the line, to the next line.
5349
If the C FLAG is set (a digit), JUMP to 5397H for a number.
534B
CP 22H FE 22
Compare Register A against 22H, the quotation mark.
534D
If the NZ FLAG is set (no string), JUMP to 535CH.
534F
GOSUB to 1D78H, the ROM's RST 10H code: the next character of the string at Register Pair HL into Register A.
5352
CP 22H FE 22
Compare Register A against 22H, the closing quotation mark.
5354
If the Z FLAG is set (the end of the string), JUMP back to 533EH.
5356
OR A B7
OR Register A against itself: the Z FLAG for the 00H at the end of the line.
5357
If the NZ FLAG is set (still in the string), LOOP BACK to 534FH.
5359
JUMP to 53FBH: the line ended inside the string.
535C
GOSUB to 5572H to classify the character in Register A: the C FLAG below the letter A, the Z FLAG for a letter, else a token.
535F
If the C FLAG is set (another character), JUMP back to 533EH.
5361
If the Z FLAG is set (a letter: a variable), JUMP to 53B6H.
5363
CP 88H FE 88
Compare Register A against 88H, the token DATA.
5365
If the Z FLAG is set (DATA), JUMP to 5375H: the rest of the line is passed over.
5367
CP 93H FE 93
Compare Register A against 93H, the token REM.
5369
If the Z FLAG is set (REM), JUMP to 5375H: the rest of the line is passed over.
536B
CP A3H FE A3
Compare Register A against A3H, the token FIELD.
536D
If the NZ FLAG is set (another token), JUMP to 5379H.
536F
SET 6,(IX+00H) DD CB 00 F6
SET bit 6 of the flags at Index Register IX+00H: FIELD, whose AS is not a variable.
5373
JUMP to 5379H to take the token as a keyword.
5375
SET 5,(IX+00H) DD CB 00 EE
SET bit 5 of the flags at Index Register IX+00H: the rest of the line is passed over after this keyword.
5379
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the flags at Index Register IX+00H: the NZ FLAG when keywords are listed.
537D
If the Z FLAG is set (no keywords), JUMP to 538EH.
537F
LD A,(IX+01H) DD 7E 01
Load Register A with the kind of item at Index Register IX+01H.
5382
DEC A 3D
DECrement Register A by 1: the Z FLAG for the kind 1, keywords.
5383
If the NZ FLAG is set (another kind is being listed), JUMP to 538EH.
5385
LD BC,8000H 01 00 80
Load Register Pair BC with 8000H, the last two bytes of a keyword's key.
5388
LD E,00H 1E 00
Load Register E with 00H, the second byte of a keyword's key.
538A
LD D,(HL) 56
Load Register D with the token at Register Pair HL, the first byte of the key.
538B
GOSUB to 5401H to offer the key for the current line.
538E
BIT 5,(IX+00H) DD CB 00 6E
Test bit 5 of the flags at Index Register IX+00H: the NZ FLAG after DATA or REM.
5392
If the Z FLAG is set, JUMP back to 533EH for the next character.
5394
JUMP to 53FBH to pass over the rest of the line.
5397
BIT 2,(IX+00H) DD CB 00 56
Test bit 2 of the flags at Index Register IX+00H: the NZ FLAG when line numbers are listed.
539B
If the Z FLAG is set (no line numbers), JUMP to 53AEH to pass over the number.
539D
LD A,(IX+01H) DD 7E 01
Load Register A with the kind of item at Index Register IX+01H.
53A0
CP 03H FE 03
Compare Register A against 03H, the kind line numbers.
53A2
If the NZ FLAG is set (another kind), JUMP to 53AEH to pass over the number.
53A4
GOSUB to 5539H to take the number at Register Pair HL as a key: the C FLAG when it is above 65529.
53A7
If the C FLAG is set (too large for a line number), JUMP to 53AEH to pass over its digits.
53A9
GOSUB to 5401H to offer the key for the current line.
53AC
JUMP back to 533EH for the next character of the line.
53AE
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL, with the C FLAG for a digit.
53B1
If the C FLAG is set (a digit), LOOP BACK to 53AEH.
53B3
DEC HL 2B
DECrement Register Pair HL by 1, so that the character after the number is read again.
53B4
JUMP back to 533EH for the next character of the line.
53B6
BIT 1,(IX+00H) DD CB 00 4E
Test bit 1 of the flags at Index Register IX+00H: the NZ FLAG when variables are listed.
53BA
If the Z FLAG is set (no variables), JUMP to 53EDH to pass over the name.
53BC
LD A,(IX+01H) DD 7E 01
Load Register A with the kind of item at Index Register IX+01H.
53BF
CP 02H FE 02
Compare Register A against 02H, the kind variables.
53C1
If the NZ FLAG is set (another kind), JUMP to 53EDH to pass over the name.
53C3
BIT 6,(IX+00H) DD CB 00 76
Test bit 6 of the flags at Index Register IX+00H: the NZ FLAG in a FIELD statement.
53C7
If the Z FLAG is set (no FIELD), JUMP to 53E4H to take the variable.
53C9
LD A,(HL) 7E
Load Register A with the character at Register Pair HL, the first letter.
53CA
CP 41H FE 41
Compare Register A against 41H, the letter A of AS.
53CC
If the NZ FLAG is set (not A), JUMP to 53E4H to take the variable.
53CE
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL into Register A.
53D1
CP 53H FE 53
Compare Register A against 53H, the letter S of AS.
53D3
If the Z FLAG is set (AS so far), JUMP to 53D8H.
53D5
DEC HL 2B
DECrement Register Pair HL by 1, back to the A.
53D6
JUMP to 53E4H to take the variable whose name starts with A.
53D8
GOSUB to 1D78H, the ROM's RST 10H code: the character after AS at Register Pair HL into Register A.
53DB
GOSUB to 5572H to classify the character in Register A: the Z FLAG for a letter.
53DE
If the Z FLAG is set (a longer name such as ASK), JUMP to 53E4H to take it as a variable.
53E0
DEC HL 2B
DECrement Register Pair HL by 1, so that the character after AS is read again.
53E1
JUMP to 533EH: the AS of FIELD is not a variable.
53E4
GOSUB to 54FAH to take the variable's name at Register Pair HL as a key in Register Pairs DE and BC.
53E7
GOSUB to 5401H to offer the key for the current line.
53EA
JUMP to 533EH for the next character of the line.
53ED
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL, with the C FLAG for a digit.
53F0
If the C FLAG is set (a digit of the name), LOOP BACK to 53EDH.
53F2
GOSUB to 5572H to classify the character in Register A: the Z FLAG for a letter.
53F5
If the Z FLAG is set (a letter of the name), LOOP BACK to 53EDH.
53F7
DEC HL 2B
DECrement Register Pair HL by 1, so that the character after the name is read again.
53F8
JUMP to 533EH for the next character of the line.
53FB
XOR A AF
Set Register A to 00H by XORing it with itself, the byte looked for.
53FC
LD C,A 4F
Load Register C with Register A (00H), the low byte of the count.
53FD
LD B,A 47
Load Register B with Register A: Register Pair BC = 0000H, a count that does not end the search.
53FE
CPIR ED B1
Search for the 00H from Register Pair HL by CPIR, comparing Register A, counted by Register Pair BC: Register Pair HL stops past the 00H that ends the line.
5400
RET C9
RETurn with Register Pair HL at the next line.

5401H - Offer a Key

The key in Register Pairs DE and BC (D first, C last) is compared with the current key (55E4H-55E7H). Equal: the current line number is added to the list of its lines. Above the current key, or in the S= mode below it: nothing. Below the current key and above the key listed last (55E8H-55EBH): it becomes the current key and its list starts again with this line. The list (55F3H on) gets a line only once in a row and stops at 5BFDH.

5401
PUSH HL E5
Save Register Pair HL, the text pointer, to the top of the stack.
5402
LD HL,55E7H 21 E7 55
Point Register Pair HL to 55E7H, the first byte of the current key.
5405
LD A,(HL) 7E
Load Register A with the first byte of the current key at Register Pair HL.
5406
DEC HL 2B
DECrement Register Pair HL by 1, to the next byte of the current key.
5407
SUB D 92
SUBtract Register D, the first byte of the key offered, from Register A.
5408
If the NZ FLAG is set (they differ), JUMP to 5418H with the C FLAG for a key above the current one.
540A
LD A,(HL) 7E
Load Register A with the second byte of the current key at Register Pair HL.
540B
DEC HL 2B
DECrement Register Pair HL by 1, to the next byte.
540C
SBC A,E 9B
SUBtract Register E with the C FLAG from Register A, the second bytes.
540D
If the NZ FLAG is set (they differ), JUMP to 5418H.
540F
LD A,(HL) 7E
Load Register A with the third byte of the current key at Register Pair HL.
5410
DEC HL 2B
DECrement Register Pair HL by 1, to the last byte.
5411
SBC A,B 98
SUBtract Register B with the C FLAG from Register A, the third bytes.
5412
If the NZ FLAG is set (they differ), JUMP to 5418H.
5414
LD A,(HL) 7E
Load Register A with the last byte of the current key at Register Pair HL.
5415
SBC A,C 99
SUBtract Register C with the C FLAG from Register A, the last bytes.
5416
If the Z FLAG is set (the same key), JUMP to 5444H to add the line.
5418
If the C FLAG is set (the key offered is above the current one), JUMP to 5470H: nothing to do.
541A
BIT 7,(IX+00H) DD CB 00 7E
Test bit 7 of the flags at Index Register IX+00H: the NZ FLAG in the S= mode.
541E
If the NZ FLAG is set (one item only), JUMP to 5470H: nothing to do.
5420
LD HL,55EBH 21 EB 55
Point Register Pair HL to 55EBH, the first byte of the key listed last.
5423
LD A,(HL) 7E
Load Register A with the first byte of the key listed last at Register Pair HL.
5424
DEC HL 2B
DECrement Register Pair HL by 1, to the next byte.
5425
SUB D 92
SUBtract Register D, the first byte of the key offered, from Register A.
5426
If the NZ FLAG is set (they differ), JUMP to 5434H.
5428
LD A,(HL) 7E
Load Register A with the second byte of the key listed last at Register Pair HL.
5429
DEC HL 2B
DECrement Register Pair HL by 1, to the next byte.
542A
SBC A,E 9B
SUBtract Register E with the C FLAG from Register A, the second bytes.
542B
If the NZ FLAG is set (they differ), JUMP to 5434H.
542D
LD A,(HL) 7E
Load Register A with the third byte of the key listed last at Register Pair HL.
542E
DEC HL 2B
DECrement Register Pair HL by 1, to the last byte.
542F
SBC A,B 98
SUBtract Register B with the C FLAG from Register A, the third bytes.
5430
If the NZ FLAG is set (they differ), JUMP to 5434H.
5432
LD A,(HL) 7E
Load Register A with the last byte of the key listed last at Register Pair HL.
5433
SBC A,C 99
SUBtract Register C with the C FLAG from Register A, the last bytes.
5434
If the NC FLAG is set (the key offered is not above the key listed last: listed already), JUMP to 5470H.
5436
LD HL,55E4H 21 E4 55
Point Register Pair HL to 55E4H, the current key, which the key offered replaces.
5439
LD (HL),C 71
Store Register C, the key's last byte, at Register Pair HL.
543A
INC HL 23
INCrement Register Pair HL by 1, to the next byte.
543B
LD (HL),B 70
Store Register B, the key's third byte, at Register Pair HL.
543C
INC HL 23
INCrement Register Pair HL by 1, to the next byte.
543D
LD (HL),E 73
Store Register E, the key's second byte, at Register Pair HL.
543E
INC HL 23
INCrement Register Pair HL by 1, to the first byte.
543F
LD (HL),D 72
Store Register D, the key's first byte, at Register Pair HL.
5440
RES 4,(IX+00H) DD CB 00 A6
RESET bit 4 of the flags at Index Register IX+00H: the list of lines starts again.
5444
LD HL,55F3H 21 F3 55
Point Register Pair HL to 55F3H, the start of the list of lines.
5447
LD BC,(55E0H) ED 4B E0 55
Load Register Pair BC with the current line number from 55E0H-55E1H.
544B
BIT 4,(IX+00H) DD CB 00 66
Test bit 4 of the flags at Index Register IX+00H: the NZ FLAG when the list holds lines.
544F
If the Z FLAG is set (an empty list), JUMP to 5466H to store the line at its start.
5451
LD HL,(55E2H) 2A E2 55
Load Register Pair HL with the place of the last line in the list from 55E2H-55E3H.
5454
INC HL 23
INCrement Register Pair HL by 1, to the high byte of the last line.
5455
LD A,(HL) 7E
Load Register A with the high byte of the last line at Register Pair HL.
5456
CP B B8
Compare Register A with Register B, the high byte of the current line.
5457
DEC HL 2B
DECrement Register Pair HL by 1, back to the low byte (the flags are kept).
5458
If the NZ FLAG is set (another line), JUMP to 545EH.
545A
LD A,(HL) 7E
Load Register A with the low byte of the last line at Register Pair HL.
545B
CP C B9
Compare Register A with Register C, the low byte of the current line.
545C
If the Z FLAG is set (the same line again), JUMP to 5466H: it is stored over itself.
545E
LD DE,5BFDH 11 FD 5B
Load Register Pair DE with 5BFDH, the last place of the list, below 5C00H where BASIC/CMD's code begins.
5461
RST 18H DF
RST 18H: compare Register Pair HL, the last line's place, with Register Pair DE (5BFDH): the NC FLAG when the list is full.
5462
If the NC FLAG is set (full), JUMP to 5470H: the line is not added.
5464
INC HL 23
INCrement Register Pair HL by 1, the first of two to the next place.
5465
INC HL 23
INCrement Register Pair HL by 1, to the next place of the list.
5466
LD (55E2H),HL 22 E2 55
Store Register Pair HL, the place of the line, into 55E2H-55E3H.
5469
LD (HL),C 71
Store Register C, the low byte of the line number, at Register Pair HL.
546A
INC HL 23
INCrement Register Pair HL by 1, to the high byte.
546B
LD (HL),B 70
Store Register B, the high byte of the line number, at Register Pair HL.
546C
SET 4,(IX+00H) DD CB 00 E6
SET bit 4 of the flags at Index Register IX+00H: the list holds lines.
5470
POP HL E1
Restore Register Pair HL, the text pointer, from the top of the stack.
5471
RET C9
RETurn to the caller with Register Pair HL the text pointer.

5472H - List an Item

Shows the current key by its kind: a keyword by its word from the ROM's table at 1650H (each word's first character has bit 7 set), a variable by its name, suffix and ( for an array, a line number in decimal; padded with spaces to 8 columns (Register B). Then its lines, nine to a row, each row after the first indented by 8 spaces, with the ROM's test of BREAK and SHIFT @ between the rows.

5472
LD A,(IX+01H) DD 7E 01
Load Register A with the kind of item at Index Register IX+01H.
5475
DEC A 3D
DECrement Register A by 1: the Z FLAG for the kind 1, keywords.
5476
If the Z FLAG is set (a keyword), JUMP to 5489H.
5478
DEC A 3D
DECrement Register A by 1: the Z FLAG for the kind 2, variables.
5479
If the Z FLAG is set (a variable), JUMP to 54AAH.
547B
LD B,08H 06 08
Load Register B with 08H, the width of the item's column.
547D
LD DE,(55E6H) ED 5B E6 55
Load Register Pair DE with the line number from 55E6H-55E7H, the first two bytes of the current key.
5481
GOSUB to 5560H to put the number in Register Pair DE into 55ECH as decimal text: Register Pair HL returns 55ECH.
5484
GOSUB to 557AH to show the text at Register Pair HL, counting the columns in Register B.
5487
JUMP to 54C6H for the padding of the column and the lines.
5489
LD B,08H 06 08
Load Register B with 08H, the width of the item's column.
548B
LD A,(55E7H) 3A E7 55
Load Register A with the token from 55E7H, the first byte of the current key.
548E
SUB 7FH D6 7F
SUBtract 7FH from Register A: the token's number in the table, 1 for 80H.
5490
LD C,A 4F
Load Register C with Register A, the count of the words to pass.
5491
LD HL,1650H 21 50 16
Point Register Pair HL to 1650H, the ROM's table of the reserved words.
5494
LD A,(HL) 7E
Load Register A with the byte of the table at Register Pair HL.
5495
INC HL 23
INCrement Register Pair HL by 1, to the next byte.
5496
OR A B7
OR Register A against itself: the M FLAG for a byte with bit 7 set, the first of a word.
5497
If the P FLAG is set (inside a word), LOOP BACK to 5494H.
549A
DEC C 0D
DECrement Register C by 1, the count of the words.
549B
If the NZ FLAG is set (not yet the token's word), LOOP BACK to 5494H.
549D
AND 7FH E6 7F
AND Register A with 7FH: the first character of the word.
549F
GOSUB to 5585H to output the character in Register A and count the column in Register B.
54A2
LD A,(HL) 7E
Load Register A with the next byte of the word at Register Pair HL.
54A3
INC HL 23
INCrement Register Pair HL by 1, to the next byte.
54A4
OR A B7
OR Register A against itself: the M FLAG for the first character of the next word.
54A5
If the P FLAG is set (a character of this word), LOOP BACK to 549FH.
54A8
JUMP to 54C6H for the padding of the column and the lines.
54AA
LD B,08H 06 08
Load Register B with 08H, the width of the item's column.
54AC
LD HL,55E7H 21 E7 55
Point Register Pair HL to 55E7H, the first byte of the current key.
54AF
LD A,(HL) 7E
Load Register A with the first letter of the variable at Register Pair HL.
54B0
DEC HL 2B
DECrement Register Pair HL by 1, to the second byte of the key.
54B1
GOSUB to 5585H to output the character in Register A and count the column in Register B.
54B4
LD A,(HL) 7E
Load Register A with the second character of the name at Register Pair HL.
54B5
DEC HL 2B
DECrement Register Pair HL by 1, to the third byte.
54B6
CP 20H FE 20
Compare Register A against 20H, the space of a one letter name.
54B8
If the NZ FLAG is set (a second character), GOSUB to 5585H to output it.
54BB
LD A,(HL) 7E
Load Register A with the suffix of the name at Register Pair HL.
54BC
DEC HL 2B
DECrement Register Pair HL by 1, to the last byte.
54BD
CP 20H FE 20
Compare Register A against 20H, the space of a name with no suffix.
54BF
If the NZ FLAG is set (a suffix), GOSUB to 5585H to output it.
54C2
LD A,(HL) 7E
Load Register A with the last byte of the key at Register Pair HL: ( for an array, else a space.
54C3
GOSUB to 5585H to output the character in Register A and count the column in Register B.
54C6
LD HL,55F3H 21 F3 55
Point Register Pair HL to 55F3H, the list of the item's lines.
54C9
LD A,20H 3E 20
Load Register A with 20H, a space that fills the column.
54CB
GOSUB to 5585H to output the space and count the column in Register B: the Z FLAG at the end of the column.
54CE
If the NZ FLAG is set (more columns), LOOP BACK to 54C9H.
54D0
LD C,09H 0E 09
Load Register C with 09H, the line numbers on a row.
54D2
LD E,(HL) 5E
Load Register E with the low byte of the next line number at Register Pair HL.
54D3
INC HL 23
INCrement Register Pair HL by 1, to the high byte.
54D4
LD D,(HL) 56
Load Register D with the high byte of the line number at Register Pair HL.
54D5
INC HL 23
INCrement Register Pair HL by 1, to the next line of the list.
54D6
PUSH HL E5
Save Register Pair HL, the next place of the list, to the top of the stack.
54D7
GOSUB to 5560H to put the line number in Register Pair DE into 55ECH as decimal text: Register Pair HL returns 55ECH.
54DA
GOSUB to 557AH to show the text at Register Pair HL.
54DD
POP DE D1
Restore Register Pair DE, the next place of the list, from the top of the stack.
54DE
LD HL,(55E2H) 2A E2 55
Load Register Pair HL with the place of the last line from 55E2H-55E3H.
54E1
RST 18H DF
RST 18H: compare Register Pair HL, the last place, with Register Pair DE, the next place: the C FLAG when the list is done.
54E2
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair HL = the next place of the list.
54E3
If the C FLAG is set (all lines shown), JUMP to 5583H to end the row with a carriage return and return.
54E6
LD A,20H 3E 20
Load Register A with 20H, the space between the line numbers.
54E8
GOSUB to 5585H to output the character in Register A.
54EB
DEC C 0D
DECrement Register C by 1, the line numbers left on the row.
54EC
If the NZ FLAG is set (room on the row), LOOP BACK to 54D2H.
54EE
GOSUB to 5583H to end the row with a carriage return.
54F1
POP BC C1
Restore Register Pair BC with the return address of this routine from the top of the stack.
54F2
GOSUB to 1D9BH, the ROM's test of BREAK and of SHIFT @ (a pause) between the rows.
54F5
PUSH BC C5
Save Register Pair BC, the return address, to the top of the stack again.
54F6
LD B,08H 06 08
Load Register B with 08H, the indent of the next row.
54F8
JUMP back to 54C9H to indent the row and show more line numbers.

54FAH - A Variable's Key

Takes a variable name at Register Pair HL: Register D its first letter, Register E its second character (a letter or a digit; a space for a one letter name), Register B its suffix % ! $ # (else a space), Register C ( for an array (else a space). The rest of a longer name is passed over. Returns Register Pair HL at the last character taken.

54FA
LD D,(HL) 56
Load Register D with the first letter of the name at Register Pair HL.
54FB
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL into Register A, the Z FLAG at the end of a statement, the C FLAG for a digit.
54FE
If the Z FLAG is set (the end), JUMP to 5507H: a one letter name.
5500
If the C FLAG is set (a digit), JUMP to 550AH: the second character.
5502
GOSUB to 5572H to classify the character in Register A: the Z FLAG for a letter.
5505
If the Z FLAG is set (a letter), JUMP to 550AH: the second character.
5507
DEC HL 2B
DECrement Register Pair HL by 1, so that the character is read again.
5508
LD A,20H 3E 20
Load Register A with 20H, the space that stands for no second character.
550A
LD E,A 5F
Load Register E with Register A, the second character of the name.
550B
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL, the C FLAG for a digit.
550E
If the Z FLAG is set (the end), JUMP to 5529H: no suffix.
5510
If the C FLAG is set (a digit), LOOP BACK to 550BH: the rest of the name.
5512
GOSUB to 5572H to classify the character in Register A: the Z FLAG for a letter, the NC FLAG for a letter or a token.
5515
If the Z FLAG is set (a letter), LOOP BACK to 550BH: the rest of the name.
5517
If the NC FLAG is set (a token), JUMP to 5529H: no suffix.
5519
CP 25H FE 25
Compare Register A against 25H, the suffix %.
551B
If the Z FLAG is set (%), JUMP to 552CH to keep the suffix.
551D
CP 21H FE 21
Compare Register A against 21H, the suffix !.
551F
If the Z FLAG is set (!), JUMP to 552CH to keep the suffix.
5521
CP 24H FE 24
Compare Register A against 24H, the suffix $.
5523
If the Z FLAG is set ($), JUMP to 552CH to keep the suffix.
5525
CP 23H FE 23
Compare Register A against 23H, the suffix #.
5527
If the Z FLAG is set (#), JUMP to 552CH to keep the suffix.
5529
DEC HL 2B
DECrement Register Pair HL by 1, so that the character is read again.
552A
LD A,20H 3E 20
Load Register A with 20H, the space that stands for no suffix.
552C
LD B,A 47
Load Register B with Register A, the suffix or a space.
552D
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL into Register A.
5530
CP 28H FE 28
Compare Register A against 28H, the ( of an array.
5532
If the Z FLAG is set (an array), JUMP to 5537H.
5534
DEC HL 2B
DECrement Register Pair HL by 1, so that the character is read again.
5535
LD A,20H 3E 20
Load Register A with 20H, the space that stands for a simple variable.
5537
LD C,A 4F
Load Register C with Register A, ( or a space.
5538
RET C9
RETurn with the key in Register Pairs DE and BC.

5539H - A Number's Key

Takes the decimal number at Register Pair HL: Register Pair DE the number, Register Pair BC 8000H, Register Pair HL at its last digit. A number above 65529 (a value that would pass 1998H before its last digit) returns the C FLAG, with Register Pair HL inside the number.

5539
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the number so far.
553C
DEC HL 2B
DECrement Register Pair HL by 1, so that the first digit is read again.
553D
GOSUB to 1D78H, the ROM's RST 10H code: the next character at Register Pair HL into Register A, the C FLAG for a digit.
5540
If the C FLAG is set (a digit), JUMP to 5547H.
5542
LD BC,8000H 01 00 80
Load Register Pair BC with 8000H, the last two bytes of a number's key.
5545
DEC HL 2B
DECrement Register Pair HL by 1, so that the character after the number is read again.
5546
RET C9
RETurn with the NC FLAG and the number in Register Pair DE.
5547
SUB 30H D6 30
SUBtract 30H from Register A: the value of the digit.
5549
LD C,A 4F
Load Register C with Register A, the value of the digit.
554A
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the digit.
554C
PUSH HL E5
Save Register Pair HL, the text pointer, to the top of the stack.
554D
LD HL,1998H 21 98 19
Load Register Pair HL with 1998H, 6552, the largest number that can still take a digit.
5550
RST 18H DF
RST 18H: compare Register Pair HL (1998H) with Register Pair DE, the number so far: the C FLAG when it is above 1998H.
5551
If the C FLAG is set (too large), JUMP to 555EH to return with the C FLAG.
5553
LD H,D 62
Load Register H with Register D, the high byte of the number.
5554
LD L,E 6B
Load Register L with Register E: Register Pair HL = the number.
5555
ADD HL,HL 29
ADD Register Pair HL to itself: the number times 2.
5556
ADD HL,HL 29
ADD Register Pair HL to itself: the number times 4.
5557
ADD HL,DE 19
ADD Register Pair DE, the number, to Register Pair HL: the number times 5.
5558
ADD HL,HL 29
ADD Register Pair HL to itself: the number times 10.
5559
ADD HL,BC 09
ADD Register Pair BC, the digit, to Register Pair HL.
555A
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the new number.
555B
POP HL E1
Restore Register Pair HL, the text pointer, from the top of the stack.
555C
JUMP back to 553DH for the next digit of the number.
555E
POP HL E1
Restore Register Pair HL, the text pointer, from the top of the stack.
555F
RET C9
RETurn with the C FLAG: the number is too large.

5560H - A Number as Text

Puts the integer in Register Pair DE into 55ECH as decimal text through the ROM's 132FH (the accumulator at 4121H holds it), and returns Register Pair HL = 55ECH.

5560
PUSH BC C5
Save Register Pair BC to the top of the stack.
5561
LD (4121H),DE ED 53 21 41
Store Register Pair DE, the number, into 4121H-4122H, the ROM's accumulator.
5565
LD HL,55ECH 21 EC 55
Point Register Pair HL to 55ECH, where the text is put.
5568
PUSH HL E5
Save Register Pair HL (55ECH) to the top of the stack.
5569
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the format for the ROM's 132FH.
556C
GOSUB to 132FH, the ROM's conversion of the integer in the accumulator to decimal digits at Register Pair HL.
556F
POP HL E1
Restore Register Pair HL (55ECH) from the top of the stack.
5570
POP BC C1
Restore Register Pair BC from the top of the stack.
5571
RET C9
RETurn with Register Pair HL at the decimal text (55ECH).

5572H - Classify a Character

Register A: the C FLAG below 41H (not a letter), the Z FLAG for 41H-7EH (a letter), the NC and NZ FLAGS for 7FH and above (a token).

5572
CP 41H FE 41
Compare Register A against 41H, the letter A: the C FLAG below it.
5574
RET C D8
If the C FLAG is set (not a letter), RETurn with the C FLAG.
5575
CP 7FH FE 7F
Compare Register A against 7FH: the NC FLAG for 7FH and above, the tokens.
5577
RET NC D0
If the NC FLAG is set (a token), RETurn with the NC and NZ FLAGS.
5578
CP A BF
Compare Register A with itself: the Z FLAG and the NC FLAG for a letter.
5579
RET C9
RETurn with the Z FLAG and the NC FLAG: a letter.

557AH - Show a Text

Shows the text at Register Pair HL up to its 00H through 5585H, counting the columns in Register B. 5583H outputs a carriage return; 5585H outputs the character in Register A through the ROM's 032AH and decrements Register B.

557A
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
557B
OR A B7
OR Register A against itself: the Z FLAG for the 00H at the end.
557C
RET Z C8
If the Z FLAG is set (the end of the text), RETurn.
557D
GOSUB to 5585H to output the character in Register A and count the column in Register B.
5580
INC HL 23
INCrement Register Pair HL by 1, to the next character.
5581
LOOP BACK to 557AH for the next character of the text.
5583
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, and fall into 5585H.
5585
GOSUB to 032AH, the ROM's output of the character in Register A to the selected device (the display or, with P, the printer).
5588
DEC B 05
DECrement Register B by 1, the columns left: the Z FLAG at the end of the column.
5589
RET C9
RETurn to the caller with the flags of the column count.

558AH - The Heading and the Variables

Data.

558A-55AC
DEFM "REF - BASIC Program refrencer - 1.7" 52 45 46 20 2D 20 42 41 53 49 43 20 50 72 6F 67 72 61 6D 20 72 65 66 72 65 6E 63 65 72 20 2D 20 31 2E 37
The heading that REF shows when it is run from the DOS command level (5209H), spelled refrencer in the file.
55AD
DEFB 0AH 0A
A line feed, which starts the second line of the heading for DSPLY@.
55AE-55DC
DEFM "(c) Copyright 1983, Micro-Systems Software Inc." 28 63 29 20 43 6F 70 79 72 69 67 68 74 20 31 39 38 33 2C 20 4D 69 63 72 6F 2D 53 79 73 74 65 6D 73 20 53 6F 66 74 77 61 72 65 20 49 6E 63 2E
The copyright line of the heading, the second line that DSPLY@ shows.
55DD
DEFB 0DH 0D
The carriage return that ends the heading for DSPLY@.
55DE
DEFB 00H 00
The flags (Index Register IX+00H): bit 0 K, 1 V, 2 L, 3 P, 4 lines collected, 5 the rest of the line passed over, 6 a FIELD statement, 7 S=.
55DF
DEFB 03H 03
The kind of item being listed (Index Register IX+01H): 03H line numbers first, then 02H variables and 01H keywords.
55E0-55E1
DEFS 2
The number of the line being scanned (5336H).
55E2-55E3
DEFS 2
The place of the last line in the list (5466H).
55E4-55E7
DEFS 4
The current key, last byte first: the least key of the pass so far, or the S= item (526BH, 5436H).
55E8-55EB
DEFS 4
The key listed last, below which no key is taken again (5301H).
55EC-55F2
DEFS 7
The decimal text of a line number, made by the ROM's 132FH (5565H).
55F3-5BFE
DEFS 1548
The list of the lines of the current key, two bytes each, up to 774 lines (5444H); it ends below 5C00H, where BASIC/CMD's code begins.