TRS-80 DOS - NEWDOS/80 v2.0 for the Model I - DISASSEM/CMD Disassembled

Page Customization

Introduction/Summary

NEWDOS/80 v2.0 DISASSEM/CMD Disassembly - The Apparat Disassembler 3.0 (Model I)

DISASSEM/CMD (manual section 6.2) disassembles Z-80 code from main memory or from a load module on disk, to the display or the printer. For a disk object it can also build a location reference table (a cross reference of every address an instruction names), list it, write it to a file (RTD), and write the disassembly as EDTASM source text with generated names (STD). The program identifies itself as APPARAT DISASSEMBLER 3.0.

The file is one load block 55E4H-6E7BH (6,296 bytes in 25 load records), transfer address 5614H. 55E4H-5613H are the variables, 5614H-681BH the code, 681CH-6DDFH the mnemonic tables, source text lines and messages, 6DE0H-6DE6H a small routine and 6DE7H-6E7BH unused zero bytes. Everything above the file is work space: the stack below 6F60H, the reference table's search index at 6F60H-6F9FH and the table itself from 6FA0H up to HIMEM - 6. Below the file are the buffers at 5200H-55E3H.

The page shows every byte of the file once, in address order. Each row says what every register and address it uses holds at that moment.

Questions and Options

QuestionAnswer and effect
OBJECT FROM MAIN MEMORY OR DISK?M (memory) or D (disk; also ENTER) (566BH).
Memory: OBJECT VIRTUAL BASE ADDRESS?The location the code is shown at (hexadecimal, required).
Memory: OBJECT REAL BASE ADDRESS?Where the code is now; ENTER means the same as the virtual base.
Memory with PTR: BYTE COUNT?How many bytes to print; on the display the disassembly runs until X.
Disk: FILESPEC?The load module (57B7H).
Disk: OFFSET OBJECT VIRTUAL ADDRESSES BY?Added to every load and transfer address (ENTER = 0; wraps past FFFFH).
Disk: VIRTUAL RESTART LOCATION?The listing starts at this location (ENTER = from the beginning); the reference table still covers everything.
ANY OPTIONS?One option per answer, ENTER ends them (5B7DH): NCR, NIP, RTD, STD (disk only, except NCR), PTR, BFSP, RE& and RI& (& = A for all, or S T U V W X P L R), FGN=xxx. A wrong answer gives BAD REPLY and the question again.
PTR: # LINES PER PAGE ...1-255 printable lines; then the margins 0-10, ENTER at the top of a page, and the highest printer code 5AH-7FH (codes above it are shown as a period).

The options are settled at 5C1DH: RTD and STD cancel NCR, NCR cancels the reference table, STD cancels NIP, and STD and PTR both stop the pauses. Holding down the up-arrow key while pressing ENTER at any question cancels the disassembly. During the listing X ends it, P pauses (ENTER continues), BREAK held at the end of a line pauses until ENTER, and in a pause a memory disassembly can be moved with V.

The Passes of a Disk Disassembly

  1. Build pass (bit 0 of 55EFH; not with NCR): BUILDING CROSS-REFERENCE TABLE. The file is read and every instruction decoded, but nothing is shown; every operand value is recorded in the reference table (5EB2H). With STD the entry point gets a table entry too.
  2. RTD: the table is written to the file named at REFERENCE TABLE FILESPEC?, straight from memory (59C9H).
  3. Listing pass (bit 1 of 55EFH; skipped with NIP): the file is read again and every instruction shown or printed; with STD it is also written as source text. The program's entry point is shown as nnnn = PROGRAM ENTRY POINT.
  4. Reference table listing (5FECH): the type definitions, then every referenced location with the location and type letter of every instruction referring to it.

The load records are read a byte at a time (5807H); the data of the load blocks is collected in the object buffer at 5200H-52FFH and decoded from there, keeping up to 4 bytes for an instruction that continues in the next block. A load block that does not start where the previous one ended begins a new run: the old run is decoded to its last byte, the output pauses, and with STD an ORG line is written. Records other than 01H (load) and 02H (transfer) are skipped.

The Output Line

ColumnsContents
55A4H-55A5HThe reference mark (listing pass with a table): the number of references to the instruction's bytes (hexadecimal, F = 15 or more), and a mask of the referenced bytes (8 = first byte, 4 second, 2 third, 1 fourth); the mask is blank when only the first byte is referenced (6172H).
55A6H-55A9HThe virtual location.
55ABH-55B2HThe instruction's bytes, two hexadecimal digits each.
55B5H-55BCHThe label: with STD the location's three-letter name.
55BDH-55C4HThe mnemonic.
55C5H-55D2HThe operands. Numbers are hexadecimal with a trailing H and a leading 0 when they start with a letter; with STD every number is replaced by its name.
55D3H-55D6HThe instruction's bytes as characters, a period for codes below 20H or from 5613H up.

The decoder (61A2H) knows every documented Z-80 instruction. A byte that cannot start an instruction, CB 30H-37H, ED codes that are not instructions, ED 71H, a DD or FD prefix followed by another prefix or by an instruction that has no IX/IY form (EX DE,HL among them), and an instruction that runs past the byte count are shown as DEFB nnH for their first byte, and decoding goes on with the next byte (618AH). Bit numbers are written as bytes (BIT 03H,(HL)), relative jumps with their target address, and ED 70H as IN (C).

The Location Reference Table

The table starts at 6FA0H with a byte C0H. It holds 3-byte entries in ascending order of location: a referencee (the location, high byte first, and 40H) followed by its referencers (the location of each referencing instruction, high byte first, and the reference type), in ascending order too; an entry with the control byte C0H ends it. Bit 5 of a referencee's control byte is set when STD puts its name on an instruction. The reference types are S 0 (LD rr,(nn)), T 1 (LD A,(nn), IN A,(n)), U 2 (LD rr,nn), V 3 (LD r,n, an operation with a byte, DEFB), W 4 (LD (nn),rr), X 5 (LD (nn),A, OUT (n),A), P 8 (JP), L 9 (CALL), R 10 (JR, DJNZ).

A 16-entry index at 6F60H-6F9FH (a pointer into the table and the name number of the referencee there) shortens the searches (5F4DH); it is rebuilt after the first 32 new locations, then after every 64, and before the listing pass (5F93H). The table may grow to HIMEM - 12; beyond that the disassembly ends with INSUFFICIENT MEMORY.

RTD file: the memory from 6FA0H to the end marker, written sector by sector. The file therefore starts with the C0H byte the manual describes, and its entries are the table entries above: the location's high byte comes first, not the low byte as the manual says.

For the reference mark of the listing, references by an 8-bit value (type V) to a location below 0100H are not counted (65EFH); they are still in the table and its listing.

STD Source Text

Every line written to the source file starts with a five-digit line number (the digits with bit 7 set, as EDTASM keeps them) and a space. Fields are separated by TAB characters, lines end with 0DH and the text with 1AH. Every referencee has a three-letter name: the referencees are numbered in table order from the FGN= value (AAA = 0) and the number is written in base 26 (66DAH). The name goes on the instruction at that location; a referenced byte inside an instruction gets name EQU $-n after it (56B9H); every other name gets name EQU value after the last instruction, followed by END name for the entry point. A new run starts with ORG address.

Notes From the Code

  • In the reference table listing a referencer of a type turned off by RI still moves the next column on by two positions (60CDH).
  • The output routine has a printer-and-display mode (bit 6 of 5602H, 5E7DH), but the routine that sets it (5DFEH) is never called.
  • Never executed: 5DFEH-5E06H, 64C3H-64C5H, 6696H-669AH and 6735H-6737H. 5E69H-5E80H, the printer code, is reached only through the self-modified JR at 5E67H.
  • The input file is closed after the build pass but not after the listing pass.

Variables

Variables in the File

55E4H-5613H, one row each at the start of the disassembly: the object source, the virtual location (55E5H) and real pointer (55E7H), the pass and option flags (55EFH, 55F0H), the reference mark (55F1H), the table limits and pointers (55F2H-55F7H), the line and page counts (5601H-5608H), the byte count (560BH), and the decoder's opcode and prefix state (560DH-5611H).

Self-Modified Operands

Address
Size
Contents
599DH-599EH
2 bytes
Entry Point
Operand of the LD DE,nnnn at 599CH, stored by 5928H; named on the END line.
5AAAH-5AABH
2 bytes
Output Buffer Pointer
Operand of the LD HL,nnnn at 5AA9H: 5400H from 5A29H, kept by 5AB9H.
5E2FH
1 byte
Bottom Margin
Operand of the LD B,nn at 5E2EH: 03H in the file, the margin answer from 5C69H.
5E36H
1 byte
Top Margin
Operand of the LD B,nn at 5E35H: 03H in the file, the margin answer from 5C66H.
5E68H
1 byte
Output Device
Displacement of the JR at 5E67H: 18H display, 00H printer (5DECH).
5F2EH-5F2FH
2 bytes
Index Entry Used
Operand of the LD HL,nnnn at 5F2DH, stored by the search at 5F5AH.
5FC1H-5FC2H
2 bytes
First Name Number
Operand of the LD BC,nnnn at 5FC0H: 0000H (AAA), or the FGN= value from 5C18H.
6187H-6188H
2 bytes
Stack at the Instruction Start
Operand of the LD SP,nnnn at 6186H, stored by 6122H.
618BH-618CH
2 bytes
Stack Below the Saved State
Operand of the LD SP,nnnn at 618AH, stored by 613CH.

Buffers and Tables Outside the File

Address
Size
Contents
5200H-52FFH
256 bytes
Object Buffer
The data of the load blocks being decoded (disk object).
5300H-53FFH
256 bytes
Input Sector Buffer
The object file's sectors (58BAH).
5400H-54FFH
256 bytes
Output Sector Buffer
The STD source text being written (5AA8H); the RTD file is written from the table itself.
5500H-551FH
32 bytes
Object File FCB
The filespec copied in at 57BDH, then the FCB.
5532H-5551H
32 bytes
Output File FCB
For the RTD and STD files (5A2FH).
5564H-55A3H
64 bytes
Answer Line
The answer to a question (5DA6H); also the line of the reference table listing.
55A4H-55E3H
64 bytes
Output Line
The disassembled instruction (60EDH).
6F60H-6F9FH
64 bytes
Search Index
16 entries: table pointer, name number.
6FA0H up
up to HIMEM - 12
Location Reference Table
C0H, then the 3-byte entries, then the end marker.

Outside Locations

Address
Size
Contents
3840H
1 byte
Keyboard Row 6
Bit 0 ENTER, bit 2 BREAK (5D8DH), bit 3 up-arrow (5DAFH).
4049H-404AH
2 bytes
HIMEM
The top of the reference table's space (563DH).

Outside Routines Called

AddressContents
002BH / 0049HROM: scan the keyboard / wait for a key (5CE1H, 5CD3H).
0033H / 003BHROM: display / print a character (5E94H, 5E76H).
0040HROM: read a line (5DACH).
0060HROM: delay (5D97H).
402DHSYS0: DOS READY (5D09H).
4409HSYS0: display a DOS error and return (5CEFH).
4420H / 4424H / 4428HSYS0: open new or existing / open existing / close.
4436H / 443CHSYS0: read / write with verify.

Disassembly

55E4H - Variables

Data. The program's variables are loaded with the file (the first load record starts here) and most are set again at 5614H for every disassembly. The work buffers below 55E4H (5200H object buffer, 5300H input sector buffer, 5400H output sector buffer, 5500H input FCB, 5532H output FCB, 5564H input line, 55A4H output line) and the reference table from 6F60H up are not in the file.

55E4
DEFB 00H 00
Data: the object source, set at 5671H from the M or D answer: 00H the object is in main memory, 01H it is a load module on disk. Read at 56FEH, 577BH (V restart only for memory) and as the end of the output line scan at 5723H.
55E5-55E6
DEFW 0000H 00 00
Data: the virtual location, the address the next object byte is considered to be at (printed in the location column). Set from the VIRTUAL BASE ADDRESS (5682H), from each load block's address plus the offset (5826H), by a V restart (578BH); advanced by 662CH for every byte fetched; restored by 619AH when an instruction is redone.
55E7-55E8
DEFW 0000H 00 00
Data: the real pointer, the main memory address the next object byte is fetched from (6620H). Memory object: the REAL BASE ADDRESS (5690H, the virtual base by default). Disk object: inside the object buffer at 5200H-52FFH (5801H, 5885H).
55E9-55EA
DEFW 0000H 00 00
Data: the virtual restart location for a disk object (5AE0H, 0000H = start at the beginning). During the listing pass 588EH drops every byte before it, then clears it (58B4H).
55EB-55EC
DEFW 0000H 00 00
Data: the virtual location of the instruction being decoded, copied from 55E5H at 6129H. It is the referencing location stored in the reference table (5ED5H) and the base for the referenced-byte mask (65D5H, 56C5H).
55ED-55EE
DEFW 0000H 00 00
Data: the real address of the instruction being decoded, copied from 55E7H at 6130H; 6153H reads the instruction's bytes from it for the ASCII column.
55EF
DEFB 00H 00
Data: the pass and option flags (with 55F0H read as Register Pair BC at 5696H, 579AH, 5C1FH): bit 0 the reference table build pass is running, bit 1 the listing pass with a reference table, bit 2 NCR (no reference table; set for a memory object), bit 3 NIP, bit 4 RTD, bit 5 STD. 5A0DH flips bits 0 and 1 between the passes.
55F0
DEFB 00H 00
Data: the output flags: bit 0 BFSP (no pauses; also forced by PTR and STD at 5C36H/5C3CH), bit 1 PTR (output to the printer), bit 7 pause when the screen is full (set at 57ABH unless bit 0 is set). Cleared at 5627H.
55F1
DEFB 00H 00
Data: the reference mark of the current instruction: bits 0-3 the mask of its referenced bytes (bit 3 the first byte), bits 4-7 the number of references (F0H saturates at 15). 6592H adds to it during the listing pass; 6172H prints it as the first two columns. FFH (from 619DH) means the instruction must be redone as one DEFB byte (61A2H).
55F2-55F3
DEFW 0000H 00 00
Data: the highest address the reference table may reach, HIMEM minus 6, set at 5644H; 5F07H checks every insertion against it (minus 6 more).
55F4-55F5
DEFW 0000H 00 00
Data: the address of the reference table's end marker (C0H), first 6FA3H (5651H); moved up by every insertion (5F24H); RTD writes the table up to it (59FBH).
55F6-55F7
DEFW 0000H 00 00
Data: the reference table scan pointer of the listing pass: the referencee entry at or above the virtual location (65ABH, 65CFH, 660EH). Reset to 6FA1H at the start of every contiguous run (58D8H) and saved and restored with each instruction (6138H, 618EH).
55F8
DEFB 00H 00
Data: the reference type of the operand being printed, stored by 664FH, 665CH and 667BH and written into the table with each referencer entry (5EDDH): 00H S, 01H T, 02H U, 03H V, 04H W, 05H X, 08H P, 09H L, 0AH R.
55F9-55FA
DEFW 0000H 00 00
Data: the OFFSET OBJECT VIRTUAL ADDRESSES BY value (57CEH), added to every load and transfer address read from the file (5A54H).
55FB-55FC
DEFW 0000H 00 00
Data: the address that follows the last load block read from the file (584DH); a block starting there continues the current run. 0001H at the start of each pass (57E6H), so the first block always starts a new run.
55FD-55FE
DEFW 0000H 00 00
Data: the pointer to the next byte in the input sector buffer 5300H-53FFH (58BBH, 58CFH).
55FF-5600
DEFW 0000H 00 00
Data: the real address at which decoding of the object buffer must stop (5707H): 52FCH when the 5200H buffer is full (586AH), FFFFH at the end of a run (58F2H). The byte at 5600H is its high byte and is not used on its own.
5601
DEFB 00H 00
Data: the lines still to be shown before the screen is full: 10H at 5752H, counted down at 573AH; at 0 the program pauses (5742H) and starts a new screen.
5602
DEFB 00H 00
Data: the printer state: bit 0 the first top margin has been output (5DD4H); bit 6 also show printer output on the display (tested at 5E7DH, set only by the unreferenced 5DFEH). Cleared at 562AH.
5603
DEFB 00H 00
Data: the printed lines left on the current page, set from 5604H at 5E3EH and counted down at 5E2AH; 5E10H compares it with 5604H to find the top of a page.
5604
DEFB 3CH 3C
Data: the printable lines per page, 3CH (60) in the file; replaced by the # LINES PER PAGE answer at 5C54H.
5605
DEFB 00H 00
Data: the characters still free on the current output line, counted down by 5D79H for every printable character; reset to the line width (5606H) at the end of each line (5E44H).
5606
DEFB 40H 40
Data: the width of the current output line, 64 characters; copied from 5607H (display) or 5608H (printer) by 5DF7H.
5607
DEFB 40H 40
Data: the display line width, 40H (64 characters), used when the output goes to the display (5DEFH).
5608
DEFB 40H 40
Data: the printer line width, 40H (64 characters), used when the output goes to the printer (5DF4H).
5609-560A
DEFW 0000H 00 00
Data: the pointer into the hexadecimal byte column of the output line, set to 55ABH at 6143H and advanced two characters for every byte fetched (662FH-6635H).
560B-560C
DEFW 0000H 00 00
Data: the number of object bytes still to be disassembled: FFFFH (no limit) at 5623H, the BYTE COUNT answer (56ADH), or the rest of a disk run (58ECH). 6593H counts it down; 0000H ends the disassembly (56FCH) or makes an instruction that runs past it a DEFB (6598H).
560D
DEFB 00H 00
Data: the opcode being decoded (61ACH; the second byte after an ED, CB, DD or FD prefix at 6435H/6470H). The decoder reads its bit fields through 6727H, 673BH and 6743H.
560E
DEFB 00H 00
Data: a byte cleared at 611FH for every instruction; no instruction reads it.
560F
DEFB 00H 00
Data: the index prefix state: 00H none, 01H a DD or FD prefix has been read (63B1H), 03H also the DD/FD CB form whose displacement is already in 5611H (6427H). Cleared at 611CH, 6575H and 67FDH once the (IX+d)/(IY+d) or IX/IY operand is printed.
5610
DEFB 00H 00
Data: the register pair used for HL: 02H HL (6118H), 04H IX after a DD prefix, 05H IY after an FD prefix (63A8H); an index into the pair name table at 6824H.
5611
DEFB 00H 00
Data: the displacement byte of a DD CB d op or FD CB d op instruction, fetched before the opcode at 642DH and printed by 6578H.
5612
DEFB 20H 20
Data: the new referencee entries still allowed before the search index at 6F60H is rebuilt: 20H in the file, 40H after every rebuild (5F95H); counted down at 5ED0H.
5613
DEFB 80H 80
Data: the lowest character code shown as a period in the ASCII column (6169H): 80H, or the HIGH ASCII CODE FOR PRINTER answer plus 1 (5C7EH). Codes below 20H are always shown as a period.

5614H - Start: Title, Variables and the Reference Table

DISASSEM's transfer address; ANOTHER DISASSEMBLY? answered Y also comes back here (5D06H). The stack is put below the reference table index at 6F60H, the title is shown, the per-run variables are reset and an empty reference table is built at 6FA0H with its 16-entry search index at 6F60H-6F9FH. Then the object source (M or D) is asked for.

5614
LD SP,6F60H 31 60 6F
Load the Stack Pointer with 6F60H: the stack grows down from just below the reference table's search index (6F60H-6F9FH), above every buffer and the program.
5617
GOSUB to 5D2DH to clear the screen (codes 1CH and 1FH through the output routine).
561A
LD DE,6992H 11 92 69
Load Register Pair DE with 6992H, the title text APPARAT DISASSEMBLER 3.0 (ended by 00H).
561D
GOSUB to 5D17H to display the text at Register Pair DE and a carriage return.
5620
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, the byte count meaning no limit.
5623
LD (560BH),HL 22 0B 56
Store Register Pair HL (FFFFH) at 560BH, the number of object bytes still to be disassembled, so that a memory disassembly runs until it is stopped.
5626
XOR A AF
Load Register A with 00H (XOR A with itself), to clear the output flags.
5627
LD (55F0H),A 32 F0 55
Store Register A (00H) at 55F0H, the output flags: no BFSP, no PTR, no pauses yet.
562A
LD (5602H),A 32 02 56
Store Register A (00H) at 5602H, the printer state: the first top margin has not been output.
562D
LD A,80H 3E 80
Load Register A with 80H, the default limit of the ASCII column: codes 80H and above are shown as a period.
562F
LD (5613H),A 32 13 56
Store Register A (80H) at 5613H, the lowest code shown as a period in the ASCII column (the PTR question may lower it).
5632
LD HL,698DH 21 8D 69
Load Register Pair HL with 698DH, five bytes B0H (the digit 0 with bit 7 set), the starting value of the line numbers.
5635
LD DE,6987H 11 87 69
Load Register Pair DE with 6987H, the five line number digits written before every source line.
5638
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five digits to copy.
563B
LDIR ED B0
Copy Register Pair BC (5) bytes from Register Pair HL (698DH) to Register Pair DE (6987H): the line number is 00000 again, in the form EDTASM source files use (digits with bit 7 set).
563D
LD HL,(4049H) 2A 49 40
Load Register Pair HL with the 16-bit value at 4049H, HIMEM: the highest address the program may use.
5640
LD DE,FFFAH 11 FA FF
Load Register Pair DE with FFFAH, minus 6 in two's complement, to take 6 off HIMEM.
5643
ADD HL,DE 19
Add Register Pair DE (minus 6) to Register Pair HL: Register Pair HL = HIMEM - 6, the highest address the reference table may reach.
5644
LD (55F2H),HL 22 F2 55
Store Register Pair HL (HIMEM - 6) at 55F2H, the reference table limit.
5647
LD DE,6FA0H 11 A0 6F
Load Register Pair DE with 6FA0H, the start of the reference table.
564A
LD A,C0H 3E C0
Load Register A with C0H, the control byte of the table's end marker (bits 7 and 6 set).
564C
LD (DE),A 12
Store Register A (C0H) at Register Pair DE, 6FA0H: the marker before the first entry (written as the first byte of an RTD file).
564D
INC DE 13
Increment Register Pair DE to 6FA1H, where the first entry will go.
564E
INC DE 13
Increment Register Pair DE (the table pointer) to 6FA2H.
564F
INC DE 13
Increment Register Pair DE to 6FA3H, the control byte of an empty 3-byte entry.
5650
LD (DE),A 12
Store Register A (C0H) at Register Pair DE, 6FA3H: the end marker of the empty table.
5651
LD (55F4H),DE ED 53 F4 55
Store Register Pair DE (6FA3H) at 55F4H, the address of the table's end marker.
5655
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC (Register A, C0H, is not changed).
5656
SBC HL,DE ED 52
Subtract Register Pair DE (6FA3H) from Register Pair HL (HIMEM - 6): the CARRY FLAG is set if HIMEM is too low for even an empty table.
5658
If the CARRY FLAG is set, JUMP to 5F47H to display INSUFFICIENT MEMORY and end the disassembly.
565B
DEC DE 1B
Decrement Register Pair DE (6FA3H, the end marker) to 6FA2H.
565C
DEC DE 1B
Decrement Register Pair DE to 6FA1H, the first entry position, which every index entry points to at the start.
565D
LD HL,6F60H 21 60 6F
Load Register Pair HL with 6F60H, the first of the 16 four-byte search index entries.

Index Loop
Register Pair HL = the index entry, Register Pair DE = 6FA1H.

5660
LD (HL),E 73
Store Register E (A1H) at Register Pair HL, the low byte of the index entry's table pointer.
5661
INC HL 23
Increment Register Pair HL to the high byte of the pointer.
5662
LD (HL),D 72
Store Register D (6FH) at Register Pair HL: the index entry points at 6FA1H.
5663
INC HL 23
Increment Register Pair HL past the pointer, to byte 2 of the entry (the name count, set when the index is rebuilt at 5F93H).
5664
INC HL 23
Increment Register Pair HL to byte 3 of the entry.
5665
INC HL 23
Increment Register Pair HL to the next index entry.
5666
LD A,L 7D
Load Register A with Register L, the low byte of the index pointer.
5667
CP A0H FE A0
Compare Register A (the low byte) against A0H: the Z FLAG is set after the sixteenth entry (6F9CH + 4 = 6FA0H).
5669
If the NZ FLAG is set (more index entries), LOOP back to 5660H.
566B
LD DE,69ACH 11 AC 69
Load Register Pair DE with 69ACH, the question OBJECT FROM MAIN MEMORY OR DISK? (M OR D).
566E
GOSUB to 5B08H to ask it: Register A comes back 01H with the NZ FLAG for D or ENTER (disk), 00H with the Z FLAG for M (memory).
5671
LD (55E4H),A 32 E4 55
Store Register A, the object source (00H memory, 01H disk), at 55E4H.
5674
If the NZ FLAG is set (a disk object), JUMP to 57B7H to ask for the filespec.

5677H - Memory Object: Questions

For an object in main memory the virtual base address (where the code is considered to run) and the real base address (where it is now, by default the same) are asked; then the options. NIP, RTD and STD need a disk object; PTR also asks for a byte count. Then the disassembly runs at 5748H until the byte count runs out or the operator stops it.

5677
LD A,04H 3E 04
Load Register A with 04H, bit 2 (NCR) of the flags: a memory object never gets a reference table.
5679
LD (55EFH),A 32 EF 55
Store Register A (04H) at 55EFH, the pass and option flags.
567C
LD DE,69D8H 11 D8 69
Load Register Pair DE with 69D8H, the question OBJECT VIRTUAL BASE ADDRESS? (HEX).
567F
GOSUB to 5B22H to ask it and read a hexadecimal value (an answer is required) into Register Pair HL.
5682
LD (55E5H),HL 22 E5 55
Store Register Pair HL, the virtual base address, at 55E5H, the virtual location of the first byte.
5685
LD (55E7H),HL 22 E7 55
Store Register Pair HL at 55E7H, the real pointer too: by default the object is read where it is considered to run.
5688
LD DE,69FCH 11 FC 69
Load Register Pair DE with 69FCH, the question OBJECT REAL BASE ADDRESS? (HEX).
568B
GOSUB to 5B29H to ask it: Register Pair HL = the value with the NZ FLAG, or the Z FLAG for an empty answer.
568E
If the Z FLAG is set (no real base given), JUMP to 5693H; the real pointer stays equal to the virtual base.
5690
LD (55E7H),HL 22 E7 55
Store Register Pair HL, the real base address, at 55E7H, the real pointer.
5693
GOSUB to 5B7DH to ask ANY OPTIONS? until an empty answer and settle the flags at 55EFH and 55F0H.
5696
LD BC,(55EFH) ED 4B EF 55
Load Register Pair BC with the 16-bit value at 55EFH: Register C = the pass and option flags (55EFH), Register B = the output flags (55F0H).
569A
LD DE,6D21H 11 21 6D
Load Register Pair DE with 6D21H, the message ATLEAST ONE OPTION REQUIRES OBJECT FROM DISK, in case it is needed.
569D
LD A,C 79
Load Register A with Register C, the option flags.
569E
AND 38H E6 38
Mask Register A (the option flags) against 38H (0011 1000) to keep NIP (bit 3), RTD (bit 4) and STD (bit 5).
56A0
If the NZ FLAG is set (one of them was given for a memory object), JUMP to 5CFAH to display the message at Register Pair DE and ask ANOTHER DISASSEMBLY?.
56A3
BIT 1,B CB 48
Test bit 1 of Register B, the output flags: PTR.
56A5
If the Z FLAG is set (output to the display), JUMP to 56B0H: the disassembly runs until the operator stops it.
56A7
LD DE,6A1DH 11 1D 6A
Load Register Pair DE with 6A1DH, the question BYTE COUNT? (HEX), asked when printing because the printer does not pause.
56AA
GOSUB to 5B22H to ask it and read a hexadecimal value (an answer is required) into Register Pair HL.
56AD
LD (560BH),HL 22 0B 56
Store Register Pair HL, the byte count, at 560BH, the number of object bytes to disassemble.
56B0
GOSUB to 579AH to set the pause flag (bit 7 of 55F0H) and, for PTR, switch the output to the printer.
56B3
GOSUB to 5748H, the disassembly loop: it returns when the byte count at 560BH reaches 0 (56FDH).
56B6
JUMP to 5CFDH to switch the output back to the display and ask ANOTHER DISASSEMBLY?.

56B9H - Disassembly Loop: STD Labels Inside the Last Instruction

The loop is entered at 5748H (a new screen) or 5755H (the keyboard check) and returns from 56FDH or 570EH. When STD source text is being written, a byte inside the instruction just written that is referenced elsewhere cannot have a label on a line of its own, so an EQU line name EQU $-n is written after the instruction for every such byte, n being the bytes from it to the end of the instruction. The bytes are taken from bits 2-0 of the reference mark at 55F1H (bit 3, the first byte, gets its label on the instruction itself).

