LDOS 5.3.1 for the Model III - CMDFILE/CMD Disassembled

Page Customization

Introduction/Summary

LDOS 5.3.1 CMDFILE/CMD Disassembly - The Command File Utility (Model III)

CMDFILE/CMD reads command files (load modules) from disk and SYSTEM files from cassette into one memory image, so that several files or blocks can be joined into one; it can offset the image to load at another address, optionally with a small driver that moves it back and jumps to it, change the transfer address, and write the result to disk as a command file or to tape as a SYSTEM file. It can also take a single member out of a library file such as SYS6/SYS. The command is CMDFILE alone; everything else is asked by prompts (M-40-060). Most answers also take C, which starts CMDFILE again with an empty image, and E, which ends it. The same file runs on the Model I and the Model III: at its start it looks at ROM 0125H and, on the Model I, writes the Model I addresses into six operands and shortens the cassette prompt.

The file is a load module of 2931 bytes: a record of type 1FH with the text Copyright 1991 MISOSYS, Inc., All rights reserved, twelve load blocks for 5400H-5AA9H and 5AB7H-5F18H (2828 bytes) and the transfer address record for 5400H. The image is built from 6000H up to HIGH$, one byte at a time, in the load module format: each file read adds its records, and its transfer record is overwritten by the next file. Disk files are read and written a sector at a time through the buffer 5200H-52FFH below the program, with @VER for the output. Tapes are read and written with the ROM cassette routines; the Model III ROM asks the speed (H 1500 baud, L 500 baud).

What CMDFILE Does

StepWhat Happens
The startThe model test and the Model I operands; the banner; whether the load log is printed too (5400H, 5433H).
The readsThe input prompt: D reads a command file from disk, T a SYSTEM tape, Q displays a directory; each block is logged with its addresses; a library file asks for its member (545EH, 5489H, 5727H, 575CH, 57BAH, 5873H).
The offsetENTER at the input prompt: the load range is shown and a new base address gives the offset; the restrict address for a file loading below 4200H; the driver, the interrupts and the keyboard debounce questions (54B4H, 5543H).
The transfer addressA new transfer address may be typed when no driver was added (5596H).
The outputD writes the image as a command file, T as a SYSTEM tape, each load block with its offset; then another output of the same image or a new image (55B6H, 55D5H, 567CH).

About This Page

The site has no Model I page of CMDFILE/CMD, so this page is written from the bytes of the Model III file alone; the six operands that the code changes on the Model I are named with both values on their rows. Every byte of the file is shown at its address. Found in the code: ENTER at Enter address to restrict offset keeps the lowest address, so that every load block is offset, those below 4200H too, while the manual says CMDFILE never offsets a block below 4200H (54EDH, 5669H). A block read from tape whose address becomes the new lowest address is not compared with the highest address (58D9H): the end of the first block of a tape is never counted, and a tape of one block leaves the highest address at 0000H for the load range and the driver. The test for the end of memory (5969H) compares each new address with HIGH$ for equality only, and the two address bytes of a tape block are stored without it (58C3H, 58C9H), so a read can pass HIGH$ when one of them falls on it. ENTER alone at a file specification prompt is not refused and the result of @FSPEC is not tested (599BH, 59A0H): @OPEN or @INIT then works on the control block as the last file left it. A drive after Q that is not 0-7 or not ready gives error 20H, where the manual says the entry is ignored. Every ISAM header on the diskette gives a byte above 00H in its record; a member starting at byte 00H would be taken from the wrong place (5814H). An ISAM number of 00H asks for the member again at the next header. On the Model III the blink call before each tape block (ROM 022CH) is JR 0212H, XOR A and RET, so nothing is shown on the screen while a tape is read or written. The banner says Copyright 1979.

Memory Map

Load Blocks in File Order

The twelve load blocks of the file, after the copyright record: 2828 bytes, 5400H-5AA9H and 5AB7H-5F18H. 5AAAH-5AB6H are not in the file. The transfer address is 5400H.

AddressContents
5400H-54FFH, 5500H-55FFH, 5600H-56FFH256 bytes each: the start, the prompts, the offset and the disk output
5700H-57FFH, 5800H-58FFH, 5900H-59FFH256 bytes each: the disk and tape reads, the helpers and the file routines
5A00H-5AA9H170 bytes: the file routines, the Q answer, hex numbers and answers
5AB7H-5BB6H, 5BB7H-5CB6H, 5CB7H-5DB6H, 5DB7H-5EB6H256 bytes each: the debounce record, the driver record and the texts
5EB7H-5F18H98 bytes: the last texts and the default extension CMD

Sections of the Disassembly

AddressContents
5400HEntry: the Model Test and the Model I Operands
5433HThe Banner and the Log Question
5448HA New Memory Image
545EHThe Input Prompt
5489HInput from Disk and from Tape
54A1HThe End of the Reads
54B4HThe New Base Address and the Offset
5543HThe Driver Questions and the Driver Record
5596HThe Transfer Address
55B6HThe Output Prompt
55D5HOutput to Disk
5654HWrite a Byte; the Offset of a Load Address
567CHOutput to Tape
5727HReading a Load Module from Disk
575CHLoad Blocks and the Address Load Log
57BAHThe ISAM Members of a Library File
5824HThe End of a Member and the Transfer Record
5873HInput from Tape
5927HThe Transfer Record, a Word and the Hex Digits
5969HStoring in the Image, the Prompts and the Answers
59BCHThe File: Open, Errors and One Byte at a Time
5A19HThe Directory: Q
5A42HHex Numbers, Answers and Capitals
5AAAHThe Debounce Record and the Offset Driver
5AD0HThe Texts
5F19HThe Cells Beyond the File

Memory CMDFILE/CMD Uses

AddressContents
0018H (4006H)RST 18H: the ROM's compare of Register Pair HL with Register Pair DE (through JP 1C90H at 4006H).
0033H, 0040HROM: display the character in Register A; take a line at Register Pair HL of up to Register B characters (the CARRY FLAG after BREAK).
0125HThe ROM byte of the model test: 49H in ROM 3.1, A3H in ROM 1.3.
0212H, 022CH, 0235H, 0264H, 0287H, 0296H, 0314H, 01F8HROM cassette routines: select, blink, read a byte, write a byte, write the leader and sync, find the leader and sync, read a word into Register Pair HL, cassette off. 0212H and 022CH do nothing in ROM 3.1; 01F8H ends with EI. 0314H is the same in ROM 3.1 and ROM 1.3, the others differ (both models call them by these addresses).
3042HROM 3.1 only: the cassette speed question, kept at 4211H (the Model I code calls 0049H, wait for a key, instead).
4016H-4017HThe driver address of the keyboard device control block: the debounce record loads 3024H there.
402DH@EXIT: E at a question, BREAK at a prompt.
4209H, 4419H@CKDRV and @DODIR (Register B = 00H or 02H): the directory of the Q answer (44B8H and 4463H on the Model I).
4409H@ERROR, with bits 7 and 6 set: the short message, and it returns.
4411H-4412HHIGH$, the end of the image (4049H on the Model I).
441CH, 444BH@FSPEC and @FEXT (4473H on the Model I): the file specification and its default extension CMD.
4420H, 4424H, 4428H, 4436H, 443CH, 4442H@INIT, @OPEN, @CLOSE, @READ, @VER and @POSN on the control block at 5F19H.
4467H, 446AH@DSPLY and @PRINT: the texts to the video and the log lines to the printer.
5200H-52FFH, 5300H-53FFHThe sector buffer of the file read or written; the stack, from 5400H down.
6000H up to HIGH$The memory image of the files read, in load module format.

Variables

The entry points of CMDFILE/CMD, then the data of the file, the operands it changes, and the cells outside the file that it uses, by address.

Entry Points

AddressContents
5400HThe start of CMDFILE/CMD, the transfer address of the file; C at any question comes back here.
5448HBegin a new memory image and display the input prompt.
545EHThe input prompt; every error of a read ends here.
55B6HThe output prompt.
5654H, 5A03HWrite the byte in Register A to the output file, the full sector with @VER.
565AHFetch the load address of a block into Register Pair DE, with the offset added unless kept.
5727HRead the records of the open file into the image after Register Pair HL.
5873HRead a SYSTEM tape into the image after Register Pair HL.
5927HStore a transfer record with the address at 5F67H.
594DHWrite the word below Register Pair HL as four hex digits at Register Pair DE.
5969HStore Register A in the image after Register Pair HL and test for HIGH$.
597DH, 598BH, 59ABHThe cassette prompt; take a file specification; take an answer of up to six characters.
59BCH, 59C9H, 59D1H, 59E0HOpen the input file; display an error; read a byte, with the end of the file an error or not.
5A42H, 5A5DHConvert hex digits into Register Pair HL; one hex digit.
5A6EHAsk a Y/N question (C and E included).

Data in the File

Address
Size
Contents
5AAAH-5AB6H
13 bytes
DEFS 13
5AAAH-5AB6H: not in the file. Thirteen bytes between the last load block of the code and the records, which CMDFILE neither reads nor writes.
5AB7H-5AB8H
2 bytes
DEFB 03H, 04H
5AB7H-5AB8H: the type 03H (a load block that is not offset; written as type 01H, 560CH, 56D3H) and the length 04H of the debounce record.
5AB9H-5ABAH
2 bytes
DEFW 4016H
5AB9H-5ABAH: the load address of the debounce record, 4016H, the driver address of the keyboard device control block 4015H.
5ABBH-5ABCH
2 bytes
DEFW 3024H
5ABBH-5ABCH: the data of the debounce record, 3024H, the ROM 3.1 keyboard driver; 5424H writes 03E3H, the Model I ROM's, on the Model I.
5ABDH-5ABEH
2 bytes
DEFB 01H, 11H
5ABDH-5ABEH: the type 01H and the length 11H of the driver record: two address bytes and 15 bytes of code.
5ABFH-5AC0H
2 bytes
DEFW 0000H
5ABFH-5AC0H: the load address of the driver, the highest address loaded + 1, written by 5535H; 565AH adds the offset to it.
5AC1H
1 byte
DEFB 00H
5AC1H: the first instruction of the driver, NOP (00H) or DI (F3H), written by 5560H after the interrupts question.
5AC2H-5AC4H
3 bytes
DEFB 21H / DEFW 0000H
5AC2H-5AC4H: LD HL,nnnnH, the source of the move: written by 5514H (lowest + offset) or 5528H (highest + offset).
5AC5H-5AC7H
3 bytes
DEFB 11H / DEFW 0000H
5AC5H-5AC7H: LD DE,nnnnH, the destination of the move: written by 5510H (the lowest address) or 5524H (the highest).
5AC8H-5ACAH
3 bytes
DEFB 01H / DEFW 0000H
5AC8H-5ACAH: LD BC,nnnnH, the number of bytes to move, the highest address + 1 less the lowest, written by 5540H.
5ACBH-5ACCH
2 bytes
DEFB EDH, B0H
5ACBH-5ACCH: LDIR; 5507H writes B0H (LDIR) for a positive offset and 551BH B8H (LDDR) for a negative one.
5ACDH-5ACFH
3 bytes
DEFB C3H / DEFW 0000H
5ACDH-5ACFH: JP nnnnH, the transfer address of the image before the driver was added, written by 552EH.
5AD0H-5AD1H
2 bytes
DEFB 1CH, 1FH
5AD0H-5AD1H: cursor home and clear to the end of the screen, the start of the banner displayed by 5433H.
5AD2H-5B00H
47 bytes
DEFM "MISOSYS Command File Utility - LDOS Version 5.3"
5AD2H-5B00H: the name of the program and the version of LDOS it is for.
5B01H
1 byte
DEFB 0AH
5B01H: 0AH, a new line: the copyright goes on the next line of the banner.
5B02H-5B32H
49 bytes
DEFM "Copyright 1979 MISOSYS, Inc., All rights reserved"
5B02H-5B32H: the copyright line of the banner, with the year 1979; the copyright record of the file says 1991.
5B33H-5B34H
2 bytes
DEFB 0AH, 0DH
5B33H-5B34H: 0AH, a new line, and 0DH, the end of the banner.
5B35H-5B4FH
27 bytes
DEFM "Enter input file filespec >"
5B35H-5B4FH: the prompt of 548AH for the file to read from disk.
5B50H
1 byte
DEFB 03H
5B50H: 03H, the end of the prompt for @DSPLY: the file specification is typed after it.
5B51H-5B6DH
29 bytes
DEFM "Block loads from XXXX to XXXX"
5B51H-5B6DH: the log line of a load block (57A5H); 577DH writes the first address at 5B62H, 57A2H the last at 5B6AH.
5B6EH
1 byte
DEFB 0DH
5B6EH: 0DH, the end of the log line for @DSPLY and @PRINT.
5B6FH-5B76H
8 bytes
DEFM "FILNAM: "
5B6FH-5B76H: the place of the tape name (5899H writes the six characters over FILNAM), a colon and a space, displayed by 591DH.
5B77H
1 byte
DEFB 03H
5B77H: 03H, the end of the text: the transfer address follows on the same line.
5B78H-5B9DH
38 bytes
DEFM "Transfer address (entry point) is XXXX"
5B78H-5B9DH: the text of 5860H at the end of a read; 585DH writes the address at 5B9AH.
5B9EH
1 byte
DEFB 0DH
5B9EH: 0DH, the end of the line for @DSPLY and @PRINT.
5B9FH-5BACH
14 bytes
DEFM "Out of memory!"
5B9FH-5BACH: the text of 5974H, when the image reaches HIGH$.
5BADH
1 byte
DEFB 0DH
5BADH: 0DH, the end of the line of the memory error.
5BAEH-5BDCH
47 bytes
DEFM "Requested file is not a Command or System file!"
5BAEH-5BDCH: the text of 59D7H: a bad record, a transfer record of another length, the end of the file or of the ISAM directory.
5BDDH
1 byte
DEFB 0DH
5BDDH: 0DH, the end of the line of the file error.
5BDEH-5C03H
38 bytes
DEFM "Address load log to printer (Y,N,E)? >"
5BDEH-5C03H: the first question, asked by 543DH: print the Block loads from lines as well.
5C04H
1 byte
DEFB 03H
5C04H: 03H, the end of the question: the answer is typed after it.
5C05H-5C37H
51 bytes
DEFM "Enter new transfer address or <ENTER> to use XXXX >"
5C05H-5C37H: the prompt of 559FH; 559CH writes the transfer address of the image at 5C32H.
5C38H
1 byte
DEFB 03H
5C38H: 03H, the end of the prompt: the address is typed after it.
5C39H-5C58H
32 bytes
DEFM "Enter filespec to write output >"
5C39H-5C58H: the prompt of 55D5H for the output file on disk.
5C59H
1 byte
DEFB 03H
5C59H: 03H, the end of the prompt: the file specification is typed after it.
5C5AH-5C8EH
53 bytes
DEFM "Module write is complete - write another (Y,N,E,C)? >"
5C5AH-5C8EH: the question after a disk file (5648H) or a tape (5717H) is written.
5C8FH
1 byte
DEFB 03H
5C8FH: 03H, the end of the question: the answer is typed after it.
5C90H-5CBAH
43 bytes
DEFM "*** No file input *** No file to output ***"
5C90H-5CBAH: the text of 54ABH, ENTER at the input prompt with nothing read.
5CBBH
1 byte
DEFB 0DH
5CBBH: 0DH, the end of the line of that text.
5CBCH-5CE6H
43 bytes
DEFM "Tape checksum error detected - reread tape!"
5CBCH-5CE6H: the text of 5907H, a block whose checksum does not agree or a mark that is neither 3CH nor 78H.
5CE7H
1 byte
DEFB 0DH
5CE7H: 0DH, the end of the line of the tape error.
5CE8H-5D05H
30 bytes
DEFM "Ready cassette and enter <H,L>"
5CE8H-5D05H: the cassette prompt of 597DH; on the Model I 540CH stores 03H at 5D00H, the space before <H,L>.
5D06H
1 byte
DEFB 03H
5D06H: 03H, the end of the prompt: ROM 3042H asks the speed after it.
5D07H-5D3FH
57 bytes
DEFM "Input disk or tape (D,T,E,C,Q) or <ENTER> to end reads? >"
5D07H-5D3FH: the input prompt of 5461H; the manual prints (D,I,E,C,Q), the code takes T.
5D40H
1 byte
DEFB 03H
5D40H: 03H, the end of the prompt: the answer is typed after it.
5D41H-5D56H
22 bytes
DEFM "Enter tape file name >"
5D41H-5D56H: the prompt of 567CH for the name of the SYSTEM tape to write.
5D57H
1 byte
DEFB 03H
5D57H: 03H, the end of the prompt: the name is typed after it.
5D58H-5D90H
57 bytes
DEFM "Output to disk or tape (D,T,E,C) or <ENTER> to restart? >"
5D58H-5D90H: the output prompt of 55B6H, after the base address and transfer address questions.
5D91H
1 byte
DEFB 03H
5D91H: 03H, the end of the prompt: the answer is typed after it.
5D92H-5DBDH
44 bytes
DEFM "Program loads from base address XXXX to XXXX"
5D92H-5DBDH: the load range of the image (54C6H); 54BAH writes the lowest address at 5DB2H, 54C3H the highest at 5DBAH.
5DBEH
1 byte
DEFB 0DH
5DBEH: 0DH, the end of the line of the load range.
5DBFH-5DE1H
35 bytes
DEFM "Enter new base address or <ENTER> >"
5DBFH-5DE1H: the prompt of 54CCH for the offset.
5DE2H
1 byte
DEFB 03H
5DE2H: 03H, the end of the prompt: the address is typed after it.
5DE3H-5E14H
50 bytes
DEFM "Do you want to disable the interrupts (Y,N,E,C)? >"
5DE3H-5E14H: the question of 5554H: DI or NOP at 5AC1H in the driver.
5E15H
1 byte
DEFB 03H
5E15H: 03H, the end of the question: the answer is typed after it.
5E16H-5E4EH
57 bytes
DEFM "Do you want to disable the keyboard debounce (Y,N,E,C)? >"
5E16H-5E4EH: the question of 5563H: the debounce record 5AB7H before the driver.
5E4FH
1 byte
DEFB 03H
5E4FH: 03H, the end of the question: the answer is typed after it.
5E50H-5E88H
57 bytes
DEFM "Do you want to add the offset driver routine (Y,N,E,C)? >"
5E50H-5E88H: the question of 5543H, asked after a new base address.
5E89H
1 byte
DEFB 03H
5E89H: 03H, the end of the question: the answer is typed after it.
5E8AH-5EA2H
25 bytes
DEFM "Program loads below 4200H"
5E8AH-5EA2H: the first line of the text of 54E7H, when the lowest address is below 4200H.
5EA3H
1 byte
DEFB 0AH
5EA3H: 0AH, a new line: the restrict prompt follows on the next line.
5EA4H-5ED5H
50 bytes
DEFM " Enter address to restrict offset or <ENTER> >"
5EA4H-5ED5H: the restrict prompt, indented by five spaces.
5ED6H
1 byte
DEFB 03H
5ED6H: 03H, the end of the prompt: the address is typed after it.
5ED7H-5EF8H
34 bytes
DEFM "File has ISAM overlays - enter # >"
5ED7H-5EF8H: the prompt of 57CBH at the first member header of a library file; the manual prints the # as //.
5EF9H
1 byte
DEFB 03H
5EF9H: 03H, the end of the prompt: the member number is typed after it.
5EFAH-5F14H
27 bytes
DEFM "Overlay beyond end of file!"
5EFAH-5F14H: the text of 580BH, when @POSN cannot reach the record of the member asked for.
5F15H
1 byte
DEFB 0DH
5F15H: 0DH, the end of the line of that text.
5F16H-5F18H
3 bytes
DEFM "CMD"
5F16H-5F18H: the default extension of the files read and written, given to @FEXT by 59A3H.

Operands and Bytes Changed While It Runs

Address
Size
Contents
57E7H
1 byte
The operand of CP 00H at 57E6H: the ISAM member asked for, 00H before the question (5728H), the number typed (57DBH).
5984H-5985H
2 bytes
The operand of CALL 3042H at 5983H: 0049H on the Model I (5412H).
596DH-596EH
2 bytes
The operand of LD HL,(4411H) at 596CH: 4049H on the Model I (5418H).
59A7H-59A8H
2 bytes
The operand of CALL 444BH at 59A6H: 4473H on the Model I (541EH).
5A38H-5A39H
2 bytes
The operand of CALL 4209H at 5A37H: 44B8H on the Model I (5430H).
5A3DH-5A3EH
2 bytes
The operand of CALL 4419H at 5A3CH: 4463H on the Model I (542AH).
5ABBH-5ABCH
2 bytes
The data of the debounce record: 03E3H on the Model I (5424H).
5ABFH-5ACFHThe driver record: its load address, DI or NOP, the source, destination and count of the move, LDIR or LDDR, the old transfer address (5507H-5560H).
5B62H, 5B6AH, 5B9AH, 5C32H, 5DB2H, 5DBAHThe XXXX places of the texts, written by 594DH.
5B6FH-5B74H
6 bytes
FILNAM: the name of the tape read (5899H).
5D00H
1 byte
A space of the cassette prompt: 03H on the Model I (540CH).

Cells Outside the File That CMDFILE/CMD Uses

Address
Size
Contents
5F19H-5F38H
32 bytes
DEFS 32
5F19H-5F38H: not in the file. The file control block of the file read (5489H) or written (55D5H); 5F21H is its end of file byte (FCB +08H, 563FH).
5F39H-5F58H
32 bytes
DEFS 32
5F39H-5F58H: not in the file. The answer buffer of ROM 0040H: 6 characters at 59ABH, 32 at 598BH (whose 0DH can then fall on 5F59H).
5F59H-5F5EH
6 bytes
DEFS 6
5F59H-5F5EH: not in the file. The tape name typed at 5687H, written in capitals by 56A8H.
5F5FH-5F60H
2 bytes
DEFS 2
5F5FH-5F60H: not in the file. The byte pointer into the sector buffer 5200H-52FFH (59BFH, 55DEH, 59E0H, 5A03H).
5F61H-5F62H
2 bytes
DEFS 2
5F61H-5F62H: not in the file. The address of the last byte of the memory image, 6003H when it is empty (5448H, 5497H, 5591H).
5F63H-5F64H
2 bytes
DEFS 2
5F63H-5F64H: not in the file. The first address of the load block being read, for the log line (5768H).
5F65H-5F66H
2 bytes
DEFS 2
5F65H-5F66H: not in the file. The last address of the load block being read, for the log line (578FH).
5F67H-5F68H
2 bytes
DEFS 2
5F67H-5F68H: not in the file. The transfer address: from the last file read (5852H, 5912H), a member's entry (57F2H) or the driver (5551H).
5F69H-5F6AH
2 bytes
DEFS 2
5F69H-5F6AH: not in the file. The highest address loaded, 0000H at the start (5457H, 5799H, 58EFH).
5F6BH-5F6CH
2 bytes
DEFS 2
5F6BH-5F6CH: not in the file. The lowest address loaded, FFFFH at the start (545BH, 5773H, 58D4H), or the restrict address (54F6H).
5F6DH-5F6EH
2 bytes
DEFS 2
5F6DH-5F6EH: not in the file. The offset, the new base less the lowest address (54FEH), added by 565AH.
5F6FH-5F72H
4 bytes
DEFS 4
5F6FH-5F72H: not in the file. The answer of a Y/N question, one character and its 0DH (5A72H); 5F71H-5F72H are not used.
5F73H
1 byte
DEFS 1
5F73H: not in the file. The log switch: 00H, or 59H when the load log is printed too (543AH, 5445H).
5F74H
1 byte
DEFS 1
5F74H: not in the file. The length of the tape name, for another copy of the tape (568CH, 5720H).
5F75H
1 byte
DEFS 1
5F75H: not in the file. The no offset switch: 01H for the type 03H block being written, cleared by 565AH.

Disassembly

5400H - Entry: the Model Test and the Model I Operands

LDOS Ready loads CMDFILE/CMD at 5400H-5F18H and jumps to 5400H, the transfer address. The command is CMDFILE alone: everything else is asked by prompts (M-40-060). The same file runs on the Model I and the Model III. The byte at ROM 0125H is the I of Model III Basic in ROM 3.1 (49H); on the Model I ROM the byte is A3H. On the Model I the code stores 03H at 5D00H, which ends the cassette prompt after Ready cassette and enter, and writes the Model I addresses into six operands: ROM 0049H for the Model III speed question 3042H (5984H), HIGH$ 4049H for 4411H (596DH), @FEXT 4473H for 444BH (59A7H), the ROM keyboard driver 03E3H for 3024H in the debounce record (5ABBH), @DODIR 4463H for 4419H (5A3DH) and @CKDRV 44B8H for 4209H (5A38H). On the Model III all six keep the values of the file.

5400
LD SP,5400H 31 00 54
Load the Stack Pointer with 5400H: the stack grows down from 53FFH, below the program and above the sector buffer 5200H-52FFH.
5403
LD A,(0125H) 3A 25 01
Fetch the byte at ROM 0125H into Register A: 49H, the I of Model III Basic, in ROM 3.1; A3H in the Model I ROM.
5406
CP 49H FE 49
Compare Register A (the ROM byte) against 49H: the Z FLAG on the Model III, where the file's operands are already right.
5408
If the Z FLAG is set (the Model III ROM), JUMP to 5433H to display the banner with every operand as the file holds it.
540A
LD A,03H 3E 03
Load Register A with 03H, the end of a text for @DSPLY, for the Model I form of the cassette prompt at 5CE8H.
540C
LD (5D00H),A 32 00 5D
Store Register A (03H) at 5D00H, the space after Ready cassette and enter: the Model I prompt ends there, without <H,L>.
540F
LD HL,0049H 21 49 00
Load Register Pair HL with 0049H, the Model I ROM's wait for a key, for the CALL at 5983H that asks the Model III cassette speed.
5412
LD (5984H),HL 22 84 59
Store Register Pair HL (0049H) at 5984H, the operand of CALL 3042H at 5983H: on the Model I the prompt waits for any key.
5415
LD HL,4049H 21 49 40
Load Register Pair HL with 4049H, the address of HIGH$ on the Model I, for the memory test of 5969H.
5418
LD (596DH),HL 22 6D 59
Store Register Pair HL (4049H) at 596DH, the operand of LD HL,(4411H) at 596CH: the Model I HIGH$ instead of 4411H.
541B
LD HL,4473H 21 73 44
Load Register Pair HL with 4473H, the Model I address of @FEXT, for the default extension of the file specification.
541E
LD (59A7H),HL 22 A7 59
Store Register Pair HL (4473H) at 59A7H, the operand of CALL 444BH at 59A6H: the Model I @FEXT instead of 444BH.
5421
LD HL,03E3H 21 E3 03
Load Register Pair HL with 03E3H, the Model I ROM's keyboard driver, for the record that disables the keyboard debounce.
5424
LD (5ABBH),HL 22 BB 5A
Store Register Pair HL (03E3H) at 5ABBH, the data of the debounce record 5AB7H: 4016H gets 03E3H on the Model I, 3024H on the Model III.
5427
LD HL,4463H 21 63 44
Load Register Pair HL with 4463H, the Model I address of @DODIR, for the directory display of the Q answer.
542A
LD (5A3DH),HL 22 3D 5A
Store Register Pair HL (4463H) at 5A3DH, the operand of CALL 4419H at 5A3CH: the Model I @DODIR instead of 4419H.
542D
LD HL,44B8H 21 B8 44
Load Register Pair HL with 44B8H, the Model I address of @CKDRV, for the drive test of the Q answer.
5430
LD (5A38H),HL 22 38 5A
Store Register Pair HL (44B8H) at 5A38H, the operand of CALL 4209H at 5A37H: the Model I @CKDRV instead of 4209H.

5433H - The Banner and the Log Question

The screen is cleared and the banner displayed (5AD0H: 1CH 1FH, the name and version, the copyright). The first question decides whether each Block loads from line of a disk read also goes to the printer: 5F73H is 00H for N, the answer letter (59H) for Y. As at every Y/N question of CMDFILE, C starts again at 5400H and E ends at @EXIT (5A6EH).

5433
LD HL,5AD0H 21 D0 5A
Point Register Pair HL to 5AD0H, the banner: 1CH 1FH (cursor home, clear the screen), the name, 0AH, the copyright, 0AH 0DH.
5436
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5AD0H) on the video up to its 0DH.
5439
XOR A AF
Clear Register A (XOR A) to 00H, the value of the log switch when the load log is not printed.
543A
LD (5F73H),A 32 73 5F
Store Register A (00H) at 5F73H, the log switch: 00H, the Block loads from lines go to the video only.
543D
LD HL,5BDEH 21 DE 5B
Point Register Pair HL to 5BDEH, the question Address load log to printer (Y,N,E)?, ended by 03H.
5440
GOSUB to 5A6EH to display the question at Register Pair HL and take Y or N: the CARRY FLAG for N, Register A the letter.
5443
If the CARRY FLAG is set (N), JUMP to 5448H with the log switch left at 00H.
5445
LD (5F73H),A 32 73 5F
Store Register A (59H, the letter Y) at 5F73H, the log switch: not 00H, the Block loads from lines go to the printer as well.

5448H - A New Memory Image

The memory image of the files read is built from 6000H up (5969H stores each byte one place after Register Pair HL). 5F61H holds the address of its last byte; 6003H is the value for an empty image, because a read starts four bytes before that address, over the transfer record of the file read before (5471H). The offset 5F6DH, the highest address loaded 5F69H and the lowest 5F6BH (FFFFH) start again, and so does the switch 5F75H that keeps one load block from being offset.

5448
LD HL,6003H 21 03 60
Load Register Pair HL with 6003H, the end pointer of an empty image: four bytes less is 5FFFH, so the first byte read goes to 6000H.
544B
LD (5F61H),HL 22 61 5F
Store Register Pair HL (6003H) at 5F61H-5F62H, the address of the last byte of the memory image.
544E
XOR A AF
Clear Register A (XOR A) to 00H, for the no offset switch and for the cells cleared below.
544F
LD (5F75H),A 32 75 5F
Store Register A (00H) at 5F75H, the switch set by a type 03H record: no load block is kept from the offset now.
5452
LD H,A 67
Copy Register A (00H) into Register H, the high byte of Register Pair HL, for the zero word stored below.
5453
LD L,A 6F
Copy Register A (00H) into Register L: Register Pair HL = 0000H.
5454
LD (5F6DH),HL 22 6D 5F
Store Register Pair HL (0000H) at 5F6DH-5F6EH, the offset: no offset until a new base address is given (54FEH).
5457
LD (5F69H),HL 22 69 5F
Store Register Pair HL (0000H) at 5F69H-5F6AH, the highest address loaded so far: any load block is above it.
545A
DEC HL 2B
DECrement Register Pair HL from 0000H to FFFFH, the start value of the lowest address loaded.
545B
LD (5F6BH),HL 22 6B 5F
Store Register Pair HL (FFFFH) at 5F6BH-5F6CH, the lowest address loaded so far: any load block is below it.

545EH - The Input Prompt

The stack is set again, since every error of a read comes back here by a JP. Input disk or tape (D,T,E,C,Q) takes six characters at 5F39H; the first, made a capital by AND 5FH, decides: ENTER alone ends the reads (54A1H), Q displays a directory (5A19H), C starts again, E ends, T reads a SYSTEM tape (549CH), D a file from disk (5489H). Any other letter repeats the prompt. Register Pair HL is set to four bytes before the last byte of the image: the read overwrites the transfer record of the file read before, so the files join into one load module.

545E
LD SP,5400H 31 00 54
Load the Stack Pointer with 5400H again: the error ways out of the reads (5977H, 59CEH, 59DDH, 5A3FH) jump here with any stack.
5461
LD HL,5D07H 21 07 5D
Point Register Pair HL to 5D07H, the prompt Input disk or tape (D,T,E,C,Q) or <ENTER> to end reads?, ended by 03H.
5464
GOSUB to 59ABH to display the prompt at Register Pair HL and take up to 6 characters at 5F39H: the Z FLAG for ENTER alone.
5467
If the Z FLAG is set (ENTER alone), JUMP to 54A1H to end the reads and go on to the base address and the output.
5469
LD A,(HL) 7E
Fetch the first character of the answer at Register Pair HL (5F39H, ROM 0040H leaves Register Pair HL there) into Register A.
546A
AND 5FH E6 5F
AND Register A with 5FH: a small letter becomes a capital (bit 5 cleared; bit 7 too).
546C
CP 51H FE 51
Compare Register A (the letter) against 51H, the letter Q, the directory display.
546E
If the Z FLAG is set (Q), JUMP to 5A19H to take the drive after the Q and display its directory with @DODIR.
5471
LD HL,(5F61H) 2A 61 5F
Fetch the address of the last byte of the image from 5F61H-5F62H into Register Pair HL.
5474
DEC HL 2B
DECrement Register Pair HL, the first of four steps back over the transfer record of the image (02H 02H and the address).
5475
DEC HL 2B
DECrement Register Pair HL, the second step back over the transfer record; DEC of a register pair leaves the flags alone.
5476
DEC HL 2B
DECrement Register Pair HL, the third step back over the transfer record at the end of the image.
5477
DEC HL 2B
DECrement Register Pair HL, the fourth step: Register Pair HL = the byte before the old transfer record, where 5969H stores next.
5478
CP 43H FE 43
Compare Register A (the letter) against 43H, the letter C: cancel, start CMDFILE again with a new image.
547A
If the Z FLAG is set (C), JUMP to 5400H, the start of CMDFILE, to begin again from the banner.
547C
CP 45H FE 45
Compare Register A (the letter) against 45H, the letter E: exit to LDOS.
547E
If the Z FLAG is set (E), JUMP to 402DH, @EXIT, to end CMDFILE.
5481
CP 54H FE 54
Compare Register A (the letter) against 54H, the letter T: read a SYSTEM tape.
5483
If the Z FLAG is set (T), JUMP to 549CH to read a SYSTEM tape into the image at Register Pair HL.
5485
CP 44H FE 44
Compare Register A (the letter) against 44H, the letter D: read a file from disk.
5487
If the NZ FLAG is set (no letter CMDFILE takes), JUMP back to 545EH to display the prompt again.

5489H - Input from Disk and from Tape

D asks for the file specification (Enter input file filespec), which @FSPEC takes into the control block at 5F19H with the default extension CMD (5F16H); @OPEN opens it with the sector buffer 5200H. 5727H reads the records into the image and returns the address of its last byte, which is only then stored at 5F61H: a read that fails ends at 545EH and adds nothing to the image (as the manual says). T reads the next SYSTEM file of the tape through 5873H, with the same rule.

5489
PUSH HL E5
Save Register Pair HL (the byte before the old transfer record) to the stack across the prompt and the @OPEN.
548A
LD HL,5B35H 21 35 5B
Point Register Pair HL to 5B35H, the prompt Enter input file filespec >, ended by 03H.
548D
GOSUB to 598BH to display the prompt at Register Pair HL, take the file specification into 5F39H and @FSPEC it into 5F19H with the extension CMD.
5490
GOSUB to 59BCH to open the file at 5F19H with the sector buffer 5200H and set the byte pointer 5F5FH (an error ends at 545EH).
5493
POP HL E1
Restore Register Pair HL from the stack: the place in the image where the file's records go.
5494
GOSUB to 5727H to read the records of the file into the image after Register Pair HL; Register Pair HL returns the last byte stored.
5497
LD (5F61H),HL 22 61 5F
Store Register Pair HL (the last byte of the image) at 5F61H-5F62H: the file read is now part of the image.
549A
JUMP back to 545EH to display the input prompt for the next file.
549C
GOSUB to 5873H to read the next SYSTEM file of the tape into the image after Register Pair HL; Register Pair HL returns the last byte.
549F
JUMP back to 5497H to store Register Pair HL at 5F61H and display the input prompt again.

54A1H - The End of the Reads

ENTER alone at the input prompt ends the reads. With nothing read (the end pointer still 6003H) the text No file input, No file to output (5C90H, between rows of asterisks) is displayed and a new image is begun at 5448H.

54A1
LD HL,6003H 21 03 60
Load Register Pair HL with 6003H, the end pointer of an empty image (5448H).
54A4
LD DE,(5F61H) ED 5B 61 5F
Fetch the end pointer of the image from 5F61H-5F62H into Register Pair DE.
54A8
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (6003H) with Register Pair DE (through 4006H, JP 1C90H): the Z FLAG when no file was read.
54A9
If the NZ FLAG is set (the image holds a file), JUMP to 54B4H to display its load range and ask for a new base address.
54AB
LD HL,5C90H 21 90 5C
Point Register Pair HL to 5C90H, the text No file input, No file to output, ended by 0DH.
54AE
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5C90H).
54B1
JUMP back to 5448H to begin a new image and display the input prompt.

54B4H - The New Base Address and the Offset

Program loads from base address XXXX to XXXX shows the lowest (5F6BH) and the highest (5F69H) address loaded, written into the text by 594DH. ENTER keeps the addresses (5596H). A new base address in hex gives the offset 5F6DH = base less the lowest address. When the image loads below 4200H the code asks Enter address to restrict offset: the address typed becomes the lowest address, and 565AH then offsets only the load blocks at or above it. ENTER at that question keeps the lowest address, so every block is offset, those below 4200H too, although the manual says CMDFILE never offsets a block below 4200H. The driver record 5ABDH gets its operands: LDIR (B0H) when the offset is positive, LDDR (B8H) when it is negative, the source (5AC3H) and the destination (5AC6H) of the move, the old transfer address (5ACEH), its own load address (5ABFH, the highest address + 1) and the count (5AC9H).