56B9
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
56BC
AND 21H E6 21
Mask Register A (the flags) against 21H (0010 0001) to keep STD (bit 5) and the build pass (bit 0).
56BE
CP 20H FE 20
Compare Register A against 20H: the Z FLAG is set only when STD text is being written, that is STD in the listing pass.
56C0
If the NZ FLAG is set (no source text now), JUMP to 56F8H.
56C2
LD HL,(55E5H) 2A E5 55
Load Register Pair HL with the 16-bit value at 55E5H, the virtual location after the last instruction.
56C5
LD DE,(55EBH) ED 5B EB 55
Load Register Pair DE with the 16-bit value at 55EBH, the virtual location of the last instruction.
56C9
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC (Register A, 20H, is not changed).
56CA
SBC HL,DE ED 52
Subtract Register Pair DE (the instruction's location) from Register Pair HL: Register L = the instruction's length (1-4).
56CC
LD C,08H 0E 08
Load Register C with 08H, the mask bit of the instruction's first byte, which the loop shifts right to the later bytes.
56CE
LD B,L 45
Load Register B with Register L, the instruction's length, counted down to the bytes after the one being tested.
56CF
LD HL,55F1H 21 F1 55
Load Register Pair HL with 55F1H, the reference mark of the instruction (bits 0-3 the referenced bytes).

Byte Loop
Register Pair DE = the virtual location of the byte, Register C = its mask bit, Register B = the bytes from it to the end of the instruction.

56D2
INC DE 13
Increment Register Pair DE, the virtual location, to the next byte of the instruction.
56D3
DEC B 05
Decrement Register B, the instruction's length: Register B = the bytes from this byte to the end.
56D4
SRL C CB 39
Shift Register C (the mask bit) right: 04H for the second byte, 02H the third, 01H the fourth; the Z FLAG is set once it has gone past bit 0.
56D6
If the Z FLAG is set (every byte tested), JUMP to 56F8H.
56D8
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the reference mark at 55F1H.
56D9
AND C A1
AND Register A (the mark) with Register C, the mask bit of this byte: the NZ FLAG is set if the byte is referenced.
56DA
If the Z FLAG is set (this byte is not referenced), LOOP back to 56D2H.
56DC
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the reference mark.
56DD
XOR C A9
XOR Register A (the mark) with Register C, the byte's mask bit: the bit is cleared, so this byte is not handled twice.
56DE
LD (HL),A 77
Store Register A, the updated mark, at Register Pair HL, 55F1H.
56DF
LD A,B 78
Load Register A with Register B, the bytes from this byte to the end of the instruction (1-3).
56E0
ADD A,30H C6 30
Add 30H to Register A (the byte count 1-3): Register A = the ASCII digit 1-3.
56E2
LD (6970H),A 32 70 69
Store Register A (the digit) at 6970H, the n of the text AAA EQU $-n at 6966H.
56E5
LD A,03H 3E 03
Load Register A with 03H for 66C1H: bit 0 the location must be in the reference table, bit 1 mark its name as used.
56E7
LD HL,6966H 21 66 69
Load Register Pair HL with 6966H, where the name is written (the first three bytes of the EQU line).
56EA
PUSH HL E5
Save Register Pair HL (6966H, the line) on the stack.
56EB
GOSUB to 66C1H to find the virtual location in Register Pair DE in the reference table and write its three-letter name at Register Pair HL (6966H); it marks the name as used.
56EE
GOSUB to 5A6EH to count the line number up and write it to the source file.
56F1
POP HL E1
Restore Register Pair HL from the stack: 6966H, the EQU line.
56F2
GOSUB to 5AC5H to write the line at Register Pair HL, up to and including its carriage return, to the source file.
56F5
JUMP to 5755H to check the keyboard and come back to 56B9H, which looks for the next referenced byte.

56F8H - Disassembly Loop: Next Instruction

Stops when the byte count is used up, or for a disk object when the object buffer has been decoded up to 55FFH. Otherwise one instruction is decoded into the output line (60EDH); STD writes it to the source file, and unless the reference table is being built the line is shown, with a pause when the screen is full.

56F8
LD HL,(560BH) 2A 0B 56
Load Register Pair HL with the 16-bit value at 560BH, the object bytes still to be disassembled.
56FB
LD A,H 7C
Load Register A with Register H, the high byte of the byte count.
56FC
OR L B5
OR Register A with Register L, the low byte: the Z FLAG is set when no bytes are left.
56FD
RET Z C8
If the Z FLAG is set (the byte count is used up), RETURN to the caller of 5748H.
56FE
LD A,(55E4H) 3A E4 55
Load Register A with the byte at 55E4H, the object source (00H memory, 01H disk).
5701
OR A B7
OR Register A with itself: the Z FLAG is set for a memory object.
5702
If the Z FLAG is set (memory object: no buffer limit), JUMP to 570FH.
5704
LD HL,(55E7H) 2A E7 55
Load Register Pair HL with the 16-bit value at 55E7H, the real pointer into the object buffer.
5707
LD DE,(55FFH) ED 5B FF 55
Load Register Pair DE with the 16-bit value at 55FFH, the address where decoding of the buffer must stop (52FCH or FFFFH).
570B
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC (Register A, 01H, is not changed).
570C
SBC HL,DE ED 52
Subtract Register Pair DE (the stop address) from Register Pair HL (the real pointer): the NO CARRY FLAG is set once the pointer has reached it.
570E
RET NC D0
If the NO CARRY FLAG is set (the buffer is decoded up to the stop address), RETURN to the caller of 5748H to read more of the file.
570F
GOSUB to 60EDH to decode one instruction into the output line at 55A4H-55E3H (and, in the build pass, record its references).
5712
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
5715
AND 21H E6 21
Mask Register A (the flags) against 21H (0010 0001) to keep STD (bit 5) and the build pass (bit 0).
5717
CP 20H FE 20
Compare Register A against 20H: the Z FLAG is set when STD source text is being written.
5719
If the Z FLAG is set (writing source text), GOSUB to 5A5BH to write the label, mnemonic and operands of the line to the source file.
571C
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
571F
AND 01H E6 01
Mask Register A (the flags) against 01H to keep bit 0, the build pass.
5721
If the NZ FLAG is set (building the reference table: nothing is shown), JUMP to 5755H.
5723
LD HL,55E4H 21 E4 55
Load Register Pair HL with 55E4H, one byte past the end of the output line 55A4H-55E3H.
5726
LD B,40H 06 40
Load Register B with 40H, the 64 characters of the output line.

Trailing Spaces
Register Pair HL = the character tested (from the end), Register B = the length still possible.

5728
DEC HL 2B
Decrement Register Pair HL to the previous character of the output line.
5729
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, a character of the output line.
572A
CP 20H FE 20
Compare Register A (the character) against 20H, a space.
572C
If the NZ FLAG is set (the last character that is not a space), JUMP to 5731H with Register B = the line's length.
572E
Decrement Register B, the length; if Register B is not 0, LOOP back to 5728H.
5730
INC B 04
The line is all spaces: increment Register B to 1, so one space is shown.
5731
LD DE,55A4H 11 A4 55
Load Register Pair DE with 55A4H, the start of the output line.
5734
GOSUB to 5D3FH to output Register B characters from Register Pair DE.
5737
LD HL,5601H 21 01 56
Load Register Pair HL with 5601H, the lines left before the screen is full.
573A
DEC (HL) 35
Decrement the byte at Register Pair HL, the lines left on the screen.
573B
If the Z FLAG is set (the screen is full), JUMP to 5742H to pause and start a new screen.
573D
GOSUB to 5D1AH to end the line with a carriage return.
5740
JUMP to 5755H to check the keyboard before the next instruction.
5742
GOSUB to 5765H to wait for a key if pauses are wanted (bit 7 of 55F0H).
5745
GOSUB to 5D1AH to end the line with a carriage return.

5748H - Disassembly Loop: New Screen, Keyboard Check and Pause

5748H is the entry of the disassembly loop: it clears the screen unless the table is being built and allows 16 lines on it. 5755H checks the keyboard after every instruction: X ends the disassembly, P pauses. The pause (5765H/576BH) waits for ENTER, X, or for a memory object V, which asks for a new VIRTUAL RESTART LOCATION and moves the real pointer by the same amount.

5748
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
574B
AND 01H E6 01
Mask Register A (the flags) against 01H to keep bit 0, the build pass.
574D
If the Z FLAG is set (not the build pass), GOSUB to 5D2DH to clear the screen for the new page of output.
5750
LD A,10H 3E 10
Load Register A with 10H, the 16 lines shown before a pause.
5752
LD (5601H),A 32 01 56
Store Register A (10H) at 5601H, the lines left on the screen.
5755
GOSUB to 5CE0H to scan the keyboard: Register A = the key held down (upper case), 00H if none.
5758
CP 58H FE 58
Compare Register A (the key) against 58H, the letter X.
575A
If the Z FLAG is set (X), JUMP to 5CF2H to display FUNCTION CANCELLED and ask ANOTHER DISASSEMBLY?.
575D
CP 50H FE 50
Compare Register A (the key) against 50H, the letter P.
575F
If the Z FLAG is set (P), GOSUB to 576BH to pause until ENTER (or X, or V).
5762
JUMP to 56B9H to decode the next instruction (after any STD EQU lines).
5765
LD A,(55F0H) 3A F0 55
Load Register A with the byte at 55F0H, the output flags.
5768
AND 80H E6 80
Mask Register A (the flags) against 80H to keep bit 7, pause when the screen is full.
576A
RET Z C8
If the Z FLAG is set (no pauses: BFSP, PTR or STD), RETURN at once.
576B
GOSUB to 5CD2H to wait for a key: Register A = the key, in upper case.
576E
CP 0DH FE 0D
Compare Register A (the key) against 0DH, ENTER.
5770
RET Z C8
If the Z FLAG is set (ENTER), RETURN: the disassembly goes on.
5771
CP 58H FE 58
Compare Register A (the key) against 58H, the letter X.
5773
If the Z FLAG is set (X), JUMP to 5CF2H to display FUNCTION CANCELLED and ask ANOTHER DISASSEMBLY?.
5776
CP 56H FE 56
Compare Register A (the key) against 56H, the letter V.
5778
If the NZ FLAG is set (another key), JUMP back to 576BH to wait for the next key.
577B
LD A,(55E4H) 3A E4 55
Load Register A with the byte at 55E4H, the object source.
577E
OR A B7
OR Register A with itself: the NZ FLAG is set for a disk object.
577F
If the NZ FLAG is set (V is only for a memory object), JUMP back to 576BH to wait for the next key.
5781
LD DE,6A30H 11 30 6A
Load Register Pair DE with 6A30H, the question VIRTUAL RESTART LOCATION? (HEX).
5784
GOSUB to 5B22H to ask it and read a hexadecimal value (an answer is required) into Register Pair HL.
5787
LD DE,(55E5H) ED 5B E5 55
Load Register Pair DE with the 16-bit value at 55E5H, the old virtual location.
578B
LD (55E5H),HL 22 E5 55
Store Register Pair HL, the new virtual location, at 55E5H.
578E
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC.
578F
SBC HL,DE ED 52
Subtract Register Pair DE (the old virtual location) from Register Pair HL (the new one): Register Pair HL = the distance moved.
5791
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the distance moved.
5792
LD HL,(55E7H) 2A E7 55
Load Register Pair HL with the 16-bit value at 55E7H, the real pointer.
5795
ADD HL,DE 19
Add Register Pair DE (the distance) to Register Pair HL: the real pointer moves by the same amount.
5796
LD (55E7H),HL 22 E7 55
Store Register Pair HL, the new real pointer, at 55E7H.
5799
RET C9
RETURN to the disassembly loop, which goes on at the new location.

579AH - Start the Output of a Pass

During the build pass only BUILDING CROSS-REFERENCE TABLE is displayed. Otherwise the pause flag (bit 7 of 55F0H) is set unless BFSP is set, and with PTR the output is switched to the printer.

579A
LD BC,(55EFH) ED 4B EF 55
Load Register Pair BC with the 16-bit value at 55EFH: Register C = the pass and option flags, Register B = the output flags (55F0H).
579E
LD DE,6DC1H 11 C1 6D
Load Register Pair DE with 6DC1H, the message BUILDING CROSS-REFERENCE TABLE.
57A1
LD A,C 79
Load Register A with Register C, the pass and option flags.
57A2
AND 01H E6 01
Mask Register A (the flags) against 01H to keep bit 0, the build pass.
57A4
If the NZ FLAG is set (the build pass), JUMP to 5D17H to display the message at Register Pair DE and return.
57A7
BIT 0,B CB 40
Test bit 0 of Register B, the output flags: BFSP (no pauses).
57A9
If the NZ FLAG is set (BFSP), JUMP to 57ADH without the pause flag.
57AB
SET 7,B CB F8
Set bit 7 of Register B, the output flags: pause when the screen is full.
57AD
LD (55EFH),BC ED 43 EF 55
Store Register Pair BC at 55EFH: the flags at 55EFH and the output flags at 55F0H.
57B1
BIT 1,B CB 48
Test bit 1 of Register B, the output flags: PTR.
57B3
If the NZ FLAG is set (PTR), GOSUB to 5DC6H to switch the output to the printer.
57B6
RET C9
RETURN to the caller with the flags at 55EFH and 55F0H set for the pass.

57B7H - Disk Object: Questions and Opening the File

For a load module on disk the filespec, the offset to add to the load addresses and the virtual restart location are asked, the reference types are all enabled, and the options are asked. 57E3H is also where the second pass starts (from 5A2CH): the file is opened again and read from its first record.

57B7
LD DE,6A88H 11 88 6A
Load Register Pair DE with 6A88H, the question FILESPEC?.
57BA
GOSUB to 5AEBH to ask it (an answer is required): the answer is in the input line at Register Pair HL (5564H).
57BD
LD DE,5500H 11 00 55
Load Register Pair DE with 5500H, the FCB of the object file.
57C0
LD BC,001FH 01 1F 00
Load Register Pair BC with 001FH, the 31 characters of a filespec the FCB can hold.
57C3
LDIR ED B0
Copy Register Pair BC (31) bytes from Register Pair HL (the input line) to Register Pair DE (5500H): the filespec text for the open.
57C5
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the filespec text in the FCB.
57C7
LD (DE),A 12
Store Register A (0DH) at Register Pair DE, 551FH, so the filespec text always ends.
57C8
LD DE,6A5CH 11 5C 6A
Load Register Pair DE with 6A5CH, the question OFFSET OBJECT VIRTUAL ADDRESSES BY? (HEX).
57CB
GOSUB to 5B29H to ask it: Register Pair HL = the value, 0000H for an empty answer.
57CE
LD (55F9H),HL 22 F9 55
Store Register Pair HL, the offset, at 55F9H; 5A54H adds it to every address read from the file.
57D1
GOSUB to 5ADAH to ask VIRTUAL RESTART LOCATION? and store the answer (0000H for none) at 55E9H.
57D4
LD A,01H 3E 01
Load Register A with 01H, bit 0 of the flags: the first pass builds the reference table.
57D6
LD (55EFH),A 32 EF 55
Store Register A (01H) at 55EFH, the pass and option flags.
57D9
LD C,01H 0E 01
Load Register C with 01H: bit 0 set means enable (RE) for 5BCDH.
57DB
LD A,41H 3E 41
Load Register A with 41H, the letter A: all reference types.
57DD
GOSUB to 5BCDH to enable all the reference types in the flags at 60E2H (REA, the default).
57E0
GOSUB to 5B7DH to ask ANY OPTIONS? until an empty answer and settle the flags at 55EFH and 55F0H.
57E3
LD HL,0001H 21 01 00
Load Register Pair HL with 0001H, an address no load block can follow on from, so that the first block starts a new run.
57E6
LD (55FBH),HL 22 FB 55
Store Register Pair HL (0001H) at 55FBH, the address that follows the last load block read.
57E9
XOR A AF
Load Register A with 00H (XOR A with itself).
57EA
LD (55F1H),A 32 F1 55
Store Register A (00H) at 55F1H, the reference mark: no instruction is pending as a DEFB.
57ED
GOSUB to 579AH to display BUILDING CROSS-REFERENCE TABLE (build pass) or set the pause and printer output (listing pass).
57F0
LD HL,5300H 21 00 53
Load Register Pair HL with 5300H, the sector buffer for the object file.
57F3
LD DE,5500H 11 00 55
Load Register Pair DE with 5500H, the FCB holding the filespec.
57F6
LD B,00H 06 00
Load Register B with 00H, the record length 256 for the open.
57F8
GOSUB to SYS0 4424H to open the existing file named in the FCB at Register Pair DE, with the buffer at Register Pair HL.
57FB
If the NZ FLAG is set (the open failed), JUMP to 5CE6H to display the DOS error and ask ANOTHER DISASSEMBLY?.
57FE
LD DE,5200H 11 00 52
Load Register Pair DE with 5200H, the object buffer that holds the bytes of the load blocks for decoding.
5801
LD (55E7H),DE ED 53 E7 55
Store Register Pair DE (5200H) at 55E7H, the real pointer: decoding starts at the buffer's first byte.
5805
LD B,01H 06 01
Load Register B with 01H, the sector byte counter of 58BAH: the first call reads the first sector.

5807H - Disk Object: Read the Load Records

Each record starts with a type byte. Type 01H (a load block) has a length byte (the bytes after it, address included; 00H means 256), a two-byte load address and the data, which is collected in the object buffer at 5200H. A block that does not start where the previous one ended begins a new run: the previous run is decoded to its end (58D5H) and for STD an ORG line is written. Type 02H is the transfer record (591FH); other types are skipped (590EH). Register B is the sector byte counter of 58BAH throughout, Register C the bytes left in the record and Register Pair DE the store position in the object buffer.

5807
GOSUB to 58BAH to read the next byte of the file into Register A: the type of the next record.
580A
CP 01H FE 01
Compare Register A (the record type) against 01H, a load block.
580C
If the NZ FLAG is set (another record type), JUMP to 590EH.
580F
GOSUB to 58BAH to read the record's length byte into Register A.
5812
LD C,A 4F
Load Register C with Register A, the length: the bytes of the record after the length byte.
5813
GOSUB to 5A49H to read the load address into Register Pair HL, add the offset (55F9H) and take 2 off Register C: Register C = the data bytes (00H means 256).
5816
PUSH DE D5
Save Register Pair DE, the store position in the object buffer, on the stack.
5817
LD DE,(55FBH) ED 5B FB 55
Load Register Pair DE with the 16-bit value at 55FBH, the address that follows the previous load block.
581B
GOSUB to 5EA9H to compare Register Pair HL (this block's address) with Register Pair DE: the Z FLAG is set if they are equal; Register Pair HL = the difference.
581E
If the Z FLAG is set (the block follows on: the run continues), JUMP to 5843H.
5820
ADD HL,DE 19
Add Register Pair DE back to Register Pair HL: Register Pair HL = this block's address again.
5821
PUSH HL E5
Save Register Pair HL, the block's address, on the stack.
5822
GOSUB to 58D5H to decode the rest of the previous run, if any, before the new one starts.
5825
POP DE D1
Restore Register Pair DE from the stack: the block's address.
5826
LD (55E5H),DE ED 53 E5 55
Store Register Pair DE at 55E5H, the virtual location: the new run starts at the block's address.
582A
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
582D
AND 21H E6 21
Mask Register A (the flags) against 21H (0010 0001) to keep STD (bit 5) and the build pass (bit 0).
582F
CP 20H FE 20
Compare Register A against 20H: the Z FLAG is set when STD source text is being written.
5831
If the NZ FLAG is set (no source text now), JUMP to 5843H.
5833
PUSH DE D5
Save Register Pair DE, the block's address, on the stack.
5834
PUSH BC C5
Save Register Pair BC (Register B the sector byte counter, Register C the data bytes) on the stack.
5835
LD HL,6977H 21 77 69
Load Register Pair HL with 6977H, the address field of the ORG line at 6972H.
5838
GOSUB to 6665H to write Register Pair DE (the block's address) at Register Pair HL as hexadecimal with a trailing H (and a leading 0 if it starts with a letter).
583B
LD DE,6972H 11 72 69
Load Register Pair DE with 6972H, the ORG line (a TAB, ORG, a TAB and the address).
583E
GOSUB to 5ABEH to end the line at Register Pair HL with a carriage return and write it, with a line number, to the source file.
5841
POP BC C1
Restore Register Pair BC from the stack: Register B the sector byte counter, Register C the data bytes.
5842
POP DE D1
Restore Register Pair DE from the stack: the block's address.
5843
LD L,C 69
Load Register L with Register C, the data bytes of the block.
5844
LD H,00H 26 00
Load Register H with 00H: Register Pair HL = the data bytes.
5846
ADD HL,DE 19
Add Register Pair DE (the block's address) to Register Pair HL: the address that follows the block.
5847
LD A,C 79
Load Register A with Register C, the data bytes.
5848
OR A B7
OR Register A with itself: the Z FLAG is set when Register C is 00H, which means 256 bytes.
5849
If the NZ FLAG is set (fewer than 256 bytes), JUMP to 584CH.
584B
INC H 24
Increment Register H: 256 bytes, so the address that follows is 100H further.
584C
POP DE D1
Restore Register Pair DE from the stack: the store position in the object buffer.
584D
LD (55FBH),HL 22 FB 55
Store Register Pair HL, the address that follows this block, at 55FBH for the next block's test.
5850
JUMP to 5855H to store the block's first data byte.

Data Byte Loop
Register C = the data bytes left in the record, Register Pair DE = the store position in the object buffer.

5852
DEC C 0D
Decrement Register C, the data bytes left in the record.
5853
If the Z FLAG is set (the record is finished), JUMP back to 5807H for the next record.
5855
LD HL,AD00H 21 00 AD
Load Register Pair HL with AD00H, so that the ADD below carries when Register Pair DE has reached 5300H.
5858
ADD HL,DE 19
Add Register Pair DE (the store position) to Register Pair HL: the CARRY FLAG is set when the object buffer 5200H-52FFH is full.
5859
If the NO CARRY FLAG is set (room in the buffer), JUMP to 588EH to read and store the byte.
585B
PUSH BC C5
The buffer is full: save Register Pair BC (Register B the sector byte counter, Register C the data bytes left) on the stack.
585C
LD DE,5200H 11 00 52
Load Register Pair DE with 5200H, the start of the object buffer.
585F
LD HL,(55E7H) 2A E7 55
Load Register Pair HL with the 16-bit value at 55E7H, the real pointer: where decoding of the buffer has got to.
5862
GOSUB to 5EA9H to compare Register Pair HL (the real pointer) with Register Pair DE (5200H): the Z FLAG is set if nothing of this buffer has been decoded yet; Register Pair HL = the difference.
5865
If the NZ FLAG is set (decoding has moved on: there is already room), JUMP to 5877H to move the rest down.
5867
LD HL,52FCH 21 FC 52
Load Register Pair HL with 52FCH, the address where decoding must stop: the last 4 bytes stay, because an instruction there may continue in the next bytes.
586A
LD (55FFH),HL 22 FF 55
Store Register Pair HL (52FCH) at 55FFH, the stop address for 570EH.
586D
GOSUB to 5748H to decode the buffer up to 52FCH.
5870
PUSH HL E5
Save Register Pair HL on the stack: the real pointer minus 52FCH, as the SBC at 570CH left it when the decoding loop returned.
5871
PUSH DE D5
Save Register Pair DE on the stack: 52FCH, the stop address loaded at 5707H.
5872
GOSUB to 5765H to pause if pauses are wanted.
5875
POP DE D1
Restore Register Pair DE from the stack: 52FCH.
5876
POP HL E1
Restore Register Pair HL from the stack: the real pointer minus 52FCH.
5877
ADD HL,DE 19
Add Register Pair DE to Register Pair HL: Register Pair HL = the real pointer, the first byte not yet decoded (52FCH plus the loop's difference, or 5200H plus the difference from 5862H).
5878
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = that pointer, the first byte not yet decoded.
5879
LD HL,5300H 21 00 53
Load Register Pair HL with 5300H, the end of the object buffer.
587C
GOSUB to 5EA9H to subtract Register Pair DE from Register Pair HL (5300H): Register L = the bytes not yet decoded (Z FLAG if none).
587F
LD C,L 4D
Load Register C with Register L, the bytes not yet decoded.
5880
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the bytes to move; LD does not change the flags.
5882
LD HL,5200H 21 00 52
Load Register Pair HL with 5200H, the start of the object buffer.
5885
LD (55E7H),HL 22 E7 55
Store Register Pair HL (5200H) at 55E7H: decoding goes on from the buffer's start, where those bytes are moved.
5888
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the first byte not yet decoded, Register Pair DE = 5200H.
5889
If the Z FLAG is set (no bytes to move), JUMP to 588DH.
588B
LDIR ED B0
Copy Register Pair BC bytes from Register Pair HL to Register Pair DE (5200H): the bytes not yet decoded go to the start of the buffer, and Register Pair DE ends after them.
588D
POP BC C1
Restore Register Pair BC from the stack: Register B the sector byte counter, Register C the data bytes left.
588E
GOSUB to 58BAH to read the next data byte of the record into Register A.
5891
LD HL,(55E9H) 2A E9 55
Load Register Pair HL with the 16-bit value at 55E9H, the virtual restart location (0000H for none).
5894
LD (DE),A 12
Store Register A (the data byte) at Register Pair DE in the object buffer.
5895
INC DE 13
Increment Register Pair DE to the next store position.
5896
LD A,H 7C
Load Register A with Register H, the high byte of the restart location.
5897
OR L B5
OR Register A with Register L, the low byte: the Z FLAG is set when no restart is pending.
5898
If the Z FLAG is set (no restart pending), JUMP to 5852H for the next byte.
589A
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
589D
AND 01H E6 01
Mask Register A (the flags) against 01H to keep bit 0, the build pass.
589F
If the NZ FLAG is set (the build pass keeps every byte), JUMP to 5852H.
58A1
PUSH DE D5
Save Register Pair DE, the store position, on the stack.
58A2
LD DE,(55E5H) ED 5B E5 55
Load Register Pair DE with the 16-bit value at 55E5H, the virtual location of the byte just stored.
58A6
GOSUB to 5EA9H to compare Register Pair HL (the restart location) with Register Pair DE: the Z FLAG is set when the byte is at the restart location; Register Pair HL = the difference.
58A9
If the Z FLAG is set (the restart location is reached), JUMP to 58B4H to keep this byte and clear the restart.
58AB
INC DE 13
Increment Register Pair DE, the virtual location, past the byte that is dropped.
58AC
LD (55E5H),DE ED 53 E5 55
Store Register Pair DE at 55E5H: the location moves on without the byte being decoded.
58B0
POP DE D1
Restore Register Pair DE from the stack: the store position.
58B1
DEC DE 1B
Decrement Register Pair DE: the byte just stored is dropped from the buffer.
58B2
JUMP to 5852H for the next byte of the record (the dropped byte is not counted again).
58B4
LD (55E9H),HL 22 E9 55
Store Register Pair HL (0000H, the difference) at 55E9H: the restart is done and every further byte is kept.
58B7
POP DE D1
Restore Register Pair DE from the stack: the store position.
58B8
JUMP to 5852H for the next byte of the record, now decoded normally.

58BAH - Disk Object: Read One Byte of the File

Returns the next byte of the object file in Register A. Register B counts down the bytes left in the sector buffer at 5300H; when it runs out the next sector is read with SYS0 4436H. Register Pair DE is preserved.

58BA
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack.
58BB
LD DE,(55FDH) ED 5B FD 55
Load Register Pair DE with the 16-bit value at 55FDH, the pointer to the next byte in the sector buffer.
58BF
Decrement Register B, the bytes left in the sector buffer; if Register B is not 0, JUMP to 58CDH to take the byte at Register Pair DE.
58C1
LD DE,5500H 11 00 55
The buffer is used up: load Register Pair DE with 5500H, the object file's FCB.
58C4
GOSUB to SYS0 4436H to read the next sector of the file at Register Pair DE into its buffer at 5300H; Register B is now 00H, so 256 bytes follow.
58C7
If the NZ FLAG is set (a read error, or the end of the file), JUMP to 5CE6H to display the DOS error and ask ANOTHER DISASSEMBLY?.
58CA
LD DE,5300H 11 00 53
Load Register Pair DE with 5300H, the first byte of the new sector.
58CD
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next byte of the file.
58CE
INC DE 13
Increment Register Pair DE to the byte after it.
58CF
LD (55FDH),DE ED 53 FD 55
Store Register Pair DE at 55FDH, the pointer for the next call.
58D3
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
58D4
RET C9
RETURN with the file's next byte in Register A.

58D5H - Disk Object: End of a Run

Called when a load block starts a new run and for the transfer record. The bytes of the run that are still in the object buffer are decoded: the byte count at 560BH is set to the bytes between the virtual location and the end of the run, so decoding stops exactly there. Then the output pauses and, when printing, up to three blank lines mark the break.

58D5
LD HL,6FA1H 21 A1 6F
Load Register Pair HL with 6FA1H, the first entry of the reference table.
58D8
LD (55F6H),HL 22 F6 55
Store Register Pair HL (6FA1H) at 55F6H, the reference table scan pointer: the next run's locations are looked up from the start of the table.
58DB
LD DE,(55E5H) ED 5B E5 55
Load Register Pair DE with the 16-bit value at 55E5H, the virtual location: how far the run has been decoded.
58DF
LD HL,(55FBH) 2A FB 55
Load Register Pair HL with the 16-bit value at 55FBH, the address that follows the run's last block.
58E2
DEC HL 2B
Decrement Register Pair HL: 0000H if 55FBH still holds the starting value 0001H (no block has been read yet).
58E3
GOSUB to 5EACH to test Register Pair HL: the Z FLAG is set if it is 0000H.
58E6
RET Z C8
If the Z FLAG is set (no run before this one), RETURN.
58E7
INC HL 23
Increment Register Pair HL back to the address that follows the run.
58E8
GOSUB to 5EA9H to compare Register Pair HL (the end of the run) with Register Pair DE (the virtual location): Register Pair HL = the bytes still to decode, the Z FLAG set if none.
58EB
RET Z C8
If the Z FLAG is set (the run is fully decoded), RETURN.
58EC
LD (560BH),HL 22 0B 56
Store Register Pair HL, the bytes still to decode, at 560BH, the byte count.
58EF
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, no stop address: the buffer is decoded to the end of the run.
58F2
LD (55FFH),HL 22 FF 55
Store Register Pair HL (FFFFH) at 55FFH, the stop address for 570EH.
58F5
PUSH BC C5
Save Register Pair BC (Register B the sector byte counter, Register C the record's byte count) on the stack.
58F6
GOSUB to 5748H to decode the rest of the run; it returns when the byte count at 560BH reaches 0.
58F9
LD HL,FFFFH 21 FF FF
Load Register Pair HL with FFFFH, no byte count limit.
58FC
LD (560BH),HL 22 0B 56
Store Register Pair HL (FFFFH) at 560BH, the byte count, for the next run.
58FF
GOSUB to 5765H to pause if pauses are wanted.
5902
LD C,03H 0E 03
Load Register C with 03H, at most three blank lines.
5904
LD A,(55F0H) 3A F0 55
Load Register A with the byte at 55F0H, the output flags.
5907
AND 02H E6 02
Mask Register A (the output flags) against 02H to keep PTR (bit 1).
5909
If the NZ FLAG is set (printing), GOSUB to 5E48H to print up to Register C (3) blank lines, stopping at the top of a page.
590C
POP BC C1
Restore Register Pair BC from the stack: Register B the sector byte counter, Register C the record's byte count.
590D
RET C9
RETURN to the record loop with Register B and Register C as they were.

590EH - Disk Object: Other Records and the Transfer Record

A record of a type other than 01H and 02H is skipped. The transfer record 02H ends the run and gives the entry point: for STD its address gets a name, it is shown as nnnn = PROGRAM ENTRY POINT, and at the end of the listing pass the EQU lines for the names that are not on an instruction and the END line are written to the source file.

590E
CP 02H FE 02
Compare Register A (the record type) against 02H, the transfer record.
5910
If the Z FLAG is set (the transfer record), JUMP to 591FH.
5912
GOSUB to 58BAH to read the record's length byte into Register A.
5915
LD C,A 4F
Load Register C with Register A, the bytes of the record to skip (00H means 256).
5916
GOSUB to 58BAH to read a byte of the record, which is not used.
5919
DEC C 0D
Decrement Register C, the bytes left to skip.
591A
If the NZ FLAG is set (more bytes), LOOP back to 5916H.
591C
JUMP to 5807H to read the type of the next record.
591F
GOSUB to 58D5H to decode the rest of the last run.
5922
GOSUB to 58BAH to read the transfer record's length byte, which is not used.
5925
GOSUB to 5A49H to read the transfer address into Register Pair HL and add the offset (55F9H); Register C is not used here.
5928
LD (599DH),HL 22 9D 59
Self-Modifying Code
Store Register Pair HL, the entry point, at 599DH, the operand of the LD DE,nnnn at 599CH that names it on the END line.
592B
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the entry point.
592C
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
592F
AND 21H E6 21
Mask Register A (the flags) against 21H (0010 0001) to keep STD (bit 5) and the build pass (bit 0).
5931
CP 21H FE 21
Compare Register A against 21H: the Z FLAG is set in the build pass with STD.
5933
If the NZ FLAG is set, JUMP to 5945H: the entry point needs no table entry.
5935
GOSUB to 5F4DH to look the entry point (Register Pair DE) up in the reference table: the Z FLAG if it is there.
5938
If the Z FLAG is set (already referenced), JUMP to 5945H.
593A
LD A,03H 3E 03
Load Register A with 03H, the size of one table entry.
593C
GOSUB to 5F02H to make room for 3 bytes before the entry at Register Pair HL: Register Pair HL = the new entry.
593F
LD (HL),D 72
Store Register D, the high byte of the entry point, at Register Pair HL (the table keeps the high byte first).
5940
INC HL 23
Increment Register Pair HL to the entry's second byte.
5941
LD (HL),E 73
Store Register E, the low byte of the entry point, at Register Pair HL.
5942
INC HL 23
Increment Register Pair HL to the entry's control byte.
5943
LD (HL),40H 36 40
Store 40H at Register Pair HL: a referencee entry with no referencers, so the entry point gets a name for the END line.
5945
LD HL,6A93H 21 93 6A
Load Register Pair HL with 6A93H, the four digits of the message 0000 = PROGRAM ENTRY POINT.
5948
GOSUB to 669BH to write Register Pair DE (the entry point) at Register Pair HL as four hexadecimal digits.
594B
GOSUB to 5D2DH to clear the screen before the end of the pass.
594E
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
5951
AND 01H E6 01
Mask Register A (the flags) against 01H to keep bit 0, the build pass.
5953
If the NZ FLAG is set (the build pass is finished), JUMP to 59C9H to close the file and start the next phase.
5956
LD DE,6A93H 11 93 6A
Load Register Pair DE with 6A93H, the message nnnn = PROGRAM ENTRY POINT.
5959
GOSUB to 5D17H to display the message at Register Pair DE and a carriage return.
595C
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
595F
AND 20H E6 20
Mask Register A (the flags) against 20H to keep STD (bit 5).
5961
If the Z FLAG is set (no source text), JUMP to 59C6H for the reference table listing.
5963
LD HL,6FA0H 21 A0 6F
Load Register Pair HL with 6FA0H, the marker before the first table entry.
5966
LD BC,(5FC1H) ED 4B C1 5F
Load Register Pair BC with the 16-bit value at 5FC1H, the number of the first name (AAA = 0, or the FGN= value).
596A
DEC BC 0B
Decrement Register Pair BC: the loop increments it before the first referencee.

EQU Loop
Register Pair HL = the control byte of the previous entry, Register Pair BC = the name number of the last referencee, Register Pair DE = the entry's address.

596B
INC HL 23
Increment Register Pair HL to the next entry's first byte.
596C
LD D,(HL) 56
Load Register D with the byte at Register Pair HL, the high byte of the entry's address.
596D
INC HL 23
Increment Register Pair HL to the entry's second byte.
596E
LD E,(HL) 5E
Load Register E with the byte at Register Pair HL, the low byte: Register Pair DE = the entry's address.
596F
INC HL 23
Increment Register Pair HL to the entry's control byte.
5970
BIT 7,(HL) CB 7E
Test bit 7 of the byte at Register Pair HL, the control byte: set only for the end marker.
5972
If the NZ FLAG is set (the end of the table), JUMP to 5999H for the END line.
5974
BIT 6,(HL) CB 76
Test bit 6 of the control byte at Register Pair HL: set for a referencee (a location that has a name).
5976
If the Z FLAG is set (a referencer entry), LOOP back to 596BH.
5978
INC BC 03
Increment Register Pair BC, the name number: the referencees are numbered in table order.
5979
BIT 5,(HL) CB 6E
Test bit 5 of the control byte at Register Pair HL: set when the name was put on an instruction (66D5H).
597B
If the NZ FLAG is set (the name is a label), LOOP back to 596BH: it needs no EQU.
597D
PUSH HL E5
Save Register Pair HL, the table position, on the stack.
597E
PUSH BC C5
Save Register Pair BC, the name number, on the stack.
597F
PUSH DE D5
Save Register Pair DE, the referenced value, on the stack.
5980
LD H,B 60
Load Register H with Register B, the high byte of the name number.
5981
LD L,C 69
Load Register L with Register C: Register Pair HL = the name number.
5982
LD DE,6957H 11 57 69
Load Register Pair DE with 6957H, the name field of the line AAA EQU 00000H.
5985
GOSUB to 66DAH to write the name number in Register Pair HL as three letters at Register Pair DE.
5988
LD HL,695FH 21 5F 69
Load Register Pair HL with 695FH, the value field of the EQU line.
598B
POP DE D1
Restore Register Pair DE from the stack: the referenced value.
598C
GOSUB to 6665H to write Register Pair DE at Register Pair HL as hexadecimal with a trailing H (and a leading 0 if it starts with a letter).
598F
LD DE,6957H 11 57 69
Load Register Pair DE with 6957H, the EQU line.
5992
GOSUB to 5ABEH to end the line at Register Pair HL with a carriage return and write it, with a line number, to the source file.
5995
POP BC C1
Restore Register Pair BC from the stack: the name number.
5996
POP HL E1
Restore Register Pair HL from the stack: the table position.
5997
LOOP back to 596BH for the next table entry, with Register Pair HL at this entry's control byte.
5999
LD HL,6983H 21 83 69
Load Register Pair HL with 6983H, the name field after END at 697EH.
599C
LD DE,0000H 11 00 00
Self-Modifying Code
Load Register Pair DE with the entry point, the operand at 599DH (0000H in the file, stored at 5928H).
599F
LD A,01H 3E 01
Load Register A with 01H for 66C1H: bit 0 the location must be in the table.
59A1
GOSUB to 66C1H to find Register Pair DE in the reference table and write its name at Register Pair HL (6983H).
59A4
LD DE,697EH 11 7E 69
Load Register Pair DE with 697EH, the END line (a TAB, END, a TAB and the name).
59A7
GOSUB to 5ABEH to end the line at Register Pair HL with a carriage return and write it, with a line number, to the source file.
59AA
LD A,1AH 3E 1A
Load Register A with 1AH, the byte that ends the source text.
59AC
GOSUB to 5AA8H to put Register A (1AH) in the output sector buffer.
59AF
LD A,(5AAAH) 3A AA 5A
Load Register A with the byte at 5AAAH, the low byte of the output buffer pointer: the bytes used in the last sector.
59B2
SUB 00H D6 00
Subtract 00H from Register A: Register A is unchanged and the Z FLAG is set if the last sector is empty.
59B4
LD (5537H),A 32 37 55
Store Register A (the bytes used) at 5537H, byte 5 of the output FCB at 5532H (the low byte of NEXT).
59B7
LD (553AH),A 32 3A 55
Store Register A at 553AH, byte 8 of the output FCB (the low byte of EOF): the file ends after the last byte written.
59BA
If the NZ FLAG is set (the last sector holds bytes), GOSUB to 5AD0H to write it.
59BD
LD DE,5532H 11 32 55
Load Register Pair DE with 5532H, the source text file's FCB.
59C0
GOSUB to SYS0 4428H to close the source text file at Register Pair DE.
59C3
If the NZ FLAG is set (the close failed), JUMP to 5CE6H to display the DOS error.
59C6
JUMP to 5FECH to list the reference table (or end the disassembly when NCR is set).

59C9H - Disk Object: End of the Build Pass

The object file is closed. With RTD the reference table is written to a new file, a sector at a time straight from memory starting with the C0H marker at 6FA0H. The flags then switch from the build pass (bit 0) to the listing pass (bit 1); NIP goes straight to the reference table listing. Otherwise the search index is rebuilt, which also numbers the names, the STD output file is opened, and the file is read again from 57E3H.

59C9
LD DE,5500H 11 00 55
Load Register Pair DE with 5500H, the object file's FCB.
59CC
GOSUB to SYS0 4428H to close the object file at Register Pair DE.
59CF
If the NZ FLAG is set (the close failed), JUMP to 5CE6H to display the DOS error.
59D2
GOSUB to 5D2DH to clear the screen after the build pass.
59D5
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
59D8
AND 10H E6 10
Mask Register A (the flags) against 10H to keep RTD (bit 4).
59DA
If the Z FLAG is set (no RTD), JUMP to 5A0DH.
59DC
LD DE,6C77H 11 77 6C
Load Register Pair DE with 6C77H, the question REFERENCE TABLE FILESPEC?.
59DF
GOSUB to 5A2FH to ask it and open the file with the FCB at 5532H; Register Pair DE comes back as 5532H.
59E2
GOSUB to 6DE0H: Index Register IX = the FCB (Register Pair DE) and Register Pair HL = 6FA0H, the table's first byte.

Write Loop
Register Pair HL = the start of the next 256 bytes of the table, Index Register IX = the FCB at 5532H.

59E5
LD (IX+03H),L DD 75 03
Store Register L at Index Register IX+03H, the low byte of the FCB's buffer address.
59E8
LD (IX+04H),H DD 74 04
Store Register H at Index Register IX+04H: the FCB's buffer is now the table itself at Register Pair HL.
59EB
LD DE,5532H 11 32 55
Load Register Pair DE with 5532H, the reference table file's FCB.
59EE
GOSUB to SYS0 443CH to write the 256 bytes at Register Pair HL to the file at Register Pair DE, with verify.
59F1
If the NZ FLAG is set (a write error), JUMP to 5CE6H to display the DOS error.
59F4
LD DE,0100H 11 00 01
Load Register Pair DE with 0100H, one sector.
59F7
ADD HL,DE 19
Add Register Pair DE (256) to Register Pair HL: the start of the next 256 bytes of the table.
59F8
If the CARRY FLAG is set (past FFFFH), JUMP to 5A04H to close the file.
59FA
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the next start.
59FB
LD HL,(55F4H) 2A F4 55
Load Register Pair HL with the 16-bit value at 55F4H, the address of the table's end marker.
59FE
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC.
59FF
SBC HL,DE ED 52
Subtract Register Pair DE (the next start) from Register Pair HL (the end marker): the NO CARRY FLAG is set while the end marker is at or after the next start.
5A01
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the next start again.
5A02
If the NO CARRY FLAG is set (more of the table to write), LOOP back to 59E5H.
5A04
LD DE,5532H 11 32 55
Load Register Pair DE with 5532H, the reference table file's FCB.
5A07
GOSUB to SYS0 4428H to close the reference table file at Register Pair DE.
5A0A
If the NZ FLAG is set (the close failed), JUMP to 5CE6H to display the DOS error.
5A0D
LD HL,55EFH 21 EF 55
Load Register Pair HL with 55EFH, the pass and option flags.
5A10
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the flags.
5A11
XOR 03H EE 03
XOR Register A (the flags) with 03H: bit 0 (the build pass) is cleared and bit 1 (the listing pass with a reference table) is set.
5A13
LD (HL),A 77
Store Register A, the new flags, at Register Pair HL, 55EFH.
5A14
BIT 3,A CB 5F
Test bit 3 of Register A, the new flags: NIP (no instructions listed).
5A16
If the NZ FLAG is set (NIP: no instructions listed), JUMP to 59C6H, which jumps to the reference table listing.
5A19
GOSUB to 5F93H to rebuild the search index at 6F60H and set the name numbers in it.
5A1C
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
5A1F
AND 20H E6 20
Mask Register A (the flags) against 20H to keep STD (bit 5).
5A21
If the Z FLAG is set (no source text), JUMP to 5A2CH.
5A23
LD DE,6C98H 11 98 6C
Load Register Pair DE with 6C98H, the question ASSEMBLER SOURCE TEXT OUTPUT FILESPEC?.
5A26
GOSUB to 5A2FH to ask it and open the file with the FCB at 5532H and the buffer at 5400H; Register Pair HL comes back as 5400H.
5A29
LD (5AAAH),HL 22 AA 5A
Self-Modifying Code
Store Register Pair HL (5400H) at 5AAAH, the operand of the LD HL,nnnn at 5AA9H: the output buffer pointer starts at the buffer's first byte.
5A2C
JUMP to 57E3H to read the object file again for the listing pass.

5A2FH - Open an Output File

Asks the question at Register Pair DE (an answer is required), copies the answer into the FCB at 5532H and opens the file with SYS0 4420H (new or existing), the buffer at 5400H and the record length 256. Returns with Register Pair DE = 5532H and Register Pair HL = 5400H.

5A2F
GOSUB to 5AEBH to ask the question at Register Pair DE (an answer is required): the answer is in the input line at Register Pair HL (5564H).
5A32
LD DE,5532H 11 32 55
Load Register Pair DE with 5532H, the output FCB.
5A35
LD BC,001FH 01 1F 00
Load Register Pair BC with 001FH, the 31 characters of a filespec the FCB can hold.
5A38
PUSH DE D5
Save Register Pair DE (5532H, the FCB) on the stack for the open.
5A39
LDIR ED B0
Copy Register Pair BC (31) bytes from Register Pair HL (the input line) to Register Pair DE (5532H); Register Pair BC ends as 0000H, so Register B = 00H is the record length 256 for the open.
5A3B
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the filespec text in the FCB.
5A3D
LD (DE),A 12
Store Register A (0DH) at Register Pair DE, 5551H, so the filespec text always ends.
5A3E
POP DE D1
Restore Register Pair DE from the stack: 5532H, the FCB.
5A3F
LD HL,5400H 21 00 54
Load Register Pair HL with 5400H, the output sector buffer.
5A42
GOSUB to SYS0 4420H to open the file named in the FCB at Register Pair DE (new or existing) with the buffer at Register Pair HL and the record length in Register B.
5A45
RET Z C8
If the Z FLAG is set (opened), RETURN with Register Pair DE = 5532H and Register Pair HL = 5400H.
5A46
JUMP to 5CE6H to display the DOS error and ask ANOTHER DISASSEMBLY?.

5A49H - Disk Object: Read a Load Address

Reads two bytes of the file (low byte first) into Register Pair HL, takes 2 off Register C (the bytes left in the record) and adds the offset at 55F9H, giving the virtual address. Register Pair DE is preserved.

5A49
GOSUB to 58BAH to read the next byte of the file into Register A: the low byte of the address.
5A4C
LD L,A 6F
Load Register L with Register A, the address's low byte.
5A4D
DEC C 0D
Decrement Register C, the bytes left in the record, for the low byte.
5A4E
GOSUB to 58BAH to read the next byte of the file into Register A: the high byte of the address.
5A51
LD H,A 67
Load Register H with Register A: Register Pair HL = the address in the file.
5A52
DEC C 0D
Decrement Register C, the bytes left in the record, for the high byte.
5A53
PUSH DE D5
Save Register Pair DE (the caller's store position) on the stack.
5A54
LD DE,(55F9H) ED 5B F9 55
Load Register Pair DE with the 16-bit value at 55F9H, the OFFSET OBJECT VIRTUAL ADDRESSES BY value.
5A58
ADD HL,DE 19
Add Register Pair DE (the offset) to Register Pair HL: the virtual address (it may wrap past FFFFH, as the manual allows).
5A59
POP DE D1
Restore Register Pair DE from the stack: the caller's store position.
5A5A
RET C9
RETURN with the virtual address in Register Pair HL and Register C reduced by 2.

5A5BH - STD: Write the Source Line of an Instruction

Writes the instruction just decoded to the source text file: the line number, the label field (55B5H, the location's name if it has one) and a TAB, the mnemonic field (55BDH) and a TAB, the operand field (55C5H) and a carriage return. Spaces end each field.

5A5B
GOSUB to 5A6EH to count the line number up and write it, with the space after it, to the source file.
5A5E
LD HL,55B5H 21 B5 55
Load Register Pair HL with 55B5H, the label field of the output line (8 characters).
5A61
GOSUB to 5A91H to write the label (up to the first space) and a TAB; Register Pair HL comes back at the mnemonic field 55BDH.
5A64
GOSUB to 5A91H to write the mnemonic (up to the first space) and a TAB; Register Pair HL comes back at the operand field 55C5H and Register B as 00H.
5A67
GOSUB to 5A9DH to write the operands at Register Pair HL up to the first space (Register B = 00H allows up to 256 characters).
5A6A
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the source line.
5A6C
JUMP to 5AA8H to put Register A (0DH) in the output buffer and return.

5A6EH - STD: Count and Write the Line Number

The line number at 6987H-698BH is five digits with bit 7 set (B0H-B9H), as EDTASM source files keep them. It is counted up by 1 from the last digit and then written with the space after it (698CH). Going past 99999 gives SEQUENCE # OVERFLOW.

5A6E
LD HL,698BH 21 8B 69
Load Register Pair HL with 698BH, the last digit of the line number.
5A71
LD B,05H 06 05
Load Register B with 05H, the five digits of the line number to count through.

Count Loop
Register Pair HL = the digit, Register B = the digits left.

5A73
INC (HL) 34
Increment the byte at Register Pair HL, the digit (B0H-B9H, the digits 0-9 with bit 7 set).
5A74
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the incremented digit.
5A75
CP BAH FE BA
Compare Register A (the digit) against BAH, one past B9H: the CARRY FLAG is set while it is still a digit.
5A77
If the CARRY FLAG is set (no carry into the next digit), JUMP to 5A84H to write the number.
5A79
LD (HL),B0H 36 B0
Store B0H (the digit 0 with bit 7) at Register Pair HL: the digit wraps to 0.
5A7B
DEC HL 2B
Decrement Register Pair HL to the next digit to the left, which gets the carry.
5A7C
Decrement Register B, the digits left; if Register B is not 0, LOOP back to 5A73H.
5A7E
LD DE,6CC0H 11 C0 6C
Every digit wrapped: load Register Pair DE with 6CC0H, the message SEQUENCE # OVERFLOW.
5A81
JUMP to 5CFAH to display the message at Register Pair DE and ask ANOTHER DISASSEMBLY?.
5A84
LD HL,6987H 21 87 69
Load Register Pair HL with 6987H, the first digit of the line number.
5A87
LD B,06H 06 06
Load Register B with 06H, the five digits and the space at 698CH.
5A89
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, a digit (or the final space).
5A8A
INC HL 23
Increment Register Pair HL to the next byte of the line number.
5A8B
GOSUB to 5AA8H to put Register A in the output buffer.
5A8E
Decrement Register B, the bytes left; if Register B is not 0, LOOP back to 5A89H.
5A90
RET C9
RETURN with the line number and its space written to the output buffer.

5A91H - STD: Write Fields and Characters to the Output File

5A91H writes an 8-character field up to its first space, steps Register Pair HL to the next field and writes a TAB. 5A9DH writes characters from Register Pair HL until a space, at most Register B of them. 5AA8H puts one character in the output sector buffer at 5400H; when the buffer is full (the pointer's low byte wraps to 00H) the sector is written with SYS0 443CH. 5ABEH ends a line at Register Pair HL with a carriage return and writes it, with a line number, from Register Pair DE; 5AC5H writes a line up to and including its carriage return.

5A91
LD B,08H 06 08
Load Register B with 08H, the width of the label and mnemonic fields.
5A93
GOSUB to 5A9DH to write the field's characters at Register Pair HL up to the first space; Register B comes back as the positions not written.

Skip Loop
Register Pair HL = the position in the field, Register B = the positions left.

5A96
INC HL 23
Increment Register Pair HL past one more position of the field.
5A97
Decrement Register B, the positions left; if Register B is not 0, LOOP back to 5A96H: Register Pair HL ends at the next field.
5A99
LD A,09H 3E 09
Load Register A with 09H, a TAB, which separates the source fields.
5A9B
JUMP to 5AA8H to put Register A (09H) in the output buffer and return.

Character Loop
Register Pair HL = the next character, Register B = the most still to write.

5A9D
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next character of the field.
5A9E
CP 20H FE 20
Compare Register A (the character) against 20H, a space, which ends the field's text.
5AA0
RET Z C8
If the Z FLAG is set (a space), RETURN with Register Pair HL at it and Register B = the positions left.
5AA1
INC HL 23
Increment Register Pair HL to the next character.
5AA2
GOSUB to 5AA8H to put Register A (the character) in the output buffer.
5AA5
Decrement Register B, the characters still allowed; if Register B is not 0, LOOP back to 5A9DH.
5AA7
RET C9
RETURN after Register B characters, with Register Pair HL after the last one.
5AA8
PUSH HL E5
Save Register Pair HL (the caller's pointer) on the stack.
5AA9
LD HL,0000H 21 00 00
Self-Modifying Code
Load Register Pair HL with the output buffer pointer, the operand at 5AAAH (0000H in the file; 5400H from 5A29H, then kept by 5AB9H).
5AAC
LD (HL),A 77
Store Register A, the character, at Register Pair HL in the output sector buffer 5400H-54FFH.
5AAD
INC HL 23
Increment Register Pair HL to the next buffer position.
5AAE
LD A,L 7D
Load Register A with Register L, the low byte of the buffer pointer.
5AAF
CP 00H FE 00
Compare Register A (the low byte) against 00H: the Z FLAG is set when the buffer has just been filled (5500H).
5AB1
If the NZ FLAG is set (room left), JUMP to 5AB9H.
5AB3
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack.
5AB4
GOSUB to 5AD0H to write the full buffer to the output file.
5AB7
DEC H 25
Decrement Register H: Register Pair HL = 5400H, the start of the buffer again.
5AB8
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
5AB9
LD (5AAAH),HL 22 AA 5A
Self-Modifying Code
Store Register Pair HL, the new buffer pointer, at 5AAAH, the operand of 5AA9H.
5ABC
POP HL E1
Restore Register Pair HL from the stack: the caller's pointer.
5ABD
RET C9
RETURN with the character stored (Register A is now the low byte of the pointer).
5ABE
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL, the end of the text built: the line now ends with a carriage return.
5AC0
PUSH DE D5
Save Register Pair DE, the start of the line, on the stack.
5AC1
GOSUB to 5A6EH to count the line number up and write it with its space.
5AC4
POP HL E1
Restore Register Pair HL from the stack: the start of the line.

Line Loop
Register Pair HL = the next character of the line.

5AC5
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next character of the line.
5AC6
GOSUB to 5AA8H to put Register A in the output buffer.
5AC9
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the character just written.
5ACA
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the carriage return that ends the line.
5ACC
INC HL 23
Increment Register Pair HL to the next character; INC HL does not change the flags.
5ACD
If the NZ FLAG is set (not the end of the line), LOOP back to 5AC5H.
5ACF
RET C9
RETURN with the line written up to and including its carriage return.
5AD0
LD DE,5532H 11 32 55
Load Register Pair DE with 5532H, the output file's FCB.
5AD3
GOSUB to SYS0 443CH to write the buffer (5400H) to the file at Register Pair DE, with verify.
5AD6
RET Z C8
If the Z FLAG is set (the sector was written and verified), RETURN.
5AD7
JUMP to 5CE6H to display the DOS error and ask ANOTHER DISASSEMBLY?.

5ADAH - Questions and Their Answers

Every question goes through 5CC5H, which displays it, reads a line into 5564H and keeps the question and its own return address on the stack. A bad answer displays BAD REPLY (5B18H) and asks the same question again by going back into 5CC5H; a good one leaves through 5B03H, which drops those two words and returns Register A = Register C with the flags of OR A. Register B is the number of characters typed, Register Pair HL the start of the answer. 5AE4H accepts only ENTER; 5AEBH needs any answer; 5AF2H Y (NZ), N or ENTER (Z); 5B08H D or ENTER (A = 01H, NZ), M (A = 00H, Z); 5B22H a hexadecimal number (required) and 5B29H one with the default 0 (Z for an empty answer); 5B52H a decimal number. Numbers come back in Register Pair HL.

5ADA
LD DE,6A30H 11 30 6A
Load Register Pair DE with 6A30H, the question VIRTUAL RESTART LOCATION? (HEX).
5ADD
GOSUB to 5B29H to ask it: Register Pair HL = the location, 0000H for an empty answer.
5AE0
LD (55E9H),HL 22 E9 55
Store Register Pair HL, the virtual restart location, at 55E9H.
5AE3
RET C9
RETURN to the questions of a disk object with the restart location stored.
5AE4
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: the Z FLAG if only ENTER was typed.
5AE7
If the Z FLAG is set (ENTER alone), JUMP to 5B03H to return.
5AE9
JUMP to 5B18H: any other answer than ENTER alone is a BAD REPLY.
5AEB
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: the NZ FLAG if something was typed.
5AEE
If the NZ FLAG is set (an answer), JUMP to 5B03H to return with it at Register Pair HL.
5AF0
JUMP to 5B18H: an empty answer is a BAD REPLY.
5AF2
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: Register A = its first character, Register C = 00H, the Z FLAG for an empty answer.
5AF5
If the Z FLAG is set (ENTER alone means N), JUMP to 5B03H with Register C = 00H.
5AF7
CP 4EH FE 4E
Compare Register A (the first character) against 4EH, the letter N.
5AF9
If the Z FLAG is set (N), JUMP to 5B00H with Register C = 00H.
5AFB
CP 59H FE 59
Compare Register A (the first character) against 59H, the letter Y.
5AFD
If the NZ FLAG is set (neither Y nor N), JUMP to 5B18H for BAD REPLY.
5AFF
INC C 0C
Increment Register C to 01H: the answer is Y.
5B00
DEC B 05
Decrement Register B, the characters typed: the Z FLAG is set if the letter was the only one.
5B01
If the NZ FLAG is set (more than one character), JUMP to 5B18H for BAD REPLY.
5B03
POP DE D1
Restore Register Pair DE from the stack, dropping the question's address that 5CC5H kept.
5B04
POP AF F1
Restore Register Pair AF from the stack, dropping the copy of the return address that 5CC5H kept.
5B05
LD A,C 79
Load Register A with Register C, the result (00H or 01H).
5B06
OR A B7
OR Register A with itself: the Z FLAG for 00H, the NZ FLAG for 01H.
5B07
RET C9
RETURN to the routine that asked the question.
5B08
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: Register A = its first character, the Z FLAG for an empty answer.
5B0B
LD C,01H 0E 01
Load Register C with 01H, the result for D (disk); LD does not change the flags.
5B0D
If the Z FLAG is set (ENTER alone means D), JUMP to 5B03H with Register C = 01H.
5B0F
CP 44H FE 44
Compare Register A (the first character) against 44H, the letter D.
5B11
If the Z FLAG is set (D), JUMP to 5B00H with Register C = 01H.
5B13
DEC C 0D
Decrement Register C to 00H, the result for M (memory).
5B14
CP 4DH FE 4D
Compare Register A (the first character) against 4DH, the letter M.
5B16
If the Z FLAG is set (M), JUMP to 5B00H with Register C = 00H.
5B18
LD DE,6A52H 11 52 6A
Load Register Pair DE with 6A52H, the message BAD REPLY.
5B1B
GOSUB to 5D17H to display the message at Register Pair DE and a carriage return.
5B1E
POP DE D1
Restore Register Pair DE from the stack: the address of the question that was answered badly (option handlers also come here to ask ANY OPTIONS? again).
5B1F
JUMP to 5CC5H, which takes the asking routine's return address back off the stack, asks the question at Register Pair DE again and returns into that routine.
5B22
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: the Z FLAG for an empty answer.
5B25
If the NZ FLAG is set (an answer), JUMP to 5B2CH to read the number.
5B27
JUMP to 5B18H: an empty answer is a BAD REPLY.
5B29
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: Register Pair HL = 5564H, Register B = the characters typed, the Z FLAG for an empty answer.
5B2C
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the answer (5564H).
5B2D
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value so far (also the result of an empty answer); LD does not change the flags.
5B30
If the Z FLAG is set (an empty answer), JUMP to 5B03H with Register C = 00H: Register Pair HL = 0000H and the Z FLAG.

Hexadecimal Digit Loop
Register Pair DE = the next character, Register Pair HL = the value, Register B = the characters left.

5B32
LD A,H 7C
Load Register A with Register H, the high byte of the value so far.
5B33
CP 10H FE 10
Compare Register A (the high byte) against 10H: the NO CARRY FLAG is set if another digit would overflow 16 bits.
5B35
If the NO CARRY FLAG is set (too many digits), JUMP to 5B18H for BAD REPLY.
5B37
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next character of the answer.
5B38
SUB 30H D6 30
Subtract 30H from Register A: the digits 0-9 become 00H-09H.
5B3A
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG is set for a digit 0-9.
5B3C
INC DE 13
Increment Register Pair DE to the next character; INC DE does not change the flags.
5B3D
If the CARRY FLAG is set (a digit 0-9 in Register A), JUMP to 5B47H.
5B3F
SUB 11H D6 11
Subtract 11H from Register A (the character minus 30H): the letters A-F become 00H-05H.
5B41
CP 06H FE 06
Compare Register A against 06H: the CARRY FLAG is set for a letter A-F.
5B43
If the NO CARRY FLAG is set (not a hexadecimal digit, the H suffix included), JUMP to 5B18H for BAD REPLY.
5B45
ADD A,0AH C6 0A
Add 0AH to Register A: the letters A-F become the values 10-15.
5B47
ADD HL,HL 29
Add Register Pair HL to itself: the value times 2.
5B48
ADD HL,HL 29
Add Register Pair HL to itself: the value times 4.
5B49
ADD HL,HL 29
Add Register Pair HL to itself: the value times 8.
5B4A
ADD HL,HL 29
Add Register Pair HL to itself: the value times 16, so Register L's low four bits are 0.
5B4B
ADD A,L 85
Add Register L to Register A, the digit: the new low byte.
5B4C
LD L,A 6F
Load Register L with Register A: Register Pair HL = the value with the digit added.
5B4D
Decrement Register B, the characters left; if Register B is not 0, LOOP back to 5B32H.
5B4F
INC C 0C
Increment Register C to 01H, the result that gives the NZ FLAG: a number was read.
5B50
JUMP to 5B03H to return with the number in Register Pair HL and the NZ FLAG.
5B52
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: the Z FLAG for an empty answer.
5B55
If the Z FLAG is set (an empty answer), JUMP to 5B18H for BAD REPLY.
5B57
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the answer (5564H).
5B58
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value so far.

Decimal Digit Loop
Register Pair DE = the next character, Register Pair HL = the value, Register B = the characters left, Register A collects any overflow.

5B5B
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next character of the answer.
5B5C
SUB 30H D6 30
Subtract 30H from Register A: the digits 0-9 become 00H-09H.
5B5E
CP 0AH FE 0A
Compare Register A against 0AH: the CARRY FLAG is set for a digit 0-9.
5B60
INC DE 13
Increment Register Pair DE to the next character; INC DE does not change the flags.
5B61
If the NO CARRY FLAG is set (not a digit), JUMP to 5B18H for BAD REPLY.
5B63
PUSH BC C5
Save Register Pair BC (Register B = the characters left, Register C = 00H) on the stack.
5B64
PUSH DE D5
Save Register Pair DE, the answer pointer, on the stack.
5B65
LD C,A 4F
Load Register C with Register A, the digit's value 0-9.
5B66
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the digit.
5B68
LD D,H 54
Load Register D with Register H, the high byte of the value so far.
5B69
LD E,L 5D
Load Register E with Register L: Register Pair DE = the value so far.
5B6A
XOR A AF
Load Register A with 00H (XOR A with itself): Register A collects the bits carried out of Register Pair HL.
5B6B
ADD HL,HL 29
Add Register Pair HL to itself: the value times 2.
5B6C
ADC A,A 8F
Add Register A to itself with the CARRY FLAG: an overflow bit is kept in Register A.
5B6D
ADD HL,HL 29
Add Register Pair HL to itself: the value times 4.
5B6E
ADC A,A 8F
Add Register A to itself with the CARRY FLAG: an overflow bit is kept in Register A.
5B6F
ADD HL,DE 19
Add Register Pair DE (the value) to Register Pair HL: the value times 5.
5B70
POP DE D1
Restore Register Pair DE from the stack: the answer pointer; POP does not change the flags.
5B71
ADC A,A 8F
Add Register A to itself with the CARRY FLAG: an overflow bit of the times-5 step is kept in Register A.
5B72
ADD HL,HL 29
Add Register Pair HL to itself: the value times 10.
5B73
ADC A,A 8F
Add Register A to itself with the CARRY FLAG: an overflow bit is kept in Register A.
5B74
ADD HL,BC 09
Add Register Pair BC (the digit) to Register Pair HL: the new value.
5B75
POP BC C1
Restore Register Pair BC from the stack: Register B = the characters left, Register C = 00H.
5B76
ADC A,A 8F
Add Register A to itself with the CARRY FLAG: the NZ FLAG is set if any step overflowed 16 bits.
5B77
If the NZ FLAG is set (the number is over 65535), JUMP to 5B18H for BAD REPLY.
5B79
Decrement Register B, the characters left; if Register B is not 0, LOOP back to 5B5BH.
5B7B
JUMP to 5B4FH to return with the number in Register Pair HL and the NZ FLAG.

5B7DH - ANY OPTIONS?

Each answer is one option, looked up in the table at 5C8EH; its handler sets a flag and asks the question again (through 5B1EH). An empty answer ends the options (5C1DH). The name must be typed exactly; NCR, NIP, RTD, STD, PTR and BFSP must stand alone, RE and RI take one more letter, FGN= three letters.

5B7D
LD DE,6C69H 11 69 6C
Load Register Pair DE with 6C69H, the question ANY OPTIONS?.
5B80
GOSUB to 5CC5H to display the question at Register Pair DE and read the answer: Register Pair HL = 5564H, Register B = the characters typed, the Z FLAG for an empty answer.
5B83
If the Z FLAG is set (no more options), JUMP to 5C1DH to settle the flags.
5B86
LD DE,5C8EH 11 8E 5C
Load Register Pair DE with 5C8EH, the option table.

Table Loop
Register Pair DE = the option entry, Register Pair HL = the answer, Register B = the characters typed.

5B89
PUSH HL E5
Save Register Pair HL, the start of the answer, on the stack.
5B8A
PUSH BC C5
Save Register Pair BC (Register B = the characters typed) on the stack.
5B8B
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next letter of the option name.
5B8C
CP (HL) BE
Compare Register A (the letter) against the byte at Register Pair HL, the next character typed.
5B8D
INC DE 13
Increment Register Pair DE to the next byte of the entry; INC DE does not change the flags.
5B8E
INC HL 23
Increment Register Pair HL to the next character typed; INC HL does not change the flags.
5B8F
If the NZ FLAG is set (they differ), JUMP to 5B9AH to skip to the next entry.
5B91
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the byte after the matched letter.
5B92
XOR 80H EE 80
XOR Register A with 80H: the byte that ends a name (bit 7 set) becomes its mask value with bit 7 clear; a letter gets bit 7 set.
5B94
LD C,A 4F
Load Register C with Register A, the option's mask value (used only when the name is complete).
5B95
If the P FLAG is set (bit 7 now clear: the whole name matched), JUMP to 5BAAH to run the handler.
5B98
Decrement Register B, the characters typed still to compare; if Register B is not 0, LOOP back to 5B8BH for the next letter.
5B9A
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, a byte of the rest of the entry's name.
5B9B
RLCA 07
Rotate Register A left: bit 7 (the end of the name) goes into the CARRY FLAG.
5B9C
INC DE 13
Increment Register Pair DE to the next byte; INC DE does not change the flags.
5B9D
If the NO CARRY FLAG is set (still inside the name), LOOP back to 5B9AH.
5B9F
INC DE 13
Increment Register Pair DE past the low byte of the handler address.
5BA0
INC DE 13
Increment Register Pair DE past the high byte: Register Pair DE = the next entry.
5BA1
POP BC C1
Restore Register Pair BC from the stack: Register B = the characters typed.
5BA2
POP HL E1
Restore Register Pair HL from the stack: the start of the answer.
5BA3
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the first byte of the next entry.
5BA4
OR A B7
OR Register A with itself: the Z FLAG is set for the 00H that ends the table.
5BA5
If the NZ FLAG is set (another entry), LOOP back to 5B89H.
5BA7
JUMP to 5B18H for BAD REPLY: no option has this name (also used by the handlers for a bad value).
5BAA
POP AF F1
Restore Register Pair AF from the stack, dropping the saved Register Pair BC.
5BAB
POP AF F1
Restore Register Pair AF from the stack, dropping the saved start of the answer.
5BAC
INC DE 13
Increment Register Pair DE past the byte that ended the name: Register Pair DE = the handler address.
5BAD
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the handler address in the table, Register Pair DE = the character after the name.
5BAE
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the low byte of the handler's address.
5BAF
INC HL 23
Increment Register Pair HL to the high byte of the handler's address.
5BB0
LD H,(HL) 66
Load Register H with the byte at Register Pair HL, the high byte of the handler's address.
5BB1
LD L,A 6F
Load Register L with Register A: Register Pair HL = the handler's address.
5BB2
JP (HL) E9
JUMP to the handler at Register Pair HL with Register C = the option's mask value, Register B = the characters left counting the last letter of the name, Register Pair DE = the character after the name.

5BB3H - Option Handlers

5BB3H (PTR, BFSP) sets the mask in Register C in the output flags at 55F0H, 5BB8H (NCR, NIP, RTD, STD) in the flags at 55EFH; nothing may follow the name. 5BC4H handles RE and RI: one letter must follow, A for every reference type or one of S T U V W X P L R. 5BCDH enables (Register C bit 0 set) or disables those types in the flags at 60E2H. 5BF6H reads FGN=xxx, three letters, into the first name number at 5FC1H. Every handler asks ANY OPTIONS? again through 5B1EH.

5BB3
LD HL,55F0H 21 F0 55
PTR or BFSP: load Register Pair HL with 55F0H, the output flags.
5BB6
JUMP to 5BBBH to set the mask in Register C there.
5BB8
LD HL,55EFH 21 EF 55
NCR, NIP, RTD or STD: load Register Pair HL with 55EFH, the pass and option flags.
5BBB
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the flags.
5BBC
OR C B1
OR Register A (the flags) with Register C, the option's mask.
5BBD
LD (HL),A 77
Store Register A, the flags with the option set, at Register Pair HL.
5BBE
GOSUB to 5C88H: nothing may follow the option's name (else BAD REPLY).
5BC1
JUMP to 5B1EH, which asks ANY OPTIONS? again for the next option.
5BC4
DEC B 05
RE or RI: decrement Register B, the characters left, for the last letter of the name.
5BC5
GOSUB to 5C88H: exactly one more character must follow (else BAD REPLY).
5BC8
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the reference type letter typed.
5BC9
LD HL,5BC1H 21 C1 5B
Load Register Pair HL with 5BC1H, the address that asks ANY OPTIONS? again.
5BCC
PUSH HL E5
Save Register Pair HL (5BC1H) on the stack as the return address of 5BCDH.
5BCD
LD DE,60E2H 11 E2 60
Load Register Pair DE with 60E2H, the eleven enabled-type flags (a type's letter when it is listed, a space when not).
5BD0
LD HL,60D7H 21 D7 60
Load Register Pair HL with 60D7H, the eleven type letters in type number order (STUVWX, two unused positions, PLR).
5BD3
LD B,0BH 06 0B
Load Register B with 0BH, the eleven positions.

Type Loop
Register Pair HL = the type letter, Register Pair DE = its flag, Register A = the letter typed, Register C bit 0 = enable.

5BD5
CP 41H FE 41
Compare Register A (the letter typed) against 41H, the letter A: every type.
5BD7
If the Z FLAG is set (A), JUMP to 5BE0H to set this type's flag.
5BD9
CP (HL) BE
Compare Register A (the letter typed) against the byte at Register Pair HL, this position's type letter.
5BDA
If the NZ FLAG is set (another letter), JUMP to 5BECH for the next position.
5BDC
CP 20H FE 20
Compare Register A (the letter typed) against 20H: the unused positions hold spaces.
5BDE
If the Z FLAG is set (a space was typed), JUMP to 5BECH without changing anything.
5BE0
PUSH AF F5
Save Register Pair AF (Register A = the letter typed) on the stack.
5BE1
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, this position's type letter (a space for the unused ones).
5BE2
BIT 0,C CB 41
Test bit 0 of Register C: set for RE (enable), clear for RI (disable).
5BE4
If the NZ FLAG is set (RE), JUMP to 5BE8H to store the letter.
5BE6
LD A,20H 3E 20
RI: load Register A with 20H, a space: the type is not listed.
5BE8
LD (DE),A 12
Store Register A (the letter, or a space) at Register Pair DE, the type's flag.
5BE9
POP AF F1
Restore Register Pair AF from the stack: Register A = the letter typed.
5BEA
SET 1,C CB C9
Set bit 1 of Register C: at least one type was changed.
5BEC
INC HL 23
Increment Register Pair HL to the next type letter.
5BED
INC DE 13
Increment Register Pair DE to the next enabled-type flag.
5BEE
Decrement Register B, the positions left; if Register B is not 0, LOOP back to 5BD5H.
5BF0
BIT 1,C CB 49
Test bit 1 of Register C: set if a type was changed.
5BF2
RET NZ C0
If the NZ FLAG is set (the letter was valid), RETURN (to 5BC1H, or to 57E0H after the default REA).
5BF3
POP AF F1
Restore Register Pair AF from the stack, dropping the return address 5BC1H.
5BF4
JUMP to 5BA7H for BAD REPLY: the letter is not a reference type.
5BF6
LD HL,0000H 21 00 00
FGN=: load Register Pair HL with 0000H, the name number being built.
5BF9
LD C,03H 0E 03
Load Register C with 03H, the three letters of a name.

Letter Loop
Register Pair DE = the next character, Register Pair HL = the number, Register C = the letters left.

5BFB
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next letter typed.
5BFC
SUB 41H D6 41
Subtract 41H from Register A: the letters A-Z become 00H-19H.
5BFE
CP 1AH FE 1A
Compare Register A against 1AH: the CARRY FLAG is set for a letter A-Z.
5C00
INC DE 13
Increment Register Pair DE to the next character; INC DE does not change the flags.
5C01
If the NO CARRY FLAG is set (not a letter), JUMP to 5BA7H for BAD REPLY.
5C03
PUSH DE D5
Save Register Pair DE, the answer pointer, on the stack.
5C04
LD D,H 54
Load Register D with Register H, the high byte of the number so far.
5C05
LD E,L 5D
Load Register E with Register L: Register Pair DE = the number so far.
5C06
LD B,19H 06 19
Load Register B with 19H, 25 more additions: the number times 26.
5C08
ADD HL,DE 19
Add Register Pair DE (the number) to Register Pair HL.
5C09
Decrement Register B, the additions left; if Register B is not 0, LOOP back to 5C08H: Register Pair HL = the number times 26.
5C0B
LD E,A 5F
Load Register E with Register A, the letter's value 0-25.
5C0C
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = the letter's value.
5C0E
ADD HL,DE 19
Add Register Pair DE (the letter's value) to Register Pair HL: the number with this letter.
5C0F
POP DE D1
Restore Register Pair DE from the stack: the answer pointer.
5C10
DEC C 0D
Decrement Register C, the letters of the name still to read.
5C11
If the NZ FLAG is set (more letters), LOOP back to 5BFBH.
5C13
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the character after the three letters.
5C14
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the answer.
5C16
If the NZ FLAG is set (more was typed), JUMP to 5BA7H for BAD REPLY.
5C18
LD (5FC1H),HL 22 C1 5F
Self-Modifying Code
Store Register Pair HL, the number of the first name (0 = AAA, 17575 = ZZZ), at 5FC1H, the operand of the LD BC,nnnn at 5FC0H that numbers the names.
5C1B
JUMP to 5BC1H, which asks ANY OPTIONS? again.

5C1DH - ANY OPTIONS?: Settle the Flags

After the empty answer the options are made consistent: RTD and STD need the reference table, so they cancel NCR; NCR cancels the build pass; STD cancels NIP and turns on BFSP; PTR turns on BFSP. With PTR the page size, the margins, the printer's top of page and its highest character code are asked.

5C1D
POP AF F1
Restore Register Pair AF from the stack, dropping the question's address that 5CC5H kept.
5C1E
POP AF F1
Restore Register Pair AF from the stack, dropping the copy of the return address that 5CC5H kept.
5C1F
LD BC,(55EFH) ED 4B EF 55
Load Register Pair BC with the 16-bit value at 55EFH: Register C = the pass and option flags, Register B = the output flags (55F0H).
5C23
LD A,C 79
Load Register A with Register C, the option flags.
5C24
AND 30H E6 30
Mask Register A (the flags) against 30H (0011 0000) to keep RTD (bit 4) and STD (bit 5).
5C26
If the Z FLAG is set (neither), JUMP to 5C2AH.
5C28
RES 2,C CB 91
Reset bit 2 of Register C (NCR): RTD and STD need the reference table.
5C2A
BIT 2,C CB 51
Test bit 2 of Register C, the option flags: NCR.
5C2C
If the Z FLAG is set (the table is wanted), JUMP to 5C30H.
5C2E
RES 0,C CB 81
Reset bit 0 of Register C: with NCR there is no build pass.
5C30
BIT 5,C CB 69
Test bit 5 of Register C, the option flags: STD.
5C32
If the Z FLAG is set (no STD), JUMP to 5C38H.
5C34
RES 3,C CB 99
Reset bit 3 of Register C (NIP): STD needs the listing pass.
5C36
SET 0,B CB C0
Set bit 0 of Register B (BFSP): no pauses while the source text is written.
5C38
BIT 1,B CB 48
Test bit 1 of Register B, the output flags: PTR.
5C3A
If the Z FLAG is set (no PTR), JUMP to 5C3EH.
5C3C
SET 0,B CB C0
Set bit 0 of Register B (BFSP): the printer output does not pause.
5C3E
LD (55EFH),BC ED 43 EF 55
Store Register Pair BC at 55EFH: the settled flags at 55EFH and 55F0H.
5C42
BIT 1,B CB 48
Test bit 1 of Register B, the output flags: PTR.
5C44
If the Z FLAG is set (no PTR), JUMP to 5C87H to return.
5C46
LD DE,6D4EH 11 4E 6D
Load Register Pair DE with 6D4EH, the question # LINES PER PAGE, EXCLUDING TOP AND BOTTOM MARGINS? (1 - 255).
5C49
GOSUB to 5B52H to ask it and read a decimal number into Register Pair HL.
5C4C
LD A,H 7C
Load Register A with Register H, the high byte of the number.
5C4D
OR A B7
OR Register A with itself: the NZ FLAG is set for 256 or more.
5C4E
If the NZ FLAG is set (too large), JUMP back to 5C46H to ask again.
5C50
OR L B5
OR Register A (00H) with Register L, the low byte: the Z FLAG is set for 0.
5C51
If the Z FLAG is set (0 lines), JUMP back to 5C46H to ask again.
5C53
LD A,L 7D
Load Register A with Register L, the lines per page (1-255).
5C54
LD (5604H),A 32 04 56
Store Register A at 5604H, the printable lines per page.
5C57
LD DE,6D8EH 11 8E 6D
Load Register Pair DE with 6D8EH, the question # LINES EACH FOR TOP AND BOTTOM MARGINS? (0 - 10).
5C5A
GOSUB to 5B52H to ask it and read a decimal number into Register Pair HL.
5C5D
LD A,H 7C
Load Register A with Register H, the high byte of the number.
5C5E
OR A B7
OR Register A with itself: the NZ FLAG is set for 256 or more.
5C5F
If the NZ FLAG is set (too large), JUMP back to 5C57H to ask again.
5C61
LD A,L 7D
Load Register A with Register L, the margin lines.
5C62
CP 0BH FE 0B
Compare Register A (the margin) against 0BH: the NO CARRY FLAG is set for 11 or more.
5C64
If the NO CARRY FLAG is set (more than 10), JUMP back to 5C57H to ask again.
5C66
LD (5E36H),A 32 36 5E
Self-Modifying Code
Store Register A (the margin lines) at 5E36H, the operand of the LD B,nn at 5E35H: the blank lines at the top of a page.
5C69
LD (5E2FH),A 32 2F 5E
Self-Modifying Code
Store Register A at 5E2FH, the operand of the LD B,nn at 5E2EH: the blank lines at the bottom of a page.
5C6C
LD DE,6AAEH 11 AE 6A
Load Register Pair DE with 6AAEH, the message REPLY "ENTER" WHEN PRINTER AT TOP OF PAGE.
5C6F
GOSUB to 5AE4H to display it and wait for ENTER alone.
5C72
LD DE,6CD4H 11 D4 6C
Load Register Pair DE with 6CD4H, the question HIGH ASCII CODE FOR PRINTER? (5A - 7F HEX).
5C75
GOSUB to 5B22H to ask it and read a hexadecimal number (required) into Register Pair HL.
5C78
LD A,H 7C
Load Register A with Register H, the high byte of the number.
5C79
OR A B7
OR Register A with itself: the NZ FLAG is set for 100H or more.
5C7A
If the NZ FLAG is set (too large), JUMP back to 5C72H to ask again.
5C7C
INC L 2C
Increment Register L, the code: Register L = the first code to show as a period.
5C7D
LD A,L 7D
Load Register A with Register L, the highest code plus 1.
5C7E
LD (5613H),A 32 13 56
Store Register A at 5613H, the lowest code shown as a period in the ASCII column.
5C81
SUB 5BH D6 5B
Subtract 5BH from Register A (the highest code plus 1): 5AH-7FH give 00H-25H.
5C83
CP 26H FE 26
Compare Register A against 26H: the NO CARRY FLAG is set for a code outside 5AH-7FH.
5C85
If the NO CARRY FLAG is set (out of range), JUMP back to 5C72H to ask again.
5C87
RET C9
RETURN with the option and output flags settled at 55EFH and 55F0H.
5C88
DEC B 05
Decrement Register B, the characters typed after the matched part: the Z FLAG is set when nothing follows.
5C89
RET Z C8
If the Z FLAG is set (nothing more), RETURN to the handler.
5C8A
POP AF F1
Restore Register Pair AF from the stack, dropping the handler's return address.
5C8B
JUMP to 5B18H for BAD REPLY: characters follow the option's name.

5C8EH - Option Table

Data. Searched by 5B7DH: each entry is the option's name in ASCII, a byte with bit 7 set whose low bits are the mask the handler sets (Register C), and the handler's address. A 00H in place of a name ends the table.

5C8E-5C93
DEFM "NCR" / DEFB 84H / DEFW 5BB8H 4E 43 52 84 B8 5B
Data: NCR, mask 04H in 55EFH (5BB8H): no location reference table is built or listed.
5C94-5C99
DEFM "NIP" / DEFB 88H / DEFW 5BB8H 4E 49 50 88 B8 5B
Data: NIP, mask 08H in 55EFH (5BB8H): the disassembled instructions are not printed or displayed.
5C9A-5C9F
DEFM "RTD" / DEFB 90H / DEFW 5BB8H 52 54 44 90 B8 5B
Data: RTD, mask 10H in 55EFH (5BB8H): the reference table is written to a disk file.
5CA0-5CA5
DEFM "STD" / DEFB A0H / DEFW 5BB8H 53 54 44 A0 B8 5B
Data: STD, mask 20H in 55EFH (5BB8H): source text in EDTASM form is written to a disk file.
5CA6-5CAA
DEFM "RE" / DEFB 81H / DEFW 5BC4H 52 45 81 C4 5B
Data: RE, mask 01H (enable) for 5BC4H: list the reference type given by the next letter.
5CAB-5CAF
DEFM "RI" / DEFB 80H / DEFW 5BC4H 52 49 80 C4 5B
Data: RI, mask 00H (disable) for 5BC4H: do not list the reference type given by the next letter.
5CB0-5CB5
DEFM "PTR" / DEFB 82H / DEFW 5BB3H 50 54 52 82 B3 5B
Data: PTR, mask 02H in 55F0H (5BB3H): the output goes to the printer.
5CB6-5CBC
DEFM "BFSP" / DEFB 81H / DEFW 5BB3H 42 46 53 50 81 B3 5B
Data: BFSP, mask 01H in 55F0H (5BB3H): bypass the full screen pauses.
5CBD-5CC3
DEFM "FGN=" / DEFB 80H / DEFW 5BF6H 46 47 4E 3D 80 F6 5B
Data: FGN=, mask 00H (not used) for 5BF6H: the first generated name, three letters.
5CC4
DEFB 00H 00
Data: the 00H that ends the option table; 5BA3H finds it and gives BAD REPLY.

5CC5H - Ask a Question and Read the Answer

Called first by every question routine. 5CC5H takes its own return address (the asking routine) off the stack and pushes it back with the question's address in Register Pair DE and the return address once more, so that 5B18H can ask the same question again after BAD REPLY and 5B03H can drop both words. It displays the question, reads the answer into 5564H and returns Register Pair HL = 5564H, Register A = the first character, Register B = the characters typed, Register C = 00H and the Z FLAG for an empty answer.

5CC5
POP AF F1
Restore Register Pair AF from the stack: the return address into the asking routine (the instruction after its CALL 5CC5H).
5CC6
PUSH AF F5
Save Register Pair AF (that return address) on the stack again, for 5B03H to drop or 5B18H to reuse.
5CC7
PUSH DE D5
Save Register Pair DE, the address of the question, on the stack.
5CC8
PUSH AF F5
Save Register Pair AF (the return address) on the stack once more: the RET below uses this copy.
5CC9
GOSUB to 5D24H to display the question at Register Pair DE, up to its 00H.
5CCC
GOSUB to 5DA6H to read the answer into 5564H: Register Pair HL = 5564H, Register A = the first character, Register B = the characters typed, the Z FLAG if empty.
5CCF
LD C,00H 0E 00
Load Register C with 00H, the default result; LD does not change the flags.
5CD1
RET C9
RETURN into the asking routine with the answer.

5CD2H - Keyboard: Wait for a Key, Scan the Keyboard

5CD2H waits for a key with ROM 0049H, 5CE0H only scans with ROM 002BH (Register A = 00H if no key is pressed). Both turn a lower case letter into upper case (5CD7H, also used by 5DB8H) and keep Register Pair DE.

5CD2
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack; the ROM routine changes it.
5CD3
GOSUB to ROM 0049H to wait for a key: Register A = its code.
5CD6
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
5CD7
CP 61H FE 61
Compare Register A (the character) against 61H, the letter a: the CARRY FLAG is set below it.
5CD9
RET C D8
If the CARRY FLAG is set (not a lower case letter), RETURN with Register A unchanged.
5CDA
CP 7BH FE 7B
Compare Register A (the character) against 7BH, one above z: the NO CARRY FLAG is set above z.
5CDC
RET NC D0
If the NO CARRY FLAG is set (not a lower case letter), RETURN with Register A unchanged.
5CDD
SUB 20H D6 20
Subtract 20H from Register A: the lower case letter becomes upper case.
5CDF
RET C9
RETURN with the upper case letter in Register A.
5CE0
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack; the ROM routine changes it.
5CE1
GOSUB to ROM 002BH to scan the keyboard once: Register A = the key pressed, or 00H.
5CE4
JUMP to 5CD6H to restore Register Pair DE and make the letter upper case.

5CE6H - End of a Disassembly: Errors, Cancel and Another Disassembly?

5CE6H displays a DOS error (Register A = its code) through SYS0 4409H with bits 7 and 6 set, so the message is displayed and 4409H returns, and then reports FUNCTION CANCELLED. 5CF2H (X, or the up-arrow while answering) and 5CF7H (BAD MAIN MEMORY) display their message; 5CFDH switches the output back to the display and asks ANOTHER DISASSEMBLY?: Y starts again at 5614H, N or ENTER goes to DOS READY.

5CE6
PUSH AF F5
Save Register Pair AF (Register A = the DOS error code) on the stack.
5CE7
LD B,03H 06 03
Load Register B with 03H, three carriage returns.
5CE9
GOSUB to 5D1CH to output Register B (3) carriage returns.
5CEC
POP AF F1
Restore Register Pair AF from the stack: Register A = the DOS error code.
5CED
OR C0H F6 C0
OR Register A (the error code) with C0H: bit 7 makes SYS0 4409H display the message and return instead of ending the program; bit 6 is set with it.
5CEF
GOSUB to SYS0 4409H to display the DOS error message for Register A.
5CF2
LD DE,6AD8H 11 D8 6A
Load Register Pair DE with 6AD8H, the message FUNCTION CANCELLED (after a row of ten asterisks and three spaces).
5CF5
JUMP to 5CFAH to display the message at Register Pair DE.
5CF7
LD DE,6B0CH 11 0C 6B
Load Register Pair DE with 6B0CH, the message BAD MAIN MEMORY (a name that should be in the reference table was not found, 66CBH).
5CFA
GOSUB to 5D0CH to switch to the display and show the message at Register Pair DE followed by blank lines.
5CFD
GOSUB to 5DD8H to switch the output to the display.
5D00
LD DE,6D01H 11 01 6D
Load Register Pair DE with 6D01H, the question ANOTHER DISASSEMBLY? (Y OR N).
5D03
GOSUB to 5AF2H to ask it: the NZ FLAG for Y, the Z FLAG for N or ENTER.
5D06
If the NZ FLAG is set (Y), JUMP to 5614H to start a new disassembly.
5D09
JUMP to SYS0 402DH, DOS READY: the disassembler ends.

5D0CH - Output: Messages and Characters

5D0CH switches to the display and shows a message with three blank lines after it. 5D17H shows the text at Register Pair DE up to its 00H and a carriage return; 5D1AH outputs one carriage return, 5D1CH Register B of them; 5D24H outputs text up to its 00H; 5D2DH clears the screen (1CH home, 1FH clear to the end of the frame); 5D3AH/5D3FH output Register B characters from Register Pair DE (with a carriage return after them for 5D3AH). All go through 5D47H, one character at a time.

5D0C
GOSUB to 5DD8H to switch the output to the display.
5D0F
GOSUB to 5D17H to display the message at Register Pair DE and a carriage return.
5D12
LD B,03H 06 03
Load Register B with 03H, three more carriage returns.
5D14
JUMP to 5D1CH to output Register B (3) carriage returns and return.
5D17
GOSUB to 5D24H to output the text at Register Pair DE up to its 00H.
5D1A
LD B,01H 06 01
Load Register B with 01H, one carriage return.
5D1C
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, the code that ends a line.
5D1E
GOSUB to 5D47H to output Register A (the carriage return), which ends the line.
5D21
Decrement Register B, the carriage returns left; if Register B is not 0, LOOP back to 5D1CH.
5D23
RET C9
RETURN with Register B = 00H after the last carriage return.

Text Loop
Register Pair DE = the next character of the text.

5D24
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next character of the text.
5D25
OR A B7
OR Register A with itself: the Z FLAG is set for the 00H that ends the text.
5D26
INC DE 13
Increment Register Pair DE to the next character; INC DE does not change the flags.
5D27
RET Z C8
If the Z FLAG is set (the end of the text), RETURN with Register Pair DE after the 00H.
5D28
GOSUB to 5D47H to output Register A, the character.
5D2B
LOOP back to 5D24H for the next character of the text.
5D2D
GOSUB to 5D35H to output 1CH, which moves the cursor to the top left corner.
5D30
LD A,1FH 3E 1F
Load Register A with 1FH, clear to the end of the frame.
5D32
JUMP to 5D47H to output Register A (1FH) and return: the screen is clear.
5D35
LD A,1CH 3E 1C
Load Register A with 1CH, the code that moves the cursor to the top left corner.
5D37
JUMP to 5D47H to output Register A (1CH) and return.
5D3A
GOSUB to 5D3FH to output Register B characters from Register Pair DE.
5D3D
JUMP to 5D1AH to end the line with a carriage return.

Characters Loop
Register Pair DE = the next character, Register B = the characters left.

5D3F
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next character.
5D40
INC DE 13
Increment Register Pair DE to the character after it.
5D41
GOSUB to 5D47H to output Register A, the character.
5D44
Decrement Register B, the characters left; if Register B is not 0, LOOP back to 5D3FH.
5D46
RET C9
RETURN with Register Pair DE after the last character.

5D47H - Output One Character

Outputs Register A through 5E63H (to the display or the printer) and keeps the column count at 5605H: a printable character uses a column and a full line is ended automatically; 08H gives one back; 1CH-1FH start the count again. 0AH-0DH end the line: an empty line gets a space first, the carriage return is output, the page count is updated (5E20H) and, if BREAK is held down, the output waits until ENTER is pressed. All registers are kept.

5D47
PUSH HL E5
Save Register Pair HL (the caller's value) on the stack.
5D48
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack.
5D49
PUSH BC C5
Save Register Pair BC (the caller's value) on the stack.
5D4A
PUSH AF F5
Save Register Pair AF (Register A = the character) on the stack.
5D4B
LD HL,5605H 21 05 56
Load Register Pair HL with 5605H, the characters still free on the current line.
5D4E
CP 0EH FE 0E
Compare Register A (the character) against 0EH: the NO CARRY FLAG is set for 0EH and above.
5D50
If the NO CARRY FLAG is set (not 0AH-0DH), JUMP to 5D56H to output it.
5D52
CP 0AH FE 0A
Compare Register A (the character) against 0AH: the NO CARRY FLAG is set for 0AH-0DH here.
5D54
If the NO CARRY FLAG is set (0AH-0DH: the end of a line), JUMP to 5D7CH.
5D56
GOSUB to 5E63H to send Register A (the character) to the display or the printer.
5D59
CP 20H FE 20
Compare Register A (the character) against 20H: the NO CARRY FLAG is set for a printable character.
5D5B
If the NO CARRY FLAG is set (printable), JUMP to 5D79H to count its column.
5D5D
CP 08H FE 08
Compare Register A (the control code) against 08H, backspace.
5D5F
If the NZ FLAG is set (another control code), JUMP to 5D6DH.
5D61
LD A,(5606H) 3A 06 56
Backspace: load Register A with the byte at 5606H, the line width.
5D64
DEC A 3D
Decrement Register A: the line width minus 1.
5D65
CP (HL) BE
Compare Register A (the width minus 1) against the byte at Register Pair HL (5605H), the characters free: the CARRY FLAG is set if the cursor was at the start of the line.
5D66
INC (HL) 34
Increment the byte at Register Pair HL (5605H): one more character free.
5D67
If the NO CARRY FLAG is set (the cursor was not at the start of the line), JUMP to 5DA1H.
5D69
LD (HL),01H 36 01
The backspace went to the end of the previous line: store 01H at Register Pair HL (5605H), one character free.
5D6B
JUMP to 5DA1H to restore the registers and return.
5D6D
SUB 1CH D6 1C
Subtract 1CH from Register A (the control code): 1CH-1FH become 00H-03H, every other code 04H or more.
5D6F
CP 1DH FE 1D
Compare Register A against 1DH: the CARRY FLAG is set for 1CH-1FH (codes below 1CH wrap past 1DH).
5D71
If the NO CARRY FLAG is set (another control code), JUMP to 5DA1H without changing the count.
5D73
LD A,(5606H) 3A 06 56
1CH-1FH: load Register A with the byte at 5606H, the line width.
5D76
LD (HL),A 77
Store Register A (the width) at Register Pair HL (5605H): the whole line is free again.
5D77
JUMP to 5DA1H to restore the registers and return.
5D79
DEC (HL) 35
Decrement the byte at Register Pair HL (5605H), the characters free on the line.
5D7A
If the NZ FLAG is set (room left on the line), JUMP to 5DA1H to return.
5D7C
LD A,(5606H) 3A 06 56
Load Register A with the byte at 5606H, the line width.
5D7F
CP (HL) BE
Compare Register A (the width) against the byte at Register Pair HL (5605H): the Z FLAG is set if nothing has been output on the line.
5D80
LD A,20H 3E 20
Load Register A with 20H, a space; LD does not change the flags.
5D82
If the Z FLAG is set (an empty line), GOSUB to 5E63H to output the space first.
5D85
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return.
5D87
GOSUB to 5E63H to send Register A (0DH) to the display or the printer.
5D8A
GOSUB to 5E20H to count the printed line and reset the column count at 5605H.
5D8D
LD A,(3840H) 3A 40 38
Load Register A with the byte at 3840H, keyboard row 6.
5D90
AND 04H E6 04
Mask Register A (row 6) against 04H to keep bit 2, the BREAK key.
5D92
If the Z FLAG is set (BREAK is not held down), JUMP to 5DA1H to return.
5D94
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the longest delay of ROM 0060H (65536 passes).
5D97
GOSUB to ROM 0060H to wait with Register Pair BC as the count, so that a short press of BREAK is not taken for ENTER.

Wait Loop
Waits until ENTER is pressed.

5D9A
LD A,(3840H) 3A 40 38
Load Register A with the byte at 3840H, keyboard row 6.
5D9D
AND 01H E6 01
Mask Register A (row 6) against 01H to keep bit 0, the ENTER key.
5D9F
If the Z FLAG is set (ENTER is not pressed), LOOP back to 5D9AH.
5DA1
POP AF F1
Restore Register Pair AF from the stack: Register A = the character.
5DA2
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
5DA3
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
5DA4
POP HL E1
Restore Register Pair HL from the stack: the caller's value.
5DA5
RET C9
RETURN with every register (Register Pairs AF, BC, DE, HL) as it was.

5DA6H - Read an Answer Line

Reads a line of up to 64 characters into 5564H with ROM 0040H. Holding down the up-arrow key while pressing ENTER cancels the disassembly (FUNCTION CANCELLED). The line is turned into upper case. Returns Register Pair HL = 5564H, Register B = the characters typed, Register A = the first character and the Z FLAG if the line is empty.

5DA6
LD HL,5564H 21 64 55
Load Register Pair HL with 5564H, the answer line buffer.
5DA9
LD B,40H 06 40
Load Register B with 40H, at most 64 characters.
5DAB
PUSH HL E5
Save Register Pair HL (5564H, the answer buffer) on the stack.
5DAC
GOSUB to ROM 0040H to read a line into the buffer at Register Pair HL: Register B comes back as the number of characters typed; the line ends with 0DH.
5DAF
LD A,(3840H) 3A 40 38
Load Register A with the byte at 3840H, keyboard row 6.
5DB2
AND 08H E6 08
Mask Register A (row 6) against 08H to keep bit 3, the up-arrow key.
5DB4
If the NZ FLAG is set (the up-arrow is held down), JUMP to 5CF2H to cancel the disassembly.

Upper Case Loop
Register Pair HL = the next character of the answer.

5DB7
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the next character of the answer.
5DB8
GOSUB to 5CD7H to turn a lower case letter in Register A into upper case.
5DBB
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the line.
5DBD
LD (HL),A 77
Store Register A (the upper case character) back at Register Pair HL; LD does not change the flags.
5DBE
INC HL 23
Increment Register Pair HL to the next character; INC HL does not change the flags.
5DBF
If the NZ FLAG is set (not the end of the line), LOOP back to 5DB7H.
5DC1
POP HL E1
Restore Register Pair HL from the stack: 5564H, the start of the answer.
5DC2
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the first character of the answer.
5DC3
CP 0DH FE 0D
Compare Register A (the first character) against 0DH: the Z FLAG is set for an empty answer.
5DC5
RET C9
RETURN with Register Pair HL = 5564H and the Z FLAG for an empty answer.

5DC6H - Output Device and Page Handling

5DC6H switches the output to the printer: the JR at 5E67H gets displacement 00H so 5E63H prints, the line width comes from 5608H, and before the first printed page the top margin is printed (5E34H). 5DD8H switches back to the display (displacement 18H, width from 5607H). Both first end a line that is not empty. 5E07H prints carriage returns up to the top of the next page; 5E10H returns the Z FLAG on the display or at the top of a page; 5E20H counts every printed line and prints the bottom and top margins at the end of a page; 5E48H prints up to Register C blank lines; 5E53H prints Register B lines of one space.

5DC6
LD A,00H 3E 00
Load Register A with 00H, the JR displacement that sends output to the printer code at 5E69H.
5DC8
GOSUB to 5DDAH to end the current line and set the output to the printer.
5DCB
PUSH HL E5
Save Register Pair HL (the caller's value) on the stack.
5DCC
LD HL,5602H 21 02 56
Load Register Pair HL with 5602H, the printer state.
5DCF
BIT 0,(HL) CB 46
Test bit 0 of the byte at Register Pair HL (5602H): set once the first top margin has been printed.
5DD1
If the Z FLAG is set (the first printed page), GOSUB to 5E34H to print the top margin and set the page line count.
5DD4
SET 0,(HL) CB C6
Set bit 0 of the byte at Register Pair HL (5602H): the first top margin has been printed.
5DD6
POP HL E1
Restore Register Pair HL from the stack: the caller's value.
5DD7
RET C9
RETURN with the output going to the printer (5E68H = 00H).
5DD8
LD A,18H 3E 18
Load Register A with 18H, the JR displacement that skips the printer code (5E67H jumps to 5E81H).
5DDA
PUSH AF F5
Save Register Pair AF (Register A = the displacement) on the stack.
5DDB
PUSH BC C5
Save Register Pair BC (the caller's value) on the stack.
5DDC
PUSH HL E5
Save Register Pair HL (the caller's value) on the stack.
5DDD
LD HL,5605H 21 05 56
Load Register Pair HL with 5605H, the characters free on the current line.
5DE0
LD A,(5606H) 3A 06 56
Load Register A with the byte at 5606H, the line width.
5DE3
CP (HL) BE
Compare Register A (the width) against the byte at Register Pair HL (5605H): the NZ FLAG is set if something is on the current line.
5DE4
If the NZ FLAG is set (the line is not empty), GOSUB to 5D1AH to end it with a carriage return on the old device.
5DE7
POP HL E1
Restore Register Pair HL from the stack: the caller's value.
5DE8
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
5DE9
POP AF F1
Restore Register Pair AF from the stack: Register A = the displacement (00H printer, 18H display).
5DEA
CP 18H FE 18
Compare Register A against 18H: the Z FLAG is set for the display.
5DEC
LD (5E68H),A 32 68 5E
Self-Modifying Code
Store Register A at 5E68H, the displacement of the JR at 5E67H: 18H skips to the display code at 5E81H, 00H runs the printer code at 5E69H.
5DEF
LD A,(5607H) 3A 07 56
Load Register A with the byte at 5607H, the display line width (40H); LD does not change the flags.
5DF2
If the Z FLAG is set (the display), JUMP to 5DF7H with that width.
5DF4
LD A,(5608H) 3A 08 56
Load Register A with the byte at 5608H, the printer line width (40H).
5DF7
LD (5606H),A 32 06 56
Store Register A (the line width) at 5606H, the width of the current output.
5DFA
LD (5605H),A 32 05 56
Store Register A (the width) at 5605H: the whole new line is free.
5DFD
RET C9
RETURN with the output device, line width and column count set.
5DFE
LD A,(5602H) 3A 02 56
Load Register A with the byte at 5602H, the printer state. Nothing in DISASSEM calls 5DFEH, so this row is never executed.
5E01
SET 6,A CB F7
Set bit 6 of Register A (the printer state): printer output would also be shown on the display; never executed.
5E03
LD (5602H),A 32 02 56
Store Register A at 5602H, the printer state; never executed.
5E06
RET C9
RETURN; never executed, since nothing reaches 5DFEH.

Top of Page Loop
Prints carriage returns until the top of the next page.

5E07
GOSUB to 5E10H: the Z FLAG on the display or at the top of a page.
5E0A
RET Z C8
If the Z FLAG is set (at the top of a page, or on the display), RETURN.
5E0B
GOSUB to 5D1AH to print a carriage return, one line further down the page.
5E0E
LOOP back to 5E07H to test for the top of the page again.
5E10
LD A,(5E68H) 3A 68 5E
Load Register A with the byte at 5E68H, the output displacement (18H display, 00H printer).
5E13
CP 18H FE 18
Compare Register A against 18H: the Z FLAG is set when the output goes to the display.
5E15
RET Z C8
If the Z FLAG is set (the display has no pages), RETURN with the Z FLAG.
5E16
PUSH HL E5
Save Register Pair HL (the caller's value) on the stack.
5E17
LD HL,5604H 21 04 56
Load Register Pair HL with 5604H, the printable lines per page.
5E1A
LD A,(5603H) 3A 03 56
Load Register A with the byte at 5603H, the lines left on the current page.
5E1D
CP (HL) BE
Compare Register A (the lines left) against the byte at Register Pair HL (5604H): the Z FLAG is set at the top of a page.
5E1E
POP HL E1
Restore Register Pair HL from the stack: the caller's value; POP does not change the flags.
5E1F
RET C9
RETURN with the Z FLAG at the top of a page, the NZ FLAG inside one.
5E20
LD A,(5E68H) 3A 68 5E
Load Register A with the byte at 5E68H, the output displacement (18H display, 00H printer).
5E23
CP 18H FE 18
Compare Register A against 18H: the Z FLAG is set when the output goes to the display.
5E25
If the Z FLAG is set (the display), JUMP to 5E41H to reset the column count only.
5E27
LD A,(5603H) 3A 03 56
Load Register A with the byte at 5603H, the lines left on the current page.
5E2A
DEC A 3D
Decrement Register A, the lines left: one more line has been printed.
5E2B
If the NZ FLAG is set (the page is not full), JUMP to 5E3EH to store the count.
5E2D
PUSH BC C5
The page is full: save Register Pair BC (the caller's value) on the stack.
5E2E
LD B,03H 06 03
Self-Modifying Code
Load Register B with the bottom margin, the operand at 5E2FH (03H in the file, the margin answer from 5C69H).
5E30
GOSUB to 5E53H to print Register B lines of one space: the bottom margin.
5E33
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
5E34
PUSH BC C5
Save Register Pair BC (the caller's value) on the stack.
5E35
LD B,03H 06 03
Self-Modifying Code
Load Register B with the top margin, the operand at 5E36H (03H in the file, the margin answer from 5C66H).
5E37
GOSUB to 5E53H to print Register B lines of one space: the top margin of the next page.
5E3A
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
5E3B
LD A,(5604H) 3A 04 56
Load Register A with the byte at 5604H, the printable lines per page.
5E3E
LD (5603H),A 32 03 56
Store Register A at 5603H, the lines left on the current page.
5E41
LD A,(5606H) 3A 06 56
Load Register A with the byte at 5606H, the line width.
5E44
LD (5605H),A 32 05 56
Store Register A (the width) at 5605H: the next line is empty.
5E47
RET C9
RETURN with the line and page counts updated.

Blank Lines Loop
Register C = the most carriage returns still to print.

5E48
GOSUB to 5E10H: the Z FLAG on the display or at the top of a page.
5E4B
RET Z C8
If the Z FLAG is set (nothing more to print), RETURN.
5E4C
GOSUB to 5D1AH to print a carriage return, a blank line.
5E4F
DEC C 0D
Decrement Register C, the carriage returns left.
5E50
If the NZ FLAG is set (more), LOOP back to 5E48H.
5E52
RET C9
RETURN after Register C blank lines (fewer at the top of a page).

Margin Loop
Register B = the margin lines left.

5E53
LD A,B 78
Load Register A with Register B, the margin lines left.
5E54
OR A B7
OR Register A with itself: the Z FLAG is set when none are left.
5E55
RET Z C8
If the Z FLAG is set (the margin is done), RETURN.
5E56
DEC B 05
Decrement Register B, the margin lines left to print.
5E57
LD A,20H 3E 20
Load Register A with 20H, a space, so the printer prints the line.
5E59
GOSUB to 5E63H to send Register A (the space) to the printer.
5E5C
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return.
5E5E
GOSUB to 5E63H to send Register A (0DH) to the printer.
5E61
LOOP back to 5E53H for the next margin line (Register B lines in all).

5E63H - Send a Character to the Display or the Printer

The JR at 5E67H is set by 5DEAH: with displacement 18H it goes straight to the display code (5E81H), with 00H it runs the printer code at 5E69H first. The printer gets printable characters, 0AH and 0DH through ROM 003BH; other control codes are dropped. The display code (ROM 0033H) leaves out the carriage return after a line of exactly 64 characters, because the display has already moved to the next line. All registers are kept.

5E63
PUSH HL E5
Save Register Pair HL (the caller's value) on the stack.
5E64
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack.
5E65
PUSH BC C5
Save Register Pair BC (the caller's value) on the stack.
5E66
PUSH AF F5
Save Register Pair AF (Register A = the character) on the stack.
5E67
Self-Modifying Code
JUMP to 5E81H, the display code: the displacement at 5E68H is 18H in the file and from 5DD8H; with 00H from 5DC6H this JR goes on to 5E69H, the printer code.
5E69
CP 20H FE 20
Printer: compare Register A (the character) against 20H: the NO CARRY FLAG is set for a printable character.
5E6B
If the NO CARRY FLAG is set (printable), JUMP to 5E75H to print it.
5E6D
CP 0AH FE 0A
Compare Register A (the control code) against 0AH, line feed.
5E6F
If the Z FLAG is set (0AH), JUMP to 5E75H to print it.
5E71
CP 0DH FE 0D
Compare Register A (the control code) against 0DH, carriage return.
5E73
If the NZ FLAG is set (another control code), JUMP to 5E7AH without printing it.
5E75
PUSH AF F5
Save Register Pair AF (Register A = the character) on the stack.
5E76
GOSUB to ROM 003BH to print Register A on the printer.
5E79
POP AF F1
Restore Register Pair AF from the stack: Register A = the character.
5E7A
LD HL,5602H 21 02 56
Load Register Pair HL with 5602H, the printer state.
5E7D
BIT 6,(HL) CB 76
Test bit 6 of the byte at Register Pair HL (5602H): set only by the unreferenced 5DFEH, so always clear.
5E7F
If the Z FLAG is set (printer only), JUMP to 5E97H to return without showing the character.
5E81
CP 0DH FE 0D
Display: compare Register A (the character) against 0DH, the carriage return.
5E83
If the NZ FLAG is set (another character), JUMP to 5E94H to display it.
5E85
LD HL,5605H 21 05 56
Load Register Pair HL with 5605H, the characters free on the line.
5E88
LD A,(5606H) 3A 06 56
Load Register A with the byte at 5606H, the line width.
5E8B
SUB (HL) 96
Subtract the byte at Register Pair HL (5605H) from Register A: Register A = the characters on the line.
5E8C
If the Z FLAG is set (an empty line), JUMP to 5E92H to display the carriage return.
5E8E
AND 3FH E6 3F
Mask Register A (the characters on the line) against 3FH: the Z FLAG is set for exactly 64.
5E90
If the Z FLAG is set (the line filled the display's width: the cursor has already moved down), JUMP to 5E97H without a carriage return.
5E92
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return.
5E94
GOSUB to ROM 0033H to display Register A at the cursor.
5E97
POP AF F1
Restore Register Pair AF from the stack: Register A = the character.
5E98
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
5E99
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
5E9A
POP HL E1
Restore Register Pair HL from the stack: the caller's value.
5E9B
RET C9
RETURN with every register (Register Pairs AF, BC, DE, HL) as it was.

5E9CH - Utilities: Clear the Line Buffer, Compare

5E9CH fills the 64 bytes at 5564H with spaces (the reference table listing builds its lines there) and returns Register Pair HL = 5564H. 5EA9H subtracts Register Pair DE from Register Pair HL; 5EACH tests Register Pair HL: both return the Z FLAG only when Register Pair HL is (or becomes) 0000H, with Register Pair HL = the difference.

5E9C
LD HL,5564H 21 64 55
Load Register Pair HL with 5564H, the line buffer.
5E9F
LD B,40H 06 40
Load Register B with 40H, the 64 bytes of the line buffer.
5EA1
PUSH HL E5
Save Register Pair HL (5564H, the start of the buffer) on the stack.
5EA2
LD (HL),20H 36 20
Store 20H (a space) at Register Pair HL, the next byte of the buffer.
5EA4
INC HL 23
Increment Register Pair HL to the next byte of the buffer.
5EA5
Decrement Register B, the bytes left; if Register B is not 0, LOOP back to 5EA2H.
5EA7
POP HL E1
Restore Register Pair HL from the stack: 5564H, the start of the empty line.
5EA8
RET C9
RETURN with Register Pair HL = 5564H, the start of the blank line.
5EA9
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC.
5EAA
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: Register Pair HL = the difference.
5EAC
LD A,H 7C
Load Register A with Register H, the high byte of the difference.
5EAD
OR A B7
OR Register A with itself: the NZ FLAG is set if Register H is not 00H.
5EAE
RET NZ C0
If the NZ FLAG is set, RETURN: Register Pair HL is not 0000H (the S FLAG shows a negative difference).
5EAF
LD A,L 7D
Load Register A with Register L, the low byte of the difference.
5EB0
CP H BC
Compare Register A (Register L) against Register H (00H): the Z FLAG is set only if Register L is 00H too.
5EB1
RET C9
RETURN with the Z FLAG set only for a difference of 0000H.

5EB2H - Reference Table: Record a Reference

Called for every operand value during the build pass only (bits 1 and 2 of 55EFH clear): Register Pair DE = the referenced location, 55EBH = the location of the referencing instruction, 55F8H = the reference type. The table at 6FA1H is kept in ascending order of the referenced locations; each referencee entry (location high, low, 40H) is followed by its referencer entries (location high, low, type), also in ascending order. A new referencee takes 6 bytes (with its first referencer), a further referencer 3. After every 64 new referencees (32 the first time) the search index is rebuilt.

5EB2
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
5EB5
AND 06H E6 06
Mask Register A (the flags) against 06H (0000 0110) to keep bit 1 (the listing pass) and bit 2 (NCR).
5EB7
RET NZ C0
If the NZ FLAG is set (not the build pass), RETURN: references are only recorded while the table is built.
5EB8
PUSH HL E5
Save Register Pair HL (the caller's output pointer) on the stack.
5EB9
PUSH DE D5
Save Register Pair DE (the referenced location) on the stack.
5EBA
PUSH BC C5
Save Register Pair BC (the caller's value) on the stack.
5EBB
GOSUB to 5F4DH to look the referenced location (Register Pair DE) up: the Z FLAG with Register Pair HL at its referencee entry's control byte, else Register Pair HL at the control byte of the next higher entry.
5EBE
If the Z FLAG is set (the location is already a referencee), JUMP to 5EE5H to add a referencer.
5EC0
LD A,06H 3E 06
Load Register A with 06H, the bytes of a referencee entry and its first referencer entry.
5EC2
GOSUB to 5F02H to make room for 6 bytes before the entry at Register Pair HL: Register Pair HL = the new room, Register Pair DE = the referenced location.
5EC5
LD (HL),D 72
Store Register D, the high byte of the referenced location, at Register Pair HL (the table keeps the high byte first).
5EC6
INC HL 23
Increment Register Pair HL to the entry's second byte.
5EC7
LD (HL),E 73
Store Register E, the low byte of the referenced location, at Register Pair HL.
5EC8
INC HL 23
Increment Register Pair HL to the entry's control byte.
5EC9
LD (HL),40H 36 40
Store 40H at Register Pair HL: a referencee entry (bits 7-6 = 01).
5ECB
INC HL 23
Increment Register Pair HL to the room for the referencer entry.
5ECC
PUSH HL E5
Save Register Pair HL, the referencer entry's address, on the stack.
5ECD
LD HL,5612H 21 12 56
Load Register Pair HL with 5612H, the new referencees allowed before the search index is rebuilt.
5ED0
DEC (HL) 35
Decrement the byte at Register Pair HL (5612H): the Z FLAG is set when the count runs out.
5ED1
If the Z FLAG is set, GOSUB to 5F93H to rebuild the search index (which also sets 5612H to 40H).
5ED4
POP HL E1
Restore Register Pair HL from the stack: the referencer entry's address.
5ED5
LD DE,(55EBH) ED 5B EB 55
Load Register Pair DE with the 16-bit value at 55EBH, the location of the referencing instruction.
5ED9
LD (HL),D 72
Store Register D, the high byte of the referencing location, at Register Pair HL.
5EDA
INC HL 23
Increment Register Pair HL to the referencer entry's second byte.
5EDB
LD (HL),E 73
Store Register E, the low byte of the referencing location, at Register Pair HL.
5EDC
INC HL 23
Increment Register Pair HL to the referencer entry's control byte.
5EDD
LD A,(55F8H) 3A F8 55
Load Register A with the byte at 55F8H, the reference type of the operand (0-5 S-X, 8 P, 9 L, 0AH R).
5EE0
LD (HL),A 77
Store Register A (the type, bits 7-6 = 00) at Register Pair HL, the referencer entry's control byte.
5EE1
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
5EE2
POP DE D1
Restore Register Pair DE from the stack: the referenced location.
5EE3
POP HL E1
Restore Register Pair HL from the stack: the caller's output pointer.
5EE4
RET C9
RETURN with the reference recorded and Register Pairs BC, DE and HL as they were.
5EE5
LD DE,(55EBH) ED 5B EB 55
Load Register Pair DE with the 16-bit value at 55EBH, the location of the referencing instruction.

Referencer Loop
Register Pair HL = the control byte of the previous entry, Register Pair DE = the referencing location.

5EE9
INC HL 23
Increment Register Pair HL to the next entry's first byte.
5EEA
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the high byte of the entry's location.
5EEB
INC HL 23
Increment Register Pair HL to the entry's second byte.
5EEC
LD C,(HL) 4E
Load Register C with the byte at Register Pair HL, the low byte: Register Pair BC = the entry's location.
5EED
INC HL 23
Increment Register Pair HL to the entry's control byte.
5EEE
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the control byte.
5EEF
AND C0H E6 C0
Mask Register A (the control byte) against C0H to keep bits 7-6: 00 for a referencer entry.
5EF1
If the NZ FLAG is set (the next referencee or the end marker), JUMP to 5EFBH to add the referencer before it.
5EF3
LD A,D 7A
Load Register A with Register D, the high byte of the referencing location.
5EF4
CP B B8
Compare Register A against Register B, the high byte of this referencer's location.
5EF5
If the NZ FLAG is set (the high bytes differ), JUMP to 5EF9H with the CARRY FLAG from them.
5EF7
LD A,E 7B
Load Register A with Register E, the low byte of the referencing location.
5EF8
CP C B9
Compare Register A against Register C, the low byte of this referencer's location.
5EF9
If the NO CARRY FLAG is set (the referencing location is at or above this one), LOOP back to 5EE9H.
5EFB
LD A,03H 3E 03
Load Register A with 03H, the bytes of one referencer entry.
5EFD
GOSUB to 5F02H to make room for 3 bytes before the entry at Register Pair HL: Register Pair HL = the new room.
5F00
JUMP to 5ED5H to fill in the referencer entry.

5F02H - Reference Table: Make Room for New Entries

Moves everything from the entry whose control byte is at Register Pair HL up to the end marker up by Register A bytes and updates the search index entries after the one the last search used (5F2EH). INSUFFICIENT MEMORY ends the disassembly if the end marker would pass HIMEM - 12. Returns Register Pair HL = the room made and Register Pair DE as it was.

5F02
DEC HL 2B
Decrement Register Pair HL from the entry's control byte to its second byte.
5F03
DEC HL 2B
Decrement Register Pair HL to the entry's first byte: the room goes here.
5F04
PUSH HL E5
Save Register Pair HL (the room's address) on the stack for the return.
5F05
PUSH DE D5
Save Register Pair DE (the caller's value, a location) on the stack.
5F06
PUSH HL E5
Save Register Pair HL (the room's address) on the stack again for the count.
5F07
LD HL,(55F2H) 2A F2 55
Load Register Pair HL with the 16-bit value at 55F2H, the table limit (HIMEM - 6).
5F0A
LD DE,FFFAH 11 FA FF
Load Register Pair DE with FFFAH, minus 6 in two's complement.
5F0D
ADD HL,DE 19
Add Register Pair DE (minus 6) to Register Pair HL: Register Pair HL = HIMEM - 12, leaving room for the largest insertion.
5F0E
LD DE,(55F4H) ED 5B F4 55
Load Register Pair DE with the 16-bit value at 55F4H, the address of the end marker.
5F12
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC (Register A, the size, is not changed).
5F13
SBC HL,DE ED 52
Subtract Register Pair DE (the end marker) from Register Pair HL (the limit): the CARRY FLAG is set if the table has reached the limit.
5F15
If the CARRY FLAG is set, JUMP to 5F47H for INSUFFICIENT MEMORY.
5F17
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the end marker's address.
5F18
POP DE D1
Restore Register Pair DE from the stack: the room's address.
5F19
OR A B7
OR Register A with itself to clear the CARRY FLAG before the SBC.
5F1A
SBC HL,DE ED 52
Subtract Register Pair DE (the room's address) from Register Pair HL (the end marker): the bytes from the room to the marker, minus 1.
5F1C
PUSH HL E5
Save Register Pair HL (that count) on the stack.
5F1D
ADD HL,DE 19
Add Register Pair DE (the room's address) back to Register Pair HL: the end marker's address again.
5F1E
LD D,H 54
Load Register D with Register H, the high byte of the end marker's address.
5F1F
LD E,L 5D
Load Register E with Register L: Register Pair DE = the end marker's address, the last byte to move.
5F20
LD C,A 4F
Load Register C with Register A, the bytes of room wanted (3 or 6).
5F21
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the room wanted.
5F23
ADD HL,BC 09
Add Register Pair BC (the room) to Register Pair HL: where the end marker goes.
5F24
LD (55F4H),HL 22 F4 55
Store Register Pair HL, the end marker's new address, at 55F4H.
5F27
POP BC C1
Restore Register Pair BC from the stack: the bytes to move minus 1.
5F28
INC BC 03
Increment Register Pair BC: the bytes from the room to the end marker, inclusive.
5F29
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the old end marker (the last byte to move), Register Pair DE = its new place.
5F2A
LDDR ED B8
Copy Register Pair BC bytes from Register Pair HL to Register Pair DE, downward: the table above the room moves up by the room's size.
5F2C
LD C,A 4F
Load Register C with Register A, the room's size; Register B is 00H after the copy.
5F2D
LD HL,0000H 21 00 00
Self-Modifying Code
Load Register Pair HL with the operand at 5F2EH (0000H in the file): the address of the search index entry the last search (5F4DH) started from, stored there at 5F5AH.

Index Update Loop
Register Pair HL = the index entry, Register Pair BC = the room's size.

5F30
INC HL 23
Increment Register Pair HL past the index entry's first byte.
5F31
INC HL 23
Increment Register Pair HL past its second byte.
5F32
INC HL 23
Increment Register Pair HL past its third byte.
5F33
INC HL 23
Increment Register Pair HL to the next index entry.
5F34
LD A,L 7D
Load Register A with Register L, the low byte of the index entry's address.
5F35
CP A0H FE A0
Compare Register A (the low byte) against A0H: the Z FLAG is set past the last index entry (6F9CH).
5F37
If the NZ FLAG is set (another index entry), JUMP to 5F3CH to move its pointer.
5F39
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
5F3A
POP HL E1
Restore Register Pair HL from the stack: the room's address.
5F3B
RET C9
RETURN with Register Pair HL at the room made.
5F3C
LD E,(HL) 5E
Load Register E with the byte at Register Pair HL, the low byte of the index entry's table pointer.
5F3D
INC HL 23
Increment Register Pair HL to the pointer's high byte.
5F3E
LD D,(HL) 56
Load Register D with the byte at Register Pair HL: Register Pair DE = the table pointer.
5F3F
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the table pointer.
5F40
ADD HL,BC 09
Add Register Pair BC (the room's size) to Register Pair HL: the entry it pointed at has moved up.
5F41
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the new pointer, Register Pair HL = the index entry's second byte.
5F42
LD (HL),D 72
Store Register D, the new pointer's high byte, at Register Pair HL.
5F43
DEC HL 2B
Decrement Register Pair HL to the index entry's first byte.
5F44
LD (HL),E 73
Store Register E, the new pointer's low byte, at Register Pair HL.
5F45
LOOP back to 5F30H for the next index entry, with Register Pair HL at this one's first byte.
5F47
LD DE,6AF8H 11 F8 6A
Load Register Pair DE with 6AF8H, the message INSUFFICIENT MEMORY.
5F4A
JUMP to 5CFAH to display the message at Register Pair DE and ask ANOTHER DISASSEMBLY?.

5F4DH - Reference Table: Find a Location

Looks the location in Register Pair DE up among the referencee entries. The search index at 6F60H-6F9FH (16 entries: a table pointer and the name number of the referencee it points at) is read from the last entry down until one points at a location not above Register Pair DE (the first entry is always used), and the table is searched from there. Found: the Z FLAG, Register Pair HL at the entry's control byte and Register Pair BC = its name number. Not found: the CARRY FLAG and the NZ FLAG, with Register Pair HL at the control byte of the next higher referencee (or the end marker), where a new one goes. The index entry used is left at 5F2EH for 5F02H.

5F4D
LD HL,6FA0H 21 A0 6F
Load Register Pair HL with 6FA0H, just past the last index entry (6F9CH-6F9FH).

Index Loop
Register Pair HL = just past the index entry to read, Register Pair DE = the location looked for.

5F50
LD A,L 7D
Load Register A with Register L, the low byte: 64H when the entry about to be read is the first one (6F60H).
5F51
CP 64H FE 64
Compare Register A against 64H: the Z FLAG is set for the first index entry; the flag is kept through the loads below.
5F53
DEC HL 2B
Decrement Register Pair HL to byte 3 of the index entry.
5F54
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the high byte of the entry's name number.
5F55
DEC HL 2B
Decrement Register Pair HL to byte 2 of the index entry.
5F56
LD C,(HL) 4E
Load Register C with the byte at Register Pair HL: Register Pair BC = the name number of the referencee it points at.
5F57
DEC HL 2B
Decrement Register Pair HL to byte 1 of the index entry.
5F58
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the high byte of the entry's table pointer.
5F59
DEC HL 2B
Decrement Register Pair HL to byte 0 of the index entry.
5F5A
LD (5F2EH),HL 22 2E 5F
Store Register Pair HL, the index entry's address, at 5F2EH (the operand of 5F2DH), for the next loop pass and for 5F02H.
5F5D
LD L,(HL) 6E
Load Register L with the byte at Register Pair HL, the low byte of the table pointer.
5F5E
LD H,A 67
Load Register H with Register A: Register Pair HL = the referencee entry the index points at.
5F5F
PUSH BC C5
Save Register Pair BC, the name number of that referencee, on the stack.
5F60
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the high byte of the entry's location.
5F61
INC HL 23
Increment Register Pair HL to the entry's second byte.
5F62
LD C,(HL) 4E
Load Register C with the byte at Register Pair HL: Register Pair BC = the entry's location.
5F63
INC HL 23
Increment Register Pair HL to the entry's control byte.
5F64
If the Z FLAG is set (the first index entry), JUMP to 5F7FH to search the table from it.
5F66
BIT 7,(HL) CB 7E
Test bit 7 of the byte at Register Pair HL, the control byte: set for the end marker.
5F68
If the NZ FLAG is set (this index entry points at the end marker), JUMP to 5F72H to try the one below.
5F6A
LD A,D 7A
Load Register A with Register D, the high byte of the location looked for.
5F6B
CP B B8
Compare Register A against Register B, the high byte of the entry's location.
5F6C
If the NZ FLAG is set (the high bytes differ), JUMP to 5F70H with the CARRY FLAG from them.
5F6E
LD A,E 7B
Load Register A with Register E, the low byte of the location looked for.
5F6F
CP C B9
Compare Register A against Register C, the low byte of the entry's location.
5F70
If the NO CARRY FLAG is set (the location looked for is at or above this entry's), JUMP to 5F8EH to search from here.
5F72
POP BC C1
Restore Register Pair BC from the stack, dropping that name number.
5F73
LD HL,(5F2EH) 2A 2E 5F
Load Register Pair HL with the 16-bit value at 5F2EH, the index entry just read.
5F76
LOOP back to 5F50H for the index entry below it.

Table Loop
Register Pair HL = the control byte of a referencee entry, Register Pair BC (on the stack) = its name number, Register Pair DE = the location looked for.

5F78
INC BC 03
Increment Register Pair BC, the name number: the next referencee has the next number.
5F79
PUSH BC C5
Save Register Pair BC, the name number, on the stack.
5F7A
INC HL 23
Increment Register Pair HL to the next entry's first byte.
5F7B
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the high byte of the entry's location.
5F7C
INC HL 23
Increment Register Pair HL to the entry's second byte.
5F7D
LD C,(HL) 4E
Load Register C with the byte at Register Pair HL: Register Pair BC = the entry's location.
5F7E
INC HL 23
Increment Register Pair HL to the entry's control byte.
5F7F
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the control byte.
5F80
RLC A CB 07
Rotate Register A left: bit 7 (the end marker) goes into the CARRY FLAG; the result C0H becomes 81H, so the NZ FLAG is set.
5F82
If the CARRY FLAG is set (the end marker: not found), JUMP to 5F8EH to return with the CARRY FLAG.
5F84
BIT 6,(HL) CB 76
Test bit 6 of the byte at Register Pair HL, the control byte: set for a referencee entry.
5F86
If the Z FLAG is set (a referencer entry), LOOP back to 5F7AH to skip it.
5F88
LD A,D 7A
Load Register A with Register D, the high byte of the location looked for.
5F89
CP B B8
Compare Register A against Register B, the high byte of the referencee's location.
5F8A
If the NZ FLAG is set (the high bytes differ), JUMP to 5F8EH with the CARRY FLAG from them.
5F8C
LD A,E 7B
Load Register A with Register E, the low byte of the location looked for.
5F8D
CP C B9
Compare Register A against Register C, the low byte: the Z FLAG if equal, the CARRY FLAG if below.
5F8E
POP BC C1
Restore Register Pair BC from the stack: the name number of this referencee; POP does not change the flags.
5F8F
RET C D8
If the CARRY FLAG is set (the location looked for is below this referencee, or the end was reached), RETURN: not found, Register Pair HL at this entry's control byte.
5F90
If the NZ FLAG is set (the location is above this referencee), LOOP back to 5F78H for the next one.
5F92
RET C9
RETURN with the Z FLAG: found, Register Pair HL at the control byte and Register Pair BC = the name number.

5F93H - Reference Table: Rebuild the Search Index

Counts the referencee entries, divides the count by 16 (rounded up) and points the 16 index entries at every so many referencees, with the name number of each (5FC1H, the first name, plus the referencees before it). Index entries past the last referencee point at the end marker. Called after every 64 new referencees during the build pass and once before the listing pass (5A19H), when the name numbers are needed. The counting uses the alternate register set.

5F93
LD A,40H 3E 40
Load Register A with 40H, 64 new referencees.
5F95
LD (5612H),A 32 12 56
Store Register A (40H) at 5612H: the next rebuild comes after 64 more new referencees.
5F98
XOR A AF
Load Register A with 00H (XOR A with itself): Register A collects the remainder bits of the division.
5F99
LD HL,6FA0H 21 A0 6F
Load Register Pair HL with 6FA0H, the marker before the first table entry.
5F9C
LD D,A 57
Load Register D with Register A (00H), the high byte of the count.
5F9D
LD E,A 5F
Load Register E with Register A: Register Pair DE = 0000H, the count of referencees.
5F9E
LD B,04H 06 04
Load Register B with 04H, the four shifts of the division by 16.
5FA0
PUSH HL E5
Save Register Pair HL (6FA0H, the table's marker) on the stack.

Count Loop
Register Pair HL = the control byte of the previous entry, Register Pair DE = the referencees counted.

5FA1
INC HL 23
Increment Register Pair HL past the next entry's first byte.
5FA2
INC HL 23
Increment Register Pair HL past its second byte.
5FA3
INC HL 23
Increment Register Pair HL to its control byte.
5FA4
BIT 7,(HL) CB 7E
Test bit 7 of the byte at Register Pair HL, the control byte: set for the end marker.
5FA6
If the NZ FLAG is set (the end of the table), JUMP to 5FAFH to divide the count.
5FA8
BIT 6,(HL) CB 76
Test bit 6 of the byte at Register Pair HL, the control byte: set for a referencee entry.
5FAA
If the Z FLAG is set (a referencer entry), LOOP back to 5FA1H.
5FAC
INC DE 13
Increment Register Pair DE, the number of referencees.
5FAD
LOOP back to 5FA1H for the next entry, with Register Pair DE one higher.
5FAF
SRL D CB 3A
Shift Register D (the count's high byte) right: bit 0 goes into the CARRY FLAG.
5FB1
RR E CB 1B
Rotate Register E right through the CARRY FLAG: Register Pair DE = the count halved, the bit shifted out in the CARRY FLAG.
5FB3
ADC A,A 8F
Add Register A to itself with the CARRY FLAG: the bit shifted out is kept in Register A.
5FB4
Decrement Register B, the shifts left; if Register B is not 0, LOOP back to 5FAFH: Register Pair DE = the count divided by 16.
5FB6
If the Z FLAG is set (Register A = 0: the count was a multiple of 16), JUMP to 5FB9H.
5FB8
INC DE 13
Increment Register Pair DE: the division is rounded up.
5FB9
POP HL E1
Restore Register Pair HL from the stack: 6FA0H.
5FBA
INC HL 23
Increment Register Pair HL to 6FA1H, the first table entry.
5FBB
PUSH DE D5
Save Register Pair DE, the referencees per index entry, on the stack.
5FBC
LD DE,6F60H 11 60 6F
Load Register Pair DE with 6F60H, the first index entry.
5FBF
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 6F60H (the index), Register Pair DE = 6FA1H (the table).
5FC0
LD BC,0000H 01 00 00
Self-Modifying Code
Load Register Pair BC with the number of the first name, the operand at 5FC1H (0000H = AAA in the file; FGN= stores its value there at 5C18H).

Index Entry Loop
Register Pair HL = the index entry, Register Pair DE = the referencee it gets, Register Pair BC = that referencee's name number.

5FC3
LD (HL),E 73
Store Register E, the low byte of the table pointer, at Register Pair HL, byte 0 of the index entry.
5FC4
INC HL 23
Increment Register Pair HL to byte 1 of the index entry.
5FC5
LD (HL),D 72
Store Register D, the high byte of the table pointer, at Register Pair HL.
5FC6
INC HL 23
Increment Register Pair HL to byte 2 of the index entry.
5FC7
LD (HL),C 71
Store Register C, the low byte of the name number, at Register Pair HL.
5FC8
INC HL 23
Increment Register Pair HL to byte 3 of the index entry.
5FC9
LD (HL),B 70
Store Register B, the high byte of the name number, at Register Pair HL.
5FCA
INC HL 23
Increment Register Pair HL to the next index entry.
5FCB
LD A,L 7D
Load Register A with Register L, the low byte of the next index entry's address.
5FCC
CP A0H FE A0
Compare Register A against A0H: the Z FLAG is set after the sixteenth entry.
5FCE
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: the counting is done in the alternate registers.
5FCF
POP DE D1
Restore Register Pair DE from the stack: the referencees per index entry, to count down; POP does not change the flags.
5FD0
RET Z C8
If the Z FLAG is set (all 16 index entries are written), RETURN.
5FD1
PUSH DE D5
Save Register Pair DE, the referencees per index entry, on the stack again for the next index entry.

Step Loop
Alternate Register Pair DE = the referencees still to pass; main Register Pair DE = the referencee, Register Pair BC = its name number.

5FD2
LD A,D 7A
Load Register A with Register D, the high byte of the referencees still to pass.
5FD3
OR E B3
OR Register A with Register E: the Z FLAG is set when none are left.
5FD4
DEC DE 1B
Decrement Register Pair DE, the referencees still to pass; DEC DE does not change the flags.
5FD5
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: the main set (index, table pointer, name number) is back.
5FD6
If the Z FLAG is set (enough referencees passed), JUMP to 5FC3H to write the next index entry.
5FD8
INC DE 13
Increment Register Pair DE, the table pointer, past the referencee's first byte.
5FD9
INC DE 13
Increment Register Pair DE to the referencee's control byte.
5FDA
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the control byte.
5FDB
RLCA 07
Rotate Register A left: bit 7 (the end marker) goes into the CARRY FLAG.
5FDC
If the CARRY FLAG is set (the end marker: it stays the pointer), JUMP to 5FE7H.
5FDE
INC DE 13
Increment Register Pair DE past the next entry's first byte.
5FDF
INC DE 13
Increment Register Pair DE past its second byte.
5FE0
INC DE 13
Increment Register Pair DE to its control byte.
5FE1
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the control byte.
5FE2
BIT 6,A CB 77
Test bit 6 of Register A, the control byte: set for a referencee and for the end marker.
5FE4
If the Z FLAG is set (a referencer entry), LOOP back to 5FDEH.
5FE6
INC BC 03
Increment Register Pair BC, the name number: one more referencee has been passed.
5FE7
DEC DE 1B
Decrement Register Pair DE to the entry's second byte.
5FE8
DEC DE 1B
Decrement Register Pair DE to the entry's first byte: Register Pair DE = the next referencee (or the end marker entry).
5FE9
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: the count is back in Register Pair DE.
5FEA
LOOP back to 5FD2H to count down the referencees still to pass.

5FECH - Location Reference Table Listing

The last phase of a disk disassembly (skipped with NCR). After the heading with the type definitions (6B1CH) the types turned off by RI are named. Then every referencee is listed in ascending order: its location, then the location and type letter of each referencing instruction of a listed type, six columns each, continued on further lines indented by six columns. The lines are built in the buffer at 5564H. X ends the listing, P pauses it. A referencer of a type that is not listed still moves the position on by two columns (60CDH jumps to 609BH).

5FEC
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
5FEF
AND 04H E6 04
Mask Register A (the flags) against 04H to keep NCR (bit 2).
5FF1
If the NZ FLAG is set (NCR: no table to list), JUMP to 6075H, which asks ANOTHER DISASSEMBLY?.
5FF4
LD A,(55F0H) 3A F0 55
Load Register A with the byte at 55F0H, the output flags.
5FF7
AND 02H E6 02
Mask Register A (the output flags) against 02H to keep PTR (bit 1).
5FF9
If the NZ FLAG is set (PTR), GOSUB to 5DC6H to make sure the output goes to the printer.
5FFC
GOSUB to 5E07H to print carriage returns up to the top of the next page (nothing on the display).
5FFF
LD DE,6B1CH 11 1C 6B
Load Register Pair DE with 6B1CH, the heading LOCATION REFERENCE TABLE and the definitions of the type letters L, P, R, S, T, U, V, W and X.
6002
GOSUB to 5D17H to output the heading at Register Pair DE (its lines end with 0DH) and a carriage return.
6005
GOSUB to 5D1AH to output a blank line after the heading.
6008
LD HL,60D7H 21 D7 60
Load Register Pair HL with 60D7H, the type letters in type number order.
600B
LD DE,60E2H 11 E2 60
Load Register Pair DE with 60E2H, the enabled-type flags (the letter, or a space for a type that is not listed).
600E
LD B,0BH 06 0B
Load Register B with 0BH, the eleven type positions.
6010
LD C,00H 0E 00
Load Register C with 00H, the number of types not listed.

Type Loop
Register Pair HL = the type letter, Register Pair DE = its flag, Register B = the positions left, Register C = the types not listed.

6012
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the type's flag.
6013
CP 20H FE 20
Compare Register A (the flag) against 20H: a space means the type is not listed.
6015
If the NZ FLAG is set (the type is listed), JUMP to 6024H.
6017
CP (HL) BE
Compare Register A (20H) against the byte at Register Pair HL, the type letter: the two unused positions hold spaces.
6018
If the Z FLAG is set (an unused position), JUMP to 6024H.
601A
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the letter of the type that is not listed.
601B
GOSUB to 5D47H to output Register A, the letter.
601E
INC C 0C
Increment Register C, the number of types not listed.
601F
LD A,2CH 3E 2C
Load Register A with 2CH, a comma, to separate the type letters.
6021
GOSUB to 5D47H to output Register A, the comma after the letter.
6024
INC HL 23
Increment Register Pair HL to the next type letter.
6025
INC DE 13
Increment Register Pair DE to the next enabled-type flag.
6026
Decrement Register B, the positions left; if Register B is not 0, LOOP back to 6012H.
6028
LD A,C 79
Load Register A with Register C, the number of types not listed.
6029
OR A B7
OR Register A with itself: the Z FLAG is set if every type is listed.
602A
If the Z FLAG is set (every type listed), JUMP to 6032H.
602C
LD DE,6C40H 11 40 6C
Load Register Pair DE with 6C40H, the text REFERENCE TYPE(S) ARE NOT PRINTED followed by four asterisks, after the letters.
602F
GOSUB to 5D17H to output the text at Register Pair DE and a carriage return.
6032
GOSUB to 5D1AH to output a blank line before the first referencee.
6035
LD IX,6FA0H DD 21 A0 6F
Load Index Register IX with 6FA0H, the marker before the first table entry.
6039
LD HL,5564H 21 64 55
Load Register Pair HL with 5564H, the start of the listing line buffer.
603C
JUMP to 60ADH to read the first table entry through Index Register IX.

603EH - Listing: Output the Line, Keys

Outputs the line built in 5564H up to Register Pair HL (nothing if it is empty) and a carriage return, then checks the keyboard: X ends the disassembly, P waits for ENTER (or X). The buffer is filled with spaces again and Register Pair HL = 5564H. Register Pair DE is kept.

603E
PUSH DE D5
Save Register Pair DE (the caller's location) on the stack.
603F
LD DE,5564H 11 64 55
Load Register Pair DE with 5564H, the start of the line buffer.
6042
GOSUB to 5EA9H to subtract Register Pair DE (5564H) from Register Pair HL (the next free position): Register L = the line's length, the Z FLAG if empty.
6045
LD B,L 45
Load Register B with Register L, the line's length; LD does not change the flags.
6046
If the NZ FLAG is set (the line is not empty), GOSUB to 5D3AH to output Register B characters from Register Pair DE and a carriage return.
6049
GOSUB to 5CE0H to scan the keyboard: Register A = the key pressed (upper case), 00H if none.
604C
CP 58H FE 58
Compare Register A (the key) against 58H, the letter X.
604E
If the Z FLAG is set (X), JUMP to 5CF2H to display FUNCTION CANCELLED and ask ANOTHER DISASSEMBLY?.
6051
CP 50H FE 50
Compare Register A (the key) against 50H, the letter P.
6053
If the NZ FLAG is set (not P), JUMP to 6061H.

Pause Loop
Waits for ENTER or X.

6055
GOSUB to 5CD2H to wait for a key: Register A = the key, in upper case.
6058
CP 58H FE 58
Compare Register A (the key) against 58H, the letter X.
605A
If the Z FLAG is set (X), JUMP to 5CF2H to display FUNCTION CANCELLED and ask ANOTHER DISASSEMBLY?.
605D
CP 0DH FE 0D
Compare Register A (the key) against 0DH, ENTER.
605F
If the NZ FLAG is set (another key), LOOP back to 6055H.
6061
GOSUB to 5E9CH to fill the line buffer with spaces: Register Pair HL = 5564H.
6064
POP DE D1
Restore Register Pair DE from the stack: the caller's location.
6065
RET C9
RETURN with Register Pair HL at the start of the empty line.

6066H - Listing: A Referencee

Outputs the line of the previous referencee and, unless this is the end marker, starts a new line with the referencee's location if at least one of its referencers is of a listed type (referencers of other types at the start are passed over). A referencee followed by no referencer at all, such as the entry point added at 5943H, is listed alone.

6066
GOSUB to 603EH to output the previous line and check the keyboard: Register Pair HL = 5564H, a new empty line.
6069
BIT 7,(IX+00H) DD CB 00 7E
Test bit 7 of the byte at Index Register IX+00H, the entry's control byte: set only for the end marker.
606D
If the Z FLAG is set (a referencee), JUMP to 6078H.
606F
LD DE,6C20H 11 20 6C
Load Register Pair DE with 6C20H, the message END OF LOCATION REFERENCE TABLE.
6072
GOSUB to 5D17H to output the message at Register Pair DE and a carriage return.
6075
JUMP to 5CFDH to switch the output back to the display and ask ANOTHER DISASSEMBLY?.
6078
LD IY,60E2H FD 21 E2 60
Load Index Register IY with 60E2H, the enabled-type flags.
607C
LD B,00H 06 00
Load Register B with 00H, the high byte of the offset.
607E
LD A,20H 3E 20
Load Register A with 20H, the flag of a type that is not listed.
6080
LD C,(IX+03H) DD 4E 03
Load Register C with the byte at Index Register IX+03H, the control byte of the next entry (a referencer's type 00H-0AH; 40H or C0H if no referencer follows): Register Pair BC = the offset of its flag.
6083
ADD IY,BC FD 09
Add Register Pair BC to Index Register IY: Index Register IY = the type's flag at 60E2H-60ECH (for 40H or C0H a byte of the code, never a space).
6085
CP (IY+00H) FD BE 00
Compare Register A (20H) against the byte at Index Register IY+00H, the flag.
6088
If the NZ FLAG is set (the type is listed, or no referencer follows), JUMP to 6098H to start the line.
608A
INC IX DD 23
Increment Index Register IX past one byte of the referencer that is not listed.
608C
INC IX DD 23
Increment Index Register IX past a second byte.
608E
INC IX DD 23
Increment Index Register IX to that referencer's control byte.
6090
BIT 6,(IX+03H) DD CB 03 76
Test bit 6 of the byte at Index Register IX+03H, the control byte of the entry after it: set for the next referencee or the end marker.
6094
If the Z FLAG is set (another referencer), LOOP back to 6078H to test its type.
6096
JUMP to 60ADH: no referencer of this location is listed, so the location is left out.
6098
GOSUB to 669BH to write Register Pair DE (the referencee's location) at Register Pair HL as four hexadecimal digits.
609B
INC HL 23
Increment Register Pair HL past the type letter (or the column after the location).
609C
INC HL 23
Increment Register Pair HL past one space: the next column.
609D
LD DE,559FH 11 9F 55
Load Register Pair DE with 559FH, the last position at which a new column may start.
60A0
GOSUB to 5EA9H to subtract Register Pair DE (559FH) from Register Pair HL: the S FLAG is set while there is room on the line.
60A3
ADD HL,DE 19
Add Register Pair DE back to Register Pair HL: the next free position again; ADD HL does not change the S FLAG.
60A4
If the S FLAG is set (M: room on the line), JUMP to 60ADH for the next entry.
60A7
GOSUB to 603EH to output the full line and check the keyboard.
60AA
LD HL,556AH 21 6A 55
Load Register Pair HL with 556AH, six columns into the new line: continuation lines start under the first referencer.

60ADH - Listing: Next Entry, a Referencer

Reads the next table entry through Index Register IX into Register Pair DE (its location) and its control byte. A referencer of a listed type is written as its location and type letter.

60AD
INC IX DD 23
Increment Index Register IX from the previous control byte to the entry's first byte.
60AF
LD D,(IX+00H) DD 56 00
Load Register D with the byte at Index Register IX+00H, the high byte of the entry's location.
60B2
INC IX DD 23
Increment Index Register IX to the entry's second byte.
60B4
LD E,(IX+00H) DD 5E 00
Load Register E with the byte at Index Register IX+00H: Register Pair DE = the entry's location.
60B7
INC IX DD 23
Increment Index Register IX to the entry's control byte.
60B9
BIT 6,(IX+00H) DD CB 00 76
Test bit 6 of the byte at Index Register IX+00H, the control byte: set for a referencee and for the end marker.
60BD
If the NZ FLAG is set (a referencee or the end), LOOP back to 6066H.
60BF
LD B,00H 06 00
Load Register B with 00H, the high byte of the offset.
60C1
LD C,(IX+00H) DD 4E 00
Load Register C with the byte at Index Register IX+00H, the referencer's type: Register Pair BC = the offset of its flag.
60C4
PUSH HL E5
Save Register Pair HL, the next free position on the line, on the stack.
60C5
LD HL,60E2H 21 E2 60
Load Register Pair HL with 60E2H, the enabled-type flags.
60C8
ADD HL,BC 09
Add Register Pair BC (the type) to Register Pair HL: the type's flag.
60C9
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the flag: the type's letter, or a space if it is not listed.
60CA
CP 20H FE 20
Compare Register A (the flag) against 20H, a space.
60CC
POP HL E1
Restore Register Pair HL from the stack: the next free position; POP does not change the flags.
60CD
If the Z FLAG is set (the type is not listed), JUMP to 609BH, which still moves the position on by two columns.
60CF
PUSH AF F5
Save Register Pair AF (Register A = the type letter) on the stack.
60D0
GOSUB to 669BH to write Register Pair DE (the referencing location) at Register Pair HL as four hexadecimal digits.
60D3
POP AF F1
Restore Register Pair AF from the stack: Register A = the type letter.
60D4
LD (HL),A 77
Store Register A (the type letter) at Register Pair HL, after the location.
60D5
JUMP to 609BH to move on to the next column of the line.

60D7H - Reference Type Letters and Flags

Data. 60D7H holds the eleven type letters in type number order (types 6 and 7 are not used and hold spaces); 60E2H holds the enabled-type flags, a type's letter when it is listed and a space when not, all spaces in the file and set by 5BCDH (REA by default, then RE and RI).

60D7-60E1
DEFM "STUVWX PLR" 53 54 55 56 57 58 20 20 50 4C 52
Data: the letters of the reference types 0-10: S (LD rr,(nn)), T (LD A,(nn) and IN A,(n)), U (LD rr,nn), V (LD r,n and the 8-bit immediate operations), W (LD (nn),rr), X (LD (nn),A and OUT (n),A), two unused, P (JP), L (CALL), R (JR and DJNZ).
60E2-60EC
DEFM " " 20 20 20 20 20 20 20 20 20 20 20
Data: the enabled-type flags for the types 0-10, eleven spaces in the file; 5BCDH stores each type's letter (listed) or a space (not listed), and 60C9H and 6085H test them.

60EDH - Decode One Instruction

Builds the output line for the instruction at the virtual location 55E5H. The 64-character line at 55A4H-55E3H is: 55A4H-55A5H the reference mark (count and byte mask), 55A6H the location (four hexadecimal digits), 55ABH the instruction's bytes (two digits each), 55B5H the label (the location's name, STD only), 55BDH the mnemonic, 55C5H the operands, 55D3H the bytes as ASCII. The state (virtual location, real pointer, byte count, table scan pointer) is saved on the stack first; an opcode that is not valid, an index prefix left unused, or the byte count running out inside the instruction makes 618AH restore it and decode the first byte again as DEFB (55F1H = FFH). 60EDH starts with 55F1H = 00H; 60EEH is entered from 619FH with Register A = FFH.

60ED
XOR A AF
Load Register A with 00H (XOR A with itself): a normal instruction, no DEFB pending.
60EE
LD (55F1H),A 32 F1 55
Store Register A at 55F1H, the reference mark: 00H normally, FFH when the instruction must be shown as DEFB.
60F1
LD HL,55A4H 21 A4 55
Load Register Pair HL with 55A4H, the start of the output line.
60F4
LD B,40H 06 40
Load Register B with 40H, the 64 characters of the output line.

Clear Loop
Register Pair HL = the next position of the output line, Register B = the positions left.

60F6
LD (HL),20H 36 20
Store 20H (a space) at Register Pair HL in the output line.
60F8
INC HL 23
Increment Register Pair HL to the next position of the output line.
60F9
Decrement Register B, the positions left; if Register B is not 0, LOOP back to 60F6H.
60FB
LD HL,55A6H 21 A6 55
Load Register Pair HL with 55A6H, the location column of the output line.
60FE
LD DE,(55E5H) ED 5B E5 55
Load Register Pair DE with the 16-bit value at 55E5H, the virtual location of the instruction.
6102
PUSH DE D5
Save Register Pair DE (the instruction's location) on the stack.
6103
GOSUB to 669BH to write Register Pair DE (the location) at Register Pair HL (55A6H) as four hexadecimal digits.
6106
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
6109
AND 21H E6 21
Mask Register A (the flags) against 21H (0010 0001) to keep STD (bit 5) and the build pass (bit 0).
610B
CP 20H FE 20
Compare Register A against 20H: the Z FLAG is set when STD source text is being written.
610D
POP DE D1
Restore Register Pair DE from the stack: the instruction's location; POP does not change the flags.
610E
LD A,02H 3E 02
Load Register A with 02H for 66C1H: bit 1 marks the name as used on an instruction; bit 0 clear, so a location without a name is not an error.
6110
LD HL,55B5H 21 B5 55
Load Register Pair HL with 55B5H, the label field of the output line.
6113
If the Z FLAG is set (writing source text), GOSUB to 66C1H to write the location's name, if it has one, in the label field.
6116
LD A,02H 3E 02
Load Register A with 02H, the number of the pair HL in the pair name table at 6824H.
6118
LD (5610H),A 32 10 56
Store Register A (02H) at 5610H: (HL) and HL mean HL until a DD or FD prefix says otherwise.
611B
XOR A AF
Load Register A with 00H (XOR A with itself).
611C
LD (560FH),A 32 0F 56
Store Register A (00H) at 560FH: no index prefix has been read.
611F
LD (560EH),A 32 0E 56
Store Register A (00H) at 560EH, a byte nothing else uses.
6122
LD (6187H),SP ED 73 87 61
Self-Modifying Code
Store the Stack Pointer at 6187H, the operand of the LD SP,0000H at 6186H, so the decoder can return from any depth.
6126
LD HL,(55E5H) 2A E5 55
Load Register Pair HL with the 16-bit value at 55E5H, the virtual location of the instruction.
6129
LD (55EBH),HL 22 EB 55
Store Register Pair HL at 55EBH, the location of the instruction being decoded (the referencing location for the table).
612C
PUSH HL E5
Save Register Pair HL (the virtual location) on the stack, for a restart.
612D
LD HL,(55E7H) 2A E7 55
Load Register Pair HL with the 16-bit value at 55E7H, the real pointer to the instruction's first byte.
6130
LD (55EDH),HL 22 ED 55
Store Register Pair HL at 55EDH, the real address of the instruction, for the ASCII column.
6133
PUSH HL E5
Save Register Pair HL (the real pointer) on the stack, for a restart.
6134
LD HL,(560BH) 2A 0B 56
Load Register Pair HL with the 16-bit value at 560BH, the bytes still to be disassembled.
6137
PUSH HL E5
Save Register Pair HL (the byte count) on the stack, for a restart.
6138
LD HL,(55F6H) 2A F6 55
Load Register Pair HL with the 16-bit value at 55F6H, the reference table scan pointer.
613B
PUSH HL E5
Save Register Pair HL (the scan pointer) on the stack, for a restart.
613C
LD (618BH),SP ED 73 8B 61
Self-Modifying Code
Store the Stack Pointer (now below the four saved words) at 618BH, the operand of the LD SP,0000H at 618AH, so a restart finds them.
6140
LD HL,55ABH 21 AB 55
Load Register Pair HL with 55ABH, the column of the instruction's bytes.
6143
LD (5609H),HL 22 09 56
Store Register Pair HL (55ABH) at 5609H, where 6592H writes each byte fetched as two hexadecimal digits.
6146
LD HL,55C5H 21 C5 55
Load Register Pair HL with 55C5H, the operand field: the decoder writes the operands from here.
6149
GOSUB to 61A2H to decode the instruction: the mnemonic goes to 55BDH, the operands to Register Pair HL.
614C
LD A,(560FH) 3A 0F 56
Load Register A with the byte at 560FH, the index prefix state.
614F
OR A B7
OR Register A with itself: the NZ FLAG is set if a DD or FD prefix was read but no IX or IY operand used it.
6150
If the NZ FLAG is set (the prefix does not belong to the instruction), JUMP to 618AH to show the prefix as DEFB instead.
6153
LD DE,(55EDH) ED 5B ED 55
Load Register Pair DE with the 16-bit value at 55EDH, the real address of the instruction's first byte.
6157
LD HL,55D3H 21 D3 55
Load Register Pair HL with 55D3H, the ASCII column of the output line.
615A
LD A,(5613H) 3A 13 56
Load Register A with the byte at 5613H, the lowest character code shown as a period (80H, or the printer limit).
615D
LD C,A 4F
Load Register C with Register A, the lowest code shown as a period.
615E
LD A,(55E7H) 3A E7 55
Load Register A with the byte at 55E7H, the low byte of the real pointer after the instruction.
6161
SUB E 93
Subtract Register E (the low byte of the instruction's real address) from Register A: the instruction's length.
6162
LD B,A 47
Load Register B with Register A, the instruction's length (1-4).

ASCII Loop
Register Pair DE = the next byte of the instruction, Register Pair HL = the ASCII column, Register B = the bytes left.

6163
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next byte of the instruction.
6164
CP 20H FE 20
Compare Register A (the byte) against 20H: the CARRY FLAG is set for a control code.
6166
INC DE 13
Increment Register Pair DE to the next byte; INC DE does not change the flags.
6167
If the CARRY FLAG is set (below 20H), JUMP to 616CH to show a period.
6169
CP C B9
Compare Register A (the byte) against Register C, the lowest code shown as a period: the CARRY FLAG is set below it.
616A
If the CARRY FLAG is set (a printable character), JUMP to 616EH to show it.
616C
LD A,2EH 3E 2E
Load Register A with 2EH, a period, for a byte that is not shown as a character.
616E
LD (HL),A 77
Store Register A (the character, or the period) at Register Pair HL in the ASCII column.
616F
INC HL 23
Increment Register Pair HL to the next position of the ASCII column.
6170
Decrement Register B, the bytes left; if Register B is not 0, LOOP back to 6163H.
6172
LD A,(55F1H) 3A F1 55
Load Register A with the byte at 55F1H, the reference mark of the instruction (bits 4-7 the references counted, bits 0-3 the bytes referenced).
6175
OR A B7
OR Register A with itself: the Z FLAG is set when the instruction is not referenced.
6176
If the Z FLAG is set (not referenced), JUMP to 6186H.
6178
LD HL,55A4H 21 A4 55
Load Register Pair HL with 55A4H, the first two columns of the output line.
617B
GOSUB to 66A0H to write Register A (the reference mark) at Register Pair HL as two hexadecimal digits: the count, then the byte mask.
617E
DEC HL 2B
Decrement Register Pair HL back to the second column, the byte mask digit.
617F
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the byte mask digit.
6180
CP 38H FE 38
Compare Register A (the digit) against 38H, the digit 8: only the first byte is referenced.
6182
If the NZ FLAG is set (other bytes are referenced too), JUMP to 6186H.
6184
LD (HL),20H 36 20
Store 20H (a space) at Register Pair HL: a blank second column means that only the instruction's first byte is referenced.
6186
LD SP,0000H 31 00 00
Self-Modifying Code
Load the Stack Pointer with the operand at 6187H (0000H in the file; the value saved at 6122H): the four saved words are dropped.
6189
RET C9
RETURN to the disassembly loop with the output line built.

618AH - Decode Again as DEFB

Reached when the instruction cannot be decoded: an opcode that is not valid (64E0H, 645EH), a second index prefix (63B7H), a prefix no operand used (6150H), or the byte count running out inside the instruction (6598H). The saved state is restored, so the virtual location, the real pointer, the byte count and the table scan pointer are back at the instruction's first byte, and it is decoded again with 55F1H = FFH, which makes 61A2H show that one byte as DEFB.

618A
LD SP,0000H 31 00 00
Self-Modifying Code
Load the Stack Pointer with the operand at 618BH (0000H in the file; the value saved at 613CH): the four saved words are on top again.
618D
POP HL E1
Restore Register Pair HL from the stack: the saved reference table scan pointer.
618E
LD (55F6H),HL 22 F6 55
Store Register Pair HL at 55F6H, the reference table scan pointer, as it was before the instruction.
6191
POP HL E1
Restore Register Pair HL from the stack: the saved byte count.
6192
LD (560BH),HL 22 0B 56
Store Register Pair HL at 560BH, the bytes still to be disassembled, as it was before the instruction.
6195
POP HL E1
Restore Register Pair HL from the stack: the saved real pointer.
6196
LD (55E7H),HL 22 E7 55
Store Register Pair HL at 55E7H, the real pointer, back at the instruction's first byte.
6199
POP HL E1
Restore Register Pair HL from the stack: the saved virtual location.
619A
LD (55E5H),HL 22 E5 55
Store Register Pair HL at 55E5H, the virtual location, back at the instruction's first byte.
619D
LD A,FFH 3E FF
Load Register A with FFH, the mark that the instruction must be shown as DEFB.
619F
JUMP to 60EEH to build the line again with 55F1H = FFH.

61A2H - Opcode Decoder: First Byte

Register Pair HL = the operand field (55C5H) throughout the decoder. With 55F1H not 00H the byte is shown as DEFB (626DH). Otherwise the opcode is fetched (6592H) and kept at 560DH; its bit fields are read with 6727H (bits 5-4), 673BH (bits 5-3) and 6743H (bits 2-0). 40H-7FH are LD r,r' and HALT, 80H-BFH the arithmetic and logic group; 00H-3FH and C0H-FFH are sorted by testing their bits. Each path writes the mnemonic (67A6H, into 55BDH) and the operands, and ends in a helper whose RET goes back to 614CH.

61A2
LD A,(55F1H) 3A F1 55
Load Register A with the byte at 55F1H, the reference mark: FFH when 618AH wants this byte shown as DEFB.
61A5
OR A B7
OR Register A with itself: the NZ FLAG is set when the mark is not 00H.
61A6
If the NZ FLAG is set (show as DEFB), JUMP to 626DH.
61A9
GOSUB to 6592H to fetch the next object byte into Register A: the opcode (also entered from 63B4H after a DD or FD prefix).
61AC
LD (560DH),A 32 0D 56
Store Register A (the opcode) at 560DH, where the field helpers read it.
61AF
CP 40H FE 40
Compare Register A (the opcode) against 40H: the CARRY FLAG is set for 00H-3FH.
61B1
If the CARRY FLAG is set (00H-3FH), JUMP to 61EAH.
61B4
CP C0H FE C0
Compare Register A (the opcode) against C0H: the NO CARRY FLAG is set for C0H-FFH.
61B6
If the NO CARRY FLAG is set (C0H-FFH), JUMP to 62F3H.
61B9
CP 80H FE 80
Compare Register A (the opcode) against 80H: the NO CARRY FLAG is set for 80H-BFH.
61BB
If the NO CARRY FLAG is set (80H-BFH, the arithmetic and logic group), JUMP to 61D4H.
61BD
LD DE,6886H 11 86 68
40H-7FH: load Register Pair DE with 6886H, the mnemonic HALT.
61C0
CP 76H FE 76
Compare Register A (the opcode) against 76H, HALT (the place of LD (HL),(HL)).
61C2
If the Z FLAG is set (76H), JUMP to 67CEH to write the mnemonic at Register Pair DE (HALT); there are no operands.
61C5
GOSUB to 67CBH to write the mnemonic LD into the mnemonic field at 55BDH.
61C8
GOSUB to 673BH: Register A = bits 5-3 of the opcode, the destination register (0-7: B C D E H L (HL) A).
61CB
GOSUB to 655CH to write the register in Register A, or (HL), (IX+d) or (IY+d) for 6, at Register Pair HL.
61CE
GOSUB to 674EH to write a comma at Register Pair HL.
61D1
JUMP to 6559H to write the source register, bits 2-0 of the opcode, and return (also the end of the 80H-BFH group).
61D4
80H-BFH: GOSUB to 673BH: Register A = bits 5-3 of the opcode, the operation (0-7: ADD ADC SUB SBC AND XOR OR CP).
61D7
GOSUB to 67A3H to write mnemonic number Register A of the table at 6832H.
61DA
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
61DD
CP 90H FE 90
Compare Register A (the opcode) against 90H: the CARRY FLAG is set for 80H-8FH, ADD and ADC.
61DF
If the CARRY FLAG is set (ADD or ADC), JUMP to 61E5H.
61E1
SUB 98H D6 98
Subtract 98H from Register A (the opcode): 98H-9FH (SBC) become 00H-07H.
61E3
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG is set for SBC.
61E5
If the CARRY FLAG is set (ADD, ADC or SBC), GOSUB to 6752H to write A and a comma first.
61E8
JUMP to 61D1H, which writes the source register.

61EAH - Opcode Decoder: 00H-3FH

Sorted by bits 0, 1, 2, 5 and 3 of the opcode in Register A. With all of them clear the opcode is 00H (NOP) or 10H (DJNZ); bit 5 alone gives JR cc (20H-38H), bit 3 alone 08H (EX AF,AF') or 18H (JR). A relative jump's target is computed from the location after the offset byte and written as a word with reference type R (0AH).

61EA
BIT 0,A CB 47
Test bit 0 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
61EC
If the NZ FLAG is set (an odd opcode), JUMP to 62A9H.
61EF
BIT 1,A CB 4F
Test bit 1 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
61F1
If the NZ FLAG is set (x2H, x6H, xAH, xEH), JUMP to 624BH.
61F3
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
61F5
If the NZ FLAG is set (x4H, xCH: INC r), JUMP to 6242H.
61F7
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
61F9
If the NZ FLAG is set (20H, 28H, 30H, 38H: JR cc), JUMP to 6225H.
61FB
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
61FD
If the NZ FLAG is set (08H or 18H), JUMP to 6233H.
61FF
LD DE,686AH 11 6A 68
Load Register Pair DE with 686AH, the mnemonic NOP.
6202
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: clear for 00H, set for 10H.
6204
If the Z FLAG is set (00H), JUMP to 67CEH to write the mnemonic at Register Pair DE (NOP).
6207
LD DE,6866H 11 66 68
10H: load Register Pair DE with 6866H, the mnemonic DJNZ.
620A
GOSUB to 67CEH to write the mnemonic at Register Pair DE (DJNZ).
620D
GOSUB to 6592H to fetch the next object byte into Register A: the relative offset.
6210
LD B,00H 06 00
Load Register B with 00H, the high byte of a positive offset.
6212
LD DE,(55E5H) ED 5B E5 55
Load Register Pair DE with the 16-bit value at 55E5H, the virtual location after the offset byte, from where the offset counts.
6216
OR A B7
OR Register A (the offset) with itself: the S FLAG is set for a backward jump.
6217
If the P FLAG is set (a forward jump), JUMP to 621BH.
621A
DEC B 05
Decrement Register B to FFH, the high byte of a negative offset.
621B
ADD A,E 83
Add Register E (the location's low byte) to Register A (the offset).
621C
LD E,A 5F
Load Register E with Register A, the target's low byte.
621D
LD A,D 7A
Load Register A with Register D, the location's high byte.
621E
ADC A,B 88
Add Register B (00H or FFH) to Register A with the CARRY FLAG: the target's high byte.
621F
LD D,A 57
Load Register D with Register A: Register Pair DE = the jump target.
6220
LD A,0AH 3E 0A
Load Register A with 0AH, reference type R (JR and DJNZ).
6222
JUMP to 665CH to record the reference and write Register Pair DE (the target) as a word (or its name).
6225
20H-38H: GOSUB to 6703H to write the condition from bits 4-3 of the opcode in Register A: NZ, Z, NC or C.
6228
GOSUB to 674EH to write a comma after the condition.
622B
LD DE,685AH 11 5A 68
Load Register Pair DE with 685AH, the mnemonic JR (18H also comes here, without a condition).
622E
GOSUB to 67CEH to write the mnemonic at Register Pair DE (JR).
6231
JUMP to 620DH to fetch the offset and write the target.
6233
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for 18H.
6235
If the NZ FLAG is set (18H, JR without a condition), JUMP to 622BH.
6237
LD DE,6C92H 11 92 6C
08H: load Register Pair DE with 6C92H, the operand text AF,AF' (kept just before the question at 6C98H).
623A
LD B,06H 06 06
Load Register B with 06H, the six characters of AF,AF'.
623C
GOSUB to 6815H to copy Register B (6) characters from Register Pair DE to Register Pair HL, the operand field.
623F
JUMP to 67BCH to write the mnemonic EX and return.
6242
x4H and xCH: GOSUB to 67C1H to write the mnemonic INC.
6245
GOSUB to 673BH: Register A = bits 5-3 of the opcode, the register (0-7: B C D E H L (HL) A).
6248
JUMP to 655CH to write the register (or (HL), (IX+d), (IY+d)) and return.

624BH - Opcode Decoder: 00H-3FH, Bit 1 Set and Bit 0 Clear

x2H, x6H, xAH and xEH, all loads: LD (BC)/(DE),A and LD A,(BC)/(DE), LD (nn),HL/A and LD HL/A,(nn) with reference types W, X, S and T, LD r,n with type V. 626DH writes a byte as DEFB, also with type V.

624B
GOSUB to 67CBH to write the mnemonic LD into the mnemonic field at 55BDH.
624E
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
6251
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6253
If the NZ FLAG is set (x6H, xEH: LD r,n), JUMP to 6279H.
6255
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6257
If the NZ FLAG is set (xAH: loads into A or HL), JUMP to 6263H.
6259
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
625B
If the NZ FLAG is set (22H, 32H: LD (nn),HL and LD (nn),A), JUMP to 6287H.
625D
02H, 12H: GOSUB to 67D9H to write (BC) or (DE), chosen by bit 4 of the opcode in Register A.
6260
JUMP to 6760H to write a comma and A, and return: LD (BC),A or LD (DE),A.
6263
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6265
If the NZ FLAG is set (2AH, 3AH: LD HL,(nn) and LD A,(nn)), JUMP to 629AH.
6267
0AH, 1AH: GOSUB to 6752H to write A and a comma.
626A
JUMP to 67D9H to write (BC) or (DE) from bit 4 of the opcode in Register A, and return: LD A,(BC) or LD A,(DE).
626D
XOR A AF
DEFB: load Register A with 00H (XOR A with itself).
626E
LD (55F1H),A 32 F1 55
Store Register A (00H) at 55F1H: the mark is cleared, and the byte's own references are counted into it again by 6592H.
6271
LD DE,68A2H 11 A2 68
Load Register Pair DE with 68A2H, the mnemonic DEFB.
6274
GOSUB to 67CEH to write the mnemonic at Register Pair DE (DEFB).
6277
JUMP to 6282H to write the byte as the operand.
6279
x6H, xEH: GOSUB to 673BH: Register A = bits 5-3 of the opcode, the register (0-7: B C D E H L (HL) A).
627C
GOSUB to 655CH to write the register (or (HL), (IX+d), (IY+d)) at Register Pair HL.
627F
GOSUB to 674EH to write a comma after the register.
6282
LD A,03H 3E 03
Load Register A with 03H, reference type V (an 8-bit value).
6284
JUMP to 667BH to fetch the byte, record it and write it (or its name), and return.
6287
LD A,04H 3E 04
22H, 32H: load Register A with 04H, reference type W (LD (nn),rr); 663AH makes it 05H, X, for 32H.
6289
GOSUB to 663AH to fetch the address, record it with the type, and write it in parentheses.
628C
GOSUB to 674EH to write a comma after the address.
628F
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
6292
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for 32H.
6294
If the Z FLAG is set (22H), JUMP to 67F5H to write HL (IX or IY after a prefix) and return.
6297
32H: JUMP to 6791H to write A at Register Pair HL and return: LD (nn),A.
629A
BIT 4,A CB 67
2AH, 3AH: test bit 4 of Register A, the opcode: set for 3AH.
629C
If the NZ FLAG is set (3AH), GOSUB to 6791H to write A; Register A and the flags are not changed by it.
629F
If the Z FLAG is set (2AH), GOSUB to 67F5H to write HL (IX or IY after a prefix).
62A2
GOSUB to 674EH to write a comma after the register.
62A5
XOR A AF
Load Register A with 00H (XOR A with itself), reference type S (LD rr,(nn)); 663AH makes it 01H, T, for 3AH.
62A6
JUMP to 663AH to fetch the address, record it with the type, write it in parentheses, and return.

62A9H - Opcode Decoder: 00H-3FH, Odd Opcodes

x1H LD rr,nn (type U), x3H/xBH INC rr and DEC rr, x5H/xDH DEC r, x7H/xFH the accumulator and flag instructions, x9H ADD HL,rr. HL as an operand becomes IX or IY after a DD or FD prefix (67F5H, 67FCH).

62A9
BIT 1,A CB 4F
Test bit 1 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
62AB
If the NZ FLAG is set (x3H, x7H, xBH, xFH), JUMP to 62D8H.
62AD
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
62AF
If the NZ FLAG is set (x5H, xDH: DEC r), JUMP to 62D2H.
62B1
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
62B3
If the NZ FLAG is set (x9H: ADD HL,rr), JUMP to 62C3H.
62B5
x1H: GOSUB to 67CBH to write the mnemonic LD.
62B8
GOSUB to 67F5H to write the register pair from bits 5-4 of the opcode (BC, DE, HL or SP; IX or IY for HL after a prefix).
62BB
GOSUB to 674EH to write a comma after the register pair.
62BE
LD A,02H 3E 02
Load Register A with 02H, reference type U (LD rr,nn).
62C0
JUMP to 664FH to fetch the 16-bit value, record it and write it (or its name), and return.
62C3
LD DE,6953H 11 53 69
x9H: load Register Pair DE with 6953H, the mnemonic ADD.
62C6
GOSUB to 67CEH to write the mnemonic at Register Pair DE (ADD).
62C9
GOSUB to 67FCH to write HL, IX or IY (the pair at 5610H) and clear the prefix state at 560FH.
62CC
GOSUB to 674EH to write a comma after the first register pair.
62CF
JUMP to 67F5H to write the register pair from bits 5-4 of the opcode (BC, DE, HL or SP; HL is the index register again after a prefix) and return.
62D2
x5H, xDH: GOSUB to 67C6H to write the mnemonic DEC.
62D5
JUMP to 6245H to write the register from bits 5-3 of the opcode and return.
62D8
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
62DA
If the NZ FLAG is set (x7H, xFH), JUMP to 62EAH.
62DC
x3H, xBH: GOSUB to 67F5H to write the register pair from bits 5-4 of the opcode (IX or IY for HL after a prefix).
62DF
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
62E2
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode: clear for INC rr (x3H), set for DEC rr (xBH).
62E4
If the Z FLAG is set (x3H), JUMP to 67C1H to write the mnemonic INC and return.
62E7
xBH: JUMP to 67C6H to write the mnemonic DEC and return.
62EA
x7H, xFH: GOSUB to 673BH: Register A = bits 5-3 of the opcode (0-7: RLCA RRCA RLA RRA DAA CPL SCF CCF).
62ED
LD DE,68A6H 11 A6 68
Load Register Pair DE with 68A6H, the table of those eight mnemonics.
62F0
JUMP to 67A6H to write mnemonic number Register A of the table at Register Pair DE, and return; there are no operands.

62F3H - Opcode Decoder: C0H-FFH

x0H/x8H RET cc, x2H/xAH JP cc,nn (type P), x4H/xCH CALL cc,nn (type L), x6H/xEH the arithmetic and logic operations with a byte (type V); the odd opcodes from 6342H. The condition comes from bits 5-3 of the opcode (66FFH).

62F3
BIT 0,A CB 47
Test bit 0 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
62F5
If the NZ FLAG is set (an odd opcode), JUMP to 6342H.
62F8
BIT 1,A CB 4F
Test bit 1 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
62FA
If the NZ FLAG is set (x2H, x6H, xAH, xEH), JUMP to 6317H.
62FC
x0H, x4H, x8H, xCH: GOSUB to 66FFH to write the condition from bits 5-3 of the opcode in Register A (NZ Z NC C PO PE P M); Register A is not changed.
62FF
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6301
If the NZ FLAG is set (x4H, xCH: CALL cc,nn), JUMP to 6309H.
6303
LD DE,6862H 11 62 68
Load Register Pair DE with 6862H, the mnemonic RET (RET cc, and C9H from 6367H).
6306
JUMP to 67CEH to write the mnemonic at Register Pair DE (RET) and return.
6309
GOSUB to 674EH to write a comma after the condition.
630C
LD DE,685EH 11 5E 68
Load Register Pair DE with 685EH, the mnemonic CALL (also CDH from 639BH).
630F
GOSUB to 67CEH to write the mnemonic at Register Pair DE (CALL).
6312
LD A,09H 3E 09
Load Register A with 09H, reference type L (CALL).
6314
JUMP to 664FH to fetch the address, record it and write it (or its name), and return.
6317
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6319
If the NZ FLAG is set (x6H, xEH: an operation with a byte), JUMP to 632CH.
631B
x2H, xAH: GOSUB to 66FFH to write the condition from bits 5-3 of the opcode in Register A.
631E
GOSUB to 674EH to write a comma after the condition.
6321
LD DE,6856H 11 56 68
Load Register Pair DE with 6856H, the mnemonic JP (also C3H from 63C8H).
6324
GOSUB to 67CEH to write the mnemonic at Register Pair DE (JP).
6327
LD A,08H 3E 08
Load Register A with 08H, reference type P (JP).
6329
JUMP to 664FH to fetch the address, record it and write it (or its name), and return.
632C
x6H, xEH: GOSUB to 67A0H to write the operation from bits 5-3 of the opcode (ADD ADC SUB SBC AND XOR OR CP).
632F
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
6332
CP D0H FE D0
Compare Register A (the opcode) against D0H: the CARRY FLAG is set for C6H and CEH, ADD and ADC.
6334
If the CARRY FLAG is set (ADD or ADC), JUMP to 633AH.
6336
SUB D8H D6 D8
Subtract D8H from Register A (the opcode): DEH (SBC) becomes 06H.
6338
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG is set for DEH.
633A
If the CARRY FLAG is set (ADD, ADC or SBC), GOSUB to 6752H to write A and a comma first.
633D
LD A,03H 3E 03
Load Register A with 03H, reference type V (an 8-bit value).
633F
JUMP to 667BH to fetch the byte, record it and write it (or its name), and return.

6342H - Opcode Decoder: C0H-FFH, Odd Opcodes

x1H POP, x5H PUSH, C9H RET, D9H EXX, E9H JP (HL), F9H LD SP,HL, CDH CALL nn, DDH/FDH the index prefixes, EDH the extended group, and from 63BAH the x3H/x7H/xBH/xFH opcodes. POP and PUSH use bits 5-4 with AF for 3.

6342
BIT 1,A CB 4F
Test bit 1 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6344
If the NZ FLAG is set (x3H, x7H, xBH, xFH), JUMP to 63BAH.
6346
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6348
If the NZ FLAG is set (x5H, xDH), JUMP to 638EH.
634A
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
634C
If the NZ FLAG is set (x9H: C9H, D9H, E9H, F9H), JUMP to 6361H.
634E
LD DE,688EH 11 8E 68
x1H: load Register Pair DE with 688EH, the mnemonic POP.
6351
GOSUB to 67CEH to write the mnemonic at Register Pair DE (POP, or PUSH from 6393H).
6354
GOSUB to 6727H: Register A = bits 5-4 of the opcode, the register pair (0-3).
6357
CP 03H FE 03
Compare Register A (the pair number) against 03H, which means AF here.
6359
If the NZ FLAG is set (BC, DE or HL), JUMP to 67F8H to write the pair (IX or IY for HL after a prefix) and return.
635C
LD A,06H 3E 06
Load Register A with 06H, the number of AF in the pair name table at 6824H.
635E
JUMP to 67F8H to write AF (pair number 6) at Register Pair HL and return.
6361
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6363
If the NZ FLAG is set (E9H, F9H), JUMP to 636FH.
6365
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for D9H.
6367
If the Z FLAG is set (C9H), JUMP to 6303H to write RET.
6369
LD DE,694FH 11 4F 69
D9H: load Register Pair DE with 694FH, the mnemonic EXX.
636C
JUMP to 67CEH to write the mnemonic at Register Pair DE (EXX) and return.
636F
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for F9H.
6371
If the NZ FLAG is set (F9H, LD SP,HL), JUMP to 6382H.
6373
LD DE,6856H 11 56 68
E9H: load Register Pair DE with 6856H, the mnemonic JP.
6376
GOSUB to 67CEH to write the mnemonic at Register Pair DE (JP).
6379
GOSUB to 6789H to write an opening parenthesis.
637C
GOSUB to 67FCH to write HL, IX or IY (the pair at 5610H) and clear the prefix state.
637F
JUMP to 678DH to write the closing parenthesis and return: JP (HL).
6382
F9H: GOSUB to 67CBH to write the mnemonic LD.
6385
GOSUB to 67F5H to write the pair from bits 5-4 of the opcode, 3: SP.
6388
GOSUB to 674EH to write a comma at Register Pair HL, after SP.
638B
JUMP to 67FCH to write HL, IX or IY and clear the prefix state, and return: LD SP,HL.
638E
LD DE,688AH 11 8A 68
x5H, xDH: load Register Pair DE with 688AH, the mnemonic PUSH.
6391
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6393
If the Z FLAG is set (x5H: PUSH), JUMP to 6351H to write PUSH and the register pair.
6395
BIT 4,A CB 67
Test bit 4 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
6397
If the NZ FLAG is set (DDH, FDH), JUMP to 63A1H.
6399
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
639B
If the Z FLAG is set (CDH: CALL nn), JUMP to 630CH.
639E
EDH: JUMP to 646DH to fetch and decode the second byte of the extended group.
63A1
BIT 5,A CB 6F
DDH, FDH: test bit 5 of Register A, the opcode: clear for DDH (IX), set for FDH (IY).
63A3
LD A,04H 3E 04
Load Register A with 04H, the number of IX in the pair name table at 6824H; LD does not change the flags.
63A5
If the Z FLAG is set (DDH), JUMP to 63A8H with Register A = 04H (IX).
63A7
INC A 3C
FDH: increment Register A to 05H, the number of IY in the pair name table.
63A8
LD (5610H),A 32 10 56
Store Register A (04H IX or 05H IY) at 5610H: HL in this instruction means that register.
63AB
LD A,(560FH) 3A 0F 56
Load Register A with the byte at 560FH, the index prefix state.
63AE
OR A B7
OR Register A with itself: the NZ FLAG is set if a prefix was read already.
63AF
LD A,01H 3E 01
Load Register A with 01H, a prefix has been read; LD does not change the flags.
63B1
LD (560FH),A 32 0F 56
Store Register A (01H) at 560FH, the index prefix state.
63B4
If the Z FLAG is set (the first prefix), JUMP to 61A9H to decode the next byte with it.
63B7
JUMP to 618AH: two prefixes in a row, so the first is shown as DEFB.

63BAH - Opcode Decoder: C0H-FFH, x3H x7H xBH xFH

C3H JP nn, D3H OUT (n),A (type X), E3H EX (SP),HL, F3H DI, x7H/xFH RST, CBH the bit group, DBH IN A,(n) (type T), EBH EX DE,HL, FBH EI.

63BA
BIT 2,A CB 57
Test bit 2 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
63BC
If the NZ FLAG is set (x7H, xFH: RST), JUMP to 6414H.
63BE
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
63C0
If the NZ FLAG is set (CBH, DBH, EBH, FBH), JUMP to 63ECH.
63C2
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
63C4
If the NZ FLAG is set (E3H, F3H), JUMP to 63D6H.
63C6
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for D3H.
63C8
If the Z FLAG is set (C3H: JP nn), JUMP to 6321H.
63CB
LD A,05H 3E 05
D3H: load Register A with 05H, reference type X (OUT (n),A).
63CD
GOSUB to 6672H to fetch the port number, record it and write it in parentheses.
63D0
GOSUB to 6760H to write a comma and A at Register Pair HL: OUT (n),A.
63D3
JUMP to 67B2H to write the mnemonic OUT and return.
63D6
LD DE,6947H 11 47 69
Load Register Pair DE with 6947H, the mnemonic DI.
63D9
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for F3H.
63DB
If the NZ FLAG is set (F3H), JUMP to 67CEH to write the mnemonic at Register Pair DE (DI) and return.
63DE
E3H: GOSUB to 67BCH to write the mnemonic EX.
63E1
LD A,03H 3E 03
Load Register A with 03H, the number of SP in the pair name table at 6824H.
63E3
GOSUB to 67E0H to write the pair Register A (SP) in parentheses.
63E6
GOSUB to 674EH to write a comma at Register Pair HL, after (SP).
63E9
JUMP to 67FCH to write HL, IX or IY and clear the prefix state, and return: EX (SP),HL.
63EC
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode fetched at 61A9H (also kept at 560DH).
63EE
If the NZ FLAG is set (EBH, FBH), JUMP to 6400H.
63F0
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for DBH.
63F2
If the Z FLAG is set (CBH), JUMP to 641FH for the bit group.
63F5
DBH: GOSUB to 6752H to write A and a comma at Register Pair HL.
63F8
LD A,01H 3E 01
Load Register A with 01H, reference type T (IN A,(n)).
63FA
GOSUB to 6672H to fetch the port number, record it and write it in parentheses.
63FD
JUMP to 67B7H to write the mnemonic IN and return.
6400
LD DE,694BH 11 4B 69
Load Register Pair DE with 694BH, the mnemonic EI.
6403
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: set for FBH.
6405
If the NZ FLAG is set (FBH), JUMP to 67CEH to write the mnemonic at Register Pair DE (EI) and return.
6408
EBH: GOSUB to 67BCH to write the mnemonic EX.
640B
GOSUB to 67E8H to write DE (pair number 1) at Register Pair HL.
640E
GOSUB to 674EH to write a comma at Register Pair HL, after DE.
6411
JUMP to 67ECH to write HL and return: EX DE,HL (a DD or FD prefix before it is left unused, so 614CH shows it as DEFB).
6414
AND 38H E6 38
x7H, xFH: mask Register A (the opcode) against 38H (0011 1000): the restart address 00H-38H.
6416
GOSUB to 668BH to write Register A (the restart address) as two hexadecimal digits and H.
6419
LD DE,6882H 11 82 68
Load Register Pair DE with 6882H, the mnemonic RST.
641C
JUMP to 67CEH to write the mnemonic at Register Pair DE (RST) and return.

641FH - Opcode Decoder: The Bit Group (CBH)

After a DD or FD prefix the displacement comes before the opcode (DD CB d op), so it is fetched first into 5611H and the prefix state becomes 03H. 00H-3FH are the rotates and shifts (30H-37H are not valid and give DEFB), 40H-7FH BIT, 80H-BFH RES, C0H-FFH SET, with the bit number from bits 5-3 written as a byte (e.g. 03H) and the register from bits 2-0.

641F
LD A,(560FH) 3A 0F 56
Load Register A with the byte at 560FH, the index prefix state.
6422
OR A B7
OR Register A with itself: the Z FLAG is set without a DD or FD prefix.
6423
If the Z FLAG is set (no prefix), JUMP to 6430H to fetch the opcode.
6425
OR 02H F6 02
OR Register A (01H) with 02H: 03H, the prefix state of the DD CB d op form.
6427
LD (560FH),A 32 0F 56
Store Register A (03H) at 560FH, the index prefix state.
642A
GOSUB to 6592H to fetch the next object byte into Register A: the displacement d.
642D
LD (5611H),A 32 11 56
Store Register A (the displacement) at 5611H, for 6578H.
6430
GOSUB to 6592H to fetch the next object byte into Register A: the second opcode byte.
6433
CP 40H FE 40
Compare Register A (the opcode) against 40H: the CARRY FLAG is set for 00H-3FH.
6435
LD (560DH),A 32 0D 56
Store Register A (the opcode) at 560DH; LD does not change the flags.
6438
If the CARRY FLAG is set (a rotate or shift), JUMP to 645AH.
643A
LD DE,6892H 11 92 68
Load Register Pair DE with 6892H, the mnemonic BIT.
643D
CP 80H FE 80
Compare Register A (the opcode) against 80H: the CARRY FLAG is set for 40H-7FH.
643F
If the CARRY FLAG is set (BIT), JUMP to 644BH.
6441
LD DE,6896H 11 96 68
Load Register Pair DE with 6896H, the mnemonic RES.
6444
CP C0H FE C0
Compare Register A (the opcode) against C0H: the CARRY FLAG is set for 80H-BFH.
6446
If the CARRY FLAG is set (RES), JUMP to 644BH.
6448
LD DE,689AH 11 9A 68
C0H-FFH: load Register Pair DE with 689AH, the mnemonic SET.
644B
GOSUB to 67CEH to write the mnemonic at Register Pair DE (BIT, RES or SET).
644E
GOSUB to 673BH: Register A = bits 5-3 of the opcode, the bit number 0-7.
6451
GOSUB to 668BH to write Register A (the bit number) as two hexadecimal digits and H.
6454
GOSUB to 674EH to write a comma after the bit number.
6457
JUMP to 6559H to write the register from bits 2-0 of the opcode (or (HL), (IX+d), (IY+d)) and return.
645A
SUB 30H D6 30
Subtract 30H from Register A (the opcode): 30H-37H become 00H-07H.
645C
CP 08H FE 08
Compare Register A against 08H: the CARRY FLAG is set for 30H-37H, which are not valid.
645E
If the CARRY FLAG is set (not valid), JUMP to 618AH to show the first byte as DEFB.
6461
GOSUB to 673BH: Register A = bits 5-3 of the opcode (0-7: RLC RRC RL RR SLA SRA, 6 not reached, SRL).
6464
LD DE,68C6H 11 C6 68
Load Register Pair DE with 68C6H, the table of those mnemonics.
6467
GOSUB to 67A6H to write mnemonic number Register A of the table at Register Pair DE.
646A
JUMP to 6559H to write the register from bits 2-0 of the opcode (or (HL), (IX+d), (IY+d)) and return.

646DH - Opcode Decoder: The Extended Group (EDH)

A0H-BFH with bit 2 clear are the block instructions (table 68E6H, 16 mnemonics). 40H-7FH: x0H/x8H IN r,(C) (70H is IN (C)), x1H/x9H OUT (C),r (71H is not valid), x2H/xAH SBC/ADC HL,rr, x3H/xBH LD (nn),rr and LD rr,(nn) (types W and S), and RRD, RLD, NEG, RETN, RETI, LD I,A, LD A,I, LD R,A, LD A,R, IM 0, IM 1, IM 2. Every other second byte is not valid and gives DEFB.

646D
GOSUB to 6592H to fetch the next object byte into Register A: the second byte of the instruction.
6470
LD (560DH),A 32 0D 56
Store Register A (the second byte) at 560DH, where the field helpers read it.
6473
BIT 7,A CB 7F
Test bit 7 of Register A, the second byte fetched at 646DH (also kept at 560DH).
6475
If the Z FLAG is set (00H-7FH), JUMP to 648DH.
6477
SUB A0H D6 A0
Subtract A0H from Register A (the second byte): A0H-BFH become 00H-1FH.
6479
CP 20H FE 20
Compare Register A against 20H: the NO CARRY FLAG is set outside A0H-BFH.
647B
If the NO CARRY FLAG is set (80H-9FH or C0H-FFH), JUMP to 64E0H: not valid.
647D
BIT 2,A CB 57
Test bit 2 of Register A: set for A4H-A7H and the like, which are not valid.
647F
If the NZ FLAG is set (not valid), JUMP to 64E0H.
6481
BIT 4,A CB 67
Test bit 4 of Register A: set for the repeating forms B0H-BBH.
6483
If the Z FLAG is set (A0H-ABH), JUMP to 6487H: Register A is already the table number (0-3 and 8-11).
6485
SUB 0CH D6 0C
Subtract 0CH from Register A: B0H-B3H become 4-7 and B8H-BBH 12-15.
6487
LD DE,68E6H 11 E6 68
Load Register Pair DE with 68E6H, the table of the 16 block mnemonics (LDI CPI INI OUTI LDIR CPIR INIR OTIR LDD CPD IND OUTD LDDR CPDR INDR OTDR).
648A
JUMP to 67A6H to write mnemonic number Register A of the table at Register Pair DE, and return; there are no operands.
648D
BIT 6,A CB 77
Test bit 6 of Register A, the second byte fetched at 646DH (also kept at 560DH).
648F
If the Z FLAG is set (00H-3FH), JUMP to 64E0H: not valid.
6491
BIT 2,A CB 57
Test bit 2 of Register A, the second byte fetched at 646DH (also kept at 560DH).
6493
If the NZ FLAG is set (x4H-x7H, xCH-xFH), JUMP to 6502H.
6495
BIT 1,A CB 4F
Test bit 1 of Register A, the second byte fetched at 646DH (also kept at 560DH).
6497
If the NZ FLAG is set (x2H, x3H, xAH, xBH), JUMP to 64C6H.
6499
BIT 0,A CB 47
Test bit 0 of Register A, the second byte fetched at 646DH (also kept at 560DH).
649B
If the NZ FLAG is set (x1H, x9H: OUT (C),r), JUMP to 64B0H.
649D
x0H, x8H: GOSUB to 673BH: Register A = bits 5-3 of the second byte, the register.
64A0
CP 06H FE 06
Compare Register A (the register) against 06H, the place of (HL): ED 70H only sets the flags.
64A2
If the Z FLAG is set (70H), JUMP to 64AAH to write just (C).
64A4
GOSUB to 655CH to write the register in Register A.
64A7
GOSUB to 674EH to write a comma after the register.
64AA
GOSUB to 6757H to write (C) at Register Pair HL, the port in Register C.
64AD
JUMP to 67B7H to write the mnemonic IN and return.
64B0
x1H, x9H: GOSUB to 6757H to write (C) at Register Pair HL, the port in Register C.
64B3
GOSUB to 674EH to write a comma at Register Pair HL, after (C).
64B6
GOSUB to 673BH: Register A = bits 5-3 of the second byte, the register.
64B9
CP 06H FE 06
Compare Register A (the register) against 06H, the place of (HL).
64BB
If the Z FLAG is set (ED 71H), JUMP to 64E0H: not valid.
64BD
GOSUB to 655CH to write the register in Register A.
64C0
JUMP to 67B2H to write the mnemonic OUT and return.
64C3
JUMP to 67B2H. Nothing branches to 64C3H: it follows the JP at 64C0H, so this row is never executed.
64C6
BIT 0,A CB 47
Test bit 0 of Register A, the second byte fetched at 646DH (also kept at 560DH).
64C8
If the NZ FLAG is set (x3H, xBH), JUMP to 64E3H.
64CA
LD DE,686EH 11 6E 68
Load Register Pair DE with 686EH, the mnemonic ADC.
64CD
BIT 3,A CB 5F
Test bit 3 of Register A, the second byte: set for xAH (ADC).
64CF
If the NZ FLAG is set (xAH), JUMP to 64D4H with ADC.
64D1
LD DE,6872H 11 72 68
x2H: load Register Pair DE with 6872H, the mnemonic SBC.
64D4
GOSUB to 67CEH to write the mnemonic at Register Pair DE (ADC or SBC).
64D7
GOSUB to 67ECH to write HL (pair number 2, never IX or IY here) at Register Pair HL.
64DA
GOSUB to 674EH to write a comma at Register Pair HL, after HL.
64DD
JUMP to 67F0H to write the register pair from bits 5-4 of the second byte (BC, DE, HL, SP) and return.
64E0
JUMP to 618AH: the instruction is not valid, so its first byte is shown as DEFB.
64E3
BIT 3,A CB 5F
Test bit 3 of Register A, the second byte: set for xBH, LD rr,(nn).
64E5
If the NZ FLAG is set (xBH: LD rr,(nn)), JUMP to 64F5H.
64E7
x3H: GOSUB to 67CBH to write the mnemonic LD.
64EA
LD A,04H 3E 04
Load Register A with 04H, reference type W (LD (nn),rr).
64EC
GOSUB to 6646H to fetch the address, record it and write it in parentheses.
64EF
GOSUB to 674EH to write a comma after the address.
64F2
JUMP to 67F0H to write the register pair from bits 5-4 of the second byte and return.
64F5
xBH: GOSUB to 67F0H to write the register pair from bits 5-4 of the second byte.
64F8
GOSUB to 674EH to write a comma after the register pair.
64FB
XOR A AF
Load Register A with 00H (XOR A with itself), reference type S (LD rr,(nn)).
64FC
GOSUB to 6646H to fetch the address, record it and write it in parentheses.
64FF
JUMP to 67CBH to write the mnemonic LD and return.
6502
EX DE,HL EB
x4H-x7H, xCH-xFH: exchange Register Pairs DE and HL: Register Pair DE keeps the operand pointer.
6503
LD HL,692AH 21 2A 69
Load Register Pair HL with 692AH, the last of the five second bytes at 6926H-692AH (67H 6FH 44H 45H 4DH).
6506
LD B,05H 06 05
Load Register B with 05H, the five second bytes to compare with.

Search Loop
Register Pair HL = the byte compared (from 692AH down), Register B = its number plus 1.

6508
CP (HL) BE
Compare Register A (the second byte) against the byte at Register Pair HL.
6509
DEC HL 2B
Decrement Register Pair HL to the byte below; DEC HL does not change the flags.
650A
If the Z FLAG is set (Register A matched the byte), JUMP to 6511H with Register B = its number plus 1.
650C
Decrement Register B, the entries left; if Register B is not 0, LOOP back to 6508H.
650E
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the operand pointer again.
650F
JUMP to 651AH for the loads with I and R and the IM instructions.
6511
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the operand pointer again.
6512
LD DE,692BH 11 2B 69
Load Register Pair DE with 692BH, the table RRD RLD NEG RETN RETI.
6515
LD A,B 78
Load Register A with Register B, the entry number plus 1 (5 for 4DH ... 1 for 67H).
6516
DEC A 3D
Decrement Register A: the mnemonic number 0-4.
6517
JUMP to 67A6H to write mnemonic number Register A of the table at Register Pair DE, and return; there are no operands.
651A
CP 47H FE 47
Compare Register A (the second byte) against 47H, LD I,A.
651C
LD B,49H 06 49
Load Register B with 49H, the letter I; LD does not change the flags.
651E
If the NZ FLAG is set (not 47H), JUMP to 6529H.
6520
GOSUB to 679DH to write Register B (the letter I or R) at Register Pair HL.
6523
GOSUB to 6760H to write a comma and A at Register Pair HL: I,A or R,A.
6526
JUMP to 67CBH to write the mnemonic LD and return.
6529
CP 57H FE 57
Compare Register A (the second byte) against 57H, LD A,I.
652B
If the NZ FLAG is set (not 57H), JUMP to 6535H.
652D
GOSUB to 6752H to write A and a comma at Register Pair HL.
6530
GOSUB to 679DH to write Register B (the letter I or R) at Register Pair HL: A,I or A,R.
6533
JUMP to 6526H to write the mnemonic LD and return.
6535
CP 4FH FE 4F
Compare Register A (the second byte) against 4FH, LD R,A.
6537
LD B,52H 06 52
Load Register B with 52H, the letter R; LD does not change the flags.
6539
If the Z FLAG is set (4FH), JUMP to 6520H to write R,A.
653B
CP 5FH FE 5F
Compare Register A (the second byte) against 5FH, LD A,R.
653D
If the Z FLAG is set (5FH), JUMP to 652DH to write A,R.
653F
LD B,30H 06 30
Load Register B with 30H, the digit 0 for IM.
6541
CP 46H FE 46
Compare Register A (the second byte) against 46H, IM 0.
6543
If the Z FLAG is set (46H), JUMP to 6550H with the digit 0.
6545
INC B 04
Increment Register B to 31H, the digit 1 for IM 1.
6546
CP 56H FE 56
Compare Register A (the second byte) against 56H, IM 1.
6548
If the Z FLAG is set (56H), JUMP to 6550H with the digit 1.
654A
INC B 04
Increment Register B to 32H, the digit 2 for IM 2.
654B
CP 5EH FE 5E
Compare Register A (the second byte) against 5EH, IM 2.
654D
If the NZ FLAG is set (no instruction with this second byte), JUMP to 64E0H: not valid.
6550
GOSUB to 679DH to write Register B, the digit 0, 1 or 2.
6553
LD DE,689EH 11 9E 68
Load Register Pair DE with 689EH, the mnemonic IM.
6556
JUMP to 67CEH to write the mnemonic at Register Pair DE (IM) and return.

6559H - Operand: A Register, (HL), (IX+d) or (IY+d)

6559H takes the register number from bits 2-0 of the opcode, 655CH from Register A (0-7: B C D E H L (HL) A). Number 6 is written as (HL), or (IX+d)/(IY+d) after a prefix: the displacement is the byte fetched now, or the one already saved at 5611H for the DD CB d op form, written as + or - and two hexadecimal digits with H. The prefix state is then cleared.

6559
GOSUB to 6743H: Register A = bits 2-0 of the opcode, the source register.
655C
CP 06H FE 06
Compare Register A (the register number) against 06H, the place of (HL).
655E
If the NZ FLAG is set (a register), JUMP to 67D1H to write its letter and return.
6561
GOSUB to 6789H to write an opening parenthesis.
6564
LD A,(5610H) 3A 10 56
Load Register A with the byte at 5610H, the pair used for HL (02H HL, 04H IX, 05H IY).
6567
GOSUB to 6803H to write the pair's name: HL, IX or IY.
656A
LD A,(560FH) 3A 0F 56
Load Register A with the byte at 560FH, the index prefix state.
656D
BIT 0,A CB 47
Test bit 0 of Register A: set after a DD or FD prefix.
656F
If the Z FLAG is set (no prefix: (HL)), JUMP to 658FH for the closing parenthesis.
6571
BIT 1,A CB 4F
Test bit 1 of Register A: set for the DD CB d op form, whose displacement is already at 5611H.
6573
LD A,00H 3E 00
Load Register A with 00H; LD does not change the flags.
6575
LD (560FH),A 32 0F 56
Store Register A (00H) at 560FH: the prefix has been used by this operand.
6578
LD A,(5611H) 3A 11 56
Load Register A with the byte at 5611H, the displacement saved for the DD CB d op form.
657B
If the Z FLAG is set (bit 1 was clear: the displacement follows now), GOSUB to 6592H to fetch it into Register A.
657E
CP 80H FE 80
Compare Register A (the displacement) against 80H: the NO CARRY FLAG is set for a negative one.
6580
If the CARRY FLAG is set (0-127), JUMP to 6589H.
6582
GOSUB to 6781H to write a minus sign at Register Pair HL.
6585
NEG ED 44
Negate Register A: the size of the negative displacement (1-128).
6587
JUMP to 658CH to write the size of the displacement in Register A.
6589
GOSUB to 6785H to write a plus sign at Register Pair HL.
658C
GOSUB to 668BH to write Register A (the displacement's size) as two hexadecimal digits and H.
658F
JUMP to 678DH to write the closing parenthesis and return.

6592H - Fetch the Next Object Byte

Returns the byte at the real pointer (55E7H) in Register A and moves the real pointer and the virtual location on. The byte count at 560BH is counted down; if it is already 0 the instruction does not fit and 618AH makes it a DEFB. The byte is written as two hexadecimal digits into the byte column (5609H). In the listing pass with a reference table (bit 1 of 55EFH) the byte's location is looked up from the scan pointer 55F6H: if it is a referencee, its referencers are counted (but not 8-bit values, types V, aimed at a location below 0100H) and the count and this byte's mask bit are added into the reference mark at 55F1H. Register Pair HL and Register Pair DE are kept; Index Register IY is changed.

6592
PUSH HL E5
Save Register Pair HL (the operand pointer) on the stack.
6593
LD HL,(560BH) 2A 0B 56
Load Register Pair HL with the 16-bit value at 560BH, the object bytes still to be disassembled.
6596
LD A,H 7C
Load Register A with Register H, the high byte of the byte count.
6597
OR L B5
OR Register A with Register L, the low byte: the Z FLAG is set when no bytes are left.
6598
If the Z FLAG is set (the instruction runs past the byte count), JUMP to 618AH to show its first byte as DEFB.
659B
DEC HL 2B
Decrement Register Pair HL, the byte count: this byte is used.
659C
LD (560BH),HL 22 0B 56
Store Register Pair HL, the new byte count, at 560BH.
659F
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
65A2
AND 02H E6 02
Mask Register A (the flags) against 02H to keep bit 1, the listing pass with a reference table.
65A4
If the Z FLAG is set (no table to look in), JUMP to 6620H to take the byte.
65A6
PUSH DE D5
Save Register Pair DE (the caller's value) on the stack.
65A7
LD DE,(55E5H) ED 5B E5 55
Load Register Pair DE with the 16-bit value at 55E5H, the virtual location of this byte.
65AB
LD IY,(55F6H) FD 2A F6 55
Load Index Register IY with the 16-bit value at 55F6H, the scan pointer: the first referencee not below the previous byte.

Scan Loop
Index Register IY = a referencee entry, Register Pair DE = the byte's location.

65AF
BIT 7,(IY+02H) FD CB 02 7E
Test bit 7 of the byte at Index Register IY+02H, the entry's control byte: set for the end marker.
65B3
If the NZ FLAG is set (the end of the table), JUMP to 661FH: this byte is not referenced.
65B5
LD A,D 7A
Load Register A with Register D, the high byte of the byte's location.
65B6
CP (IY+00H) FD BE 00
Compare Register A against the byte at Index Register IY+00H, the high byte of the referencee's location.
65B9
If the NZ FLAG is set (the high bytes differ), JUMP to 65BFH with the CARRY FLAG from them.
65BB
LD A,E 7B
Load Register A with Register E, the low byte of the byte's location.
65BC
CP (IY+01H) FD BE 01
Compare Register A against the byte at Index Register IY+01H, the low byte of the referencee's location.
65BF
If the CARRY FLAG is set (the byte is below the referencee), JUMP to 661FH: not referenced.
65C1
If the Z FLAG is set (the byte is the referencee's location), JUMP to 65D5H to count its references.

Next Referencee Loop
Moves Index Register IY past the referencer entries.

65C3
INC IY FD 23
Increment Index Register IY past one byte of the entry.
65C5
INC IY FD 23
Increment Index Register IY past a second byte.
65C7
INC IY FD 23
Increment Index Register IY to the next entry.
65C9
BIT 6,(IY+02H) FD CB 02 76
Test bit 6 of the byte at Index Register IY+02H, the next entry's control byte: set for a referencee or the end marker.
65CD
If the Z FLAG is set (a referencer), LOOP back to 65C3H.
65CF
LD (55F6H),IY FD 22 F6 55
Store Index Register IY (the next referencee) at 55F6H, the scan pointer.
65D3
LOOP back to 65AFH to compare the byte with it.
65D5
LD HL,(55EBH) 2A EB 55
Load Register Pair HL with the 16-bit value at 55EBH, the location of the instruction's first byte.
65D8
GOSUB to 5EA9H to subtract Register Pair DE (this byte's location) from Register Pair HL: Register L = 00H, FFH, FEH or FDH for the first to fourth byte.
65DB
LD A,10H 3E 10
Load Register A with 10H, the mask bit one place above the first byte's (08H).
65DD
DEC L 2D
Decrement Register L, the negated position minus 1.

Mask Loop
Shifts the mask bit right once for each byte position.

65DE
RRCA 0F
Rotate Register A (the mask bit) right one place.
65DF
INC L 2C
Increment Register L, counting the position up to 0.
65E0
If the NZ FLAG is set (more places), LOOP back to 65DEH: Register A = 08H, 04H, 02H or 01H for the first to fourth byte.

Referencer Loop
Index Register IY = the previous entry, Register A = the count (bits 4-7) and the mask bit.

65E2
INC IY FD 23
Increment Index Register IY past one byte of the entry.
65E4
INC IY FD 23
Increment Index Register IY past a second byte.
65E6
INC IY FD 23
Increment Index Register IY to the next entry.
65E8
BIT 6,(IY+02H) FD CB 02 76
Test bit 6 of the byte at Index Register IY+02H, the entry's control byte: set for the next referencee or the end marker.
65EC
If the NZ FLAG is set (no more referencers), JUMP to 660EH.
65EE
PUSH AF F5
Save Register Pair AF (Register A = the count and mask) on the stack.
65EF
LD A,(55E6H) 3A E6 55
Load Register A with the byte at 55E6H, the high byte of the byte's location.
65F2
OR A B7
OR Register A with itself: the NZ FLAG is set for a location of 0100H or higher.
65F3
If the NZ FLAG is set (not below 0100H), JUMP to 6605H to count the reference.
65F5
LD A,(IY+02H) FD 7E 02
Load Register A with the byte at Index Register IY+02H, the referencer's type.
65F8
CP 08H FE 08
Compare Register A (the type) against 08H: the NO CARRY FLAG is set for P, L and R.
65FA
If the NO CARRY FLAG is set (a jump or call), JUMP to 6605H to count it.
65FC
AND 03H E6 03
Mask Register A (the type) against 03H (0000 0011) to keep its low two bits.
65FE
XOR 03H EE 03
XOR Register A with 03H: the Z FLAG is set for type 3, V, an 8-bit value.
6600
If the NZ FLAG is set (types S, T, U, W, X), JUMP to 6605H to count it.
6602
POP AF F1
Restore Register Pair AF from the stack: Register A = the count and mask, without this reference.
6603
LOOP back to 65E2H: an 8-bit value is not counted as a reference to a location below 0100H.
6605
POP AF F1
Restore Register Pair AF from the stack: Register A = the count and mask.
6606
CP F0H FE F0
Compare Register A against F0H: the NO CARRY FLAG is set when the count is already 15.
6608
If the NO CARRY FLAG is set (the count stays at 15), LOOP back to 65E2H.
660A
ADD A,10H C6 10
Add 10H to Register A: one more reference in bits 4-7.
660C
LOOP back to 65E2H for the next referencer, with the count in Register A.
660E
LD (55F6H),IY FD 22 F6 55
Store Index Register IY (the next referencee) at 55F6H, the scan pointer for the next byte.
6612
CP 10H FE 10
Compare Register A (the count and mask) against 10H: the CARRY FLAG is set if no reference was counted.
6614
If the CARRY FLAG is set, JUMP to 661FH without changing the mark.
6616
LD HL,55F1H 21 F1 55
Load Register Pair HL with 55F1H, the instruction's reference mark.
6619
ADD A,(HL) 86
Add the byte at Register Pair HL (the mark) to Register A: the counts add and the mask bit joins the others.
661A
If the NO CARRY FLAG is set (the count fits), JUMP to 661EH.
661C
OR F0H F6 F0
OR Register A with F0H: the count stays at 15.
661E
LD (HL),A 77
Store Register A at Register Pair HL (55F1H), the new reference mark.
661F
POP DE D1
Restore Register Pair DE from the stack: the caller's value.
6620
LD HL,(55E7H) 2A E7 55
Load Register Pair HL with the 16-bit value at 55E7H, the real pointer.
6623
LD A,(HL) 7E
Load Register A with the byte at Register Pair HL, the object byte.
6624
INC HL 23
Increment Register Pair HL, the real pointer, to the next byte.
6625
LD (55E7H),HL 22 E7 55
Store Register Pair HL at 55E7H, the real pointer.
6628
LD HL,(55E5H) 2A E5 55
Load Register Pair HL with the 16-bit value at 55E5H, the virtual location.
662B
INC HL 23
Increment Register Pair HL, the virtual location, past this byte.
662C
LD (55E5H),HL 22 E5 55
Store Register Pair HL at 55E5H, the virtual location.
662F
LD HL,(5609H) 2A 09 56
Load Register Pair HL with the 16-bit value at 5609H, the next position in the byte column.
6632
GOSUB to 66A0H to write Register A (the object byte) at Register Pair HL as two hexadecimal digits; Register A is kept.
6635
LD (5609H),HL 22 09 56
Store Register Pair HL, the position after the two digits, at 5609H.
6638
POP HL E1
Restore Register Pair HL from the stack: the operand pointer.
6639
RET C9
RETURN with the object byte in Register A and the pointers moved on.

663AH - Operands: Addresses, Values and Names

663AH (type in Register A, plus 1 when bit 4 of the opcode is set) and 6646H write (nnnn) for a 16-bit address, 664FH writes nnnn, 665CH writes Register Pair DE (a computed jump target), 6672H writes (nn) and 667BH nn. The value is stored as the reference type at 55F8H, recorded in the table (5EB2H, build pass only) and written in hexadecimal with a trailing H and a leading 0 when it starts with a letter. When STD source text is being written (66B6H) the value's name from the table is written instead.

663A
LD IY,560DH FD 21 0D 56
Load Index Register IY with 560DH, the opcode.
663E
BIT 4,(IY+00H) FD CB 00 66
Test bit 4 of the byte at Index Register IY+00H, the opcode: set for 32H (LD (nn),A) and 3AH (LD A,(nn)).
6642
If the Z FLAG is set (bit 4 clear: HL or another pair), JUMP to 6646H with the type in Register A.
6644
OR 01H F6 01
OR Register A with 01H: type W becomes X, and S becomes T, for the A register.
6646
GOSUB to 6789H to write an opening parenthesis at Register Pair HL.
6649
GOSUB to 664FH to fetch the address, record it with the type in Register A and write it.
664C
JUMP to 678DH to write the closing parenthesis and return.
664F
LD (55F8H),A 32 F8 55
Store Register A, the reference type, at 55F8H.
6652
GOSUB to 6592H to fetch the next object byte into Register A: the value's low byte.
6655
LD E,A 5F
Load Register E with Register A, the value's low byte.
6656
GOSUB to 6592H to fetch the next object byte into Register A: the value's high byte.
6659
LD D,A 57
Load Register D with Register A: Register Pair DE = the 16-bit value.
665A
JUMP to 665FH to record and write the value in Register Pair DE.
665C
LD (55F8H),A 32 F8 55
Store Register A, the reference type (0AH for a relative jump), at 55F8H.
665F
GOSUB to 66B6H: when STD source text is being written it writes the name of Register Pair DE and returns to this routine's caller.
6662
GOSUB to 5EB2H to record the reference to Register Pair DE in the table (build pass only).
6665
LD A,D 7A
Load Register A with Register D, the value's high byte.
6666
CP A0H FE A0
Compare Register A (the high byte) against A0H: the NO CARRY FLAG is set when the number starts with a letter A-F.
6668
If the NO CARRY FLAG is set, GOSUB to 6795H to write a 0 first, so the operand is read as a number.
666B
GOSUB to 66A0H to write Register A (the high byte) as two hexadecimal digits.
666E
LD A,E 7B
Load Register A with Register E, the value's low byte.
666F
JUMP to 6690H to write it as two hexadecimal digits and H, and return.
6672
GOSUB to 6789H to write an opening parenthesis at Register Pair HL.
6675
GOSUB to 667BH to fetch the byte, record it with the type in Register A and write it.
6678
JUMP to 678DH to write the closing parenthesis and return.
667B
LD (55F8H),A 32 F8 55
Store Register A, the reference type, at 55F8H.
667E
GOSUB to 6592H to fetch the next object byte into Register A: the 8-bit value.
6681
LD E,A 5F
Load Register E with Register A, the 8-bit value just fetched.
6682
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = the value as a location 00nnH.
6684
GOSUB to 66B6H: when STD source text is being written it writes the name of Register Pair DE and returns to this routine's caller.
6687
GOSUB to 5EB2H to record the reference to Register Pair DE in the table (build pass only).
668A
LD A,E 7B
Load Register A with Register E, the 8-bit value to write.
668B
CP A0H FE A0
Compare Register A (the byte) against A0H: the NO CARRY FLAG is set when it starts with a letter A-F.
668D
If the NO CARRY FLAG is set, GOSUB to 6795H to write a 0 first.
6690
GOSUB to 66A0H to write Register A (the byte) as two hexadecimal digits.
6693
JUMP to 6799H to write the letter H after the digits, and return.
6696
PUSH BC C5
Save Register Pair BC on the stack. Nothing calls 6696H, so this row is never executed.
6697
LD B,01H 06 01
Load Register B with 01H, one digit; never executed, since nothing reaches 6696H.
6699
JUMP to 66A7H to write one hexadecimal digit; never executed, and Register C would not hold the byte there.

669BH - Hexadecimal Digits

669BH writes Register Pair DE as four hexadecimal digits at Register Pair HL, 66A0H writes Register A as two; Register Pair HL ends after them, Register A and Register Pair BC are kept.

669B
LD A,D 7A
Load Register A with Register D, the high byte of the value.
669C
GOSUB to 66A0H to write Register A (the high byte) as two hexadecimal digits.
669F
LD A,E 7B
Load Register A with Register E, the low byte, written by 66A0H below.
66A0
PUSH BC C5
Save Register Pair BC (the caller's value) on the stack.
66A1
LD B,02H 06 02
Load Register B with 02H, the two hexadecimal digits of a byte.
66A3
LD C,A 4F
Load Register C with Register A, the byte to write.
66A4
GOSUB to 6730H: Register A = the byte's high four bits.

Digit Loop
Register A = the byte (the low four bits are written), Register C = the byte, Register B = the digits left.

66A7
AND 0FH E6 0F
Mask Register A against 0FH (0000 1111) to keep the four bits of this digit.
66A9
ADD A,90H C6 90
Add 90H to Register A: 90H-99H for 0-9, 9AH-9FH for A-F.
66AB
DAA 27
Decimal Adjust Register A: 0-9 give 90H-99H with no carry, A-F give 00H-05H with the CARRY FLAG.
66AC
ADC A,40H CE 40
Add 40H to Register A with the CARRY FLAG: D0H-D9H, or 41H-46H.
66AE
DAA 27
Decimal Adjust Register A: the ASCII digit 30H-39H or the letter 41H-46H.
66AF
LD (HL),A 77
Store Register A, the hexadecimal digit, at Register Pair HL.
66B0
LD A,C 79
Load Register A with Register C, the byte, for its low four bits.
66B1
INC HL 23
Increment Register Pair HL to the next position.
66B2
Decrement Register B, the digits left; if Register B is not 0, LOOP back to 66A7H.
66B4
POP BC C1
Restore Register Pair BC from the stack: the caller's value.
66B5
RET C9
RETURN with Register Pair HL after the two digits and Register A = the byte.

66B6H - Names

66B6H returns at once unless STD source text is being written; then it drops its caller's return address and writes the name of the value in Register Pair DE (it must be in the table). 66C1H looks Register Pair DE up: Register A bit 0 set means a missing name is an error (BAD MAIN MEMORY), bit 1 set marks the name as used on an instruction (bit 5 of the control byte). The name is written at the Register Pair HL saved on entry as three letters (66DAH: the name number in base 26, AAA = 0) and Register Pair HL returns after it.

66B6
LD A,(55EFH) 3A EF 55
Load Register A with the byte at 55EFH, the pass and option flags.
66B9
AND 21H E6 21
Mask Register A (the flags) against 21H (0010 0001) to keep STD (bit 5) and the build pass (bit 0).
66BB
CP 20H FE 20
Compare Register A against 20H: the Z FLAG is set when STD source text is being written.
66BD
RET NZ C0
If the NZ FLAG is set (no source text: the number is written), RETURN.
66BE
POP AF F1
Restore Register Pair AF from the stack, dropping the return address into 6662H or 6687H: the name replaces the number.
66BF
LD A,01H 3E 01
Load Register A with 01H for 66C1H: the value must be in the table.
66C1
PUSH HL E5
Save Register Pair HL (where the name is written) on the stack.
66C2
PUSH AF F5
Save Register Pair AF (Register A = the bits for 66C1H) on the stack.
66C3
GOSUB to 5F4DH to look Register Pair DE up: the Z FLAG with Register Pair HL at the control byte and Register Pair BC = the name number.
66C6
If the Z FLAG is set (the value has a name), JUMP to 66D0H.
66C8
POP AF F1
Restore Register Pair AF from the stack: Register A = the bits for 66C1H.
66C9
BIT 0,A CB 47
Test bit 0 of Register A: set when the value must be in the table.
66CB
If the NZ FLAG is set (it must be there but is not), JUMP to 5CF7H for BAD MAIN MEMORY.
66CE
POP AF F1
Restore Register Pair AF from the stack, dropping the saved Register Pair HL (Register Pair HL stays as the search left it).
66CF
RET C9
RETURN without a name; the caller's text is left as it is.
66D0
POP AF F1
Restore Register Pair AF from the stack: Register A = the bits for 66C1H.
66D1
BIT 1,A CB 4F
Test bit 1 of Register A: set when the name is put on an instruction.
66D3
If the Z FLAG is set (an operand), JUMP to 66D7H.
66D5
SET 5,(HL) CB EE
Set bit 5 of the byte at Register Pair HL, the referencee's control byte: its name is a label, so no EQU is written for it (5979H).
66D7
LD H,B 60
Load Register H with Register B, the high byte of the name number.
66D8
LD L,C 69
Load Register L with Register C: Register Pair HL = the name number.
66D9
POP DE D1
Restore Register Pair DE from the stack: where the name is written.
66DA
PUSH HL E5
Save Register Pair HL (the name number) on the stack.
66DB
LD HL,66FBH 21 FB 66
Load Register Pair HL with 66FBH, the two divisors minus 676 and minus 26.

Letter Loop
Register Pair HL = the divisor's address (the number on the stack), Register Pair DE = where the letter goes.

66DE
LD C,(HL) 4E
Load Register C with the byte at Register Pair HL, the divisor's low byte.
66DF
INC HL 23
Increment Register Pair HL to the divisor's high byte.
66E0
LD B,(HL) 46
Load Register B with the byte at Register Pair HL: Register Pair BC = the divisor (negative).
66E1
LD A,40H 3E 40
Load Register A with 40H, one below the letter A.
66E3
INC HL 23
Increment Register Pair HL to the next divisor.
66E4
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (at the Stack Pointer SP): Register Pair HL = the number left, and the divisor pointer is kept there.
66E5
INC A 3C
Increment Register A, the letter: one more time the divisor fits.
66E6
ADD HL,BC 09
Add Register Pair BC (the negative divisor) to Register Pair HL: the CARRY FLAG is set while the number was at least the divisor.
66E7
If the CARRY FLAG is set, LOOP back to 66E5H: Register A ends at A plus the quotient.
66E9
SBC HL,BC ED 42
Subtract Register Pair BC from Register Pair HL (the CARRY FLAG is clear): the last addition is undone, Register Pair HL = the remainder.
66EB
LD (DE),A 12
Store Register A, the letter, at Register Pair DE.
66EC
INC DE 13
Increment Register Pair DE to the next letter's place.
66ED
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (at the Stack Pointer SP): Register Pair HL = the divisor pointer, and the remainder is kept there.
66EE
LD A,L 7D
Load Register A with Register L, the low byte of the divisor pointer.
66EF
CP FFH FE FF
Compare Register A against FFH: the Z FLAG is set after both divisors (66FFH).
66F1
If the NZ FLAG is set (minus 26 is next), LOOP back to 66DEH.
66F3
POP HL E1
Restore Register Pair HL from the stack: the remainder 0-25.
66F4
LD A,L 7D
Load Register A with Register L, the remainder.
66F5
ADD A,41H C6 41
Add 41H to Register A (the remainder 0-25): the third letter A-Z.
66F7
LD (DE),A 12
Store Register A, the third letter, at Register Pair DE.
66F8
INC DE 13
Increment Register Pair DE past the third letter, the end of the name.
66F9
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the position after the name.
66FA
RET C9
RETURN with the three letters written and Register Pair HL after them.
66FB-66FE
DEFW FD5CH, FFE6H 5C FD E6 FF
Data: the divisors of 66DAH, minus 676 (26 times 26) for the first letter and minus 26 for the second.

66FFH - Operands: Conditions and Opcode Fields

66FFH writes the condition of a jump, call or return from bits 5-3 of the opcode in Register A (NZ Z NC C PO PE P M; 6703H is used by JR for NZ Z NC C). 6727H returns bits 5-4 of the opcode at 560DH, 673BH bits 5-3, 6743H bits 2-0, 6730H the high four bits of Register A.

66FF
BIT 5,A CB 6F
Test bit 5 of Register A, the opcode: set for the conditions PO, PE, P and M.
6701
If the NZ FLAG is set (PO, PE, P or M), JUMP to 6710H.
6703
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode: clear for NZ and NC.
6705
If the Z FLAG is set, GOSUB to 6765H to write N at Register Pair HL.
6708
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: clear for Z and NZ, set for C and NC.
670A
If the Z FLAG is set, JUMP to 6769H to write Z and return.
670D
JUMP to 676DH to write C (giving C or NC) and return.
6710
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: clear for PO and PE, set for P and M.
6712
If the NZ FLAG is set (P or M), JUMP to 671FH.
6714
GOSUB to 6775H to write P at Register Pair HL.
6717
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode: clear for PO, set for PE.
6719
If the Z FLAG is set, JUMP to 677DH to write O and return.
671C
JUMP to 6779H to write E (giving PE) and return.
671F
BIT 3,A CB 5F
Test bit 3 of Register A, the opcode: clear for P, set for M.
6721
If the Z FLAG is set, JUMP to 6775H to write P and return.
6724
JUMP to 6771H to write M (the sign is negative) and return.
6727
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
672A
GOSUB to 6749H to rotate Register A right by four bits.
672D
AND 03H E6 03
Mask Register A against 03H (0000 0011): bits 5-4 of the opcode, a register pair number.
672F
RET C9
RETURN with the register pair number in Register A.
6730
GOSUB to 6749H to rotate Register A (the byte) right by four bits.
6733
JUMP to 6738H to keep the four bits that were the high half of Register A.
6735
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH. 6733H jumps over these three bytes and nothing else reaches them, so this row is never executed.
6738
AND 0FH E6 0F
Mask Register A against 0FH (0000 1111) to keep four bits.
673A
RET C9
RETURN with the four bits (0-15) in Register A.
673B
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
673E
RRCA 0F
Rotate Register A (the opcode) right one bit.
673F
RRCA 0F
Rotate Register A (the opcode) right a second bit.
6740
RRCA 0F
Rotate Register A right a third bit: bits 5-3 of the opcode are now bits 2-0.
6741
JUMP to 6746H to keep bits 2-0 of Register A, the opcode's bits 5-3.
6743
LD A,(560DH) 3A 0D 56
Load Register A with the byte at 560DH, the opcode.
6746
AND 07H E6 07
Mask Register A against 07H (0000 0111) to keep three bits.
6748
RET C9
RETURN with the three-bit field (0-7) in Register A.
6749
RRCA 0F
Rotate Register A right one bit (first of four).
674A
RRCA 0F
Rotate Register A right a second bit (of four).
674B
RRCA 0F
Rotate Register A right a third bit (of four).
674C
RRCA 0F
Rotate Register A right a fourth bit: the two halves of Register A are swapped.
674D
RET C9
RETURN with the halves of Register A swapped.

674EH - Operands: Single Characters

Each writes one or two characters at Register Pair HL and moves it on; Register A and the flags are kept: 674EH comma, 6752H A and comma, 6757H (C), 6760H comma and A, then N, Z, C, M, P, E, O, minus, plus, opening and closing parenthesis, A, 0 and H, and 679DH Register B.

674E
LD (HL),2CH 36 2C
Store 2CH (a comma) at Register Pair HL in the operand field.
6750
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6751
RET C9
RETURN with Register Pair HL after the comma.
6752
GOSUB to 6791H to write A at Register Pair HL.
6755
JUMP to 674EH to write a comma after the A, and return.
6757
GOSUB to 6789H to write an opening parenthesis at Register Pair HL.
675A
GOSUB to 676DH to write C at Register Pair HL.
675D
JUMP to 678DH to write the closing parenthesis and return.
6760
GOSUB to 674EH to write a comma at Register Pair HL.
6763
JUMP to 6791H to write A after the comma, and return.
6765
LD (HL),4EH 36 4E
Store 4EH (the letter N) at Register Pair HL in the operand field.
6767
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6768
RET C9
RETURN with Register Pair HL after the letter.
6769
LD (HL),5AH 36 5A
Store 5AH (the letter Z) at Register Pair HL in the operand field.
676B
INC HL 23
Increment Register Pair HL to the next position of the operand field.
676C
RET C9
RETURN with Register Pair HL after the letter.
676D
LD (HL),43H 36 43
Store 43H (the letter C) at Register Pair HL in the operand field.
676F
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6770
RET C9
RETURN with Register Pair HL after the letter.
6771
LD (HL),4DH 36 4D
Store 4DH (the letter M) at Register Pair HL in the operand field.
6773
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6774
RET C9
RETURN with Register Pair HL after the letter.
6775
LD (HL),50H 36 50
Store 50H (the letter P) at Register Pair HL in the operand field.
6777
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6778
RET C9
RETURN with Register Pair HL after the letter.
6779
LD (HL),45H 36 45
Store 45H (the letter E) at Register Pair HL in the operand field.
677B
INC HL 23
Increment Register Pair HL to the next position of the operand field.
677C
RET C9
RETURN with Register Pair HL after the letter.
677D
LD (HL),4FH 36 4F
Store 4FH (the letter O) at Register Pair HL in the operand field.
677F
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6780
RET C9
RETURN with Register Pair HL after the letter.
6781
LD (HL),2DH 36 2D
Store 2DH (a minus sign) at Register Pair HL in the operand field.
6783
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6784
RET C9
RETURN with Register Pair HL after the minus sign.
6785
LD (HL),2BH 36 2B
Store 2BH (a plus sign) at Register Pair HL in the operand field.
6787
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6788
RET C9
RETURN with Register Pair HL after the plus sign.
6789
LD (HL),28H 36 28
Store 28H (an opening parenthesis) at Register Pair HL in the operand field.
678B
INC HL 23
Increment Register Pair HL to the next position of the operand field.
678C
RET C9
RETURN with Register Pair HL after the parenthesis.
678D
LD (HL),29H 36 29
Store 29H (a closing parenthesis) at Register Pair HL in the operand field.
678F
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6790
RET C9
RETURN with Register Pair HL after the parenthesis.
6791
LD (HL),41H 36 41
Store 41H (the letter A) at Register Pair HL in the operand field.
6793
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6794
RET C9
RETURN with Register Pair HL after the letter.
6795
LD (HL),30H 36 30
Store 30H (the digit 0) at Register Pair HL in the operand field.
6797
INC HL 23
Increment Register Pair HL to the next position of the operand field.
6798
RET C9
RETURN with Register Pair HL after the digit.
6799
LD (HL),48H 36 48
Store 48H (the letter H) at Register Pair HL in the operand field.
679B
INC HL 23
Increment Register Pair HL to the next position of the operand field.
679C
RET C9
RETURN with Register Pair HL after the letter.
679D
LD (HL),B 70
Store Register B (a letter or digit chosen by the caller) at Register Pair HL in the operand field.
679E
INC HL 23
Increment Register Pair HL to the next position of the operand field.
679F
RET C9
RETURN with Register Pair HL after the character.

67A0H - Mnemonics and Register Names

67A6H copies mnemonic number Register A (4 characters) of the table at Register Pair DE into the mnemonic field at 55BDH; 67CEH copies the one at Register Pair DE itself, and 67A0H-67CBH load a table or mnemonic first (67A0H the operation in bits 5-3 of the opcode). 67D1H writes register Register A (one letter from 681CH). 6803H writes register pair Register A (two letters from 6824H: BC DE HL SP IX IY AF); 67D9H/67E0H put one in parentheses, 67E8H DE, 67ECH HL, 67F0H the pair in bits 5-4, 67F5H the same but HL as the index register after a prefix, 67FCH HL, IX or IY (5610H), which clears the prefix state.

67A0
GOSUB to 673BH: Register A = bits 5-3 of the opcode, the operation number.
67A3
LD DE,6832H 11 32 68
Load Register Pair DE with 6832H, the table ADD ADC SUB SBC AND XOR OR CP.
67A6
PUSH HL E5
Save Register Pair HL (the operand pointer) on the stack.
67A7
LD HL,55BDH 21 BD 55
Load Register Pair HL with 55BDH, the mnemonic field of the output line.
67AA
LD C,A 4F
Load Register C with Register A, the mnemonic number.
67AB
LD A,04H 3E 04
Load Register A with 04H, the four characters of a mnemonic.
67AD
GOSUB to 680BH to copy the four characters of entry Register C of the table at Register Pair DE to Register Pair HL.
67B0
POP HL E1
Restore Register Pair HL from the stack: the operand pointer.
67B1
RET C9
RETURN with the mnemonic written into 55BDH-55C0H.
67B2
LD DE,693FH 11 3F 69
Load Register Pair DE with 693FH, the mnemonic OUT.
67B5
JUMP to 67CEH to write the mnemonic at Register Pair DE.
67B7
LD DE,6943H 11 43 69
Load Register Pair DE with 6943H, the mnemonic IN.
67BA
JUMP to 67CEH to write the mnemonic at Register Pair DE.
67BC
LD DE,687EH 11 7E 68
Load Register Pair DE with 687EH, the mnemonic EX.
67BF
JUMP to 67CEH to write the mnemonic at Register Pair DE.
67C1
LD DE,6876H 11 76 68
Load Register Pair DE with 6876H, the mnemonic INC.
67C4
JUMP to 67CEH to write the mnemonic at Register Pair DE.
67C6
LD DE,687AH 11 7A 68
Load Register Pair DE with 687AH, the mnemonic DEC.
67C9
JUMP to 67CEH to write the mnemonic at Register Pair DE.
67CB
LD DE,6852H 11 52 68
Load Register Pair DE with 6852H, the mnemonic LD.
67CE
XOR A AF
Load Register A with 00H (XOR A with itself): entry 0, the four characters at Register Pair DE itself.
67CF
JUMP to 67A6H to write them into the mnemonic field.
67D1
LD C,A 4F
Load Register C with Register A, the register number (0-5 or 7).
67D2
LD DE,681CH 11 1C 68
Load Register Pair DE with 681CH, the register letters B C D E H L (space) A.
67D5
LD A,01H 3E 01
Load Register A with 01H, the one character of a register name.
67D7
JUMP to 680FH to copy the letter of register Register C to Register Pair HL.
67D9
BIT 4,A CB 67
Test bit 4 of Register A, the opcode: clear for (BC), set for (DE).
67DB
LD A,00H 3E 00
Load Register A with 00H, the pair number of BC; LD does not change the flags.
67DD
If the Z FLAG is set (BC), JUMP to 67E0H with Register A = 00H.
67DF
INC A 3C
Increment Register A to 01H, the pair number of DE.
67E0
GOSUB to 6789H to write an opening parenthesis at Register Pair HL.
67E3
GOSUB to 6803H to write the name of pair Register A.
67E6
JUMP to 678DH to write the closing parenthesis and return.
67E8
LD A,01H 3E 01
Load Register A with 01H, the pair number of DE.
67EA
JUMP to 6803H to write DE (pair number 1) and return.
67EC
LD A,02H 3E 02
Load Register A with 02H, the pair number of HL.
67EE
JUMP to 6803H to write HL (pair number 2) and return.
67F0
GOSUB to 6727H: Register A = bits 5-4 of the opcode, the pair number (BC DE HL SP).
67F3
JUMP to 6803H to write the pair named by Register A and return.
67F5
GOSUB to 6727H: Register A = bits 5-4 of the opcode, the pair number.
67F8
CP 02H FE 02
Compare Register A (the pair number) against 02H, HL.
67FA
If the NZ FLAG is set (not HL), JUMP to 6803H to write it.
67FC
XOR A AF
Load Register A with 00H (XOR A with itself).
67FD
LD (560FH),A 32 0F 56
Store Register A (00H) at 560FH: the index prefix has been used by this operand.
6800
LD A,(5610H) 3A 10 56
Load Register A with the byte at 5610H, the pair used for HL (02H HL, 04H IX, 05H IY).
6803
LD C,A 4F
Load Register C with Register A, the pair number.
6804
LD DE,6824H 11 24 68
Load Register Pair DE with 6824H, the pair names BC DE HL SP IX IY AF.
6807
LD A,02H 3E 02
Load Register A with 02H, the two characters of a pair name.
6809
JUMP to 680DH to copy the name of pair Register C.
680B
SLA C CB 21
Shift Register C (the entry number) left: times 2.
680D
SLA C CB 21
Shift Register C left: times 2 again (times 4 for a mnemonic entered at 680BH).
680F
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the offset of the entry in the table.
6811
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the table.
6812
ADD HL,BC 09
Add Register Pair BC (the offset) to Register Pair HL: the entry.
6813
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = the entry, Register Pair HL = the destination again.
6814
LD B,A 47
Load Register B with Register A, the characters to copy.

Copy Loop
Register Pair DE = the next character, Register Pair HL = the destination, Register B = the characters left.

6815
LD A,(DE) 1A
Load Register A with the byte at Register Pair DE, the next character.
6816
LD (HL),A 77
Store Register A (the character) at Register Pair HL.
6817
INC HL 23
Increment Register Pair HL to the next destination position.
6818
INC DE 13
Increment Register Pair DE to the next character.
6819
Decrement Register B, the characters left; if Register B is not 0, LOOP back to 6815H.
681B
RET C9
RETURN with Register Pair HL after the characters copied.

681CH - Register and Pair Names

Data. 681CH: one letter per register number for 67D1H (6, (HL), is never taken from here). 6824H: two letters per register pair number for 6803H.

681C-6823
DEFM "BCDEHL A" 42 43 44 45 48 4C 20 41
Data: the register letters for the numbers 0-7 (B C D E H L, a space for 6, A), read by 67D1H.
6824-6831
DEFM "BCDEHLSPIXIYAF" 42 43 44 45 48 4C 53 50 49 58 49 59 41 46
Data: the register pair names for the numbers 0-6 (BC DE HL SP IX IY AF), two characters each, read by 6803H.

6832H - Mnemonic Tables

Data. Four characters per mnemonic, padded with spaces, copied into the output line's mnemonic field (55BDH) by 67A6H. 6832H, 68A6H, 68C6H, 68E6H and 692BH are tables indexed by a number from the opcode; the single mnemonics between them are used with 67CEH.

6832-6835
DEFM "ADD " 41 44 44 20
Data: operation 0 of the table at 6832H (bits 5-3 of the opcode, 67A3H): ADD.
6836-6839
DEFM "ADC " 41 44 43 20
Data: operation 1 of the table at 6832H: ADC.
683A-683D
DEFM "SUB " 53 55 42 20
Data: operation 2 of the table at 6832H: SUB.
683E-6841
DEFM "SBC " 53 42 43 20
Data: operation 3 of the table at 6832H: SBC.
6842-6845
DEFM "AND " 41 4E 44 20
Data: operation 4 of the table at 6832H: AND.
6846-6849
DEFM "XOR " 58 4F 52 20
Data: operation 5 of the table at 6832H: XOR.
684A-684D
DEFM "OR " 4F 52 20 20
Data: operation 6 of the table at 6832H: OR (opcodes B0H-B7H and F6H).
684E-6851
DEFM "CP " 43 50 20 20
Data: operation 7 of the table at 6832H: CP (opcodes B8H-BFH and FEH).
6852-6855
DEFM "LD " 4C 44 20 20
Data: the mnemonic LD, written by 67CBH for every load instruction.
6856-6859
DEFM "JP " 4A 50 20 20
Data: the mnemonic JP, for JP nn, JP cc,nn and JP (HL) (6321H, 6373H).
685A-685D
DEFM "JR " 4A 52 20 20
Data: the mnemonic JR, for JR e and JR cc,e (622BH).
685E-6861
DEFM "CALL" 43 41 4C 4C
Data: the mnemonic CALL, for CALL nn and CALL cc,nn (630CH).
6862-6865
DEFM "RET " 52 45 54 20
Data: the mnemonic RET, for RET and RET cc (6303H).
6866-6869
DEFM "DJNZ" 44 4A 4E 5A
Data: the mnemonic DJNZ for opcode 10H (6207H).
686A-686D
DEFM "NOP " 4E 4F 50 20
Data: the mnemonic NOP for opcode 00H (61FFH).
686E-6871
DEFM "ADC " 41 44 43 20
Data: the mnemonic ADC for ED 4AH-7AH, ADC HL,rr (64CAH).
6872-6875
DEFM "SBC " 53 42 43 20
Data: the mnemonic SBC for ED 42H-72H, SBC HL,rr (64D1H).
6876-6879
DEFM "INC " 49 4E 43 20
Data: the mnemonic INC, written by 67C1H for INC r and INC rr.
687A-687D
DEFM "DEC " 44 45 43 20
Data: the mnemonic DEC, written by 67C6H for DEC r and DEC rr.
687E-6881
DEFM "EX " 45 58 20 20
Data: the mnemonic EX, written by 67BCH for EX AF,AF', EX (SP),HL and EX DE,HL.
6882-6885
DEFM "RST " 52 53 54 20
Data: the mnemonic RST for the restarts C7H-FFH (6419H).
6886-6889
DEFM "HALT" 48 41 4C 54
Data: the mnemonic HALT for opcode 76H (61BDH).
688A-688D
DEFM "PUSH" 50 55 53 48
Data: the mnemonic PUSH for C5H, D5H, E5H, F5H (638EH).
688E-6891
DEFM "POP " 50 4F 50 20
Data: the mnemonic POP for C1H, D1H, E1H, F1H (634EH).
6892-6895
DEFM "BIT " 42 49 54 20
Data: the mnemonic BIT for CB 40H-7FH (643AH).
6896-6899
DEFM "RES " 52 45 53 20
Data: the mnemonic RES for CB 80H-BFH (6441H).
689A-689D
DEFM "SET " 53 45 54 20
Data: the mnemonic SET for CB C0H-FFH (6448H).
689E-68A1
DEFM "IM " 49 4D 20 20
Data: the mnemonic IM for ED 46H, 56H, 5EH (6553H).
68A2-68A5
DEFM "DEFB" 44 45 46 42
Data: the mnemonic DEFB for a byte that is not decoded as an instruction (6271H).
68A6-68A9
DEFM "RLCA" 52 4C 43 41
Data: entry 0 of the table at 68A6H (opcodes 07H-3FH, bits 5-3 at 62EAH): RLCA.
68AA-68AD
DEFM "RRCA" 52 52 43 41
Data: entry 1 of the table at 68A6H: RRCA (0FH).
68AE-68B1
DEFM "RLA " 52 4C 41 20
Data: entry 2 of the table at 68A6H: RLA (17H).
68B2-68B5
DEFM "RRA " 52 52 41 20
Data: entry 3 of the table at 68A6H: RRA (1FH).
68B6-68B9
DEFM "DAA " 44 41 41 20
Data: entry 4 of the table at 68A6H: DAA (27H).
68BA-68BD
DEFM "CPL " 43 50 4C 20
Data: entry 5 of the table at 68A6H: CPL (2FH).
68BE-68C1
DEFM "SCF " 53 43 46 20
Data: entry 6 of the table at 68A6H: SCF (37H).
68C2-68C5
DEFM "CCF " 43 43 46 20
Data: entry 7 of the table at 68A6H: CCF (3FH).
68C6-68C9
DEFM "RLC " 52 4C 43 20
Data: entry 0 of the table at 68C6H (CB 00H-3FH, bits 5-3 at 6461H): RLC.
68CA-68CD
DEFM "RRC " 52 52 43 20
Data: entry 1 of the table at 68C6H: RRC (CB 08H-0FH).
68CE-68D1
DEFM "RL " 52 4C 20 20
Data: entry 2 of the table at 68C6H: RL (CB 10H-17H).
68D2-68D5
DEFM "RR " 52 52 20 20
Data: entry 3 of the table at 68C6H: RR (CB 18H-1FH).
68D6-68D9
DEFM "SLA " 53 4C 41 20
Data: entry 4 of the table at 68C6H: SLA (CB 20H-27H).
68DA-68DD
DEFM "SRA " 53 52 41 20
Data: entry 5 of the table at 68C6H: SRA (CB 28H-2FH).
68DE-68E1
DEFM " " 20 20 20 20
Data: entry 6 of the table at 68C6H, four spaces: CB 30H-37H are not valid and 645EH turns them into DEFB before this entry is read.
68E2-68E5
DEFM "SRL " 53 52 4C 20
Data: entry 7 of the table at 68C6H: SRL (CB 38H-3FH).
68E6-68E9
DEFM "LDI " 4C 44 49 20
Data: entry 0 of the table at 68E6H (ED A0H-BBH, the number from 6477H-6485H): LDI (A0H).
68EA-68ED
DEFM "CPI " 43 50 49 20
Data: entry 1 of the table at 68E6H: CPI (A1H).
68EE-68F1
DEFM "INI " 49 4E 49 20
Data: entry 2 of the table at 68E6H: INI (A2H).
68F2-68F5
DEFM "OUTI" 4F 55 54 49
Data: entry 3 of the table at 68E6H: OUTI (A3H).
68F6-68F9
DEFM "LDIR" 4C 44 49 52
Data: entry 4 of the table at 68E6H: LDIR (B0H).
68FA-68FD
DEFM "CPIR" 43 50 49 52
Data: entry 5 of the table at 68E6H: CPIR (B1H).
68FE-6901
DEFM "INIR" 49 4E 49 52
Data: entry 6 of the table at 68E6H: INIR (B2H).
6902-6905
DEFM "OTIR" 4F 54 49 52
Data: entry 7 of the table at 68E6H: OTIR (B3H).
6906-6909
DEFM "LDD " 4C 44 44 20
Data: entry 8 of the table at 68E6H: LDD (A8H).
690A-690D
DEFM "CPD " 43 50 44 20
Data: entry 9 of the table at 68E6H: CPD (A9H).
690E-6911
DEFM "IND " 49 4E 44 20
Data: entry 10 of the table at 68E6H: IND (AAH).
6912-6915
DEFM "OUTD" 4F 55 54 44
Data: entry 11 of the table at 68E6H: OUTD (ABH).
6916-6919
DEFM "LDDR" 4C 44 44 52
Data: entry 12 of the table at 68E6H: LDDR (B8H).
691A-691D
DEFM "CPDR" 43 50 44 52
Data: entry 13 of the table at 68E6H: CPDR (B9H).
691E-6921
DEFM "INDR" 49 4E 44 52
Data: entry 14 of the table at 68E6H: INDR (BAH).
6922-6925
DEFM "OTDR" 4F 54 44 52
Data: entry 15 of the table at 68E6H: OTDR (BBH).
6926-692A
DEFM 67H, 6FH, 44H, 45H, 4DH 67 6F 44 45 4D
Data: the second bytes of ED 67H (RRD), 6FH (RLD), 44H (NEG), 45H (RETN) and 4DH (RETI), searched by 6508H from 692AH down.
692B-692E
DEFM "RRD " 52 52 44 20
Data: entry 0 of the table at 692BH (for ED 67H): RRD.
692F-6932
DEFM "RLD " 52 4C 44 20
Data: entry 1 of the table at 692BH (for ED 6FH): RLD.
6933-6936
DEFM "NEG " 4E 45 47 20
Data: entry 2 of the table at 692BH (for ED 44H): NEG.
6937-693A
DEFM "RETN" 52 45 54 4E
Data: entry 3 of the table at 692BH (for ED 45H): RETN.
693B-693E
DEFM "RETI" 52 45 54 49
Data: entry 4 of the table at 692BH (for ED 4DH): RETI.
693F-6942
DEFM "OUT " 4F 55 54 20
Data: the mnemonic OUT, written by 67B2H for OUT (n),A and OUT (C),r.
6943-6946
DEFM "IN " 49 4E 20 20
Data: the mnemonic IN, written by 67B7H for IN A,(n) and IN r,(C).
6947-694A
DEFM "DI " 44 49 20 20
Data: the mnemonic DI for opcode F3H (63D6H).
694B-694E
DEFM "EI " 45 49 20 20
Data: the mnemonic EI for opcode FBH (6400H).
694F-6952
DEFM "EXX " 45 58 58 20
Data: the mnemonic EXX for opcode D9H (6369H).
6953-6956
DEFM "ADD " 41 44 44 20
Data: the mnemonic ADD for ADD HL,rr (62C3H).

6957H - Source Text Lines and the Line Number

Data. The lines STD writes besides the instructions, each ending with 0DH and filled in before they are written: an EQU line for a name that is not on an instruction, the EQU line for a referenced byte inside an instruction, the ORG line, the END line. 6987H-698CH is the line number written before every source line, 698DH its starting value.

6957-695E
DEFM "AAA", 09H, "EQU", 09H 41 41 41 09 45 51 55 09
Data: the name field (66DAH writes it at 6957H) and the EQU of the line for a name whose value is not a location of an instruction (5982H).
695F-6965
DEFM "00000H", 0DH 30 30 30 30 30 48 0D
Data: the value field of that EQU line; 6665H writes the value there and 5ABEH puts the 0DH after it.
6966-696F
DEFM "AAA", 09H, "EQU", 09H, "$-" 41 41 41 09 45 51 55 09 24 2D
Data: the line name EQU $-n for a referenced byte inside an instruction: 66C1H writes the name at 6966H (56EBH).
6970-6971
DEFM "0", 0DH 30 0D
Data: the n of that line, the digit stored at 56E2H, and the 0DH that ends it.
6972-6976
DEFM 09H, "ORG", 09H 09 4F 52 47 09
Data: the ORG line written when a load block starts a new run (583BH).
6977-697D
DEFM "00000H", 0DH 30 30 30 30 30 48 0D
Data: the address field of the ORG line, written by 6665H (5838H).
697E-6982
DEFM 09H, "END", 09H 09 45 4E 44 09
Data: the END line written at the end of the source text (59A4H).
6983-6986
DEFM "AAA", 0DH 41 41 41 0D
Data: the name of the entry point after END, written by 66C1H (59A1H).
6987-698C
DEFM "00000 " 30 30 30 30 30 20
Data: the line number of the source text, five digits (set to B0H-B9H, the digits with bit 7, by 563BH and counted by 5A6EH) and the space after them; 5A84H writes these six bytes before every line.
698D-6991
DEFM 0B0H, 0B0H, 0B0H, 0B0H, 0B0H B0 B0 B0 B0 B0
Data: five B0H bytes (the digit 0 with bit 7 set), copied to 6987H at 563BH so the line numbers start at 00000.

6992H - Messages

Data. The title, the questions and the messages; each ends with 00H (5D24H outputs up to it). The heading at 6B1CH has its lines separated by 0DH. 6C92H-6C97H is the operand text AF,AF', not a message.

6992-69AB
DEFM "APPARAT DISASSEMBLER 3.0", 00H 41 50 50 41 52 41 54 20 44 49 53 41 53 53 45 4D 42 4C 45 52 20 20 33 2E 30 00
Data: the title displayed at 561AH when DISASSEM starts.
69AC-69D7
DEFM "OBJECT FROM MAIN MEMORY OR DISK? (M OR D) ", 00H 4F 42 4A 45 43 54 20 46 52 4F 4D 20 4D 41 49 4E 20 4D 45 4D 4F 52 59 20 4F 52 20 44 49 53 4B 3F 20 20 28 4D 20 4F 52 20 44 29 20 00
Data: the first question (566BH), answered by 5B08H.
69D8-69FB
DEFM "OBJECT VIRTUAL BASE ADDRESS? (HEX) ", 00H 4F 42 4A 45 43 54 20 56 49 52 54 55 41 4C 20 42 41 53 45 20 41 44 44 52 45 53 53 3F 20 28 48 45 58 29 20 00
Data: the question for a memory object's location (567CH).
69FC-6A1C
DEFM "OBJECT REAL BASE ADDRESS? (HEX) ", 00H 4F 42 4A 45 43 54 20 52 45 41 4C 20 42 41 53 45 20 41 44 44 52 45 53 53 3F 20 28 48 45 58 29 20 00
Data: the question for where a memory object is now (5688H).
6A1D-6A2F
DEFM "BYTE COUNT? (HEX) ", 00H 42 59 54 45 20 43 4F 55 4E 54 3F 20 28 48 45 58 29 20 00
Data: the question asked for a memory object with PTR (56A7H).
6A30-6A51
DEFM "VIRTUAL RESTART LOCATION? (HEX) ", 00H 56 49 52 54 55 41 4C 20 52 45 53 54 41 52 54 20 4C 4F 43 41 54 49 4F 4E 3F 20 20 28 48 45 58 29 20 00
Data: the question asked by 5ADAH (disk) and after V in a pause (5781H).
6A52-6A5B
DEFM "BAD REPLY", 00H 42 41 44 20 52 45 50 4C 59 00
Data: the message for an answer that is not accepted (5B18H).
6A5C-6A87
DEFM "OFFSET OBJECT VIRTUAL ADDRESSES BY? (HEX) ", 00H 4F 46 46 53 45 54 20 4F 42 4A 45 43 54 20 56 49 52 54 55 41 4C 20 41 44 44 52 45 53 53 45 53 20 42 59 3F 20 20 28 48 45 58 29 20 00
Data: the question for the offset added to a disk object's addresses (57C8H).
6A88-6A92
DEFM "FILESPEC? ", 00H 46 49 4C 45 53 50 45 43 3F 20 00
Data: the question for the object file (57B7H).
6A93-6AAD
DEFM "0000 = PROGRAM ENTRY POINT", 00H 30 30 30 30 20 3D 20 50 52 4F 47 52 41 4D 20 45 4E 54 52 59 20 50 4F 49 4E 54 00
Data: the entry point message; 5948H writes the address over its first four characters.
6AAE-6AD7
DEFM "REPLY ", 22H, "ENTER", 22H, " WHEN PRINTER AT TOP OF PAGE", 00H 52 45 50 4C 59 20 22 45 4E 54 45 52 22 20 57 48 45 4E 20 50 52 49 4E 54 45 52 20 41 54 20 54 4F 50 20 4F 46 20 50 41 47 45 00
Data: the request to set the printer at the top of a page (5C6CH), answered with ENTER alone.
6AD8-6AF7
DEFM 2AH x 10, " FUNCTION CANCELLED", 00H 2A 2A 2A 2A 2A 2A 2A 2A 2A 2A 20 20 20 46 55 4E 43 54 49 4F 4E 20 43 41 4E 43 45 4C 4C 45 44 00
Data: the message when the disassembly is stopped (5CF2H): ten asterisk characters, three spaces and FUNCTION CANCELLED.
6AF8-6B0B
DEFM "INSUFFICIENT MEMORY", 00H 49 4E 53 55 46 46 49 43 49 45 4E 54 20 4D 45 4D 4F 52 59 00
Data: the message when the reference table does not fit below HIMEM (5F47H).
6B0C-6B1B
DEFM "BAD MAIN MEMORY", 00H 42 41 44 20 4D 41 49 4E 20 4D 45 4D 4F 52 59 00
Data: the message when a value that must have a name is not in the reference table (5CF7H).
6B1C-6C1F
DEFM "LOCATION REFERENCE TABLE", 0DH, "REFERENCE SUFFIX INDICATES REFERENCING INST TYPE", 0DH, " L = CALL", 0DH, " P = JP", 0DH, " R = JR", 0DH, " S = LD DR,(NN)", 0DH, " T = LD A,(NN) , IN A,(N)", 0DH, " U = LD DR,NN", 0DH, " V = LD SR,N , OP N", 0DH, " W = LD (NN),DR", 0DH, " X = LD (NN),A , OUT (N),A", 00H 4C 4F 43 41 54 49 4F 4E 20 52 45 46 45 52 45 4E 43 45 20 54 41 42 4C 45 0D 52 45 46 45 52 45 4E 43 45 20 53 55 46 46 49 58 20 49 4E 44 49 43 41 54 45 53 20 52 45 46 45 52 45 4E 43 49 4E 47 20 49 4E 53 54 20 54 59 50 45 0D 20 20 4C 20 3D 20 43 41 4C 4C 0D 20 20 50 20 3D 20 4A 50 0D 20 20 52 20 3D 20 4A 52 0D 20 20 53 20 3D 20 20 4C 44 20 20 44 52 2C 28 4E 4E 29 0D 20 20 54 20 3D 20 20 4C 44 20 20 20 41 2C 28 4E 4E 29 20 20 20 2C 20 20 20 49 4E 20 20 41 2C 28 4E 29 0D 20 20 55 20 3D 20 20 4C 44 20 20 44 52 2C 4E 4E 0D 20 20 56 20 3D 20 20 4C 44 20 20 53 52 2C 4E 20 20 20 20 20 20 2C 20 20 20 20 4F 50 20 20 4E 0D 20 20 57 20 3D 20 20 4C 44 20 20 28 4E 4E 29 2C 44 52 0D 20 20 58 20 3D 20 20 4C 44 20 20 28 4E 4E 29 2C 41 20 20 20 20 2C 20 20 20 4F 55 54 20 28 4E 29 2C 41 00
Data: the heading of the reference table listing (5FFFH) with the meaning of each type letter.
6C20-6C3F
DEFM "END OF LOCATION REFERENCE TABLE", 00H 45 4E 44 20 4F 46 20 4C 4F 43 41 54 49 4F 4E 20 52 45 46 45 52 45 4E 43 45 20 54 41 42 4C 45 00
Data: the last line of the reference table listing (606FH).
6C40-6C68
DEFM " REFERENCE TYPE(S) ARE NOT PRINTED ", 2AH x 4, 00H 20 20 52 45 46 45 52 45 4E 43 45 20 54 59 50 45 28 53 29 20 41 52 45 20 4E 4F 54 20 50 52 49 4E 54 45 44 20 2A 2A 2A 2A 00
Data: the text after the letters of the types turned off by RI (602CH), ending with four asterisk characters.
6C69-6C76
DEFM "ANY OPTIONS? ", 00H 41 4E 59 20 4F 50 54 49 4F 4E 53 3F 20 00
Data: the options question (5B7DH), asked again after every option.
6C77-6C91
DEFM "REFERENCE TABLE FILESPEC? ", 00H 52 45 46 45 52 45 4E 43 45 20 54 41 42 4C 45 20 46 49 4C 45 53 50 45 43 3F 20 00
Data: the question for the RTD reference table file (59DCH).
6C92-6C97
DEFM "AF,AF'" 41 46 2C 41 46 27
Data: the operand text of EX AF,AF' (08H), copied by 6237H; not a message and not ended by 00H.
6C98-6CBF
DEFM "ASSEMBLER SOURCE TEXT OUTPUT FILESPEC? ", 00H 41 53 53 45 4D 42 4C 45 52 20 53 4F 55 52 43 45 20 54 45 58 54 20 4F 55 54 50 55 54 20 46 49 4C 45 53 50 45 43 3F 20 00
Data: the question for the STD source text file (5A23H).
6CC0-6CD3
DEFM "SEQUENCE # OVERFLOW", 00H 53 45 51 55 45 4E 43 45 20 23 20 4F 56 45 52 46 4C 4F 57 00
Data: the message when the source line number passes 99999 (5A7EH).
6CD4-6D00
DEFM "HIGH ASCII CODE FOR PRINTER? (5A - 7F HEX) ", 00H 48 49 47 48 20 41 53 43 49 49 20 43 4F 44 45 20 46 4F 52 20 50 52 49 4E 54 45 52 3F 20 20 28 35 41 20 2D 20 37 46 20 48 45 58 29 20 00
Data: the PTR question for the highest code the printer prints (5C72H).
6D01-6D20
DEFM "ANOTHER DISASSEMBLY? (Y OR N) ", 00H 41 4E 4F 54 48 45 52 20 44 49 53 41 53 53 45 4D 42 4C 59 3F 20 20 28 59 20 4F 52 20 4E 29 20 00
Data: the question at the end of every disassembly (5D00H).
6D21-6D4D
DEFM "ATLEAST ONE OPTION REQUIRES OBJECT FROM DISK", 00H 41 54 4C 45 41 53 54 20 4F 4E 45 20 4F 50 54 49 4F 4E 20 52 45 51 55 49 52 45 53 20 4F 42 4A 45 43 54 20 46 52 4F 4D 20 44 49 53 4B 00
Data: the message for NIP, RTD or STD with a memory object (569AH).
6D4E-6D8D
DEFM "# LINES PER PAGE, EXCLUDING TOP AND BOTTOM MARGINS? (1 - 255)", 0DH, 00H 23 20 4C 49 4E 45 53 20 50 45 52 20 50 41 47 45 2C 20 45 58 43 4C 55 44 49 4E 47 20 54 4F 50 20 41 4E 44 20 42 4F 54 54 4F 4D 20 4D 41 52 47 49 4E 53 3F 20 20 28 31 20 2D 20 32 35 35 29 0D 00
Data: the PTR question for the page length (5C46H); its 0DH puts the answer on the next line.
6D8E-6DC0
DEFM "# LINES EACH FOR TOP AND BOTTOM MARGINS? (0 - 10)", 00H 23 20 4C 49 4E 45 53 20 45 41 43 48 20 46 4F 52 20 54 4F 50 20 41 4E 44 20 42 4F 54 54 4F 4D 20 4D 41 52 47 49 4E 53 3F 20 20 28 30 20 2D 20 31 30 29 00
Data: the PTR question for the margins (5C57H).
6DC1-6DDF
DEFM "BUILDING CROSS-REFERENCE TABLE", 00H 42 55 49 4C 44 49 4E 47 20 43 52 4F 53 53 2D 52 45 46 45 52 45 4E 43 45 20 54 41 42 4C 45 00
Data: the message shown during the build pass (579EH).

6DE0H - RTD: Set Up the Write

Called by the RTD write at 59E2H: Index Register IX = the FCB in Register Pair DE (5532H), so the loop can set its buffer address, and Register Pair HL = 6FA0H, the first byte of the reference table (its C0H marker).

6DE0
PUSH DE D5
Save Register Pair DE, the RTD file's FCB (5532H), on the stack.
6DE1
POP IX DD E1
Restore Index Register IX from the stack: Index Register IX = the FCB at 5532H.
6DE3
LD HL,6FA0H 21 A0 6F
Load Register Pair HL with 6FA0H, the first byte of the reference table, the start of the first sector to write.
6DE6
RET C9
RETURN to 59E5H with Index Register IX and Register Pair HL set.

6DE7H - Unused Bytes

The end of the file. No instruction in DISASSEM reaches or reads these 149 zero bytes; the reference table index and table start above them at 6F60H.

6DE7-6E7B
NOP x 149 00 x 149
149 zero bytes up to 6E7BH, the last byte of the file's last load record; nothing in DISASSEM reaches or reads them.