54B4
LD HL,5F6CH 21 6C 5F
Point Register Pair HL to 5F6CH, the high byte of the lowest address loaded, for the first XXXX of the text.
54B7
LD DE,5DB2H 11 B2 5D
Point Register Pair DE to 5DB2H, the first XXXX of Program loads from base address XXXX to XXXX.
54BA
GOSUB to 594DH to write the word at Register Pair HL (5F6CH, then 5F6BH) as four hex digits at Register Pair DE (5DB2H).
54BD
LD HL,5F6AH 21 6A 5F
Point Register Pair HL to 5F6AH, the high byte of the highest address loaded, for the second XXXX of the text.
54C0
LD DE,5DBAH 11 BA 5D
Point Register Pair DE to 5DBAH, the second XXXX of the text, after the word to.
54C3
GOSUB to 594DH to write the word at Register Pair HL (5F6AH, then 5F69H) as four hex digits at Register Pair DE (5DBAH).
54C6
LD HL,5D92H 21 92 5D
Point Register Pair HL to 5D92H, the text Program loads from base address XXXX to XXXX with both addresses written in.
54C9
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5D92H) up to its 0DH.
54CC
LD HL,5DBFH 21 BF 5D
Point Register Pair HL to 5DBFH, the prompt Enter new base address or <ENTER> >, ended by 03H.
54CF
GOSUB to 59ABH to display the prompt at Register Pair HL and take up to 6 characters at 5F39H: the Z FLAG for ENTER alone.
54D2
If the Z FLAG is set (ENTER: no offset), JUMP to 5596H to ask for a new transfer address.
54D5
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = 5F39H, the answer, for the hex conversion of 5A42H.
54D6
LD A,(DE) 1A
Fetch the first character of the answer at Register Pair DE (5F39H) into Register A, as 5A42H expects it.
54D7
GOSUB to 5A42H to convert the hex digits at Register Pair DE into Register Pair HL: the CARRY FLAG for a character that is not hex.
54DA
If the CARRY FLAG is set (not a hex number), JUMP back to 54B4H to display the load range and the prompt again.
54DC
PUSH HL E5
Save Register Pair HL (the new base address) to the stack across the test for blocks below 4200H.
54DD
LD HL,41FFH 21 FF 41
Load Register Pair HL with 41FFH, the last address below 4200H, the lowest address the manual says is offset.
54E0
LD DE,(5F6BH) ED 5B 6B 5F
Fetch the lowest address loaded from 5F6BH-5F6CH into Register Pair DE.
54E4
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (41FFH) with Register Pair DE (the lowest address): the CARRY FLAG when it is 4200H or above.
54E5
If the CARRY FLAG is set (nothing loads below 4200H), JUMP to 54FAH to compute the offset from the lowest address.
54E7
LD HL,5E8AH 21 8A 5E
Point Register Pair HL to 5E8AH, the text Program loads below 4200H and the prompt Enter address to restrict offset or <ENTER>.
54EA
GOSUB to 5A97H to display the text at Register Pair HL and take 6 characters at 5F39H, keeping Register Pair DE: the Z FLAG for ENTER.
54ED
If the Z FLAG is set (ENTER: no restriction), JUMP to 54FAH with Register Pair DE the lowest address: every block is offset.
54EF
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = 5F39H, the answer, Register Pair HL = the lowest address.
54F0
LD A,(DE) 1A
Fetch the first character of the answer at Register Pair DE (5F39H) into Register A, as 5A42H expects it.
54F1
GOSUB to 5A42H to convert the hex digits at Register Pair DE into Register Pair HL: the CARRY FLAG for a character that is not hex.
54F4
If the CARRY FLAG is set (not a hex number), JUMP back to 54E7H to display the restrict prompt again.
54F6
LD (5F6BH),HL 22 6B 5F
Store Register Pair HL (the restrict address) at 5F6BH-5F6CH as the lowest address: blocks below it keep their addresses (5669H).
54F9
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the restrict address, the base the offset is counted from.
54FA
POP HL E1
Restore Register Pair HL from the stack: the new base address typed at 54CFH.
54FB
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
54FC
SBC HL,DE ED 52
Subtract Register Pair DE (the lowest address) from Register Pair HL (the new base): Register Pair HL = the offset.
54FE
LD (5F6DH),HL 22 6D 5F
Store Register Pair HL (the offset) at 5F6DH-5F6EH: 565AH adds it to the address of every load block that is offset.
5501
RL H CB 14
Rotate Register H left through the CARRY FLAG: bit 7, the sign of the offset, goes into the CARRY FLAG.
5503
If the CARRY FLAG is set (a negative offset: the file is moved down), JUMP to 5519H to set up an LDDR.
5505
LD A,B0H 3E B0
Load Register A with B0H, the second byte of LDIR (EDH B0H): a positive offset is moved back down with LDIR.
5507
LD (5ACCH),A 32 CC 5A
Store Register A (B0H) at 5ACCH, the second byte of ED B0H at 5ACBH in the driver record: LDIR.
550A
RR H CB 1C
Rotate Register H right through the CARRY FLAG: Register H is the high byte of the offset again.
550C
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the offset, Register Pair HL = the lowest address.
550D
LD HL,(5F6BH) 2A 6B 5F
Fetch the lowest address from 5F6BH-5F6CH into Register Pair HL: the destination of the move, the first byte of the program.
5510
LD (5AC6H),HL 22 C6 5A
Store Register Pair HL (the lowest address) at 5AC6H, the operand of LD DE at 5AC5H in the driver: the destination of the LDIR.
5513
ADD HL,DE 19
ADD Register Pair DE (the offset) to Register Pair HL (the lowest address): Register Pair HL = the first byte where it is loaded.
5514
LD (5AC3H),HL 22 C3 5A
Store Register Pair HL (the lowest address + offset) at 5AC3H, the operand of LD HL at 5AC2H in the driver: the source of the LDIR.
5517
JUMP to 552BH to store the transfer address, the load address and the count of the driver.
5519
LD A,B8H 3E B8
Load Register A with B8H, the second byte of LDDR (EDH B8H): a negative offset is moved back up with LDDR, from the top.
551B
LD (5ACCH),A 32 CC 5A
Store Register A (B8H) at 5ACCH, the second byte of ED B0H at 5ACBH in the driver record: LDDR.
551E
RR H CB 1C
Rotate Register H right through the CARRY FLAG: Register H is the high byte of the offset again.
5520
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the offset, Register Pair HL = the lowest address.
5521
LD HL,(5F69H) 2A 69 5F
Fetch the highest address loaded from 5F69H-5F6AH into Register Pair HL: the destination of the LDDR, the last byte of the program.
5524
LD (5AC6H),HL 22 C6 5A
Store Register Pair HL (the highest address) at 5AC6H, the operand of LD DE at 5AC5H in the driver: the destination of the LDDR.
5527
ADD HL,DE 19
ADD Register Pair DE (the offset) to Register Pair HL (the highest address): Register Pair HL = the last byte where it is loaded.
5528
LD (5AC3H),HL 22 C3 5A
Store Register Pair HL (the highest address + offset) at 5AC3H, the operand of LD HL at 5AC2H in the driver: the source of the LDDR.
552B
LD HL,(5F67H) 2A 67 5F
Fetch the transfer address of the image from 5F67H-5F68H into Register Pair HL, the entry point of the program.
552E
LD (5ACEH),HL 22 CE 5A
Store Register Pair HL (the old transfer address) at 5ACEH, the operand of JP at 5ACDH: the driver jumps there after the move.
5531
LD HL,(5F69H) 2A 69 5F
Fetch the highest address loaded from 5F69H-5F6AH into Register Pair HL.
5534
INC HL 23
INCrement Register Pair HL: the byte after the program, where the driver record loads (before its offset).
5535
LD (5ABFH),HL 22 BF 5A
Store Register Pair HL (the highest address + 1) at 5ABFH, the load address of the driver record 5ABDH.
5538
PUSH HL E5
Save Register Pair HL (the highest address + 1) to the stack: the driver's address, for the transfer address at 554CH.
5539
LD DE,(5F6BH) ED 5B 6B 5F
Fetch the lowest address from 5F6BH-5F6CH into Register Pair DE, for the count of the move.
553D
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG for the SBC that follows.
553E
SBC HL,DE ED 52
Subtract Register Pair DE (the lowest address) from Register Pair HL (the highest + 1): Register Pair HL = the bytes to move.
5540
LD (5AC9H),HL 22 C9 5A
Store Register Pair HL (the count) at 5AC9H, the operand of LD BC at 5AC8H in the driver: the length of the LDIR or LDDR.

5543H - The Driver Questions and the Driver Record

Do you want to add the offset driver routine: N leaves the file offset without a driver and goes on to the transfer address question (5596H). Y makes the transfer address that of the driver, where it will load (the highest address + 1 + the offset). Then Do you want to disable the interrupts gives 5AC1H a DI (F3H) or a NOP (00H), and Do you want to disable the keyboard debounce adds the six byte record 5AB7H before the driver: a load of 3024H, the ROM keyboard driver, into 4016H, the keyboard device control block, as type 03H, a block that is not offset. The driver record (19 bytes) and a transfer record (5927H) go over the transfer record of the image, and the transfer address question is passed over (55B6H).

5543
LD HL,5E50H 21 50 5E
Point Register Pair HL to 5E50H, the question Do you want to add the offset driver routine (Y,N,E,C)?, ended by 03H.
5546
GOSUB to 5A6EH to display the question at Register Pair HL and take Y or N: the CARRY FLAG for N (C and E do not come back).
5549
POP HL E1
Restore Register Pair HL from the stack: the highest address + 1, the address of the driver before the offset.
554A
If the CARRY FLAG is set (N: no driver), JUMP to 5596H to ask for a new transfer address of the offset file.
554C
LD DE,(5F6DH) ED 5B 6D 5F
Fetch the offset from 5F6DH-5F6EH into Register Pair DE.
5550
ADD HL,DE 19
ADD Register Pair DE (the offset) to Register Pair HL (the driver's address): Register Pair HL = where the driver loads.
5551
LD (5F67H),HL 22 67 5F
Store Register Pair HL (the offset address of the driver) at 5F67H-5F68H: the transfer address of the output is the driver.
5554
LD HL,5DE3H 21 E3 5D
Point Register Pair HL to 5DE3H, the question Do you want to disable the interrupts (Y,N,E,C)?, ended by 03H.
5557
GOSUB to 5A6EH to display the question at Register Pair HL and take Y or N: the CARRY FLAG for N.
555A
If the NO CARRY FLAG is set (Y), JUMP to 555EH, inside the LD BC at 555DH, which is LD A,F3H there: the code of DI.
555C
XOR A AF
Clear Register A (XOR A) to 00H, the code of NOP, for an answer of N: the interrupts stay as they are.
555D
LD BC,F33EH 01 3E F3
Load Register Pair BC with F33EH. Nothing uses Register Pair BC here: the 01H only lets 555CH pass over 3EH F3H at 555EH-555FH, which the jump from 555AH takes as LD A,F3H.
5560
LD (5AC1H),A 32 C1 5A
Store Register A (F3H for DI, 00H for NOP) at 5AC1H, the first instruction of the driver record.
5563
LD HL,5E16H 21 16 5E
Point Register Pair HL to 5E16H, the question Do you want to disable the keyboard debounce (Y,N,E,C)?, ended by 03H.
5566
GOSUB to 5A6EH to display the question at Register Pair HL and take Y or N: the CARRY FLAG for N.
5569
LD HL,(5F61H) 2A 61 5F
Fetch the address of the last byte of the image from 5F61H-5F62H into Register Pair HL; LD leaves the CARRY FLAG of the answer.
556C
DEC HL 2B
DECrement Register Pair HL, the first of four steps back over the transfer record at the end of the image.
556D
DEC HL 2B
DECrement Register Pair HL, the second step back; DEC of a register pair leaves the CARRY FLAG of the answer alone.
556E
DEC HL 2B
DECrement Register Pair HL, the third step back over the transfer record at the end of the image.
556F
DEC HL 2B
DECrement Register Pair HL, the fourth step: Register Pair HL = the byte before the transfer record, where the new records go.
5570
If the CARRY FLAG is set (N: the debounce stays), JUMP to 5580H to add the driver record only.
5572
LD DE,5AB7H 11 B7 5A
Point Register Pair DE to 5AB7H, the debounce record: 03H, 04H, the address 4016H and the word 3024H.
5575
LD B,06H 06 06
Load Register B with 06H, the six bytes of the debounce record to copy into the image.
5577
LD A,(DE) 1A
Fetch the byte of the record at Register Pair DE into Register A.
5578
PUSH DE D5
Save Register Pair DE (the place in the record) to the stack: 5969H uses Register Pair DE for its memory test.
5579
GOSUB to 5969H to store Register A one byte after Register Pair HL in the image, and test for the end of memory.
557C
POP DE D1
Restore Register Pair DE from the stack: the place in the record.
557D
INC DE 13
INCrement Register Pair DE to the next byte of the record.
557E
DECrement Register B and JUMP back to 5577H until the six bytes of the debounce record are copied (DJNZ).
5580
LD DE,5ABDH 11 BD 5A
Point Register Pair DE to 5ABDH, the driver record: 01H, 11H, its load address, then DI or NOP, the LDIR or LDDR and the JP.
5583
LD B,13H 06 13
Load Register B with 13H, the 19 bytes of the driver record to copy into the image.
5585
LD A,(DE) 1A
Fetch the byte of the record at Register Pair DE into Register A.
5586
PUSH DE D5
Save Register Pair DE (the place in the record) to the stack: 5969H uses Register Pair DE for its memory test.
5587
GOSUB to 5969H to store Register A one byte after Register Pair HL in the image, and test for the end of memory.
558A
POP DE D1
Restore Register Pair DE from the stack: the place in the record.
558B
INC DE 13
INCrement Register Pair DE to the next byte of the record.
558C
DECrement Register B and JUMP back to 5585H until the 19 bytes of the driver record are copied (DJNZ).
558E
GOSUB to 5927H to add a transfer record to the image after Register Pair HL: 02H, 02H and the address at 5F67H, the driver.
5591
LD (5F61H),HL 22 61 5F
Store Register Pair HL (the last byte of the transfer record) at 5F61H-5F62H, the end of the image.
5594
JUMP to 55B6H to ask for the output: the transfer address question is passed over, as the manual says.

5596H - The Transfer Address

Enter new transfer address or <ENTER> to use XXXX shows the transfer address of the image (5F67H, from the last file read). A new address in hex is written into the last two bytes of the image, the address of its transfer record; 5F67H itself keeps the old address.

5596
LD HL,5F68H 21 68 5F
Point Register Pair HL to 5F68H, the high byte of the transfer address of the image, for the XXXX of the prompt.
5599
LD DE,5C32H 11 32 5C
Point Register Pair DE to 5C32H, the XXXX at the end of Enter new transfer address or <ENTER> to use XXXX.
559C
GOSUB to 594DH to write the word at Register Pair HL (5F68H, then 5F67H) as four hex digits at Register Pair DE (5C32H).
559F
LD HL,5C05H 21 05 5C
Point Register Pair HL to 5C05H, the prompt Enter new transfer address or <ENTER> to use XXXX >, ended by 03H.
55A2
GOSUB to 59ABH to display the prompt at Register Pair HL and take up to 6 characters at 5F39H: the Z FLAG for ENTER alone.
55A5
If the Z FLAG is set (ENTER: keep the address), JUMP to 55B6H to ask for the output.
55A7
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = 5F39H, the answer, for the hex conversion of 5A42H.
55A8
LD A,(DE) 1A
Fetch the first character of the answer at Register Pair DE (5F39H) into Register A, as 5A42H expects it.
55A9
GOSUB to 5A42H to convert the hex digits at Register Pair DE into Register Pair HL: the CARRY FLAG for a character that is not hex.
55AC
If the CARRY FLAG is set (not a hex number), JUMP back to 559FH to display the prompt again.
55AE
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the new transfer address.
55AF
LD HL,(5F61H) 2A 61 5F
Fetch the address of the last byte of the image from 5F61H-5F62H into Register Pair HL: the high byte of the transfer record.
55B2
DEC HL 2B
DECrement Register Pair HL to the low byte of the address in the transfer record at the end of the image.
55B3
LD (HL),E 73
Store Register E (the low byte of the new address) at Register Pair HL, in the transfer record.
55B4
INC HL 23
INCrement Register Pair HL to the high byte of the address in the transfer record.
55B5
LD (HL),D 72
Store Register D (the high byte of the new address) at Register Pair HL: the output starts at the new address.

55B6H - The Output Prompt

Output to disk or tape (D,T,E,C) or <ENTER> to restart: ENTER and C start again at 5400H, E ends, T writes a SYSTEM tape (567CH), D a disk file (55D5H); any other letter repeats the prompt.

55B6
LD HL,5D58H 21 58 5D
Point Register Pair HL to 5D58H, the prompt Output to disk or tape (D,T,E,C) or <ENTER> to restart?, ended by 03H.
55B9
GOSUB to 59ABH to display the prompt at Register Pair HL and take up to 6 characters at 5F39H: the Z FLAG for ENTER alone.
55BC
If the Z FLAG is set (ENTER), JUMP to 5400H, the start of CMDFILE, to begin again from the banner.
55BF
LD A,(HL) 7E
Fetch the first character of the answer at Register Pair HL (5F39H) into Register A.
55C0
AND 5FH E6 5F
AND Register A with 5FH: a small letter becomes a capital (bit 5 cleared; bit 7 too).
55C2
CP 45H FE 45
Compare Register A (the letter) against 45H, the letter E: exit to LDOS.
55C4
If the Z FLAG is set (E), JUMP to 402DH, @EXIT, to end CMDFILE.
55C7
CP 43H FE 43
Compare Register A (the letter) against 43H, the letter C: cancel, start CMDFILE again.
55C9
If the Z FLAG is set (C), JUMP to 5400H, the start of CMDFILE, to begin again from the banner.
55CC
CP 54H FE 54
Compare Register A (the letter) against 54H, the letter T: write a SYSTEM tape.
55CE
If the Z FLAG is set (T), JUMP to 567CH to ask for the tape name and write the image to the cassette.
55D1
CP 44H FE 44
Compare Register A (the letter) against 44H, the letter D: write a disk file.
55D3
If the NZ FLAG is set (no letter CMDFILE takes), JUMP back to 55B6H to display the output prompt again.

55D5H - Output to Disk

Enter filespec to write output takes the file specification into the control block at 5F19H (default extension CMD) and @INIT opens or creates it with the buffer 5200H and records of 256 bytes. The records of the image from 6000H are written one byte at a time by 5654H, which writes each full sector with @VER (write and verify, as the manual says). Type 01H load blocks get their address offset by 565AH; a type 03H record is written as type 01H with its address kept (560CH); the transfer record (type 02H) ends the file: the bytes in the last sector go into the end of file byte (FCB +08H, 5F21H), that sector is written and the file closed. Any other record (the copyright record 1FH, a name record 05H) is copied as it is. ENTER alone at the file specification prompt is not refused: @INIT then works on the control block as the last file left it.

55D5
LD HL,5C39H 21 39 5C
Point Register Pair HL to 5C39H, the prompt Enter filespec to write output >, ended by 03H.
55D8
GOSUB to 598BH to display the prompt at Register Pair HL, take the file specification into 5F39H and @FSPEC it into 5F19H with the extension CMD.
55DB
LD HL,5200H 21 00 52
Load Register Pair HL with 5200H, the sector buffer below the program, for @INIT and for the byte pointer.
55DE
LD (5F5FH),HL 22 5F 5F
Store Register Pair HL (5200H) at 5F5FH-5F60H, the byte pointer: the first byte written goes to 5200H.
55E1
LD B,00H 06 00
Load Register B with 00H, a record length of 256 for @INIT: the file is written a whole sector at a time.
55E3
GOSUB to 4420H, @INIT, to open or create the file of the control block at Register Pair DE (5F19H) with the buffer at Register Pair HL (5200H).
55E6
If the NZ FLAG is set (an error), JUMP to 59C9H to display the error message and return to the input prompt.
55E9
LD HL,5FFFH 21 FF 5F
Load Register Pair HL with 5FFFH, the byte before the image: the first INC HL gives 6000H, the type of its first record.
55EC
INC HL 23
INCrement Register Pair HL to the type byte of the next record of the image.
55ED
LD A,(HL) 7E
Fetch the type of the record at Register Pair HL into Register A.
55EE
CP 01H FE 01
Compare Register A (the type) against 01H, a load block.
55F0
If the Z FLAG is set (a load block), JUMP to 5611H to write it with its address offset.
55F2
CP 02H FE 02
Compare Register A (the type) against 02H, the transfer address record, the last record of the image.
55F4
If the Z FLAG is set (the transfer record), JUMP to 5632H to write it, write the last sector and close the file.
55F6
CP 03H FE 03
Compare Register A (the type) against 03H, CMDFILE's mark of a load block that is not to be offset.
55F8
If the Z FLAG is set (type 03H), JUMP to 560CH to write it as a type 01H load block with its address unchanged.
55FA
GOSUB to 5654H to write Register A, the type byte of any other record, to the file.
55FD
INC HL 23
INCrement Register Pair HL to the length byte of the record.
55FE
LD A,(HL) 7E
Fetch the length of the record at Register Pair HL into Register A.
55FF
LD B,A 47
Copy Register A (the length) into Register B, the count of the bytes that follow it.
5600
GOSUB to 5654H to write Register A, the length byte, to the file.
5603
INC HL 23
INCrement Register Pair HL to the next byte of the record.
5604
LD A,(HL) 7E
Fetch the byte of the record at Register Pair HL into Register A.
5605
GOSUB to 5654H to write Register A, the byte of the record, to the file.
5608
DECrement Register B and JUMP back to 5603H until the bytes of the record are written (DJNZ).
560A
JUMP back to 55ECH to write the next record of the image.
560C
LD A,01H 3E 01
Load Register A with 01H, the type written for a type 03H record: an ordinary load block.
560E
LD (5F75H),A 32 75 5F
Store Register A (01H) at 5F75H, the no offset switch: 565AH keeps the address of this block and clears the switch.
5611
GOSUB to 5654H to write Register A (01H), the type of the load block, to the file.
5614
INC HL 23
INCrement Register Pair HL to the length byte of the load block.
5615
LD A,(HL) 7E
Fetch the length of the load block at Register Pair HL into Register A: the two address bytes and the data.
5616
LD B,A 47
Copy Register A (the length) into Register B, the count of the bytes of the block.
5617
GOSUB to 5654H to write Register A, the length byte, to the file.
561A
GOSUB to 565AH to fetch the load address after Register Pair HL into Register Pair DE, with the offset added unless kept.
561D
LD A,E 7B
Copy Register E (the low byte of the load address) into Register A, to write it.
561E
PUSH DE D5
Save Register Pair DE (the load address) to the stack: writing a full sector at 5A0CH changes Register Pair DE.
561F
GOSUB to 5654H to write Register A, the low byte of the load address, to the file.
5622
POP DE D1
Restore Register Pair DE from the stack: the load address.
5623
LD A,D 7A
Copy Register D (the high byte of the load address) into Register A, to write it.
5624
GOSUB to 5654H to write Register A, the high byte of the load address, to the file.
5627
DEC B 05
DECrement Register B: the low byte of the address, counted in the length, is written.
5628
DEC B 05
DECrement Register B: the high byte too; Register B = the data bytes of the block.
5629
INC HL 23
INCrement Register Pair HL to the next data byte of the load block.
562A
LD A,(HL) 7E
Fetch the data byte at Register Pair HL into Register A.
562B
GOSUB to 5654H to write Register A, the data byte, to the file.
562E
DECrement Register B and JUMP back to 5629H until the data of the block is written (DJNZ).
5630
JUMP back to 55ECH to write the next record of the image.
5632
LD B,04H 06 04
Load Register B with 04H, the four bytes of the transfer record: 02H, 02H and the address.
5634
GOSUB to 5654H to write Register A, the byte of the transfer record at Register Pair HL, to the file.
5637
INC HL 23
INCrement Register Pair HL to the next byte of the transfer record.
5638
LD A,(HL) 7E
Fetch the byte at Register Pair HL into Register A: the length, then the two bytes of the transfer address.
5639
DECrement Register B and JUMP back to 5634H until the four bytes are written (DJNZ).
563B
LD A,(5F5FH) 3A 5F 5F
Fetch the low byte of the byte pointer 5F5FH into Register A: the number of bytes in the last sector.
563E
OR A B7
Set the flags from Register A (OR A): the Z FLAG when the last sector is empty (the file ends at a sector boundary).
563F
LD (5F21H),A 32 21 5F
Store Register A (the bytes in the last sector) at 5F21H, the end of file byte (FCB +08H) of the control block at 5F19H.
5642
If the NZ FLAG is set (bytes in the buffer), GOSUB to 5A0CH to write the last sector with @VER.
5645
GOSUB to 59FCH to close the file with @CLOSE (an error goes to 59C9H).
5648
LD HL,5C5AH 21 5A 5C
Point Register Pair HL to 5C5AH, the question Module write is complete, write another (Y,N,E,C)?, ended by 03H.
564B
GOSUB to 5A6EH to display the question at Register Pair HL and take Y or N: the CARRY FLAG for N.
564E
If the NO CARRY FLAG is set (Y), JUMP back to 55B6H to ask for the next output of the same image.
5651
JUMP to 5448H (N) to begin a new image and display the input prompt, as the manual's second query.

5654H - Write a Byte; the Offset of a Load Address

5654H writes Register A through 5A03H, keeping Register Pair HL. 565AH fetches the load address of a block into Register Pair DE. When the switch 5F75H is set (a type 03H record) the address is kept and the switch cleared. Otherwise an address at or above the lowest address 5F6BH (the restrict address when one was given) gets the offset 5F6DH added; one below it is kept.

5654
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack: 5A03H loads the byte pointer into Register Pair HL.
5655
GOSUB to 5A03H to store Register A in the sector buffer and write the sector when it is full.
5658
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
5659
RET C9
RETurn to the caller with Register A written to the file.
565A
INC HL 23
INCrement Register Pair HL to the low byte of the load address in the image.
565B
LD E,(HL) 5E
Fetch the low byte of the load address at Register Pair HL into Register E.
565C
INC HL 23
INCrement Register Pair HL to the high byte of the load address.
565D
LD D,(HL) 56
Fetch the high byte of the load address at Register Pair HL into Register D: Register Pair DE = the load address.
565E
PUSH HL E5
Save Register Pair HL (the high byte of the address in the image) to the stack.
565F
LD HL,5F75H 21 75 5F
Point Register Pair HL to 5F75H, the no offset switch set by a type 03H record.
5662
INC (HL) 34
INCrement the byte at Register Pair HL (5F75H): the first half of a zero test that leaves Register A alone.
5663
DEC (HL) 35
DECrement the byte at Register Pair HL (5F75H) back: the Z FLAG when the switch is 00H.
5664
If the Z FLAG is set (an ordinary load block), JUMP to 5669H to test the address against the lowest address.
5666
DEC (HL) 35
DECrement the byte at Register Pair HL (5F75H) to 00H: the switch holds for this one block only.
5667
JUMP to 567AH to return with the load address in Register Pair DE unchanged.
5669
LD HL,(5F6BH) 2A 6B 5F
Fetch the lowest address (or the restrict address) from 5F6BH-5F6CH into Register Pair HL.
566C
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (the lowest address) with Register Pair DE (the load address): the Z FLAG when equal.
566D
If the Z FLAG is set (the block starts at the lowest address), JUMP to 5671H to add the offset.
566F
If the NO CARRY FLAG is set (the block is below the lowest address), JUMP to 567AH to keep its address.
5671
LD HL,(5F6DH) 2A 6D 5F
Fetch the offset from 5F6DH-5F6EH into Register Pair HL.
5674
LD A,H 7C
Copy Register H (the high byte of the offset) into Register A.
5675
OR L B5
OR Register L (the low byte of the offset) into Register A: the Z FLAG when the offset is 0000H.
5676
If the Z FLAG is set (no offset), JUMP to 567AH with the load address unchanged.
5678
ADD HL,DE 19
ADD Register Pair DE (the load address) to Register Pair HL (the offset): Register Pair HL = the new load address.
5679
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the new load address.
567A
POP HL E1
Restore Register Pair HL from the stack: the high byte of the load address in the image.
567B
RET C9
RETurn to the caller with the load address to write in Register Pair DE.

567CH - Output to Tape

Enter tape file name takes up to six characters at 5F59H; 597DH asks for the cassette and its speed (ROM 3042H: H 1500 baud, L 500 baud, kept at 4211H). The ROM writes the leader and the sync byte (0287H), then CMDFILE writes the SYSTEM format: 55H, the name in capitals padded with spaces to six, a 3CH block for each load block of the image (the count of data bytes, the load address with its offset, the data, and the checksum: the sum of the address bytes and the data), then 78H and the transfer address. Records of other types are passed over. ROM 022CH, called before each block, is JR 0212H (XOR A, RET) in ROM 3.1, so nothing is shown on the screen while the tape is written. ROM 01F8H turns the cassette off and ends with EI. Y at Module write is complete writes another copy with the same name.

567C
LD HL,5D41H 21 41 5D
Point Register Pair HL to 5D41H, the prompt Enter tape file name >, ended by 03H.
567F
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL (5D41H).
5682
LD HL,5F59H 21 59 5F
Point Register Pair HL to 5F59H, the six bytes of the tape name.
5685
LD B,06H 06 06
Load Register B with 06H, the most characters of a SYSTEM tape name.
5687
GOSUB to 59B3H to take up to 6 characters at Register Pair HL (5F59H) with ROM 0040H: Register A and Register B the count, the Z FLAG for none.
568A
If the Z FLAG is set (no name typed), JUMP back to 567CH to display the prompt again.
568C
LD (5F74H),A 32 74 5F
Store Register A (the length of the name) at 5F74H, kept for another copy of the tape (5720H).
568F
LD A,06H 3E 06
Load Register A with 06H, the length of the name field on the tape.
5691
SUB B 90
Subtract Register B (the length of the name) from Register A (06H): the spaces that pad the name to six.
5692
LD C,A 4F
Copy Register A (the number of spaces) into Register C.
5693
PUSH BC C5
Save Register Pair BC (Register B the name length, Register C the spaces) to the stack across the cassette prompt.
5694
GOSUB to 597DH to display Ready cassette and enter <H,L>, take the speed with ROM 3042H and end the line.
5697
DI F3
Disable the interrupts (DI): the timing of the tape write must not be broken by the clock interrupt.
5698
XOR A AF
Clear Register A (XOR A) to 00H, cassette 0 for ROM 0212H.
5699
GOSUB to ROM 0212H, the cassette select of the Model I, which in ROM 3.1 is XOR A and RET.
569C
GOSUB to ROM 0287H to start the cassette and write the leader and the sync byte that a read looks for.
569F
LD A,55H 3E 55
Load Register A with 55H, the first byte of a SYSTEM tape, before its name.
56A1
GOSUB to ROM 0264H to write the byte in Register A (55H) to the tape.
56A4
POP BC C1
Restore Register Pair BC from the stack: Register B the length of the name, Register C the spaces.
56A5
LD HL,5F59H 21 59 5F
Point Register Pair HL to 5F59H, the tape name as it was typed.
56A8
LD A,(HL) 7E
Fetch the character of the name at Register Pair HL into Register A.
56A9
INC HL 23
INCrement Register Pair HL to the next character of the name.
56AA
GOSUB to 5A9DH to make Register A a capital and write it to the tape with ROM 0264H.
56AD
DECrement Register B and JUMP back to 56A8H until the characters of the name are written (DJNZ).
56AF
XOR A AF
Clear Register A (XOR A) for the test of the number of spaces.
56B0
OR C B1
OR Register C (the spaces) into Register A: the Z FLAG when the name has six characters.
56B1
If the Z FLAG is set (no padding), JUMP to 56BBH to write the records of the image.
56B3
LD B,A 47
Copy Register A (the number of spaces) into Register B, the count for the DJNZ.
56B4
LD A,20H 3E 20
Load Register A with 20H, a space, the padding of the tape name.
56B6
GOSUB to ROM 0264H to write the byte in Register A (20H) to the tape.
56B9
DECrement Register B and JUMP back to 56B4H until the name is six characters long (DJNZ).
56BB
LD HL,5FFFH 21 FF 5F
Load Register Pair HL with 5FFFH, the byte before the image: the first INC HL gives 6000H, the type of its first record.
56BE
INC HL 23
INCrement Register Pair HL to the type byte of the next record of the image.
56BF
LD A,(HL) 7E
Fetch the type of the record at Register Pair HL into Register A.
56C0
CP 01H FE 01
Compare Register A (the type) against 01H, a load block.
56C2
If the Z FLAG is set (a load block), JUMP to 56D8H to write it as a 3CH block of the tape.
56C4
CP 02H FE 02
Compare Register A (the type) against 02H, the transfer address record.
56C6
If the Z FLAG is set (the transfer record), JUMP to 5704H to write 78H and the transfer address.
56C8
CP 03H FE 03
Compare Register A (the type) against 03H, a load block that is not to be offset.
56CA
If the Z FLAG is set (type 03H), JUMP to 56D3H to write it with its address unchanged.
56CC
INC HL 23
INCrement Register Pair HL to the length byte of a record that has no place on a tape.
56CD
LD C,(HL) 4E
Fetch the length of the record at Register Pair HL into Register C.
56CE
LD B,00H 06 00
Load Register B with 00H, the high byte of Register Pair BC: Register Pair BC = the length.
56D0
ADD HL,BC 09
ADD Register Pair BC (the length) to Register Pair HL: Register Pair HL = the last byte of the record passed over.
56D1
JUMP back to 56BEH to look at the next record of the image.
56D3
LD A,01H 3E 01
Load Register A with 01H, a value that is not 00H, for the no offset switch.
56D5
LD (5F75H),A 32 75 5F
Store Register A (01H) at 5F75H, the no offset switch: 565AH keeps the address of this block and clears the switch.
56D8
GOSUB to ROM 022CH, the Model I asterisk blink before a block, which in ROM 3.1 is JR 0212H: XOR A and RET.
56DB
LD A,3CH 3E 3C
Load Register A with 3CH, the mark of a data block of a SYSTEM tape.
56DD
GOSUB to ROM 0264H to write the byte in Register A (3CH) to the tape.
56E0
INC HL 23
INCrement Register Pair HL to the length byte of the load block in the image.
56E1
LD B,(HL) 46
Fetch the length of the load block at Register Pair HL into Register B: the two address bytes and the data.
56E2
DEC B 05
DECrement Register B: the low byte of the address is not data.
56E3
DEC B 05
DECrement Register B: the high byte neither; Register B = the data bytes of the block, 00H for 256.
56E4
LD A,B 78
Copy Register B (the number of data bytes) into Register A, the count byte of the tape block.
56E5
GOSUB to ROM 0264H to write the byte in Register A (the count) to the tape.
56E8
GOSUB to 565AH to fetch the load address after Register Pair HL into Register Pair DE, with the offset added unless kept.
56EB
LD A,E 7B
Copy Register E (the low byte of the load address) into Register A, to write it.
56EC
GOSUB to ROM 0264H to write the byte in Register A (the low byte of the address) to the tape.
56EF
LD A,D 7A
Copy Register D (the high byte of the load address) into Register A, to write it.
56F0
GOSUB to ROM 0264H to write the byte in Register A (the high byte of the address) to the tape.
56F3
ADD A,E 83
ADD Register E (the low byte) to Register A (the high byte): the checksum starts with the two address bytes.
56F4
LD C,A 4F
Copy Register A (the checksum so far) into Register C.
56F5
INC HL 23
INCrement Register Pair HL to the next data byte of the load block.
56F6
LD A,(HL) 7E
Fetch the data byte at Register Pair HL into Register A.
56F7
GOSUB to ROM 0264H to write the byte in Register A (the data byte) to the tape: the ADD that follows takes Register A back from ROM 0264H unchanged.
56FA
ADD A,C 81
ADD Register C (the checksum so far) to Register A (the data byte): the sum of the block, modulo 256.
56FB
LD C,A 4F
Copy Register A (the new checksum) into Register C.
56FC
DECrement Register B and JUMP back to 56F5H until the data of the block is written (DJNZ).
56FE
LD A,C 79
Copy Register C (the checksum of the address and the data) into Register A, to write it.
56FF
GOSUB to ROM 0264H to write the byte in Register A (the checksum) to the tape, the end of the block.
5702
JUMP back to 56BEH to look at the next record of the image.
5704
LD A,78H 3E 78
Load Register A with 78H, the mark of the end of a SYSTEM tape, before the transfer address.
5706
GOSUB to ROM 0264H to write the byte in Register A (78H) to the tape.
5709
INC HL 23
INCrement Register Pair HL past the type byte to the length byte (02H) of the transfer record.
570A
INC HL 23
INCrement Register Pair HL to the low byte of the transfer address.
570B
LD A,(HL) 7E
Fetch the low byte of the transfer address at Register Pair HL into Register A.
570C
GOSUB to ROM 0264H to write the byte in Register A (the low byte of the transfer address) to the tape.
570F
INC HL 23
INCrement Register Pair HL to the high byte of the transfer address.
5710
LD A,(HL) 7E
Fetch the high byte of the transfer address at Register Pair HL into Register A.
5711
GOSUB to ROM 0264H to write the byte in Register A (the high byte of the transfer address) to the tape.
5714
GOSUB to ROM 01F8H to turn the cassette off; in ROM 3.1 it ends with EI, so the interrupts run again.
5717
LD HL,5C5AH 21 5A 5C
Point Register Pair HL to 5C5AH, the question Module write is complete, write another (Y,N,E,C)?, ended by 03H.
571A
GOSUB to 5A6EH to display the question at Register Pair HL and take Y or N: the CARRY FLAG for N.
571D
If the CARRY FLAG is set (N), JUMP to 5448H to begin a new image and display the input prompt.
5720
LD A,(5F74H) 3A 74 5F
Fetch the length of the tape name from 5F74H into Register A (Y: another copy of the tape).
5723
LD B,A 47
Copy Register A (the length of the name) into Register B, as 568FH expects it.
5724
JUMP to 568FH to write another copy of the image to the tape with the same name.

5727H - Reading a Load Module from Disk

The records of the file are read one byte at a time by 59D1H and copied into the image by 5969H, type byte first: a load block (01H, 575CH), the transfer record (02H, 5844H, which ends the read), the end of a library member (04H, 5824H), an ISAM member header (08H, 57C3H) and the end of the ISAM directory (0AH, 57BAH). Any other record (the copyright record 1FH, a name record 05H) is copied as it is, with its length. 57E7H, the operand of CP 00H at 57E6H, holds the ISAM member wanted: 00H while none has been asked for.

5727
XOR A AF
Clear Register A (XOR A) to 00H: no ISAM member has been asked for yet in this file.
5728
LD (57E7H),A 32 E7 57
Store Register A (00H) at 57E7H, the operand of CP 00H at 57E6H, the number of the ISAM member wanted.
572B
GOSUB to 59D1H to read the next byte of the file into Register A, the type of the next record (an end of file is an error).
572E
GOSUB to 5969H to store Register A (the type) one byte after Register Pair HL in the image, and test for the end of memory.
5731
CP 01H FE 01
Compare Register A (the type) against 01H, a load block.
5733
If the Z FLAG is set (a load block), JUMP to 575CH to log its addresses and copy it.
5735
CP 02H FE 02
Compare Register A (the type) against 02H, the transfer address record.
5737
If the Z FLAG is set (the transfer record), JUMP to 5844H to copy it, display the transfer address and end the read.
573A
CP 04H FE 04
Compare Register A (the type) against 04H, the end of a member of a library file.
573C
If the Z FLAG is set (the end of a member), JUMP to 5824H to end the member with a transfer record.
573F
CP 08H FE 08
Compare Register A (the type) against 08H, the header of an ISAM member in a library file.
5741
If the Z FLAG is set (an ISAM member header), JUMP to 57C3H to ask for the member and look for it.
5744
CP 0AH FE 0A
Compare Register A (the type) against 0AH, the end of the ISAM directory of a library file.
5746
If the Z FLAG is set (the end of the directory), JUMP to 57BAH: the member asked for is not in the file.
5749
GOSUB to 59D1H to read the next byte of the file into Register A, the length of the record.
574C
GOSUB to 5969H to store Register A (the length) one byte after Register Pair HL in the image.
574F
LD B,A 47
Copy Register A (the length) into Register B, the count of the bytes of the record (00H for 256).
5750
PUSH BC C5
Save Register Pair BC (Register B the count) to the stack: the read of 59D1H can change Register Pair BC.
5751
GOSUB to 59D1H to read the next byte of the record into Register A.
5754
GOSUB to 5969H to store Register A (the byte) one byte after Register Pair HL in the image.
5757
POP BC C1
Restore Register Pair BC from the stack: Register B the count.
5758
DECrement Register B and JUMP back to 5750H until the bytes of the record are copied (DJNZ).
575A
JUMP back to 572BH to read the type of the next record.

575CH - Load Blocks and the Address Load Log

The length and the load address are copied; the address is compared with the lowest address 5F6BH, the last address of the block (the address + the data bytes - 1, a count of 00H giving 256) with the highest 5F69H. Block loads from XXXX to XXXX (5B51H) is displayed for every block, and also printed when the log switch 5F73H is set. Then the data bytes are copied by the loop at 5750H.

575C
GOSUB to 59D1H to read the next byte of the file into Register A, the length of the load block.
575F
GOSUB to 5969H to store Register A (the length) one byte after Register Pair HL in the image.
5762
LD B,A 47
Copy Register A (the length) into Register B: the address bytes and the data.
5763
DEC B 05
DECrement Register B: the low byte of the address is not data.
5764
DEC B 05
DECrement Register B: the high byte neither; Register B = the data bytes of the block, 00H for 256.
5765
GOSUB to 593CH to read the two bytes of the load address into Register Pair DE and store them in the image.
5768
LD (5F63H),DE ED 53 63 5F
Store Register Pair DE (the load address) at 5F63H-5F64H, the first address of the block for the log line.
576C
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack across the address tests.
576D
LD HL,(5F6BH) 2A 6B 5F
Fetch the lowest address loaded from 5F6BH-5F6CH into Register Pair HL.
5770
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (the lowest address) with Register Pair DE (the load address): the CARRY FLAG when it is lower.
5771
If the CARRY FLAG is set (the lowest address is below the block), JUMP to 5777H with it unchanged.
5773
LD (5F6BH),DE ED 53 6B 5F
Store Register Pair DE (the load address) at 5F6BH-5F6CH: the new lowest address loaded.
5777
LD HL,5F64H 21 64 5F
Point Register Pair HL to 5F64H, the high byte of the first address of the block, for the first XXXX of the log line.
577A
LD DE,5B62H 11 62 5B
Point Register Pair DE to 5B62H, the first XXXX of Block loads from XXXX to XXXX.
577D
GOSUB to 594DH to write the word at Register Pair HL (5F64H, then 5F63H) as four hex digits at Register Pair DE (5B62H).
5780
LD HL,(5F63H) 2A 63 5F
Fetch the first address of the block from 5F63H-5F64H into Register Pair HL.
5783
PUSH BC C5
Save Register Pair BC (Register B the data bytes) to the stack for the copy at 5750H.
5784
XOR A AF
Clear Register A (XOR A) for the test of the count.
5785
OR B B0
OR Register B (the data bytes) into Register A: the Z FLAG when the count is 00H, 256 bytes.
5786
If the Z FLAG is set (256 bytes), JUMP to 578DH to add 256 with INC H.
5788
LD A,L 7D
Copy Register L (the low byte of the address) into Register A.
5789
ADD A,B 80
ADD Register B (the data bytes) to Register A: the low byte of the address after the block.
578A
LD L,A 6F
Copy Register A (the low byte) into Register L.
578B
If the NO CARRY FLAG is set (no carry into the high byte), JUMP to 578EH.
578D
INC H 24
INCrement Register H: 256 added to Register Pair HL (a count of 00H), or the carry of the ADD.
578E
DEC HL 2B
DECrement Register Pair HL: Register Pair HL = the last address of the block.
578F
LD (5F65H),HL 22 65 5F
Store Register Pair HL (the last address of the block) at 5F65H-5F66H for the log line.
5792
LD DE,(5F69H) ED 5B 69 5F
Fetch the highest address loaded from 5F69H-5F6AH into Register Pair DE.
5796
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (the last address) with Register Pair DE (the highest): the CARRY FLAG when it is lower.
5797
If the CARRY FLAG is set (the block ends below the highest address), JUMP to 579CH with it unchanged.
5799
LD (5F69H),HL 22 69 5F
Store Register Pair HL (the last address of the block) at 5F69H-5F6AH: the new highest address loaded.
579C
LD HL,5F66H 21 66 5F
Point Register Pair HL to 5F66H, the high byte of the last address of the block, for the second XXXX of the log line.
579F
LD DE,5B6AH 11 6A 5B
Point Register Pair DE to 5B6AH, the second XXXX of Block loads from XXXX to XXXX.
57A2
GOSUB to 594DH to write the word at Register Pair HL (5F66H, then 5F65H) as four hex digits at Register Pair DE (5B6AH).
57A5
LD HL,5B51H 21 51 5B
Point Register Pair HL to 5B51H, the log line Block loads from XXXX to XXXX with both addresses written in.
57A8
GOSUB to 4467H, @DSPLY, to display the log line at Register Pair HL (5B51H).
57AB
LD HL,5F73H 21 73 5F
Point Register Pair HL to 5F73H, the log switch set at 5445H.
57AE
INC (HL) 34
INCrement the byte at Register Pair HL (5F73H): the first half of a zero test.
57AF
DEC (HL) 35
DECrement the byte at Register Pair HL (5F73H) back: the Z FLAG when the log goes to the video only.
57B0
LD HL,5B51H 21 51 5B
Point Register Pair HL to 5B51H, the log line, again; LD leaves the Z FLAG of the test.
57B3
If the NZ FLAG is set (the log switch is on), GOSUB to 446AH, @PRINT, to print the log line at Register Pair HL (5B51H).
57B6
POP BC C1
Restore Register Pair BC from the stack: Register B the data bytes of the block.
57B7
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
57B8
JUMP back to 5750H to copy the data bytes of the load block into the image.

57BAH - The ISAM Members of a Library File

A library file (SYS6/SYS, SYS7/SYS) starts with the headers of its members, type 08H records of six bytes: the member number, the entry address, the record of the file where the member starts and the byte in that record. The first header asks File has ISAM overlays, enter # (two hex digits) and the number goes into 57E7H. A header of another member is passed over; the header of the member asked for gives the transfer address (5F67H), @POSN goes to its record and the byte pointer is set to the byte before the member, so the next byte read is its first record. The end of the directory (0AH) means the member is not in the file: Requested file is not a Command or System file. With FFH, as the manual says, no header matches, the 0AH record and the end of member records (04H) are copied like any other, and every member is read into the image. A member whose header gives byte 00H would be taken from the wrong place: the pointer 51FFH set at 5814H makes the next byte read another record (59E3H); no header on the diskette gives 00H.

57BA
LD A,(57E7H) 3A E7 57
Fetch the number of the member asked for from 57E7H, the operand of CP 00H at 57E6H, into Register A.
57BD
INC A 3C
INCrement Register A: the Z FLAG when the number is FFH, the whole file.
57BE
If the NZ FLAG is set (a member was asked for and not found), JUMP to 59D7H to display Requested file is not a Command or System file.
57C1
JUMP to 5749H (FFH) to copy the end of directory record into the image like any other record.
57C3
DEC HL 2B
DECrement Register Pair HL: the type byte 08H stored by 572EH is taken back out of the image.
57C4
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack across the header.
57C5
LD A,(57E7H) 3A E7 57
Fetch the number of the member asked for from 57E7H into Register A.
57C8
OR A B7
Set the flags from Register A (OR A): the Z FLAG when no member has been asked for yet.
57C9
If the NZ FLAG is set (the number is known), JUMP to 57DEH to compare it with this header.
57CB
LD HL,5ED7H 21 D7 5E
Point Register Pair HL to 5ED7H, the prompt File has ISAM overlays, enter # >, ended by 03H.
57CE
GOSUB to 59ABH to display the prompt at Register Pair HL and take up to 6 characters at 5F39H: the Z FLAG for ENTER alone.
57D1
If the Z FLAG is set (nothing typed), JUMP back to 57CBH to display the prompt again.
57D3
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = 5F39H, the answer, for the hex conversion of 5A42H.
57D4
LD A,(DE) 1A
Fetch the first character of the answer at Register Pair DE (5F39H) into Register A, as 5A42H expects it.
57D5
GOSUB to 5A42H to convert the hex digits at Register Pair DE into Register Pair HL: the CARRY FLAG for a character that is not hex.
57D8
If the CARRY FLAG is set (not a hex number), JUMP back to 57CBH to display the prompt again.
57DA
LD A,L 7D
Copy Register L (the low byte of the number typed) into Register A.
57DB
LD (57E7H),A 32 E7 57
Store Register A (the member number) at 57E7H, the operand of CP 00H at 57E6H; an answer of 00H asks again at the next header.
57DE
GOSUB to 59D1H to read the next byte of the file into Register A, the length of the header record.
57E1
LD B,A 47
Copy Register A (the length) into Register B, the bytes of the header.
57E2
GOSUB to 59D1H to read the next byte of the file into Register A, the member number of this header.
57E5
DEC B 05
DECrement Register B: the member number is read; Register B = the bytes left in the header.
57E6
CP 00H FE 00
Compare Register A (the member number of the header) against 00H, the operand 57E7H, the number of the member asked for.
57E8
If the NZ FLAG is set (another member), JUMP to 581CH to pass over the rest of the header.
57EA
GOSUB to 59D1H to read the next byte of the file into Register A, the low byte of the member's entry address.
57ED
LD L,A 6F
Copy Register A (the low byte) into Register L.
57EE
GOSUB to 59D1H to read the next byte of the file into Register A, the high byte of the entry address.
57F1
LD H,A 67
Copy Register A (the high byte) into Register H: Register Pair HL = the entry address of the member.
57F2
LD (5F67H),HL 22 67 5F
Store Register Pair HL (the entry address) at 5F67H-5F68H, the transfer address of the image (5824H writes it).
57F5
GOSUB to 59D1H to read the next byte of the file into Register A, the low byte of the record where the member starts.
57F8
LD L,A 6F
Copy Register A (the low byte of the record number) into Register L.
57F9
GOSUB to 59D1H to read the next byte of the file into Register A, the high byte of the record number.
57FC
LD H,A 67
Copy Register A (the high byte) into Register H: Register Pair HL = the record number of the member.
57FD
GOSUB to 59D1H to read the next byte of the file into Register A, the byte in that record where the member starts.
5800
LD C,A 4F
Copy Register A (the byte in the record) into Register C.
5801
PUSH BC C5
Save Register Pair BC (Register C the byte in the record) to the stack across @POSN.
5802
LD B,H 44
Copy Register H (the high byte of the record number) into Register B, for @POSN.
5803
LD C,L 4D
Copy Register L (the low byte of the record number) into Register C: Register Pair BC = the record number.
5804
LD DE,5F19H 11 19 5F
Point Register Pair DE to 5F19H, the control block of the file being read.
5807
GOSUB to 4442H, @POSN, to put the file at Register Pair DE (5F19H) at the record in Register Pair BC: the NZ FLAG for an error.
580A
POP BC C1
Restore Register Pair BC from the stack: Register C the byte in the record.
580B
LD HL,5EFAH 21 FA 5E
Point Register Pair HL to 5EFAH, the text Overlay beyond end of file!, ended by 0DH; LD leaves the flags of @POSN.
580E
If the NZ FLAG is set (the record is not in the file), JUMP to 59DAH to display the text at Register Pair HL and return to the input prompt.
5811
LD H,52H 26 52
Load Register H with 52H, the page of the sector buffer 5200H-52FFH.
5813
LD L,C 69
Copy Register C (the byte in the record) into Register L: Register Pair HL = the member's first byte in the buffer.
5814
DEC HL 2B
DECrement Register Pair HL to the byte before it: the next read (59E0H) increments the pointer first.
5815
GOSUB to 59E4H to store Register Pair HL as the byte pointer 5F5FH and, with the Z FLAG of @POSN, read the record into 5200H.
5818
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
5819
JUMP to 572BH to read the records of the member, or the next record after a header passed over.
581C
GOSUB to 59D1H to read the next byte of the header into Register A, which is passed over.
581F
DECrement Register B and JUMP back to 581CH until the rest of the header is read (DJNZ).
5821
JUMP to 5818H to restore Register Pair HL and read the next record.

5824H - The End of a Member and the Transfer Record

The end of a member (04H) ends the read as a transfer record would: the 04H is taken back out of the image and a transfer record 02H 02H with the entry address 5F67H is stored in its place (with FFH the 04H record is copied instead). A transfer record of the file (02H) must have the length 02H; its address goes to 5F67H. Both display Transfer address (entry point) is XXXX, printed too when the log switch is set, and return to the caller with Register Pair HL at the last byte of the image.

5824
LD A,(57E7H) 3A E7 57
Fetch the number of the member asked for from 57E7H into Register A.
5827
INC A 3C
INCrement Register A: the Z FLAG when the number is FFH, the whole file.
5828
If the Z FLAG is set (FFH), JUMP to 5749H to copy the end of member record into the image like any other record.
582B
DEC HL 2B
DECrement Register Pair HL: the type byte 04H stored by 572EH is taken back out of the image.
582C
LD A,02H 3E 02
Load Register A with 02H, the type of the transfer address record.
582E
GOSUB to 5969H to store Register A (02H, the type) one byte after Register Pair HL in the image.
5831
LD A,02H 3E 02
Load Register A with 02H, the length of the transfer address record.
5833
GOSUB to 5969H to store Register A (02H, the length) one byte after Register Pair HL in the image.
5836
LD A,(5F67H) 3A 67 5F
Fetch the low byte of the transfer address from 5F67H into Register A: the member's entry address (57F2H).
5839
GOSUB to 5969H to store Register A (the low byte) one byte after Register Pair HL in the image.
583C
LD A,(5F68H) 3A 68 5F
Fetch the high byte of the transfer address from 5F68H into Register A.
583F
GOSUB to 5969H to store Register A (the high byte) one byte after Register Pair HL in the image.
5842
JUMP to 5856H to display the transfer address and end the read.
5844
GOSUB to 59D1H to read the next byte of the file into Register A, the length of the transfer record.
5847
GOSUB to 5969H to store Register A (the length) one byte after Register Pair HL in the image.
584A
CP 02H FE 02
Compare Register A (the length) against 02H, the only length of a transfer record.
584C
If the NZ FLAG is set (another length), JUMP to 59D7H to display Requested file is not a Command or System file.
584F
GOSUB to 593CH to read the two bytes of the transfer address into Register Pair DE and store them in the image.
5852
LD (5F67H),DE ED 53 67 5F
Store Register Pair DE (the transfer address) at 5F67H-5F68H, the transfer address of the image.
5856
PUSH HL E5
Save Register Pair HL (the last byte of the image) to the stack across the display.
5857
LD HL,5F68H 21 68 5F
Point Register Pair HL to 5F68H, the high byte of the transfer address, for the XXXX of the text.
585A
LD DE,5B9AH 11 9A 5B
Point Register Pair DE to 5B9AH, the XXXX of Transfer address (entry point) is XXXX.
585D
GOSUB to 594DH to write the word at Register Pair HL (5F68H, then 5F67H) as four hex digits at Register Pair DE (5B9AH).
5860
LD HL,5B78H 21 78 5B
Point Register Pair HL to 5B78H, the text Transfer address (entry point) is XXXX, ended by 0DH.
5863
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5B78H).
5866
LD HL,5F73H 21 73 5F
Point Register Pair HL to 5F73H, the log switch set at 5445H.
5869
INC (HL) 34
INCrement the byte at Register Pair HL (5F73H): the first half of a zero test.
586A
DEC (HL) 35
DECrement the byte at Register Pair HL (5F73H) back: the Z FLAG when the log goes to the video only.
586B
LD HL,5B78H 21 78 5B
Point Register Pair HL to 5B78H, the text of the transfer address, again; LD leaves the Z FLAG of the test.
586E
If the NZ FLAG is set (the log switch is on), GOSUB to 446AH, @PRINT, to print the text at Register Pair HL (5B78H).
5871
POP HL E1
Restore Register Pair HL from the stack: the last byte of the image.
5872
RET C9
RETurn to the caller (5494H, 549CH) with Register Pair HL the last byte of the image: the file is read.

5873H - Input from Tape

597DH asks for the cassette and its speed; ROM 0296H finds the leader and the sync byte, and the bytes are read until the 55H of a SYSTEM file. The image gets a name record: type 05H, length 06H and the six characters of the name, which are also copied over FILNAM at 5B6FH for the display. Each 3CH block becomes a load block (01H, the count + 2, the address, the data) and its checksum is compared; a wrong checksum or a mark that is neither 3CH nor 78H turns the cassette off and ends with Tape checksum error detected, reread tape! The 78H mark is followed by the transfer address (ROM 0314H), which gives a transfer record. As the manual says, no Block loads from line is shown for a tape. Found in the code: a block whose address becomes the new lowest address (58D4H) is not compared with the highest address, so the end of the first block of a tape is never counted, and a tape of one block leaves the highest address at 0000H for the base address prompt and the driver.

5873
DI F3
Disable the interrupts (DI) for the timing of the tape read; ROM 3042H in 597DH enables them again for the key.
5874
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack across the cassette prompt.
5875
GOSUB to 597DH to display Ready cassette and enter <H,L>, take the speed with ROM 3042H and end the line.
5878
XOR A AF
Clear Register A (XOR A) to 00H, cassette 0 for ROM 0212H.
5879
GOSUB to ROM 0212H, the cassette select of the Model I, which in ROM 3.1 is XOR A and RET.
587C
GOSUB to ROM 0296H to start the cassette and read until the leader and the sync byte are found.
587F
GOSUB to ROM 0235H to read the next byte of the tape into Register A.
5882
CP 55H FE 55
Compare Register A (the byte) against 55H, the first byte of a SYSTEM file.
5884
If the NZ FLAG is set (not 55H), JUMP back to 587FH to read the next byte.
5886
LD A,05H 3E 05
Load Register A with 05H, the type of a name record in a load module.
5888
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
5889
GOSUB to 5969H to store Register A (05H, the type) one byte after Register Pair HL in the image.
588C
LD A,06H 3E 06
Load Register A with 06H, the length of the name record: the six characters of the tape name.
588E
GOSUB to 5969H to store Register A (06H, the length) one byte after Register Pair HL in the image.
5891
LD B,A 47
Copy Register A (06H) into Register B, the count of the characters of the name.
5892
LD IX,5B6FH DD 21 6F 5B
Point Index Register IX to 5B6FH, the word FILNAM of the text FILNAM: shown before the transfer address.
5896
GOSUB to ROM 0235H to read the next byte of the tape into Register A, a character of the name.
5899
LD (IX+00H),A DD 77 00
Store Register A (the character) at IX+00H, Index Register IX, over the text at 5B6FH.
589C
INC IX DD 23
INCrement Index Register IX to the next character of the text.
589E
GOSUB to 5969H to store Register A (the character) one byte after Register Pair HL in the image.
58A1
DECrement Register B and JUMP back to 5896H until the six characters of the name are read (DJNZ).
58A3
GOSUB to ROM 022CH, the Model I asterisk blink before a block, which in ROM 3.1 is JR 0212H: XOR A and RET.
58A6
GOSUB to ROM 0235H to read the next byte of the tape into Register A, the mark of the next part of the file.
58A9
CP 78H FE 78
Compare Register A (the mark) against 78H, the end of the file, followed by the transfer address.
58AB
If the Z FLAG is set (78H), JUMP to 590EH to read the transfer address.
58AD
CP 3CH FE 3C
Compare Register A (the mark) against 3CH, a data block.
58AF
If the NZ FLAG is set (another byte), JUMP to 5904H to turn the cassette off and display the checksum error.
58B1
LD A,01H 3E 01
Load Register A with 01H, the type of a load block in the image.
58B3
GOSUB to 5969H to store Register A (01H, the type) one byte after Register Pair HL in the image.
58B6
GOSUB to ROM 0235H to read the next byte of the tape into Register A, the count of data bytes (00H for 256).
58B9
LD B,A 47
Copy Register A (the count) into Register B, the bytes to read.
58BA
INC A 3C
INCrement Register A, the first of the two address bytes counted in the length of a load block.
58BB
INC A 3C
INCrement Register A: the length of the load block, the count + 2.
58BC
GOSUB to 5969H to store Register A (the length) one byte after Register Pair HL in the image.
58BF
GOSUB to ROM 0235H to read the next byte of the tape into Register A, the low byte of the load address.
58C2
INC HL 23
INCrement Register Pair HL to the next byte of the image.
58C3
LD (HL),A 77
Store Register A (the low byte of the address) at Register Pair HL, in the image; this store has no memory test.
58C4
LD E,A 5F
Copy Register A (the low byte of the address) into Register E.
58C5
GOSUB to ROM 0235H to read the next byte of the tape into Register A, the high byte of the load address.
58C8
INC HL 23
INCrement Register Pair HL to the next byte of the image.
58C9
LD (HL),A 77
Store Register A (the high byte of the address) at Register Pair HL, in the image; this store has no memory test.
58CA
LD D,A 57
Copy Register A (the high byte) into Register D: Register Pair DE = the load address of the block.
58CB
ADD A,E 83
ADD Register E (the low byte) to Register A (the high byte): the checksum starts with the two address bytes.
58CC
LD C,A 4F
Copy Register A (the checksum so far) into Register C.
58CD
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack across the address tests.
58CE
LD HL,(5F6BH) 2A 6B 5F
Fetch the lowest address loaded from 5F6BH-5F6CH into Register Pair HL.
58D1
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (the lowest address) with Register Pair DE (the load address): the CARRY FLAG when it is lower.
58D2
If the CARRY FLAG is set (the lowest address is below the block), JUMP to 58DBH to compute the end of the block.
58D4
LD (5F6BH),DE ED 53 6B 5F
Store Register Pair DE (the load address) at 5F6BH-5F6CH: the new lowest address loaded.
58D8
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
58D9
JUMP to 58F4H to read the data of the block, without the test of the highest address that 58DBH makes.
58DB
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair HL = the load address, Register Pair DE = the lowest address.
58DC
PUSH BC C5
Save Register Pair BC (Register B the count, Register C the checksum) to the stack.
58DD
XOR A AF
Clear Register A (XOR A) for the test of the count.
58DE
OR B B0
OR Register B (the data bytes) into Register A: the Z FLAG when the count is 00H, 256 bytes.
58DF
If the Z FLAG is set (256 bytes), JUMP to 58E6H to add 256 with INC H.
58E1
LD A,L 7D
Copy Register L (the low byte of the address) into Register A.
58E2
ADD A,B 80
ADD Register B (the data bytes) to Register A: the low byte of the address after the block.
58E3
LD L,A 6F
Copy Register A (the low byte) into Register L.
58E4
If the NO CARRY FLAG is set (no carry into the high byte), JUMP to 58E7H.
58E6
INC H 24
INCrement Register H: 256 added to Register Pair HL (a count of 00H), or the carry of the ADD.
58E7
DEC HL 2B
DECrement Register Pair HL: Register Pair HL = the last address of the block.
58E8
LD DE,(5F69H) ED 5B 69 5F
Fetch the highest address loaded from 5F69H-5F6AH into Register Pair DE.
58EC
RST 18H DF
RST 18H, the ROM's compare of Register Pair HL (the last address) with Register Pair DE (the highest): the CARRY FLAG when it is lower.
58ED
If the CARRY FLAG is set (the block ends below the highest address), JUMP to 58F2H with it unchanged.
58EF
LD (5F69H),HL 22 69 5F
Store Register Pair HL (the last address of the block) at 5F69H-5F6AH: the new highest address loaded.
58F2
POP BC C1
Restore Register Pair BC from the stack: Register B the count, Register C the checksum.
58F3
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
58F4
GOSUB to ROM 0235H to read the next byte of the tape into Register A, a data byte of the block.
58F7
GOSUB to 5969H to store Register A (the data byte) one byte after Register Pair HL in the image.
58FA
ADD A,C 81
ADD Register C (the checksum so far) to Register A (the data byte): the sum of the block, modulo 256.
58FB
LD C,A 4F
Copy Register A (the new checksum) into Register C.
58FC
DECrement Register B and JUMP back to 58F4H until the data of the block is read (DJNZ).
58FE
GOSUB to ROM 0235H to read the next byte of the tape into Register A, the checksum of the block.
5901
CP C B9
Compare Register A (the checksum on the tape) against Register C (the checksum computed): the Z FLAG when they agree.
5902
If the Z FLAG is set (the block is good), JUMP back to 58A3H to read the next mark.
5904
GOSUB to ROM 01F8H to turn the cassette off (and enable the interrupts) after a bad block or a bad mark.
5907
LD HL,5CBCH 21 BC 5C
Point Register Pair HL to 5CBCH, the text Tape checksum error detected, reread tape!, ended by 0DH.
590A
JUMP to 5977H to display the text at Register Pair HL and return to the input prompt; the image keeps its end at 5F61H.
590D
NOP 00
No Operation: 00H, a byte between JP 5977H and 590EH that no instruction of CMDFILE reaches or reads.
590E
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack across ROM 0314H.
590F
GOSUB to ROM 0314H to read two bytes of the tape into Register Pair HL: the transfer address after the 78H mark.
5912
LD (5F67H),HL 22 67 5F
Store Register Pair HL (the transfer address) at 5F67H-5F68H, the transfer address of the image.
5915
GOSUB to ROM 01F8H to turn the cassette off; in ROM 3.1 it ends with EI, so the interrupts run again.
5918
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
5919
GOSUB to 5927H to store a transfer record 02H 02H and the address 5F67H after Register Pair HL in the image.
591C
PUSH HL E5
Save Register Pair HL (the last byte of the image) to the stack across the display of the name.
591D
LD HL,5B6FH 21 6F 5B
Point Register Pair HL to 5B6FH, the name of the tape followed by a colon and a space, ended by 03H.
5920
GOSUB to 4467H, @DSPLY, to display the name at Register Pair HL (5B6FH); the cursor stays on the line.
5923
POP HL E1
Restore Register Pair HL from the stack: the last byte of the image.
5924
JUMP to 5856H to display the transfer address and return with Register Pair HL the last byte of the image.

5927H - The Transfer Record, a Word and the Hex Digits

5927H stores a transfer record (02H, 02H and the address at 5F67H) in the image. 593CH reads a word of the file into Register Pair DE, storing both bytes in the image. 594DH writes the word whose high byte is at Register Pair HL (the low byte at HL - 1) as four hex digits at Register Pair DE: 5950H does one byte, high digit first, and its second digit runs into 5960H, whose RET goes back into 5950H for the second byte; ADD A,90H / DAA / ADC A,40H / DAA makes a digit 0-FH into its character.

5927
LD B,02H 06 02
Load Register B with 02H: two bytes of 02H, the type and the length of a transfer record.
5929
LD A,B 78
Copy Register B (02H) into Register A, the byte stored twice by the loop.
592A
GOSUB to 5969H to store Register A (02H) one byte after Register Pair HL in the image.
592D
DECrement Register B and JUMP back to 592AH until 02H is stored twice (DJNZ); Register A stays 02H.
592F
LD A,(5F67H) 3A 67 5F
Fetch the low byte of the transfer address from 5F67H into Register A.
5932
GOSUB to 5969H to store Register A (the low byte) one byte after Register Pair HL in the image.
5935
LD A,(5F68H) 3A 68 5F
Fetch the high byte of the transfer address from 5F68H into Register A.
5938
GOSUB to 5969H to store Register A (the high byte) one byte after Register Pair HL in the image.
593B
RET C9
RETurn to the caller with Register Pair HL the last byte of the transfer record.
593C
GOSUB to 59D1H to read the next byte of the file into Register A, the low byte of a word.
593F
GOSUB to 5969H to store Register A (the low byte) one byte after Register Pair HL in the image.
5942
LD E,A 5F
Copy Register A (the low byte) into Register E.
5943
PUSH DE D5
Save Register Pair DE (Register E the low byte) to the stack: 5969H changes Register Pair DE.
5944
GOSUB to 59D1H to read the next byte of the file into Register A, the high byte of the word.
5947
GOSUB to 5969H to store Register A (the high byte) one byte after Register Pair HL in the image.
594A
POP DE D1
Restore Register Pair DE from the stack: Register E the low byte.
594B
LD D,A 57
Copy Register A (the high byte) into Register D: Register Pair DE = the word read.
594C
RET C9
RETurn to the caller with the word in Register Pair DE.
594D
GOSUB to 5950H to write the byte at Register Pair HL (the high byte) as two hex digits at Register Pair DE; it returns with Register Pair HL one lower.
5950
LD A,(HL) 7E
Fetch the byte at Register Pair HL into Register A, for its high digit.
5951
SRL A CB 3F
Shift Register A right by one bit (SRL A), the first of four: the high digit moves to bits 3-0.
5953
SRL A CB 3F
Shift Register A right by one bit (SRL A), the second of four shifts of the high digit.
5955
SRL A CB 3F
Shift Register A right by one bit (SRL A), the third of four shifts of the high digit.
5957
SRL A CB 3F
Shift Register A right by one bit (SRL A), the fourth: Register A = the high digit, 00H-0FH.
5959
GOSUB to 5960H to store the character of the digit in Register A at Register Pair DE.
595C
LD A,(HL) 7E
Fetch the byte at Register Pair HL into Register A again, for its low digit.
595D
AND 0FH E6 0F
AND Register A with 0FH: Register A = the low digit, 00H-0FH.
595F
DEC HL 2B
DECrement Register Pair HL to the next lower byte, the low byte of the word, for the second pass.
5960
ADD A,90H C6 90
ADD 90H to Register A (the digit): 90H-99H for 0-9, 9AH-9FH for AH-FH.
5962
DAA 27
Decimal Adjust Register A (DAA): 90H-99H stay with no carry; 9AH-9FH become 00H-05H with the CARRY FLAG.
5963
ADC A,40H CE 40
ADD 40H and the CARRY FLAG to Register A (ADC A,40H): D0H-D9H for 0-9, 41H-46H for AH-FH.
5965
DAA 27
Decimal Adjust Register A (DAA): D0H-D9H become 30H-39H, the characters 0-9; 41H-46H stay A-F.
5966
LD (DE),A 12
Store Register A (the hex character) at Register Pair DE, in the text.
5967
INC DE 13
INCrement Register Pair DE to the next place in the text.
5968
RET C9
RETurn to the caller; from 594DH the first time this goes back into 5950H for the low byte.

5969H - Storing in the Image, the Prompts and the Answers

5969H stores Register A one byte after Register Pair HL and compares the new address with HIGH$ (4411H; 4049H on the Model I): only when they are equal is Out of memory! displayed and the read ended at 545EH, without the part of the file read so far. 597DH is the cassette prompt: on the Model III the ROM's speed question 3042H (H 1500 baud, L 500 baud, ENTER as H; the choice kept at 4211H), on the Model I a wait for any key (ROM 0049H). 598BH takes a file specification of up to 32 characters, @FSPEC and @FEXT CMD; 59ABH an answer of up to 6 characters. BREAK at either ends CMDFILE through @EXIT. 598BH does not test @FSPEC, and returns at once for ENTER alone, leaving the control block 5F19H as it is.

5969
INC HL 23
INCrement Register Pair HL to the next byte of the image.
596A
LD (HL),A 77
Store Register A (the byte) at Register Pair HL, in the image.
596B
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair DE = the address just stored.
596C
LD HL,(4411H) 2A 11 44
Fetch HIGH$ from 4411H-4412H into Register Pair HL (the operand is 4049H on the Model I, 5418H): the highest address a program may use.
596F
OR A B7
Clear the CARRY FLAG (OR A) for the SBC; Register A keeps the byte stored.
5970
SBC HL,DE ED 52
Subtract Register Pair DE (the address stored) from Register Pair HL (HIGH$): the Z FLAG when the image has reached HIGH$.
5972
EX DE,HL EB
EXchange Register Pairs DE and HL: Register Pair HL = the address stored again; Register Pair DE holds the difference.
5973
RET NZ C0
If the NZ FLAG is set (below HIGH$, or above it), RETurn to the caller with Register A unchanged.
5974
LD HL,5B9FH 21 9F 5B
Point Register Pair HL to 5B9FH, the text Out of memory!, ended by 0DH.
5977
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5B9FH, or 5CBCH from 590AH).
597A
JUMP to 545EH to return to the input prompt: the image keeps its end at 5F61H, without the file being read.
597D
LD HL,5CE8H 21 E8 5C
Point Register Pair HL to 5CE8H, the prompt Ready cassette and enter <H,L>, ended by 03H (ended at 5D00H on the Model I).
5980
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL (5CE8H).
5983
GOSUB to ROM 3042H, the Model III cassette speed question: H or ENTER 1500 baud, L 500 baud, kept at 4211H (ROM 0049H on the Model I, 5412H).
5986
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, to move the cursor below the prompt.
5988
JUMP to ROM 0033H to display the character in Register A (0DH) and return to the caller of 597DH.
598B
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL.
598E
LD HL,5F39H 21 39 5F
Point Register Pair HL to 5F39H, the buffer of the answer.
5991
LD B,20H 06 20
Load Register B with 20H, the most characters of a file specification: 32.
5993
GOSUB to ROM 0040H to take a line of up to Register B characters at Register Pair HL: the CARRY FLAG for BREAK, Register B the count.
5996
If the CARRY FLAG is set (BREAK), JUMP to 402DH, @EXIT, to end CMDFILE.
5999
XOR A AF
Clear Register A (XOR A) for the test of the count.
599A
OR B B0
OR Register B (the characters typed) into Register A: the Z FLAG for ENTER alone.
599B
RET Z C8
If the Z FLAG is set (nothing typed), RETurn to the caller; the control block at 5F19H stays as it was.
599C
PUSH AF F5
Save Register Pair AF (Register A the count, the NZ FLAG) to the stack across @FSPEC and @FEXT.
599D
LD DE,5F19H 11 19 5F
Point Register Pair DE to 5F19H, the file control block of CMDFILE, for the specification.
59A0
GOSUB to 441CH, @FSPEC, to take the specification at Register Pair HL (5F39H) into the control block at Register Pair DE (5F19H); its flags are not tested.
59A3
LD HL,5F16H 21 16 5F
Point Register Pair HL to 5F16H, the default extension CMD.
59A6
GOSUB to 444BH, @FEXT, to give the specification at Register Pair DE (5F19H) the extension at Register Pair HL when it has none (4473H on the Model I, 541BH).
59A9
POP AF F1
Restore Register Pair AF from the stack: Register A the count, the NZ FLAG.
59AA
RET C9
RETurn to the caller with the file specification in the control block at 5F19H.
59AB
GOSUB to 4467H, @DSPLY, to display the prompt at Register Pair HL.
59AE
LD B,06H 06 06
Load Register B with 06H, the most characters of an answer: a letter, a hex address or an ISAM number.
59B0
LD HL,5F39H 21 39 5F
Point Register Pair HL to 5F39H, the buffer of the answer.
59B3
GOSUB to ROM 0040H to take a line of up to Register B characters at Register Pair HL: the CARRY FLAG for BREAK, Register B the count.
59B6
If the CARRY FLAG is set (BREAK), JUMP to 402DH, @EXIT, to end CMDFILE.
59B9
XOR A AF
Clear Register A (XOR A) for the test of the count.
59BA
OR B B0
OR Register B (the characters typed) into Register A: Register A = the count, the Z FLAG for ENTER alone.
59BB
RET C9
RETurn to the caller with Register Pair HL at the answer and Register A the number of characters.

59BCH - The File: Open, Errors and One Byte at a Time

59BCH opens the input file with the sector buffer 5200H; the byte pointer 5F5FH starts at 52FFH, so the first read (59E0H) loads a sector. 59C9H displays the error in Register A (OR C0H: the short message, and @ERROR returns) and goes back to the input prompt. 59D1H reads a byte and turns the end of the file in the middle of a record into Requested file is not a Command or System file. 59E0H takes the next byte from the buffer and reads the next sector with @READ when the pointer passes 52FFH; at the end of the file (error 1CH or 1DH) it closes the file and returns the CARRY FLAG. 5A03H puts a byte into the buffer and writes the full sector with @VER. 5A14H is error 20H, Illegal drive number, for the Q answer.

59BC
LD HL,52FFH 21 FF 52
Load Register Pair HL with 52FFH, the last byte of the sector buffer 5200H-52FFH.
59BF
LD (5F5FH),HL 22 5F 5F
Store Register Pair HL (52FFH) at 5F5FH-5F60H, the byte pointer: the first read passes 52FFH and loads a sector.
59C2
INC L 2C
INCrement Register L from FFH to 00H: Register Pair HL = 5200H, the buffer for @OPEN.
59C3
LD B,00H 06 00
Load Register B with 00H, a record length of 256 for @OPEN: the file is read a sector at a time.
59C5
GOSUB to 4424H, @OPEN, to open the file of the control block at Register Pair DE (5F19H) with the buffer at Register Pair HL (5200H).
59C8
RET Z C8
If the Z FLAG is set (the file is open), RETurn to the caller.
59C9
OR C0H F6 C0
OR Register A (the error number) with C0H: bit 7 makes @ERROR return, bit 6 gives the short message.
59CB
GOSUB to 4409H, @ERROR, to display the message of the error in Register A; it returns (bit 7).
59CE
JUMP to 545EH to return to the input prompt; the image keeps its end at 5F61H.
59D1
PUSH HL E5
Save Register Pair HL (the place in the image) to the stack: 59E0H loads the byte pointer into Register Pair HL.
59D2
GOSUB to 59E0H to fetch the next byte of the file into Register A: the CARRY FLAG at the end of the file.
59D5
POP HL E1
Restore Register Pair HL from the stack: the place in the image.
59D6
RET NC D0
If the NO CARRY FLAG is set (a byte was read), RETurn to the caller with it in Register A.
59D7
LD HL,5BAEH 21 AE 5B
Point Register Pair HL to 5BAEH, the text Requested file is not a Command or System file!, ended by 0DH.
59DA
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (5BAEH, or 5EFAH from 580EH).
59DD
JUMP to 545EH to return to the input prompt; the image keeps its end at 5F61H.
59E0
LD HL,(5F5FH) 2A 5F 5F
Fetch the byte pointer from 5F5FH-5F60H into Register Pair HL.
59E3
INC L 2C
INCrement Register L, the low byte of the pointer: the Z FLAG when it passes 52FFH (FFH to 00H).
59E4
LD (5F5FH),HL 22 5F 5F
Store Register Pair HL (the new pointer) at 5F5FH-5F60H; LD leaves the Z FLAG of the INC.
59E7
If the Z FLAG is set (the buffer is used up), JUMP to 59ECH to read the next sector of the file.
59E9
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG: a byte was read.
59EA
LD A,(HL) 7E
Fetch the byte at Register Pair HL (the pointer) into Register A.
59EB
RET C9
RETurn to the caller with the byte in Register A and the CARRY FLAG clear.
59EC
LD DE,5F19H 11 19 5F
Point Register Pair DE to 5F19H, the file control block of CMDFILE.
59EF
GOSUB to 4436H, @READ, to read the next sector of the file at Register Pair DE (5F19H) into the buffer 5200H: the Z FLAG when it is read.
59F2
If the Z FLAG is set (the sector is read), JUMP back to 59E9H to return its first byte.
59F4
CP 1DH FE 1D
Compare Register A (the error) against 1DH, past the end of the file.
59F6
If the Z FLAG is set (1DH), JUMP to 59FCH to close the file and return the CARRY FLAG.
59F8
CP 1CH FE 1C
Compare Register A (the error) against 1CH, the end of the file.
59FA
If the NZ FLAG is set (another error), JUMP to 59C9H to display the error and return to the input prompt.
59FC
GOSUB to 4428H, @CLOSE, to close the file at Register Pair DE (5F19H): the Z FLAG when it is closed.
59FF
SCF 37
Set the CARRY FLAG (SCF): the end of the file, for 59D1H; SCF leaves the Z FLAG of @CLOSE.
5A00
RET Z C8
If the Z FLAG is set (no error), RETurn to the caller (with the CARRY FLAG from 59FFH, or that of @VER from 5A12H).
5A01
JUMP to 59C9H to display the error in Register A and return to the input prompt.
5A03
LD HL,(5F5FH) 2A 5F 5F
Fetch the byte pointer from 5F5FH-5F60H into Register Pair HL.
5A06
LD (HL),A 77
Store Register A (the byte to write) at Register Pair HL, in the sector buffer.
5A07
INC L 2C
INCrement Register L, the low byte of the pointer: the Z FLAG when the buffer 5200H-52FFH is full.
5A08
LD (5F5FH),HL 22 5F 5F
Store Register Pair HL (the new pointer) at 5F5FH-5F60H; LD leaves the Z FLAG of the INC.
5A0B
RET NZ C0
If the NZ FLAG is set (room left in the buffer), RETurn to the caller.
5A0C
LD DE,5F19H 11 19 5F
Point Register Pair DE to 5F19H, the file control block of the output file.
5A0F
GOSUB to 443CH, @VER, to write the sector 5200H as the next record of the file at Register Pair DE (5F19H) and read it back.
5A12
JUMP to 5A00H to return when the Z FLAG is set, or display the error.
5A14
LD A,20H 3E 20
Load Register A with 20H, error 20H, Illegal drive number, for a drive after Q that is not 0-7 or not ready.
5A16
JUMP to 59C9H to display the error in Register A and return to the input prompt.

5A19H - The Directory: Q

Q at the input prompt displays a directory with @DODIR: Qd for drive d (0-7; Q alone is drive 0), Qd/ext for the files of drive d whose extension matches ext (Register B = 02H, the mask after the slash). A drive that is not 0-7, or one @CKDRV finds not ready, gives error 20H (Illegal drive number) and the input prompt; the manual says the entry is ignored. When Q ends the line Register Pair HL passes the 0DH, and the byte after it, left from an earlier answer, is tested for the slash.

5A19
INC HL 23
INCrement Register Pair HL past the Q to the drive digit of the answer at 5F39H.
5A1A
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A, the drive digit.
5A1B
INC HL 23
INCrement Register Pair HL past the drive digit, to the slash of an extension.
5A1C
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the answer: Q alone.
5A1E
If the NZ FLAG is set (a character after Q), JUMP to 5A22H to take it as the drive digit.
5A20
LD A,30H 3E 30
Load Register A with 30H, the digit 0: Q alone is drive 0.
5A22
SUB 30H D6 30
Subtract 30H from Register A (SUB 30H): the digit 0-9 becomes 00H-09H, the CARRY FLAG below 0.
5A24
If the CARRY FLAG is set (below the digit 0), JUMP to 5A14H to give error 20H, Illegal drive number.
5A26
CP 08H FE 08
Compare Register A (the drive) against 08H: the CARRY FLAG for drives 0-7.
5A28
If the NO CARRY FLAG is set (8 or more), JUMP to 5A14H to give error 20H, Illegal drive number.
5A2A
LD C,A 4F
Copy Register A (the drive, 0-7) into Register C, the drive for @CKDRV and @DODIR.
5A2B
LD B,00H 06 00
Load Register B with 00H, @DODIR's function 00H: display the visible files of the drive.
5A2D
LD A,(HL) 7E
Fetch the character at Register Pair HL (after the drive digit) into Register A.
5A2E
CP 2FH FE 2F
Compare Register A (the character) against 2FH, the slash before an extension.
5A30
If the NZ FLAG is set (no slash), JUMP to 5A37H to test the drive with function 00H.
5A32
LD (HL),00H 36 00
Store 00H at Register Pair HL over the slash; nothing reads that byte afterwards.
5A34
INC HL 23
INCrement Register Pair HL to the first character of the extension, the mask for @DODIR.
5A35
LD B,02H 06 02
Load Register B with 02H, @DODIR's function 02H: display only the files whose extension matches the mask at Register Pair HL.
5A37
GOSUB to 4209H, @CKDRV, to test that the drive in Register C is ready (the operand is 44B8H on the Model I, 5430H): the NZ FLAG when it is not.
5A3A
If the NZ FLAG is set (the drive is not ready), JUMP to 5A14H to give error 20H, Illegal drive number.
5A3C
GOSUB to 4419H, @DODIR, to display the directory of the drive in Register C with the function in Register B and the mask at Register Pair HL (4463H on the Model I, 542DH).
5A3F
JUMP to 545EH to return to the input prompt after the directory.

5A42H - Hex Numbers, Answers and Capitals

5A42H converts the hex digits at Register Pair DE (Register A the first) up to the 0DH into Register Pair HL, the last four digits counting; any other character returns the CARRY FLAG. 5A5DH turns one character 0-9, A-F into its value with the CARRY FLAG for anything else. 5A6EH asks a Y/N question: C starts CMDFILE again, E ends it, N returns the CARRY FLAG, Y returns NO CARRY with Register A = 59H; any other answer, or ENTER, asks again. 5A97H is 59ABH keeping Register Pair DE. 5A9DH writes a character to the tape as a capital.

5A42
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the value before the first hex digit.
5A45
CP 61H FE 61
Compare Register A (the character) against 61H, a small a.
5A47
If the CARRY FLAG is set (below a small a), JUMP to 5A4BH with the character as it is.
5A49
RES 5,A CB AF
Reset bit 5 of Register A: a small letter becomes a capital.
5A4B
GOSUB to 5A5DH to turn the character in Register A into its value 00H-0FH: the CARRY FLAG when it is not a hex digit.
5A4E
RET C D8
If the CARRY FLAG is set (not a hex digit), RETurn to the caller with the CARRY FLAG.
5A4F
ADD HL,HL 29
ADD Register Pair HL to itself: the value so far times 2.
5A50
ADD HL,HL 29
ADD Register Pair HL to itself: the value so far times 4, the second of four doublings.
5A51
ADD HL,HL 29
ADD Register Pair HL to itself: the value so far times 8, the third of four doublings.
5A52
ADD HL,HL 29
ADD Register Pair HL to itself: times 16, one hex digit to the left; the bits above the fourth digit are lost.
5A53
OR L B5
OR Register L into Register A (the value of the digit): the new low digit.
5A54
LD L,A 6F
Copy Register A into Register L: Register Pair HL = the value with the new digit.
5A55
INC DE 13
INCrement Register Pair DE to the next character of the answer.
5A56
LD A,(DE) 1A
Fetch the character at Register Pair DE into Register A.
5A57
CP 0DH FE 0D
Compare Register A (the character) against 0DH, the end of the answer.
5A59
If the NZ FLAG is set (another character), JUMP back to 5A45H to take it.
5A5B
XOR A AF
Clear Register A (XOR A), which clears the CARRY FLAG: the number is good.
5A5C
RET C9
RETurn to the caller with the number in Register Pair HL and the CARRY FLAG clear.
5A5D
SUB 30H D6 30
Subtract 30H from Register A (SUB 30H): the characters 0-9 become 00H-09H, the CARRY FLAG below 0.
5A5F
RET C D8
If the CARRY FLAG is set (below 0), RETurn to the caller with the CARRY FLAG: not a hex digit.
5A60
ADD A,E9H C6 E9
ADD E9H to Register A: the CARRY FLAG for the characters from G up (17H and more after the SUB).
5A62
RET C D8
If the CARRY FLAG is set (G or above), RETurn to the caller with the CARRY FLAG: not a hex digit.
5A63
ADD A,06H C6 06
ADD 06H to Register A: the CARRY FLAG for A-F (11H-16H after the SUB).
5A65
If the CARRY FLAG is set (A-F), JUMP to 5A6AH to make the value 0AH-0FH.
5A67
ADD A,07H C6 07
ADD 07H to Register A: the CARRY FLAG for the characters between 9 and A (0AH-10H after the SUB).
5A69
RET C D8
If the CARRY FLAG is set (a colon to an at sign), RETurn to the caller with the CARRY FLAG: not a hex digit.
5A6A
ADD A,0AH C6 0A
ADD 0AH to Register A: the value 00H-0FH of the digit (with a carry for 0-9 that the OR clears).
5A6C
OR A B7
Clear the CARRY FLAG (OR A); Register A keeps the value.
5A6D
RET C9
RETurn to the caller with the value of the digit in Register A and the CARRY FLAG clear.
5A6E
GOSUB to 4467H, @DSPLY, to display the question at Register Pair HL.
5A71
PUSH HL E5
Save Register Pair HL (the question) to the stack, to ask it again.
5A72
LD HL,5F6FH 21 6F 5F
Point Register Pair HL to 5F6FH, the buffer of the answer of a Y/N question.
5A75
LD B,01H 06 01
Load Register B with 01H: the answer to a Y/N question is one character.
5A77
GOSUB to ROM 0040H to take a line of up to Register B characters at Register Pair HL (5F6FH); BREAK is not tested here.
5A7A
XOR A AF
Clear Register A (XOR A) for the test of the count.
5A7B
OR B B0
OR Register B (the characters typed) into Register A: the Z FLAG for ENTER alone.
5A7C
LD A,(HL) 7E
Fetch the answer at Register Pair HL (5F6FH) into Register A; LD leaves the Z FLAG.
5A7D
POP HL E1
Restore Register Pair HL from the stack: the question.
5A7E
If the Z FLAG is set (ENTER alone), JUMP back to 5A6EH to ask the question again.
5A80
AND 5FH E6 5F
AND Register A with 5FH: a small letter becomes a capital (bit 5 cleared; bit 7 too).
5A82
CP 43H FE 43
Compare Register A (the letter) against 43H, the letter C: cancel.
5A84
If the Z FLAG is set (C), JUMP to 5400H, the start of CMDFILE, to begin again from the banner.
5A87
CP 45H FE 45
Compare Register A (the letter) against 45H, the letter E: exit to LDOS.
5A89
If the Z FLAG is set (E), JUMP to 402DH, @EXIT, to end CMDFILE.
5A8C
CP 4EH FE 4E
Compare Register A (the letter) against 4EH, the letter N.
5A8E
If the Z FLAG is set (N), JUMP to 5A95H to return the CARRY FLAG.
5A90
CP 59H FE 59
Compare Register A (the letter) against 59H, the letter Y; the compare leaves the CARRY FLAG clear for Y.
5A92
If the NZ FLAG is set (no letter the question takes), JUMP back to 5A6EH to ask the question again.
5A94
RET C9
RETurn to the caller with Register A = 59H (Y) and the CARRY FLAG clear.
5A95
CCF 3F
Complement the CARRY FLAG (CCF): the CP 4EH left it clear, so N returns with the CARRY FLAG set.
5A96
RET C9
RETurn to the caller with Register A = 4EH (N) and the CARRY FLAG set.
5A97
PUSH DE D5
Save Register Pair DE (the lowest address) to the stack across the prompt.
5A98
GOSUB to 59ABH to display the prompt at Register Pair HL and take up to 6 characters at 5F39H: the Z FLAG for ENTER alone.
5A9B
POP DE D1
Restore Register Pair DE from the stack: the lowest address, for 54EDH.
5A9C
RET C9
RETurn to the caller with the answer at Register Pair HL and the Z FLAG for ENTER alone.
5A9D
CP 61H FE 61
Compare Register A (the character of the tape name) against 61H, a small a.
5A9F
If the CARRY FLAG is set (below a small a), JUMP to 5AA7H to write the character as it is.
5AA1
CP 7BH FE 7B
Compare Register A (the character) against 7BH, the character after a small z.
5AA3
If the NO CARRY FLAG is set (above a small z), JUMP to 5AA7H to write the character as it is.
5AA5
RES 5,A CB AF
Reset bit 5 of Register A: the small letter becomes a capital.
5AA7
JUMP to ROM 0264H to write the character in Register A to the tape and return to the caller.

5AAAH - The Debounce Record and the Offset Driver

5AAAH-5AB6H are not in the file (the load blocks end at 5AA9H and start again at 5AB7H). 5AB7H-5ABCH is the record that disables the keyboard debounce, copied into the image before the driver (5572H): type 03H, length 04H, the address 4016H and the word 3024H. Written as type 01H with its address kept, it loads 3024H, the ROM's keyboard driver (03E3H on the Model I), into 4016H-4017H, the driver address of the keyboard device control block, in place of 41EDH, SYS0's driver that calls @KITSK (4285H) first. 5ABDH-5ACFH is the driver record, a load block of 17 bytes after its type and length: at the byte after the program it runs DI or NOP, moves the program from where it was loaded to where it belongs with LDIR or LDDR, and jumps to the old transfer address. Its operands are written by 54B4H-5560H.

5AAA-5AB6
DEFS 13
5AAAH-5AB6H: not in the file. Thirteen bytes between the last load block of the code and the records, which CMDFILE neither reads nor writes.
5AB7-5AB8
DEFB 03H, 04H 03 04
5AB7H-5AB8H: the type 03H (a load block that is not offset; written as type 01H, 560CH, 56D3H) and the length 04H of the debounce record.
5AB9-5ABA
DEFW 4016H 16 40
5AB9H-5ABAH: the load address of the debounce record, 4016H, the driver address of the keyboard device control block 4015H.
5ABB-5ABC
DEFW 3024H 24 30
5ABBH-5ABCH: the data of the debounce record, 3024H, the ROM 3.1 keyboard driver; 5424H writes 03E3H, the Model I ROM's, on the Model I.
5ABD-5ABE
DEFB 01H, 11H 01 11
5ABDH-5ABEH: the type 01H and the length 11H of the driver record: two address bytes and 15 bytes of code.
5ABF-5AC0
DEFW 0000H 00 00
5ABFH-5AC0H: the load address of the driver, the highest address loaded + 1, written by 5535H; 565AH adds the offset to it.
5AC1
DEFB 00H 00
5AC1H: the first instruction of the driver, NOP (00H) or DI (F3H), written by 5560H after the interrupts question.
5AC2-5AC4
DEFB 21H / DEFW 0000H 21 00 00
5AC2H-5AC4H: LD HL,nnnnH, the source of the move: written by 5514H (lowest + offset) or 5528H (highest + offset).
5AC5-5AC7
DEFB 11H / DEFW 0000H 11 00 00
5AC5H-5AC7H: LD DE,nnnnH, the destination of the move: written by 5510H (the lowest address) or 5524H (the highest).
5AC8-5ACA
DEFB 01H / DEFW 0000H 01 00 00
5AC8H-5ACAH: LD BC,nnnnH, the number of bytes to move, the highest address + 1 less the lowest, written by 5540H.
5ACB-5ACC
DEFB EDH, B0H ED B0
5ACBH-5ACCH: LDIR; 5507H writes B0H (LDIR) for a positive offset and 551BH B8H (LDDR) for a negative one.
5ACD-5ACF
DEFB C3H / DEFW 0000H C3 00 00
5ACDH-5ACFH: JP nnnnH, the transfer address of the image before the driver was added, written by 552EH.

5AD0H - The Texts

The banner, the prompts and the messages, ended by 03H (the cursor stays after the text, the answer follows) or 0DH (the end of the line). The XXXX places are written by 594DH; FILNAM at 5B6FH gets the name of a tape. 5F16H-5F18H is the default extension CMD.

5AD0-5AD1
DEFB 1CH, 1FH 1C 1F
5AD0H-5AD1H: cursor home and clear to the end of the screen, the start of the banner displayed by 5433H.
5AD2-5B00
DEFM "MISOSYS Command File Utility - LDOS Version 5.3" 4D 49 53 4F 53 59 53 20 43 6F 6D 6D 61 6E 64 20 46 69 6C 65 20 55 74 69 6C 69 74 79 20 2D 20 4C 44 4F 53 20 56 65 72 73 69 6F 6E 20 35 2E 33
5AD2H-5B00H: the name of the program and the version of LDOS it is for.
5B01
DEFB 0AH 0A
5B01H: 0AH, a new line: the copyright goes on the next line of the banner.
5B02-5B32
DEFM "Copyright 1979 MISOSYS, Inc., All rights reserved" 43 6F 70 79 72 69 67 68 74 20 31 39 37 39 20 4D 49 53 4F 53 59 53 2C 20 49 6E 63 2E 2C 20 41 6C 6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 64
5B02H-5B32H: the copyright line of the banner, with the year 1979; the copyright record of the file says 1991.
5B33-5B34
DEFB 0AH, 0DH 0A 0D
5B33H-5B34H: 0AH, a new line, and 0DH, the end of the banner.
5B35-5B4F
DEFM "Enter input file filespec >" 45 6E 74 65 72 20 69 6E 70 75 74 20 66 69 6C 65 20 66 69 6C 65 73 70 65 63 20 3E
5B35H-5B4FH: the prompt of 548AH for the file to read from disk.
5B50
DEFB 03H 03
5B50H: 03H, the end of the prompt for @DSPLY: the file specification is typed after it.
5B51-5B6D
DEFM "Block loads from XXXX to XXXX" 42 6C 6F 63 6B 20 6C 6F 61 64 73 20 66 72 6F 6D 20 58 58 58 58 20 74 6F 20 58 58 58 58
5B51H-5B6DH: the log line of a load block (57A5H); 577DH writes the first address at 5B62H, 57A2H the last at 5B6AH.
5B6E
DEFB 0DH 0D
5B6EH: 0DH, the end of the log line for @DSPLY and @PRINT.
5B6F-5B76
DEFM "FILNAM: " 46 49 4C 4E 41 4D 3A 20
5B6FH-5B76H: the place of the tape name (5899H writes the six characters over FILNAM), a colon and a space, displayed by 591DH.
5B77
DEFB 03H 03
5B77H: 03H, the end of the text: the transfer address follows on the same line.
5B78-5B9D
DEFM "Transfer address (entry point) is XXXX" 54 72 61 6E 73 66 65 72 20 61 64 64 72 65 73 73 20 28 65 6E 74 72 79 20 70 6F 69 6E 74 29 20 69 73 20 58 58 58 58
5B78H-5B9DH: the text of 5860H at the end of a read; 585DH writes the address at 5B9AH.
5B9E
DEFB 0DH 0D
5B9EH: 0DH, the end of the line for @DSPLY and @PRINT.
5B9F-5BAC
DEFM "Out of memory!" 4F 75 74 20 6F 66 20 6D 65 6D 6F 72 79 21
5B9FH-5BACH: the text of 5974H, when the image reaches HIGH$.
5BAD
DEFB 0DH 0D
5BADH: 0DH, the end of the line of the memory error.
5BAE-5BDC
DEFM "Requested file is not a Command or System file!" 52 65 71 75 65 73 74 65 64 20 66 69 6C 65 20 69 73 20 6E 6F 74 20 61 20 43 6F 6D 6D 61 6E 64 20 6F 72 20 53 79 73 74 65 6D 20 66 69 6C 65 21
5BAEH-5BDCH: the text of 59D7H: a bad record, a transfer record of another length, the end of the file or of the ISAM directory.
5BDD
DEFB 0DH 0D
5BDDH: 0DH, the end of the line of the file error.
5BDE-5C03
DEFM "Address load log to printer (Y,N,E)? >" 41 64 64 72 65 73 73 20 6C 6F 61 64 20 6C 6F 67 20 74 6F 20 70 72 69 6E 74 65 72 20 28 59 2C 4E 2C 45 29 3F 20 3E
5BDEH-5C03H: the first question, asked by 543DH: print the Block loads from lines as well.
5C04
DEFB 03H 03
5C04H: 03H, the end of the question: the answer is typed after it.
5C05-5C37
DEFM "Enter new transfer address or <ENTER> to use XXXX >" 45 6E 74 65 72 20 6E 65 77 20 74 72 61 6E 73 66 65 72 20 61 64 64 72 65 73 73 20 6F 72 20 3C 45 4E 54 45 52 3E 20 74 6F 20 75 73 65 20 58 58 58 58 20 3E
5C05H-5C37H: the prompt of 559FH; 559CH writes the transfer address of the image at 5C32H.
5C38
DEFB 03H 03
5C38H: 03H, the end of the prompt: the address is typed after it.
5C39-5C58
DEFM "Enter filespec to write output >" 45 6E 74 65 72 20 66 69 6C 65 73 70 65 63 20 74 6F 20 77 72 69 74 65 20 6F 75 74 70 75 74 20 3E
5C39H-5C58H: the prompt of 55D5H for the output file on disk.
5C59
DEFB 03H 03
5C59H: 03H, the end of the prompt: the file specification is typed after it.
5C5A-5C8E
DEFM "Module write is complete - write another (Y,N,E,C)? >" 4D 6F 64 75 6C 65 20 77 72 69 74 65 20 69 73 20 63 6F 6D 70 6C 65 74 65 20 2D 20 77 72 69 74 65 20 61 6E 6F 74 68 65 72 20 28 59 2C 4E 2C 45 2C 43 29 3F 20 3E
5C5AH-5C8EH: the question after a disk file (5648H) or a tape (5717H) is written.
5C8F
DEFB 03H 03
5C8FH: 03H, the end of the question: the answer is typed after it.
5C90-5CBA
DEFM "*** No file input *** No file to output ***" 2A 2A 2A 20 4E 6F 20 66 69 6C 65 20 69 6E 70 75 74 20 2A 2A 2A 20 4E 6F 20 66 69 6C 65 20 74 6F 20 6F 75 74 70 75 74 20 2A 2A 2A
5C90H-5CBAH: the text of 54ABH, ENTER at the input prompt with nothing read.
5CBB
DEFB 0DH 0D
5CBBH: 0DH, the end of the line of that text.
5CBC-5CE6
DEFM "Tape checksum error detected - reread tape!" 54 61 70 65 20 63 68 65 63 6B 73 75 6D 20 65 72 72 6F 72 20 64 65 74 65 63 74 65 64 20 2D 20 72 65 72 65 61 64 20 74 61 70 65 21
5CBCH-5CE6H: the text of 5907H, a block whose checksum does not agree or a mark that is neither 3CH nor 78H.
5CE7
DEFB 0DH 0D
5CE7H: 0DH, the end of the line of the tape error.
5CE8-5D05
DEFM "Ready cassette and enter <H,L>" 52 65 61 64 79 20 63 61 73 73 65 74 74 65 20 61 6E 64 20 65 6E 74 65 72 20 3C 48 2C 4C 3E
5CE8H-5D05H: the cassette prompt of 597DH; on the Model I 540CH stores 03H at 5D00H, the space before <H,L>.
5D06
DEFB 03H 03
5D06H: 03H, the end of the prompt: ROM 3042H asks the speed after it.
5D07-5D3F
DEFM "Input disk or tape (D,T,E,C,Q) or <ENTER> to end reads? >" 49 6E 70 75 74 20 64 69 73 6B 20 6F 72 20 74 61 70 65 20 28 44 2C 54 2C 45 2C 43 2C 51 29 20 6F 72 20 3C 45 4E 54 45 52 3E 20 74 6F 20 65 6E 64 20 72 65 61 64 73 3F 20 3E
5D07H-5D3FH: the input prompt of 5461H; the manual prints (D,I,E,C,Q), the code takes T.
5D40
DEFB 03H 03
5D40H: 03H, the end of the prompt: the answer is typed after it.
5D41-5D56
DEFM "Enter tape file name >" 45 6E 74 65 72 20 74 61 70 65 20 66 69 6C 65 20 6E 61 6D 65 20 3E
5D41H-5D56H: the prompt of 567CH for the name of the SYSTEM tape to write.
5D57
DEFB 03H 03
5D57H: 03H, the end of the prompt: the name is typed after it.
5D58-5D90
DEFM "Output to disk or tape (D,T,E,C) or <ENTER> to restart? >" 4F 75 74 70 75 74 20 74 6F 20 64 69 73 6B 20 6F 72 20 74 61 70 65 20 28 44 2C 54 2C 45 2C 43 29 20 6F 72 20 3C 45 4E 54 45 52 3E 20 74 6F 20 72 65 73 74 61 72 74 3F 20 3E
5D58H-5D90H: the output prompt of 55B6H, after the base address and transfer address questions.
5D91
DEFB 03H 03
5D91H: 03H, the end of the prompt: the answer is typed after it.
5D92-5DBD
DEFM "Program loads from base address XXXX to XXXX" 50 72 6F 67 72 61 6D 20 6C 6F 61 64 73 20 66 72 6F 6D 20 62 61 73 65 20 61 64 64 72 65 73 73 20 58 58 58 58 20 74 6F 20 58 58 58 58
5D92H-5DBDH: the load range of the image (54C6H); 54BAH writes the lowest address at 5DB2H, 54C3H the highest at 5DBAH.
5DBE
DEFB 0DH 0D
5DBEH: 0DH, the end of the line of the load range.
5DBF-5DE1
DEFM "Enter new base address or <ENTER> >" 45 6E 74 65 72 20 6E 65 77 20 62 61 73 65 20 61 64 64 72 65 73 73 20 6F 72 20 3C 45 4E 54 45 52 3E 20 3E
5DBFH-5DE1H: the prompt of 54CCH for the offset.
5DE2
DEFB 03H 03
5DE2H: 03H, the end of the prompt: the address is typed after it.
5DE3-5E14
DEFM "Do you want to disable the interrupts (Y,N,E,C)? >" 44 6F 20 79 6F 75 20 77 61 6E 74 20 74 6F 20 64 69 73 61 62 6C 65 20 74 68 65 20 69 6E 74 65 72 72 75 70 74 73 20 28 59 2C 4E 2C 45 2C 43 29 3F 20 3E
5DE3H-5E14H: the question of 5554H: DI or NOP at 5AC1H in the driver.
5E15
DEFB 03H 03
5E15H: 03H, the end of the question: the answer is typed after it.
5E16-5E4E
DEFM "Do you want to disable the keyboard debounce (Y,N,E,C)? >" 44 6F 20 79 6F 75 20 77 61 6E 74 20 74 6F 20 64 69 73 61 62 6C 65 20 74 68 65 20 6B 65 79 62 6F 61 72 64 20 64 65 62 6F 75 6E 63 65 20 28 59 2C 4E 2C 45 2C 43 29 3F 20 3E
5E16H-5E4EH: the question of 5563H: the debounce record 5AB7H before the driver.
5E4F
DEFB 03H 03
5E4FH: 03H, the end of the question: the answer is typed after it.
5E50-5E88
DEFM "Do you want to add the offset driver routine (Y,N,E,C)? >" 44 6F 20 79 6F 75 20 77 61 6E 74 20 74 6F 20 61 64 64 20 74 68 65 20 6F 66 66 73 65 74 20 64 72 69 76 65 72 20 72 6F 75 74 69 6E 65 20 28 59 2C 4E 2C 45 2C 43 29 3F 20 3E
5E50H-5E88H: the question of 5543H, asked after a new base address.
5E89
DEFB 03H 03
5E89H: 03H, the end of the question: the answer is typed after it.
5E8A-5EA2
DEFM "Program loads below 4200H" 50 72 6F 67 72 61 6D 20 6C 6F 61 64 73 20 62 65 6C 6F 77 20 34 32 30 30 48
5E8AH-5EA2H: the first line of the text of 54E7H, when the lowest address is below 4200H.
5EA3
DEFB 0AH 0A
5EA3H: 0AH, a new line: the restrict prompt follows on the next line.
5EA4-5ED5
DEFM " Enter address to restrict offset or <ENTER> >" 20 20 20 20 20 45 6E 74 65 72 20 61 64 64 72 65 73 73 20 74 6F 20 72 65 73 74 72 69 63 74 20 6F 66 66 73 65 74 20 6F 72 20 3C 45 4E 54 45 52 3E 20 3E
5EA4H-5ED5H: the restrict prompt, indented by five spaces.
5ED6
DEFB 03H 03
5ED6H: 03H, the end of the prompt: the address is typed after it.
5ED7-5EF8
DEFM "File has ISAM overlays - enter # >" 46 69 6C 65 20 68 61 73 20 49 53 41 4D 20 6F 76 65 72 6C 61 79 73 20 2D 20 65 6E 74 65 72 20 23 20 3E
5ED7H-5EF8H: the prompt of 57CBH at the first member header of a library file; the manual prints the # as //.
5EF9
DEFB 03H 03
5EF9H: 03H, the end of the prompt: the member number is typed after it.
5EFA-5F14
DEFM "Overlay beyond end of file!" 4F 76 65 72 6C 61 79 20 62 65 79 6F 6E 64 20 65 6E 64 20 6F 66 20 66 69 6C 65 21
5EFAH-5F14H: the text of 580BH, when @POSN cannot reach the record of the member asked for.
5F15
DEFB 0DH 0D
5F15H: 0DH, the end of the line of that text.
5F16-5F18
DEFM "CMD" 43 4D 44
5F16H-5F18H: the default extension of the files read and written, given to @FEXT by 59A3H.

5F19H - The Cells Beyond the File

The file control block, the answer buffers, the tape name, the pointers and the addresses of the image, the switches; then the memory image itself from 6000H to HIGH$. Below the program, 5200H-52FFH is the sector buffer of the file read or written and the stack grows down from 53FFH.

5F19-5F38
DEFS 32
5F19H-5F38H: not in the file. The file control block of the file read (5489H) or written (55D5H); 5F21H is its end of file byte (FCB +08H, 563FH).
5F39-5F58
DEFS 32
5F39H-5F58H: not in the file. The answer buffer of ROM 0040H: 6 characters at 59ABH, 32 at 598BH (whose 0DH can then fall on 5F59H).
5F59-5F5E
DEFS 6
5F59H-5F5EH: not in the file. The tape name typed at 5687H, written in capitals by 56A8H.
5F5F-5F60
DEFS 2
5F5FH-5F60H: not in the file. The byte pointer into the sector buffer 5200H-52FFH (59BFH, 55DEH, 59E0H, 5A03H).
5F61-5F62
DEFS 2
5F61H-5F62H: not in the file. The address of the last byte of the memory image, 6003H when it is empty (5448H, 5497H, 5591H).
5F63-5F64
DEFS 2
5F63H-5F64H: not in the file. The first address of the load block being read, for the log line (5768H).
5F65-5F66
DEFS 2
5F65H-5F66H: not in the file. The last address of the load block being read, for the log line (578FH).
5F67-5F68
DEFS 2
5F67H-5F68H: not in the file. The transfer address: from the last file read (5852H, 5912H), a member's entry (57F2H) or the driver (5551H).
5F69-5F6A
DEFS 2
5F69H-5F6AH: not in the file. The highest address loaded, 0000H at the start (5457H, 5799H, 58EFH).
5F6B-5F6C
DEFS 2
5F6BH-5F6CH: not in the file. The lowest address loaded, FFFFH at the start (545BH, 5773H, 58D4H), or the restrict address (54F6H).
5F6D-5F6E
DEFS 2
5F6DH-5F6EH: not in the file. The offset, the new base less the lowest address (54FEH), added by 565AH.
5F6F-5F72
DEFS 4
5F6FH-5F72H: not in the file. The answer of a Y/N question, one character and its 0DH (5A72H); 5F71H-5F72H are not used.
5F73
DEFS 1
5F73H: not in the file. The log switch: 00H, or 59H when the load log is printed too (543AH, 5445H).
5F74
DEFS 1
5F74H: not in the file. The length of the tape name, for another copy of the tape (568CH, 5720H).
5F75
DEFS 1
5F75H: not in the file. The no offset switch: 01H for the type 03H block being written, cleared by 565AH.