DOSPLUS 3.5 for the Model III - CODIR/CMD Disassembled

Page Customization

Introduction/Summary

DOSPLUS 3.5 CODIR/CMD Disassembly - CO-DIR 2.1, the Cursor Oriented Directory (Model III)

CODIR/CMD is CO-DIR 2.1 by Hunt K. Brand, licensed to Micro-Systems Software, run from the DOS command level as CODIR with the parameters of CAT; its title reads CO-DIR 2.1 - Cursor Oriented DIR. (C) 1983 by Hunt K. Brand. It is a load module of 30 blocks, 3745 bytes, at 8000H-8EA0H with the transfer address 8000H, after the two comment records (the name CODIR and the copyright notice). CODIR/CMD is on the Model III master only, but the program runs on both models: the byte 49H at 0125H, in the Model III ROM, picks the Model III's command buffer 4225H and HMEM$ 4411H, else the Model I's 4318H and 4049H (8000H, 8060H). The configuring program CODIR21/MOD on the master has no page.

CODIR runs CAT with the parameters typed after its name, through CMNDI@, with ABORT@ pointed at its own end (885AH) and a hook in the display driver at 401EH (8AD6H) that saves every line shown into a buffer from 9000H, 64 bytes a line, up to HMEM$ less 80H, clicking port FFH for each character. Then two blinking cursors, on a file's name and 12 places to its right where CODIR puts its marks, pick a file on the screens kept in the buffer, and a key runs a DOS command on it. All sounds go out through bit 0 of port FFH, the cassette output (88E7H).

The Parts of CODIR/CMD

AddressContents
8000H-8158HThe start: the command line CAT, the title, the hooks, the listing and the first file (8000H, 8102H).
8159H-82F8HThe cursors, the keys and the moves of the cursors (8159H, 81D9H).
82F9H-8433HThe commands D, A, F, V, H and S, the search (82F9H, 83B2H).
8434H-86FAHThe commands on the file: K, G, O, J, Z, F and M, P and C, L, the run on a cleared screen and R (8434H, 8520H, 8561H, 85C3H, 8605H, 8690H, 86AAH, 86E8H).
86FBH-8869HThe line input, ENTER, the return to the cursors and the end through ABORT@ (86FBH, 87FEH, 883CH, 885AH).
886DH-8A9CHThe decimal number, the running of a command line, the tones, the places of the cursors, the command line of the screen, the drive question, a key and the comparison of a name (886DH, 88BFH, 88E7H, 8918H, 8958H, 89CBH, 8A50H, 8A78H).
8A9DH-8B9AHThe buffer, the display hook and the scrolling of the screens (8A9DH, 8AD6H, 8B4CH).
8B9BH-8EA0HThe variables, the texts and the command line (8B9BH, 8BF2H).

How CODIR Works

The display hook counts the places of each line and fills the rest of a line with spaces at its carriage return, with the mark 8FH after the last line; it is taken out by the graphic 85H that CODIR shows after CAT, by a full buffer or by BREAK at the end of a line (8AD6H). CODIR then shows the last screen saved, finds the last line with files on the screen and puts the cursors on the first file, line 3 (80ADH). The arrows move the cursors a line or a column of 15 characters, scrolling the screens through the buffer, and SHIFT with the up arrow goes to the first screen; empty places and files marked with an asterisk are passed over unless the space bar is held (81D9H, 8938H). BREAK or CLEAR ends CODIR.

D and A run CAT again on a drive asked for (D with SHIFT adds (I), A gives (I,A)) into a new buffer (8339H); F runs FREE :d, V shows the title and the licence, H the keys, S searches (83B2H). The other keys copy the file's name from the screen to 8E40H with :d, the drive of the listing, after it; with SHIFT (a lower case key) a password is asked for first and put after a period (8434H). Each asks its question on the command line, the last line of the screen, Y for yes, and builds its command line from the first word of its question: Kill, Clear (Z), List (L, and with @PR for P), Copy name:d :e,T (C), Diskdump (M), Rename (R), Load (O) and Do (J); ENTER runs a CMD file, or any file with the space bar held, as a program, and any other through BASIC name:d -F:03 (87FEH). O, J and ENTER leave CODIR through CMNDI@ (8831H); the others run through CMNDI@ and return (88C9H), K, Z, R and C putting a mark (an asterisk, Z, R or the drive) next to the file. G shows the size: the end of the file in sectors, a part sector counted as one, divided by four, as nnk or <k (8520H).

Differences from the Manual

The title says 1983 (the manual 1982). The test of the title (8090H) looks only at the H of Hunt, after the listing; a changed letter gives 50 warnings (C) NAME MODIFIED! RE-BOOT! and the return to the DOS (8090H). The cursors pass over empty places and files marked with an asterisk by K; nothing tests for system files (8938H). A space at the question of a drive cancels it with the high tone, as any key but a drive, the backspace and ENTER does (the manual: spaces are ignored) (89DEH). G shows the size with a lower case k, and <k for a file of fewer than four sectors; an error of OPEN@ is posted by ERROR@ and ends CODIR (855BH). The copy adds the parameter T after a comma; BASIC is always given -F:03 (the manual: the number set with CODIR2/MOD). Closing the buffer, at the normal end of the listing too, sounds the high tone (the manual: a low tone) (8B43H).

Variables

CODIR/CMD Variables

Address
Size
Contents
8B9BH-8B9FH
5 bytes
Buffer
The screen shown, the last byte saved and the count of the line (8AD6H).
8BAAH-8BABH
2 bytes
End of the buffer
HMEM$ less 80H (807EH).
8BCAH-8BD5H
12 bytes
Search
(83CBH).
8BE0H-8BEEH
15 bytes
Cursors
The cursor, its row and column, the characters under the cursors, the drive and the place of a command line (8159H).
8BEFH-8BF1H
3 bytes
Modes
Of the line input and the drive question (86FBH).
8D0BH-8D0CH
2 bytes
Default drive
(8A19H).
8E37H-8E85H
79 bytes
Command line
The command word before the name at 8E40H (8434H).
8E86H-8EC5H
64 bytes
Copy
The command line run (88C9H).
9000H
to HMEM$ less 80H
The screens
64 bytes a line, 15 lines a screen (8A9DH).

Memory Outside CODIR/CMD

Address
Size
Contents
3C00H-3FFFH
1024 bytes
Video RAM
The listing, line 16 the command line (8B7FH).
3840H, 3880H
2 bytes
Keyboard
The row of ENTER, CLEAR, BREAK, the arrows and the space bar, and the row of SHIFT (81B2H).
401EH-401FH
2 bytes
Display driver
Hooked during CAT (8AC9H).
4020H-4021H
2 bytes
Cursor
(89AFH).
4031H-4032H
2 bytes
ABORT@
Pointed at 885AH during CAT (805DH).
4049H, 4411H
2 bytes
HMEM$
Of the Model I and the Model III (8067H).
4225H, 4318H
64 bytes
Command line
Of the Model III and the Model I (800DH).

Outside Routines

AddressContents
4405HSYS0/SYS: CMNDI@ (88E0H, 8839H).
4424HSYS0/SYS: OPEN@ (853DH).
4409HSYS0/SYS: ERROR@ (855BH).
4467HSYS0/SYS: DSPLY@ (8044H).
402DHSYS0/SYS: EXIT@ (814CH).
002BHROM: scan the keyboard (816FH).
0033HROM: display a character (89AAH).
01C9HROM: clear the screen (89C1H).
0125HROM: the byte 49H of the Model III ROM (8006H).

Disassembly

8000H - CODIR

CODIR/CMD's transfer address, entered from the DOS command level as CODIR with the parameters of CAT. CO-DIR 2.1 by Hunt K. Brand runs CAT through CMNDI@ while its own display hook (8AD6H) saves every line shown into a buffer from 9000H, then lets two blinking cursors pick a file on the screens kept there and runs a DOS command on it. The program runs on the Model I and the Model III: the byte 49H at 0125H (the Model III ROM) picks the Model III's command buffer 4225H and HMEM$ 4411H, else the Model I's 4318H and 4049H.

8000
LD DE,8E43H 11 43 8E
Point Register Pair DE to 8E43H, the place after the word CAT in the command line built at 8E40H.
8003
LD HL,4318H 21 18 43
Point Register Pair HL to 4318H, the command line buffer of the Model I DOS.
8006
LD A,(0125H) 3A 25 01
Load Register A with the byte at 0125H of the ROM, 49H (the letter I) in the Model III ROM.
8009
CP 49H FE 49
Compare Register A against 49H, the letter I that marks the Model III ROM.
800B
If the NZ FLAG is set (a Model I), JUMP to 8010H with Register Pair HL at 4318H.
800D
LD HL,4225H 21 25 42
Point Register Pair HL to 4225H, INPBUF$, the command line buffer of the Model III DOS.
8010
LD A,(HL) 7E
Load Register A with the next character of the command line at Register Pair HL.
8011
CP 20H FE 20
Compare Register A against 20H, a space after the command's name.
8013
If the Z FLAG is set (a space), JUMP to 8024H: the parameters start at Register Pair HL.
8015
CP 2CH FE 2C
Compare Register A against 2CH, a comma after the command's name.
8017
If the Z FLAG is set (a comma), JUMP to 8024H: the parameters start at Register Pair HL.
8019
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of the command line.
801B
If the Z FLAG is set (the end of the line), JUMP to 8024H: there are no parameters.
801D
CP 2FH FE 2F
Compare Register A against 2FH, the slash of an extension typed with the name.
801F
If the Z FLAG is set (a slash), JUMP to 8024H, the slash put into the line with the rest.
8021
INC HL 23
INCrement Register Pair HL past the character of the command's name.
8022
JUMP to 8010H to look at the next character of the command line.
8024
LD BC,003DH 01 3D 00
Load Register Pair BC with 003DH, the 61 bytes of the command line copied after CAT.
8027
LDIR ED B0
Copy the rest of the command line from Register Pair HL to Register Pair DE (8E43H), the count in Register Pair BC.
8029
LD HL,8BD8H 21 D8 8B
Point Register Pair HL to 8BD8H, the word CAT, the DOS command that CODIR runs first.
802C
LD DE,8E40H 11 40 8E
Point Register Pair DE to 8E40H, the start of the command line CODIR builds.
802F
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three letters of the word CAT.
8032
LDIR ED B0
Copy the word CAT from Register Pair HL to Register Pair DE (8E40H), the count in Register Pair BC.
8034
LD HL,8E43H 21 43 8E
Point Register Pair HL to 8E43H, the first character after CAT in the command line.
8037
LD A,(HL) 7E
Load Register A with the first character after CAT at Register Pair HL.
8038
CP 2FH FE 2F
Compare Register A against 2FH, the slash of an extension such as CODIR/CMD.
803A
If the NZ FLAG is set (no slash), JUMP to 803EH, the parameters kept as they are.
803C
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL: the extension of the command's name is cut off, CAT alone.
803E
GOSUB to 89C0H to clear the screen through the ROM's 01C9H and switch the cursor off.
8041
LD HL,8BF2H 21 F2 8B
Point Register Pair HL to 8BF2H, two line feeds and the title line of CO-DIR 2.1.
8044
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the title at Register Pair HL up to its 03H.
8047
LD HL,8C33H 21 33 8C
Point Register Pair HL to 8C33H, the lines All Rights Reserved and Licensed to Micro-Systems Software.
804A
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the text at Register Pair HL up to its 0DH.
804D
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8050
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no key of the row at 3840H is held down.
8052
If the NZ FLAG is set (a key is held), JUMP to 804DH to wait until it is let go.
8054
LD HL,(4031H) 2A 31 40
Load Register Pair HL with the contents of 4031H-4032H, the address ABORT@ (4030H) jumps to.
8057
LD (8BE2H),HL 22 E2 8B
Store Register Pair HL, the address of ABORT@, into 8BE2H-8BE3H, to be put back by 8866H.
805A
LD HL,885AH 21 5A 88
Point Register Pair HL to 885AH, CODIR's own end for a CAT stopped by BREAK.
805D
LD (4031H),HL 22 31 40
Store Register Pair HL (885AH) into 4031H-4032H: ABORT@ now jumps to CODIR's 885AH.
8060
LD A,(0125H) 3A 25 01
Load Register A with the byte at 0125H of the ROM, 49H (the letter I) in the Model III ROM.
8063
CP 49H FE 49
Compare Register A against 49H, the letter I that marks the Model III ROM.
8065
If the NZ FLAG is set (a Model I), JUMP to 806FH to take HMEM$ from 4049H.
8067
LD HL,(4411H) 2A 11 44
Load Register Pair HL with the contents of 4411H-4412H, HMEM$ of the Model III DOS.
806A
LD (8BAAH),HL 22 AA 8B
Store Register Pair HL, HMEM$, into 8BAAH-8BABH, the end of the buffer before the margin is taken off.
806D
JUMP to 8075H to take the margin off the end of the buffer.
806F
LD HL,(4049H) 2A 49 40
Load Register Pair HL with the contents of 4049H-404AH, HMEM$ of the Model I DOS.
8072
LD (8BAAH),HL 22 AA 8B
Store Register Pair HL, HMEM$, into 8BAAH-8BABH, the end of the buffer before the margin is taken off.
8075
LD HL,(8BAAH) 2A AA 8B
Load Register Pair HL with the contents of 8BAAH-8BABH, HMEM$ of the DOS.
8078
LD DE,0080H 11 80 00
Load Register Pair DE with 0080H, the 128 bytes kept free below HMEM$.
807B
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
807C
SBC HL,DE ED 52
SUBtract Register Pair DE (0080H) from Register Pair HL with the carry: HMEM$ less 80H.
807E
LD (8BAAH),HL 22 AA 8B
Store Register Pair HL into 8BAAH-8BABH, the last place the directory's buffer may use.
8081
GOSUB to 8A9DH to clear the first screen of the buffer at 9000H and hook the display driver.
8084
GOSUB to 89C0H to clear the screen through the ROM's 01C9H and switch the cursor off.
8087
LD HL,8E40H 21 40 8E
Point Register Pair HL to 8E40H, the command line CAT with the parameters typed after CODIR.
808A
GOSUB to 88C9H to run the command line at Register Pair HL through CMNDI@: the directory is listed.
808D
GOSUB to 8866H to point ABORT@ (4031H) back at the address it had before CODIR.
8090
LD A,(8C23H) 3A 23 8C
Load Register A with the byte at 8C23H, the letter H of Hunt in the title line.
8093
INC A 3C
INCrement Register A, the letter of the title: 49H when the letter is still the H (48H).
8094
CP 49H FE 49
Compare Register A against 49H, the letter H of the title plus one.
8096
If the Z FLAG is set (the title is as it was), JUMP to 80ADH to go on with the directory.
8098
LD B,32H 06 32
Load Register B with 32H, the 50 warnings of a changed title.
809A
GOSUB to 88F7H to sound the high tone of an error through port FFH.
809D
LD HL,8BACH 21 AC 8B
Point Register Pair HL to 8BACH, the text (C) NAME MODIFIED! and RE-BOOT!.
80A0
GOSUB to 8997H to display the text at Register Pair HL up to its 03H at the cursor.
80A3
DECrement Register B and loop back to 809AH until the 50 warnings are given.
80A5
LD A,FFH 3E FF
Load Register A with FFH, the value put into the operand of the BREAK test at 8B30H.
80A7
LD (8B31H),A 32 31 8B
Store Register A (FFH) into 8B31H: the display hook's test of the BREAK key (CP 04H) becomes CP FFH.
80AA
JUMP to 8149H to sound a tone and return to the DOS through EXIT@.
80AD
LD A,85H 3E 85
Load Register A with 85H, a graphic character, for the top right corner of the screen.
80AF
LD (3C3EH),A 32 3E 3C
Store Register A (85H) at 3C3EH, the next to last place of the first line of the screen.
80B2
GOSUB to 89A9H to display Register A (85H) through the ROM's 0033H at the cursor.
80B5
LD A,08H 3E 08
Load Register A with 08H, the backspace, to take the cursor back over the character.
80B7
GOSUB to 89A9H to display Register A (08H) through the ROM's 0033H: the cursor steps back.
80BA
LD A,20H 3E 20
Load Register A with 20H, a space, for the place 3C3EH at the top right of the screen.
80BC
LD (3C3EH),A 32 3E 3C
Store Register A, the space, at 3C3EH, the next to last place of the first line of the screen.
80BF
LD HL,93C0H 21 C0 93
Point Register Pair HL to 93C0H, the byte after the first screen of the buffer at 9000H.
80C2
LD A,(HL) 7E
Load Register A with the byte after the first screen at Register Pair HL.
80C3
CP 20H FE 20
Compare Register A against 20H, a space saved by the display hook at the place after the first screen.
80C5
If the NZ FLAG is set (not a space), JUMP to 80C9H to test it for the end mark.
80C7
LD (HL),8FH 36 8F
Store 8FH at Register Pair HL, the end mark of the buffer, after the first screen.
80C9
LD A,(HL) 7E
Load Register A with the byte after the first screen at Register Pair HL.
80CA
CP 8FH FE 8F
Compare Register A against 8FH, the end mark: the whole listing fitted on the first screen.
80CC
If the NZ FLAG is set (more lines were saved), JUMP to 80E1H to show the last screen saved.
80CE
LD HL,(8B9DH) 2A 9D 8B
Load Register Pair HL with the contents of 8B9DH-8B9EH, the place of the last byte saved.
80D1
INC HL 23
INCrement Register Pair HL to the place after the last byte saved in the buffer.
80D2
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL over the end mark of the last line saved.
80D4
LD HL,93C0H 21 C0 93
Point Register Pair HL to 93C0H, the byte after the first screen of the buffer.
80D7
LD (HL),8FH 36 8F
Store 8FH at Register Pair HL (93C0H), the end mark after the first screen.
80D9
LD HL,(8B9BH) 2A 9B 8B
Load Register Pair HL with the contents of 8B9BH-8B9CH, the start of the screen shown in the buffer.
80DC
GOSUB to 8B7FH to copy the screen of the buffer at Register Pair HL to the video memory 3C00H.
80DF
JUMP to 8102H to show the title on the command line and pick the first file.
80E1
LD HL,(8B9DH) 2A 9D 8B
Load Register Pair HL with the contents of 8B9DH-8B9EH, the place of the last byte saved.
80E4
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
80E5
LD DE,03BFH 11 BF 03
Load Register Pair DE with 03BFH, a screen of 15 lines less one byte.
80E8
SBC HL,DE ED 52
SUBtract Register Pair DE (03BFH) from Register Pair HL with the carry: the start of the last screen.
80EA
LD (8B9BH),HL 22 9B 8B
Store Register Pair HL, the start of the last screen, into 8B9BH-8B9CH, the screen shown.
80ED
LD A,(3F80H) 3A 80 3F
Load Register A with the first character of line 15 of the screen at 3F80H.
80F0
CP 20H FE 20
Compare Register A against 20H, a space: the last line of the listing on the screen is empty.
80F2
If the NZ FLAG is set (the line holds a file), JUMP to 8102H, the screen kept as it is.
80F4
GOSUB to 8B4CH to move the screen one line back in the buffer and show it.
80F7
LD HL,(8B9DH) 2A 9D 8B
Load Register Pair HL with the contents of 8B9DH-8B9EH, the place of the last byte saved.
80FA
LD DE,003FH 11 3F 00
Load Register Pair DE with 003FH, the 63 bytes of a line less one.
80FD
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
80FE
SBC HL,DE ED 52
SUBtract Register Pair DE (003FH) from Register Pair HL with the carry: the start of the last line saved.
8100
LD (HL),8FH 36 8F
Store 8FH at Register Pair HL, the end mark, over the start of the last line saved.
8102
LD HL,8BF4H 21 F4 8B
Point Register Pair HL to 8BF4H, the title line CO-DIR 2.1 - Cursor Oriented DIR. without the two line feeds.
8105
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
8108
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
810B
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no key of the row at 3840H is held down.
810D
If the Z FLAG is set (no key held), JUMP to 8113H to take the drive of the listing.
810F
CP 08H FE 08
Compare Register A against 08H: the C FLAG while only ENTER, CLEAR or BREAK is held.
8111
If the C FLAG is set (ENTER, CLEAR or BREAK held), JUMP to 8108H to wait until it is let go.
8113
LD HL,9007H 21 07 90
Point Register Pair HL to 9007H, the eighth character of the first line saved, the drive of the listing.
8116
LD A,(HL) 7E
Load Register A with the drive's character at Register Pair HL.
8117
LD (8BE8H),A 32 E8 8B
Store Register A, the drive's character, into 8BE8H, the drive of the files shown.
811A
LD (8D0BH),A 32 0B 8D
Store Register A, the drive's character, into 8D0BH, the default drive of the prompts.
811D
INC HL 23
INCrement Register Pair HL to the character after the drive's.
811E
LD A,(HL) 7E
Load Register A with the character after the drive's at Register Pair HL.
811F
CP 20H FE 20
Compare Register A against 20H, a space; the JR below jumps whatever the comparison gives.
8121
JUMP to 8125H with the character after the drive's in Register A; the LD A,00H below is not reached.
8123
LD A,00H 3E 00
Load Register A with 00H; no jump comes here, as the JR at 8121H passes over it.
8125
LD (8D0CH),A 32 0C 8D
Store Register A, the character after the drive's, into 8D0CH, the second place of the default drive.
8128
LD (8BE9H),A 32 E9 8B
Store Register A, the character after the drive's, into 8BE9H, the second place of the drive shown.
812B
LD A,80H 3E 80
Load Register A with 80H, the flag stored into 8BF1H below.
812D
LD (8BF1H),A 32 F1 8B
Store Register A (80H) into 8BF1H, the flag that lets ENTER take the default drive (8A2BH).
8130
LD HL,3F80H 21 80 3F
Point Register Pair HL to 3F80H, line 15 of the screen, the lowest line a file can be on.
8133
LD C,0DH 0E 0D
Load Register C with 0DH, the 13 lines from line 15 up to line 3 that can hold files.
8135
LD A,(HL) 7E
Load Register A with the first character of the line at Register Pair HL.
8136
CP 20H FE 20
Compare Register A against 20H, a space: no file on this line.
8138
If the NZ FLAG is set (a file on the line), JUMP to 8154H: the last line with files is found.
813A
LD DE,0040H 11 40 00
Load Register Pair DE with 0040H, the 64 characters of a line of the screen.
813D
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
813E
SBC HL,DE ED 52
SUBtract Register Pair DE (0040H) from Register Pair HL with the carry: the line above.
8140
DEC C 0D
DECrement Register C, the lines left to look at.
8141
If the NZ FLAG is set (lines left), JUMP to 8135H to look at the line above.
8143
LD HL,3C80H 21 80 3C
Point Register Pair HL to 3C80H, line 3 of the screen, where the cursor of the DOS is put.
8146
LD (4020H),HL 22 20 40
Store Register Pair HL (3C80H) into 4020H-4021H, the cursor of the display.
8149
GOSUB to 88F7H to sound the high tone through port FFH: no file is listed.
814C
JUMP to 402DH, EXIT@, back to the DOS: CODIR ends with no file to show.

814FH - Leaving CODIR

BREAK or CLEAR sounds the low tone and returns to the DOS through EXIT@.

814F
GOSUB to 88EFH to sound the low tone through port FFH before CODIR ends.
8152
JUMP to 814CH to return to the DOS through EXIT@ (402DH).
8154
LD A,C 79
Load Register A with Register C, the number of lines from line 3 to the last line with files.
8155
DEC A 3D
DECrement Register A: the row of the last line with files, counted from 0 at line 3.
8156
LD (823AH),A 32 3A 82
Store Register A into 823AH, the operand of the CP at 8239H: the last row the cursor may go to.

8159H - The Cursors

The character at the cursor (8BE0H) and the one 12 places to its right (8BEDH, where CODIR marks a file) are shown as graphic blocks for a time and then as they are, while the keyboard is scanned through 002BH. A key in the row 3840H held down makes the shown time shorter (4BH scans in place of FFH). A key goes to 81A1H.

8159
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
815C
LD A,(HL) 7E
Load Register A with the character at the cursor at Register Pair HL.
815D
LD (8BE7H),A 32 E7 8B
Store Register A, the character under the cursor, into 8BE7H, to be put back by 8918H.
8160
LD (HL),8FH 36 8F
Store 8FH, a full graphic block, at Register Pair HL: the first cursor.
8162
GOSUB to 8927H to step Register Pair HL 12 places on and keep the character there at 8BECH.
8165
LD (8BEDH),HL 22 ED 8B
Store Register Pair HL, the place 12 characters on, into 8BEDH-8BEEH, the second cursor.
8168
LD (HL),8FH 36 8F
Store 8FH, a full graphic block, at Register Pair HL: the second cursor.
816A
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
816D
LD C,FFH 0E FF
Load Register C with FFH, the scans with the cursors shown; 817DH and 818BH change this operand.
816F
GOSUB to 002BH, the ROM's keyboard scan, to load Register A with a key pressed, or 00H.
8172
OR A B7
OR Register A with itself: the NZ FLAG when a key was pressed.
8173
If the NZ FLAG is set (a key), JUMP to 8199H to take the key.
8175
DEC C 0D
DECrement Register C, the scans left with the cursors shown.
8176
If the NZ FLAG is set (scans left), JUMP to 816FH to scan the keyboard again.
8178
GOSUB to 8918H to put back the characters under the two cursors; Register Pair HL returns the cursor.
817B
LD A,4BH 3E 4B
Load Register A with 4BH, the shorter time of the cursors shown while a key is held.
817D
LD (816EH),A 32 6E 81
Store Register A (4BH) into 816EH, the operand of the LD C at 816DH.
8180
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8183
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no key of the row at 3840H is held down.
8185
If the NZ FLAG is set (a key is held), JUMP to 81B2H to move the cursors at once.
8187
LD C,FFH 0E FF
Load Register C with FFH, the scans with the cursors not shown.
8189
LD A,FFH 3E FF
Load Register A with FFH, the longer time of the cursors shown.
818B
LD (816EH),A 32 6E 81
Store Register A (FFH) into 816EH, the operand of the LD C at 816DH.
818E
GOSUB to 002BH, the ROM's keyboard scan, to load Register A with a key pressed, or 00H.
8191
OR A B7
OR Register A with itself: the NZ FLAG when a key was pressed.
8192
If the NZ FLAG is set (a key), JUMP to 81A1H to take the key.
8194
DEC C 0D
DECrement Register C, the scans left with the cursors not shown.
8195
If the NZ FLAG is set (scans left), JUMP to 818EH to scan the keyboard again.
8197
JUMP to 8159H to show the cursors again, the blinking going on.
8199
PUSH AF F5
Save Register Pair AF, the key in Register A, to the top of the stack.
819A
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
819D
GOSUB to 8918H to put back the characters under the two cursors.
81A0
POP AF F1
Restore Register Pair AF, the key in Register A, from the top of the stack.
81A1
LD (8BE4H),A 32 E4 8B
Store Register A, the key, into 8BE4H, the key of the command.
81A4
CP 5BH FE 5B
Compare Register A against 5BH, the code of the up arrow.
81A6
If the Z FLAG is set (the up arrow), JUMP to 81B2H to move the cursors.
81A8
CP 21H FE 21
Compare Register A against 21H: the NC FLAG for a printable character other than the space.
81AA
If the NC FLAG is set (a letter or another sign), JUMP to 82F9H, the commands.
81AD
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key.
81AF
If the Z FLAG is set (ENTER), JUMP to 82F9H, the command that runs the file.
81B2
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
81B5
CP 04H FE 04
Compare Register A against 04H, the BREAK key alone in the row.
81B7
If the Z FLAG is set (BREAK), JUMP to 814FH to leave CODIR.
81BA
CP 02H FE 02
Compare Register A against 02H, the CLEAR key alone in the row.
81BC
If the Z FLAG is set (CLEAR), JUMP to 814FH to leave CODIR.
81BF
CP 01H FE 01
Compare Register A against 01H, the ENTER key alone in the row.
81C1
If the Z FLAG is set (ENTER), JUMP to 82F9H, the command that runs the file.
81C4
CP 81H FE 81
Compare Register A against 81H, the ENTER key with the space bar.
81C6
If the Z FLAG is set (ENTER and the space bar), JUMP to 82F9H, the file run as a program.
81C9
GOSUB to 8930H to test the space bar at 3840H: the Z FLAG when it is held down.
81CC
If the NZ FLAG is set (the space bar is not held), JUMP to 81D3H to move at once.
81CE
LD C,5AH 0E 5A
Load Register C with 5AH, the length of the pause while the space bar is held.
81D0
GOSUB to 8A48H to wait for Register C (5AH) times 256 turns of a loop.
81D3
GOSUB to 81D9H to move the cursors by the arrow keys held down.
81D6
JUMP to 8159H to show the cursors at their new place.

81D9H - Moving the Cursors

The arrows held down in the row 3840H move the cursor: up and down a line (rows 0 to the last row at 823AH, from line 3 of the screen), the screen scrolled through the buffer at the top and the bottom; left and right a column of 15 characters (0 to 3). SHIFT with the up arrow goes to the first screen of the buffer. Places with nothing or a file marked with an asterisk are passed over (8938H) unless the space bar is held.

81D9
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
81DC
AND 08H E6 08
Keep only bit 3 of Register A (AND 08H), the up arrow.
81DE
CP 08H FE 08
Compare Register A against 08H: the Z FLAG when the up arrow is held down.
81E0
If the NZ FLAG is set (not the up arrow), JUMP to 822DH to test the down arrow.
81E2
LD A,(3880H) 3A 80 38
Load Register A with the keyboard row at 3880H, the row with the SHIFT keys.
81E5
CP 01H FE 01
Compare Register A against 01H, the left SHIFT key alone in the row.
81E7
If the NZ FLAG is set (no SHIFT), JUMP to 81FDH to move one line up.
81E9
LD HL,3C80H 21 80 3C
Point Register Pair HL to 3C80H, line 3 of the screen, the place of the first file.
81EC
LD (8BE0H),HL 22 E0 8B
Store Register Pair HL (3C80H) into 8BE0H-8BE1H, the video address of the cursor.
81EF
LD A,00H 3E 00
Load Register A with 00H, the first row and the first column.
81F1
LD (8BE5H),A 32 E5 8B
Store Register A (00H) into 8BE5H, the row of the cursor.
81F4
LD (8BE6H),A 32 E6 8B
Store Register A (00H) into 8BE6H, the column of the cursor.
81F7
LD HL,9000H 21 00 90
Point Register Pair HL to 9000H, the first screen of the buffer.
81FA
JUMP to 8B59H to show the screen of the buffer at Register Pair HL, the first one.
81FD
LD A,(8BE5H) 3A E5 8B
Load Register A with the row of the cursor from 8BE5H.
8200
CP 00H FE 00
Compare Register A against 00H, the first row.
8202
If the NZ FLAG is set (not the first row), JUMP to 820BH to move the cursor up a line.
8204
GOSUB to 8B4CH to move the screen one line back in the buffer: the Z FLAG at the start of the buffer.
8207
If the Z FLAG is set (the start of the buffer), JUMP to 822DH: the cursor stays.
8209
JUMP to 8228H to test the place the cursor is now on.
820B
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
820E
LD DE,0040H 11 40 00
Load Register Pair DE with 0040H, the 64 characters of a line of the screen.
8211
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
8212
SBC HL,DE ED 52
SUBtract Register Pair DE (0040H) from Register Pair HL with the carry: the line above.
8214
LD (8BE0H),HL 22 E0 8B
Store Register Pair HL into 8BE0H-8BE1H, the video address of the cursor, a line up.
8217
LD A,(8BE5H) 3A E5 8B
Load Register A with the row of the cursor from 8BE5H.
821A
DEC A 3D
DECrement Register A, the row of the cursor, a line up.
821B
LD (8BE5H),A 32 E5 8B
Store Register A, the new row, into 8BE5H, the row of the cursor.
821E
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8221
AND 08H E6 08
Keep only bit 3 of Register A (AND 08H), the up arrow.
8223
CP 08H FE 08
Compare Register A against 08H: the Z FLAG when the up arrow is still held down.
8225
If the NZ FLAG is set (no longer held), JUMP to 828AH to test the left arrow.
8228
GOSUB to 8938H to test the cursor's place: the Z FLAG for nothing or a killed file.
822B
If the Z FLAG is set (a place to pass over), JUMP to 81FDH to move up again.
822D
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8230
AND 10H E6 10
Keep only bit 4 of Register A (AND 10H), the down arrow.
8232
CP 10H FE 10
Compare Register A against 10H: the Z FLAG when the down arrow is held down.
8234
If the NZ FLAG is set (not the down arrow), JUMP to 828AH to test the left arrow.
8236
LD A,(8BE5H) 3A E5 8B
Load Register A with the row of the cursor from 8BE5H.
8239
CP 0EH FE 0E
Compare Register A against 0EH; the operand 823AH is set by 8156H to the last row with files.
823B
If the NZ FLAG is set (not the last row), JUMP to 8254H to move the cursor down a line.
823D
GOSUB to 8B63H to move the screen one line on in the buffer: the Z FLAG at the end of the buffer.
8240
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8243
LD (8BE4H),A 32 E4 8B
Store Register A, 80H after a scroll or 8FH at the end, into 8BE4H.
8246
LD A,(HL) 7E
Load Register A with the character at the cursor at Register Pair HL.
8247
CP 20H FE 20
Compare Register A against 20H, a space: no file at the cursor's place.
8249
If the Z FLAG is set (nothing there), JUMP to 81FDH to move the cursor up.
824B
LD A,(8BE4H) 3A E4 8B
Load Register A with the answer of the scroll from 8BE4H.
824E
CP 80H FE 80
Compare Register A against 80H, the answer of 8B7FH when the screen was moved.
8250
If the Z FLAG is set (the screen moved), JUMP to 8285H to test the cursor's place.
8252
JUMP to 828AH to test the left arrow: the end of the buffer is reached.
8254
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8257
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H, the 64 characters of a line of the screen.
825A
ADD HL,BC 09
ADD Register Pair BC (0040H) to Register Pair HL: the line below.
825B
LD (8BE0H),HL 22 E0 8B
Store Register Pair HL into 8BE0H-8BE1H, the video address of the cursor, a line down.
825E
LD A,(8BE5H) 3A E5 8B
Load Register A with the row of the cursor from 8BE5H.
8261
INC A 3C
INCrement Register A, the row of the cursor, a line down.
8262
LD (8BE5H),A 32 E5 8B
Store Register A, the new row, into 8BE5H, the row of the cursor.
8265
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8268
LD A,(HL) 7E
Load Register A with the character at the cursor at Register Pair HL.
8269
CP 20H FE 20
Compare Register A against 20H, a space: no file at the cursor's place.
826B
If the NZ FLAG is set (a file there), JUMP to 8285H to test the cursor's place.
826D
LD HL,823AH 21 3A 82
Point Register Pair HL to 823AH, the last row with files, the operand of the CP at 8239H.
8270
LD A,(8BE5H) 3A E5 8B
Load Register A with the row of the cursor from 8BE5H.
8273
CP (HL) BE
Compare Register A against the last row at Register Pair HL.
8274
If the Z FLAG is set (the last row), JUMP to 8282H to move the cursor back up.
8276
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8279
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H, the 64 characters of a line of the screen.
827C
ADD HL,BC 09
ADD Register Pair BC (0040H) to Register Pair HL: the place a line below the cursor.
827D
LD A,(HL) 7E
Load Register A with the character a line below the cursor at Register Pair HL.
827E
CP 20H FE 20
Compare Register A against 20H, a space: nothing a line below either.
8280
If the NZ FLAG is set (a file below), JUMP to 8236H to move the cursor down again.
8282
JUMP to 81FDH to move the cursor up, back to a place with a file.
8285
GOSUB to 8938H to test the cursor's place: the Z FLAG for nothing or a killed file.
8288
If the Z FLAG is set (a place to pass over), JUMP to 8236H to move down again.
828A
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
828D
AND 20H E6 20
Keep only bit 5 of Register A (AND 20H), the left arrow.
828F
CP 20H FE 20
Compare Register A against 20H: the Z FLAG when the left arrow is held down.
8291
If the NZ FLAG is set (not the left arrow), JUMP to 82C5H to test the right arrow.
8293
LD A,(8BE6H) 3A E6 8B
Load Register A with the column of the cursor from 8BE6H, 0 to 3.
8296
CP 00H FE 00
Compare Register A against 00H, the first column.
8298
If the Z FLAG is set (the first column), JUMP to 82C5H: the cursor goes no further left.
829A
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
829D
LD DE,000FH 11 0F 00
Load Register Pair DE with 000FH, the 15 characters of a column of the listing.
82A0
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
82A1
SBC HL,DE ED 52
SUBtract Register Pair DE (000FH) from Register Pair HL with the carry: the column to the left.
82A3
LD (8BE0H),HL 22 E0 8B
Store Register Pair HL into 8BE0H-8BE1H, the video address of the cursor, a column left.
82A6
LD A,(8BE6H) 3A E6 8B
Load Register A with the column of the cursor from 8BE6H.
82A9
DEC A 3D
DECrement Register A, the column of the cursor, a column left.
82AA
LD (8BE6H),A 32 E6 8B
Store Register A, the new column, into 8BE6H, the column of the cursor.
82AD
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
82B0
AND 20H E6 20
Keep only bit 5 of Register A (AND 20H), the left arrow.
82B2
CP 20H FE 20
Compare Register A against 20H: the Z FLAG when the left arrow is still held down.
82B4
RET NZ C0
RETurn to the caller if the NZ FLAG is set: the left arrow is no longer held.
82B5
GOSUB to 8938H to test the cursor's place: the Z FLAG for nothing or a killed file.
82B8
If the Z FLAG is set (a place to pass over), JUMP to 8293H to move left again.
82BA
IN A,(FFH) DB FF
Read port FFH into Register A, the cassette and display port, to choose the pause below.
82BC
CP FFH FE FF
Compare Register A against FFH, the value of port FFH that skips the pause.
82BE
If the Z FLAG is set (port FFH gives FFH), JUMP to 82C5H with no pause.
82C0
LD C,0AH 0E 0A
Load Register C with 0AH, the length of the pause after a step to the left.
82C2
GOSUB to 8A48H to wait for Register C (0AH) times 256 turns of a loop.
82C5
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
82C8
AND 40H E6 40
Keep only bit 6 of Register A (AND 40H), the right arrow.
82CA
CP 40H FE 40
Compare Register A against 40H: the Z FLAG when the right arrow is held down.
82CC
RET NZ C0
RETurn to the caller if the NZ FLAG is set: the right arrow is not held.
82CD
LD A,(8BE6H) 3A E6 8B
Load Register A with the column of the cursor from 8BE6H, 0 to 3.
82D0
CP 03H FE 03
Compare Register A against 03H, the last column of the listing.
82D2
RET Z C8
RETurn to the caller if the Z FLAG is set: the cursor goes no further right.
82D3
LD A,(8BE6H) 3A E6 8B
Load Register A with the column of the cursor from 8BE6H.
82D6
INC A 3C
INCrement Register A, the column of the cursor, a column right.
82D7
LD (8BE6H),A 32 E6 8B
Store Register A, the new column, into 8BE6H, the column of the cursor.
82DA
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
82DD
LD BC,000FH 01 0F 00
Load Register Pair BC with 000FH, the 15 characters of a column of the listing.
82E0
ADD HL,BC 09
ADD Register Pair BC (000FH) to Register Pair HL: the column to the right.
82E1
LD (8BE0H),HL 22 E0 8B
Store Register Pair HL into 8BE0H-8BE1H, the video address of the cursor, a column right.
82E4
LD A,(HL) 7E
Load Register A with the character at the cursor at Register Pair HL.
82E5
CP 20H FE 20
Compare Register A against 20H, a space: no file in that column.
82E7
If the Z FLAG is set (nothing there), JUMP to 8293H to move back to the left.
82E9
GOSUB to 8938H to test the cursor's place: the Z FLAG for nothing or a killed file.
82EC
If the Z FLAG is set (a place to pass over), JUMP to 82CDH to move right again.
82EE
IN A,(FFH) DB FF
Read port FFH into Register A, the cassette and display port, to choose the pause below.
82F0
CP FFH FE FF
Compare Register A against FFH, the value of port FFH that skips the pause.
82F2
RET Z C8
RETurn to the caller if the Z FLAG is set: no pause.
82F3
LD C,0AH 0E 0A
Load Register C with 0AH, the length of the pause after a step to the right.
82F5
GOSUB to 8A48H to wait for Register C (0AH) times 256 turns of a loop.
82F8
RET C9
RETurn to the caller after the move of the cursors.

82F9H - The Commands

The key of 8BE4H, made upper case: D and A list another drive (SHIFT with D adds (I), A gives (I,A)), F the free space map, V the title and the licence, H the keys on the command line; S searches; the keys of the list at 8CA8H (C G J K L M O P R Z and ENTER) work on the file at the cursor, with SHIFT (a lower case key) asking for a password first. Any other key sounds the high tone.

82F9
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the command CAT :d at 8C76H.
82FB
LD (8C7DH),A 32 7D 8C
Store Register A (0DH) into 8C7DH, the place after the drive of CAT :d, so no options follow.
82FE
LD A,(8BE4H) 3A E4 8B
Load Register A with the key of the command from 8BE4H.
8301
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): a lower case key becomes upper case.
8303
CP 44H FE 44
Compare Register A against 44H, the letter D, a directory of another drive.
8305
If the Z FLAG is set (D), JUMP to 8339H for the directory, with (I) when SHIFT is held.
8307
CP 41H FE 41
Compare Register A against 41H, the letter A, a directory with the options I and A.
8309
If the Z FLAG is set (A), JUMP to 8345H for the directory with (I,A).
830B
CP 46H FE 46
Compare Register A against 46H, the letter F, the free space map of a drive.
830D
If the Z FLAG is set (F), JUMP to 85C3H for the free space map.
8310
CP 56H FE 56
Compare Register A against 56H, the letter V, the view of the title and the licence.
8312
If the NZ FLAG is set (not V), JUMP to 8329H to test for H.
8314
GOSUB to 8B8CH to save the screen into the buffer, so it can be shown again afterward.
8317
GOSUB to 89C0H to clear the screen through the ROM's 01C9H and switch the cursor off.
831A
LD HL,8BF2H 21 F2 8B
Point Register Pair HL to 8BF2H, two line feeds and the title line of CO-DIR 2.1.
831D
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the title at Register Pair HL up to its 03H.
8320
LD HL,8C33H 21 33 8C
Point Register Pair HL to 8C33H, the lines All Rights Reserved and Licensed to Micro-Systems Software.
8323
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the text at Register Pair HL up to its 0DH.
8326
JUMP to 86BEH to ask for BREAK or CLEAR (the DOS) or another key (back to the directory).
8329
CP 48H FE 48
Compare Register A against 48H, the letter H, the help line of the keys.
832B
If the NZ FLAG is set (not H), JUMP to 8398H to look for the key in the list of 8CA8H.
832D
LD HL,8C88H 21 88 8C
Point Register Pair HL to 8C88H, the line Choices: with the keys of CODIR.
8330
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
8333
GOSUB to 88EFH to sound the low tone through port FFH: the command is done.
8336
JUMP to 8159H to show the cursors again with the help line shown.
8339
LD A,(3880H) 3A 80 38
Load Register A with the keyboard row at 3880H, the row with the SHIFT keys.
833C
CP 01H FE 01
Compare Register A against 01H, the left SHIFT key alone in the row.
833E
If the NZ FLAG is set (no SHIFT), JUMP to 8355H: CAT :d with no options.
8340
LD HL,8C7EH 21 7E 8C
Point Register Pair HL to 8C7EH, the option (I), invisible files too, for SHIFT with D.
8343
JUMP to 8348H to put the option at Register Pair HL after CAT :d.
8345
LD HL,8C82H 21 82 8C
Point Register Pair HL to 8C82H, the options (I,A), invisible files and the allocation, for A.
8348
LD A,20H 3E 20
Load Register A with 20H, a space, to go between CAT :d and the options.
834A
LD (8C7DH),A 32 7D 8C
Store Register A, the space, into 8C7DH, the place after the drive of CAT :d.
834D
LD DE,8E48H 11 48 8E
Point Register Pair DE to 8E48H, the place after CAT :d and the space in the command line at 8E40H.
8350
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the seven bytes copied from the option text.
8353
LDIR ED B0
Copy the option from Register Pair HL to Register Pair DE (8E48H), the count in Register Pair BC.
8355
LD HL,8CE2H 21 E2 8C
Point Register Pair HL to 8CE2H, the prompt CO-DIR Directory of.
8358
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
835B
GOSUB to 89CBH to ask which drive (d)?: Register A returns the drive, Register C its second character, 80H to cancel.
835E
CP 80H FE 80
Compare Register A against 80H, the answer of a cancelled question.
8360
If the Z FLAG is set (cancelled), JUMP to 883CH to show the title and the cursors again.
8363
LD (8BE8H),A 32 E8 8B
Store Register A, the drive's character, into 8BE8H, the drive of the files shown.
8366
LD (8D0BH),A 32 0B 8D
Store Register A, the drive's character, into 8D0BH, the default drive of the prompts.
8369
LD (8C7BH),A 32 7B 8C
Store Register A, the drive's character, into 8C7BH, the drive of the command CAT :d.
836C
LD A,C 79
Load Register A with Register C, the second character of the answer, or 0DH.
836D
LD (8BE9H),A 32 E9 8B
Store Register A, the second character, into 8BE9H, the second place of the drive shown.
8370
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return of an answer of one character.
8372
If the NZ FLAG is set (a second character), JUMP to 8376H to keep it.
8374
LD A,00H 3E 00
Load Register A with 00H, which the copy at 88C9H leaves out of a command line.
8376
LD (8D0CH),A 32 0C 8D
Store Register A, the second character or 00H, into 8D0CH, the second place of the default drive.
8379
LD (8C7CH),A 32 7C 8C
Store Register A, the second character or 00H, into 8C7CH, the second place of the drive of CAT :d.
837C
LD HL,3C80H 21 80 3C
Point Register Pair HL to 3C80H, line 3 of the screen, the place of the first file.
837F
LD (8BE0H),HL 22 E0 8B
Store Register Pair HL (3C80H) into 8BE0H-8BE1H, the video address of the cursor.
8382
LD A,00H 3E 00
Load Register A with 00H, the first row and the first column.
8384
LD (8BE5H),A 32 E5 8B
Store Register A (00H) into 8BE5H, the row of the cursor.
8387
LD (8BE6H),A 32 E6 8B
Store Register A (00H) into 8BE6H, the column of the cursor.
838A
LD HL,8C76H 21 76 8C
Point Register Pair HL to 8C76H, the command CAT :d with the drive just given.
838D
LD DE,8E40H 11 40 8E
Point Register Pair DE to 8E40H, the start of the command line CODIR runs.
8390
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the eight bytes of CAT :d and the byte after it.
8393
LDIR ED B0
Copy CAT :d from Register Pair HL to Register Pair DE (8E40H), the count in Register Pair BC.
8395
JUMP to 8054H to hook ABORT@ again and list the new directory into a new buffer.
8398
LD HL,8CA8H 21 A8 8C
Point Register Pair HL to 8CA8H, the keys of the help line from A to Z, then 03H, 01H and 0DH.
839B
LD BC,0022H 01 22 00
Load Register Pair BC with 0022H, the 34 bytes searched, ENTER's 0DH the last.
839E
LD A,(8BE4H) 3A E4 8B
Load Register A with the key of the command from 8BE4H.
83A1
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): a lower case key becomes upper case.
83A3
CPIR ED B1
Search Register Pair HL on for Register A (CPIR), Register Pair BC counting: the Z FLAG when the key is found.
83A5
If the Z FLAG is set (a key of the list), JUMP to 83ADH to run it.
83A7
GOSUB to 88F7H to sound the high tone through port FFH: the key is not a command.
83AA
JUMP to 883CH to show the title and the cursors again.
83AD
CP 53H FE 53
Compare Register A against 53H, the letter S, the search.
83AF
If the NZ FLAG is set (not S), JUMP to 8434H for a command on the file at the cursor.

83B2H - S - The Search

Search for: takes up to 12 characters into 8BCAH (ENTER alone keeps the last ones, all question marks at the start). From the place after the cursor, each file shown is compared: a search starting with a slash compares the extension (8A78H), another the name from its first character (8A88H), a question mark matching any character. A file found keeps the cursor with the low tone; the end of the buffer sounds the high tone.

83B2
LD A,79H 3E 79
Load Register A with 79H, the letter y, the mark of the search for the line input at 86FBH.
83B4
LD (8BEFH),A 32 EF 8B
Store Register A (79H) into 8BEFH, the mode of the line input: the search.
83B7
LD HL,8BC9H 21 C9 8B
Point Register Pair HL to 8BC9H, the byte before the search's 12 characters at 8BCAH.
83BA
LD (8BEAH),HL 22 EA 8B
Store Register Pair HL (8BC9H) into 8BEAH-8BEBH, where the line input puts its text.
83BD
LD HL,8D4DH 21 4D 8D
Point Register Pair HL to 8D4DH, the prompt Search for: and the left border 85H.
83C0
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
83C3
LD A,8AH 3E 8A
Load Register A with 8AH, a graphic character, the right border of the field.
83C5
LD (3FD9H),A 32 D9 3F
Store Register A (8AH) at 3FD9H, 12 places after the start of the field on the command line.
83C8
GOSUB to 86FBH to take a line from the keyboard into the field and on to 8BCAH; ENTER alone returns at once.
83CB
LD HL,8BCAH 21 CA 8B
Point Register Pair HL to 8BCAH, the characters of the search.
83CE
LD DE,3FCDH 11 CD 3F
Point Register Pair DE to 3FCDH, the field on the command line, to show the search.
83D1
LD B,0CH 06 0C
Load Register B with 0CH, the 12 characters of the search at most.
83D3
LD A,00H 3E 00
Load Register A with 00H, the length of the search, none counted yet.
83D5
LD (8BEFH),A 32 EF 8B
Store Register A (00H) into 8BEFH, the length of the search.
83D8
LD A,(HL) 7E
Load Register A with the next character of the search at Register Pair HL.
83D9
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that ends the search.
83DB
If the Z FLAG is set (the end), JUMP to 83E9H to search.
83DD
LD (DE),A 12
Store Register A, the character of the search, at Register Pair DE in the field shown.
83DE
LD A,(8BEFH) 3A EF 8B
Load Register A with the length of the search from 8BEFH.
83E1
INC A 3C
INCrement Register A, the length of the search, for this character.
83E2
LD (8BEFH),A 32 EF 8B
Store Register A, the length of the search, into 8BEFH.
83E5
INC HL 23
INCrement Register Pair HL to the next character of the search.
83E6
INC DE 13
INCrement Register Pair DE to the next place of the field shown.
83E7
DECrement Register B and loop back to 83D8H until 12 characters are shown.
83E9
LD A,80H 3E 80
Load Register A with 80H, the mark that the search may go on to the next line.
83EB
LD (8BE4H),A 32 E4 8B
Store Register A (80H) into 8BE4H; 8243H puts 8FH there at the end of the buffer.
83EE
LD A,(8BE6H) 3A E6 8B
Load Register A with the column of the cursor from 8BE6H, 0 to 3.
83F1
CP 03H FE 03
Compare Register A against 03H, the last column of the listing.
83F3
If the Z FLAG is set (the last column), JUMP to 841CH to go on with the next line.
83F5
LD B,04H 06 04
Load Register B with 04H, the four columns of a line.
83F7
PUSH BC C5
Save Register Pair BC, the columns left, to the top of the stack.
83F8
GOSUB to 82CDH to move the cursor one column right, passing over empty and killed places.
83FB
POP BC C1
Restore Register Pair BC, the columns left, from the top of the stack.
83FC
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
83FF
PUSH BC C5
Save Register Pair BC, the columns left, to the top of the stack.
8400
LD DE,8BCAH 11 CA 8B
Point Register Pair DE to 8BCAH, the characters of the search.
8403
LD A,(DE) 1A
Load Register A with the first character of the search at Register Pair DE.
8404
CP 2FH FE 2F
Compare Register A against 2FH, the slash of a search of the extension.
8406
If the NZ FLAG is set (a search of the name), JUMP to 840DH.
8408
GOSUB to 8A78H to compare the extension of the file at Register Pair HL with the search at Register Pair DE.
840B
JUMP to 8416H with the Z FLAG set when the file matches.
840D
DEC HL 2B
DECrement Register Pair HL, as 8A88H steps on before each character it compares.
840E
DEC DE 1B
DECrement Register Pair DE, as 8A88H steps on before each character it compares.
840F
LD A,(8BEFH) 3A EF 8B
Load Register A with the length of the search from 8BEFH.
8412
LD B,A 47
Load Register B with Register A, the characters to compare.
8413
GOSUB to 8A88H to compare Register B characters at Register Pair DE and Register Pair HL: the Z FLAG for a match.
8416
POP BC C1
Restore Register Pair BC, the columns left, from the top of the stack.
8417
If the Z FLAG is set (the file matches), JUMP to 8844H: the low tone, the cursor on the file.
841A
DECrement Register B and loop back to 83F7H for the next column of the line.
841C
LD B,04H 06 04
Load Register B with 04H, the four columns to go back to the first.
841E
PUSH BC C5
Save Register Pair BC, the columns left, to the top of the stack.
841F
GOSUB to 8293H to move the cursor one column left, passing over empty and killed places.
8422
POP BC C1
Restore Register Pair BC, the columns left, from the top of the stack.
8423
DECrement Register B and loop back to 841EH until the cursor is in the first column.
8425
GOSUB to 8236H to move the cursor down a line, the screen scrolled at the bottom.
8428
LD B,04H 06 04
Load Register B with 04H, the four columns of the new line.
842A
LD A,(8BE4H) 3A E4 8B
Load Register A with the mark from 8BE4H: 8FH when the end of the buffer was reached.
842D
CP 80H FE 80
Compare Register A against 80H, the mark that the search may go on.
842F
If the Z FLAG is set (go on), JUMP to 83FCH to compare the file in the first column.
8431
JUMP to 8849H: the high tone, the search found nothing.

8434H - A Command on the File

The file at the cursor is copied from the screen to 8E40H; a file marked with an asterisk sounds the high tone. With SHIFT held (8BEFH 80H) Password: asks for up to eight characters, put after a period. Then :d, the drive of the listing, is added and the key's command is run: K kills, and the other keys go on at 84EAH.

8434
LD A,00H 3E 00
Load Register A with 00H, the mode of the line input: no password.
8436
LD (8BEFH),A 32 EF 8B
Store Register A (00H) into 8BEFH, the mode of the line input.
8439
LD A,(3880H) 3A 80 38
Load Register A with the keyboard row at 3880H, the row with the SHIFT keys.
843C
CP 01H FE 01
Compare Register A against 01H, the left SHIFT key alone in the row.
843E
If the NZ FLAG is set (no SHIFT), JUMP to 8445H with no password.
8440
LD A,80H 3E 80
Load Register A with 80H, the mode of the line input for a password.
8442
LD (8BEFH),A 32 EF 8B
Store Register A (80H) into 8BEFH, the mode of the line input: a password.
8445
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8448
GOSUB to 8945H to look at the mark 12 places on: the Z FLAG for an asterisk, a killed file.
844B
If the Z FLAG is set (a killed file), JUMP to 8849H to sound the high tone.
844E
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8451
LD DE,8E40H 11 40 8E
Point Register Pair DE to 8E40H, where the name of the file is put for the command.
8454
LD B,0DH 06 0D
Load Register B with 0DH, the 13 characters of a name and extension at most.
8456
LD A,(HL) 7E
Load Register A with the character of the name on the screen at Register Pair HL.
8457
CP 20H FE 20
Compare Register A against 20H: the C FLAG for a character held below 20H in the video memory.
8459
If the NC FLAG is set (20H or above), JUMP to 845DH to keep the character.
845B
ADD A,40H C6 40
ADD 40H to Register A: the video memory's code below 20H becomes its letter.
845D
LD (DE),A 12
Store Register A, the character of the name, at Register Pair DE.
845E
CP 20H FE 20
Compare Register A against 20H, the space after the name on the screen.
8460
If the Z FLAG is set (the end of the name), JUMP to 8466H.
8462
INC HL 23
INCrement Register Pair HL to the next character of the name on the screen.
8463
INC DE 13
INCrement Register Pair DE to the next place of the name at 8E40H.
8464
DECrement Register B and loop back to 8456H for the next character of the name.
8466
PUSH DE D5
Save Register Pair DE, the place after the name, to the top of the stack.
8467
POP HL E1
Restore Register Pair HL from the top of the stack: the place after the name (from Register Pair DE).
8468
LD (8BEAH),HL 22 EA 8B
Store Register Pair HL, the place after the name, into 8BEAH-8BEBH, where the line input puts a password.
846B
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL, the end of the name for the display of 8958H.
846D
LD A,(8BEFH) 3A EF 8B
Load Register A with the mode of the line input from 8BEFH.
8470
CP 80H FE 80
Compare Register A against 80H, the mode of a password.
8472
If the NZ FLAG is set (no password), JUMP to 8495H to add the drive.
8474
LD HL,8D5BH 21 5B 8D
Point Register Pair HL to 8D5BH, the prompt Password : and the left border 85H.
8477
GOSUB to 8958H to show the name on the command line, the cursor put after it at 3FD8H.
847A
GOSUB to 8997H to display the prompt at Register Pair HL at the cursor.
847D
LD A,8AH 3E 8A
Load Register A with 8AH, a graphic character, the right border of the field.
847F
LD (3FEDH),A 32 ED 3F
Store Register A (8AH) at 3FEDH, eight places after the start of the field.
8482
LD A,(8BE4H) 3A E4 8B
Load Register A with the key of the command from 8BE4H.
8485
LD (8BF0H),A 32 F0 8B
Store Register A, the key, into 8BF0H while the password is typed.
8488
GOSUB to 86FBH to take the password from the keyboard and put a period and it after the name.
848B
LD A,(8BF0H) 3A F0 8B
Load Register A with the key of the command from 8BF0H.
848E
LD (8BE4H),A 32 E4 8B
Store Register A, the key, back into 8BE4H, the key of the command.
8491
LD DE,(8BEAH) ED 5B EA 8B
Load Register Pair DE with the contents of 8BEAH-8BEBH, the place after the name and the password.
8495
LD A,3AH 3E 3A
Load Register A with 3AH, the colon before the drive.
8497
LD (DE),A 12
Store Register A, the colon, at Register Pair DE after the name.
8498
LD A,(8BE8H) 3A E8 8B
Load Register A with the drive's character from 8BE8H, the drive of the listing.
849B
INC DE 13
INCrement Register Pair DE to the place of the drive.
849C
LD (DE),A 12
Store Register A, the drive's character, at Register Pair DE.
849D
LD A,(8BE9H) 3A E9 8B
Load Register A with the second place of the drive from 8BE9H.
84A0
CP 0DH FE 0D
Compare Register A against 0DH, a carriage return: no second character.
84A2
If the Z FLAG is set (one character), JUMP to 84A6H to end the name.
84A4
INC DE 13
INCrement Register Pair DE to the next place of the name.
84A5
LD (DE),A 12
Store Register A, the second place of the drive, at Register Pair DE.
84A6
INC DE 13
INCrement Register Pair DE to the place after the drive.
84A7
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the file's name and drive.
84A9
LD (DE),A 12
Store Register A (0DH) at Register Pair DE after the drive of the file.
84AA
PUSH DE D5
Save Register Pair DE, the place of the carriage return, to the top of the stack.
84AB
POP HL E1
Restore Register Pair HL from the top of the stack: the place of the carriage return (from Register Pair DE).
84AC
LD (8BEAH),HL 22 EA 8B
Store Register Pair HL into 8BEAH-8BEBH, where the rest of a command line is put.
84AF
LD A,(8BE4H) 3A E4 8B
Load Register A with the key of the command from 8BE4H.
84B2
CP 4BH FE 4B
Compare Register A against 4BH, the letter K, the kill.
84B4
If the Z FLAG is set (K), JUMP to 84BBH to kill the file.
84B7
CP 6BH FE 6B
Compare Register A against 6BH, the letter k, K with SHIFT.
84B9
If the NZ FLAG is set (not the kill), JUMP to 84EAH for the other commands.
84BB
LD HL,8E0BH 21 0B 8E
Point Register Pair HL to 8E0BH, the prompt Kill file?.
84BE
GOSUB to 88E7H to sound the warning tone through port FFH.
84C1
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
84C4
CP 59H FE 59
Compare Register A against 59H, the letter Y.
84C6
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
84C9
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
84CC
LD (HL),8FH 36 8F
Store 8FH, a graphic block, at Register Pair HL next to the file while it is killed.
84CE
LD HL,8E0BH 21 0B 8E
Point Register Pair HL to 8E0BH, the prompt Kill file?, whose first five characters are the command.
84D1
LD DE,8E3BH 11 3B 8E
Point Register Pair DE to 8E3BH, five places before the name at 8E40H.
84D4
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five characters of Kill and the space.
84D7
LDIR ED B0
Copy Kill and a space from Register Pair HL to Register Pair DE (8E3BH), the count in Register Pair BC.
84D9
LD HL,8E3BH 21 3B 8E
Point Register Pair HL to 8E3BH, the command line Kill name:d.
84DC
GOSUB to 88BFH to show the command line at Register Pair HL and run it through CMNDI@.
84DF
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
84E2
LD (HL),2AH 36 2A
Store 2AH, an asterisk, at Register Pair HL: the file is marked killed.
84E4
GOSUB to 8236H to move the cursor down a line, off the killed file.
84E7
JUMP to 884CH to wait for the keys to be let go and show the cursors again.
84EA
LD A,(8BE4H) 3A E4 8B
Load Register A with the key of the command from 8BE4H.
84ED
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key.
84EF
If the Z FLAG is set (ENTER), JUMP to 87FEH to run the file.
84F2
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): a lower case key becomes upper case.
84F4
CP 4CH FE 4C
Compare Register A against 4CH, the letter L, the list.
84F6
If the Z FLAG is set (L), JUMP to 8690H to list the file on the screen.
84F9
CP 43H FE 43
Compare Register A against 43H, the letter C, the copy.
84FB
If the Z FLAG is set (C), JUMP to 8633H to copy the file to another drive.
84FE
CP 5AH FE 5A
Compare Register A against 5AH, the letter Z, the zero.
8500
If the Z FLAG is set (Z), JUMP to 8598H to fill the file with zeros through CLEAR.
8503
CP 4DH FE 4D
Compare Register A against 4DH, the letter M, the modify.
8505
If the Z FLAG is set (M), JUMP to 85E8H to run DISKDUMP on the file.
8508
CP 50H FE 50
Compare Register A against 50H, the letter P, the print.
850A
If the Z FLAG is set (P), JUMP to 8605H to list the file to the printer.
850D
CP 52H FE 52
Compare Register A against 52H, the letter R, the rename.
850F
If the Z FLAG is set (R), JUMP to 86E8H to rename the file.
8512
CP 4AH FE 4A
Compare Register A against 4AH, the letter J, the DO file.
8514
If the Z FLAG is set (J), JUMP to 857DH to run the file through DO.
8516
CP 4FH FE 4F
Compare Register A against 4FH, the letter O, the load.
8518
If the Z FLAG is set (O), JUMP to 8561H to load the file through LOAD.
851B
CP 47H FE 47
Compare Register A against 47H, the letter G, the size of the file.
851D
If the NZ FLAG is set (not G), JUMP to 8849H to sound the high tone.

8520H - G - The Size of the File

The file is opened (OPEN@ with the name line 8E40H as its control block) and its size in sectors, a part sector counted as one, is divided by four and shown as kilobytes, nnk, or <k for none; an error of OPEN@ is posted by ERROR@ and CODIR ends.

8520
LD HL,8D7EH 21 7E 8D
Point Register Pair HL to 8D7EH, the question Display file size (allocation)?.
8523
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
8526
CP 59H FE 59
Compare Register A against 59H, the letter Y.
8528
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
852B
LD HL,8E40H 21 40 8E
Point Register Pair HL to 8E40H, the name of the file and its drive.
852E
GOSUB to 8992H to display the name at Register Pair HL on the command line.
8531
LD HL,8D9FH 21 9F 8D
Point Register Pair HL to 8D9FH, the text size is :.
8534
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the text at Register Pair HL up to its 03H.
8537
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the sector buffer given to OPEN@, not used as nothing is read.
853A
LD DE,8E40H 11 40 8E
Point Register Pair DE to 8E40H, the name of the file, used as the control block of OPEN@.
853D
GOSUB to 4424H, OPEN@ in SYS0/SYS, to open the file named in the control block at Register Pair DE.
8540
If the NZ FLAG is set (not opened), JUMP to 855BH to post the error.
8542
LD HL,(8E4CH) 2A 4C 8E
Load Register Pair HL with the contents of 8E4CH-8E4DH, +0CH of the control block, the end of the file in sectors.
8545
LD A,(8E48H) 3A 48 8E
Load Register A with the byte at 8E48H, +08H of the control block, the end of the file in the last sector.
8548
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when the file ends on the end of a sector.
854A
If the Z FLAG is set (no part sector), JUMP to 854DH to divide the sectors.
854C
INC HL 23
INCrement Register Pair HL, the sectors, for the part sector at the end.
854D
SRL H CB 3C
Shift Register H right (SRL H), the first half of a division of Register Pair HL by two.
854F
RR L CB 1D
Rotate Register L right through the carry: Register Pair HL halved.
8551
SRL H CB 3C
Shift Register H right (SRL H), the first half of a second division of Register Pair HL by two.
8553
RR L CB 1D
Rotate Register L right through the carry: Register Pair HL, the sectors divided by four.
8555
GOSUB to 886DH to display Register Pair HL as a decimal number followed by k.
8558
JUMP to 884CH to wait for the keys to be let go and show the cursors again.
855B
GOSUB to 4409H, ERROR@ in SYS0/SYS, to post the error of OPEN@ in Register A.
855E
JUMP to 402DH, EXIT@, back to the DOS after the error.

8561H - O, J and Z - LOAD, DO and CLEAR

O runs LOAD name:d and J runs DO name:d through CMNDI@ (8831H), so CODIR ends; Z runs CLEAR name:d after two warning tones and marks the file with Z.

8561
LD HL,8DE9H 21 E9 8D
Point Register Pair HL to 8DE9H, the question Load file??.
8564
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
8567
CP 59H FE 59
Compare Register A against 59H, the letter Y.
8569
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
856C
LD HL,8DE9H 21 E9 8D
Point Register Pair HL to 8DE9H, the question Load file??, whose first five characters are the command.
856F
LD DE,8E3BH 11 3B 8E
Point Register Pair DE to 8E3BH, five places before the name at 8E40H.
8572
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five characters of Load and the space.
8575
LDIR ED B0
Copy Load and a space from Register Pair HL to Register Pair DE (8E3BH), the count in Register Pair BC.
8577
LD HL,8E3BH 21 3B 8E
Point Register Pair HL to 8E3BH, the command line Load name:d.
857A
JUMP to 8831H to clear the screen, show the command line and run it through CMNDI@.
857D
LD HL,8DF6H 21 F6 8D
Point Register Pair HL to 8DF6H, the question Do (activate) file?.
8580
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
8583
CP 59H FE 59
Compare Register A against 59H, the letter Y.
8585
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
8588
LD HL,8DF6H 21 F6 8D
Point Register Pair HL to 8DF6H, the question Do (activate) file?, whose first three characters are the command.
858B
LD DE,8E3DH 11 3D 8E
Point Register Pair DE to 8E3DH, three places before the name at 8E40H.
858E
LD BC,0003H 01 03 00
Load Register Pair BC with 0003H, the three characters of Do and the space.
8591
LDIR ED B0
Copy Do and a space from Register Pair HL to Register Pair DE (8E3DH), the count in Register Pair BC.
8593
LD HL,8E3DH 21 3D 8E
Point Register Pair HL to 8E3DH, the command line Do name:d.
8596
JUMP to 857AH to run the command line at Register Pair HL through CMNDI@.
8598
LD HL,8CCAH 21 CA 8C
Point Register Pair HL to 8CCAH, the question Clear (Zero!) file????.
859B
GOSUB to 88E7H to sound the warning tone through port FFH.
859E
GOSUB to 88E7H to sound the warning tone through port FFH a second time.
85A1
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
85A4
CP 59H FE 59
Compare Register A against 59H, the letter Y.
85A6
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
85A9
LD HL,8CCAH 21 CA 8C
Point Register Pair HL to 8CCAH, the question Clear (Zero!) file????, whose first six characters are the command.
85AC
LD DE,8E3AH 11 3A 8E
Point Register Pair DE to 8E3AH, six places before the name at 8E40H.
85AF
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the six characters of Clear and the space.
85B2
LDIR ED B0
Copy Clear and a space from Register Pair HL to Register Pair DE (8E3AH), the count in Register Pair BC.
85B4
LD HL,8E3AH 21 3A 8E
Point Register Pair HL to 8E3AH, the command line Clear name:d.
85B7
GOSUB to 88BFH to show the command line at Register Pair HL and run it through CMNDI@.
85BA
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
85BD
INC HL 23
INCrement Register Pair HL to the place after the second cursor.
85BE
LD (HL),5AH 36 5A
Store 5AH, the letter Z, at Register Pair HL: the file is marked zeroed.
85C0
JUMP to 884CH to wait for the keys to be let go and show the cursors again.

85C3H - F and M - FREE and DISKDUMP

F asks for a drive and runs FREE :d; M runs DISKDUMP name:d. Both save the screen, run the command on a cleared screen (86AAH) and ask for BREAK or CLEAR (the DOS) or another key (the directory again).

85C3
GOSUB to 89AFH to clear the command line, the last line of the screen.
85C6
LD HL,8E17H 21 17 8E
Point Register Pair HL to 8E17H, the prompt Free space map of.
85C9
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
85CC
GOSUB to 89CBH to ask which drive (d)?: Register A returns the drive, Register C its second character, 80H to cancel.
85CF
CP 80H FE 80
Compare Register A against 80H, the answer of a cancelled question.
85D1
If the Z FLAG is set (cancelled), JUMP to 883CH to show the title and the cursors again.
85D4
LD (8E2FH),A 32 2F 8E
Store Register A, the drive's character, into 8E2FH, the drive of the command FREE :d.
85D7
LD A,C 79
Load Register A with Register C, the second character of the answer, or 0DH.
85D8
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return of an answer of one character.
85DA
If the NZ FLAG is set (a second character), JUMP to 85DEH to keep it.
85DC
LD A,00H 3E 00
Load Register A with 00H, which the copy at 88C9H leaves out of a command line.
85DE
LD (8E30H),A 32 30 8E
Store Register A, the second character or 00H, into 8E30H, after the drive of FREE :d.
85E1
LD HL,8E29H 21 29 8E
Point Register Pair HL to 8E29H, the command line FREE :d.
85E4
PUSH HL E5
Save Register Pair HL, the command line, to the top of the stack for 86AAH.
85E5
JUMP to 86AAH to run the command line on a cleared screen and then ask for a key.
85E8
LD HL,8DABH 21 AB 8D
Point Register Pair HL to 8DABH, the question Diskdump file?.
85EB
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
85EE
CP 59H FE 59
Compare Register A against 59H, the letter Y.
85F0
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
85F3
LD HL,8DABH 21 AB 8D
Point Register Pair HL to 8DABH, the question Diskdump file?, whose first nine characters are the command.
85F6
LD DE,8E37H 11 37 8E
Point Register Pair DE to 8E37H, nine places before the name at 8E40H.
85F9
LD BC,0009H 01 09 00
Load Register Pair BC with 0009H, the nine characters of Diskdump and the space.
85FC
LDIR ED B0
Copy Diskdump and a space from Register Pair HL to Register Pair DE (8E37H), the count in Register Pair BC.
85FE
LD HL,8E37H 21 37 8E
Point Register Pair HL to 8E37H, the command line Diskdump name:d.
8601
PUSH HL E5
Save Register Pair HL, the command line, to the top of the stack for 86AAH.
8602
JUMP to 86AAH to run the command line on a cleared screen and then ask for a key.

8605H - P and C - Printing and Copying

P runs List name:d @PR after the warning tone. C asks for a drive other than the listing's (the same drive sounds the high tone) and runs Copy name:d :e,T, marking the file with the drive it went to.

8605
LD HL,8DBBH 21 BB 8D
Point Register Pair HL to 8DBBH, the question Print file? (check printer).
8608
GOSUB to 88E7H to sound the warning tone through port FFH.
860B
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
860E
CP 59H FE 59
Compare Register A against 59H, the letter Y.
8610
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
8613
LD HL,8DD8H 21 D8 8D
Point Register Pair HL to 8DD8H, the text @PR and a carriage return, the printer.
8616
LD DE,(8BEAH) ED 5B EA 8B
Load Register Pair DE with the contents of 8BEAH-8BEBH, the carriage return after the name and drive.
861A
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the space, @PR and the carriage return.
861D
LDIR ED B0
Copy @PR from Register Pair HL to Register Pair DE, after the name, the count in Register Pair BC.
861F
LD HL,8DDDH 21 DD 8D
Point Register Pair HL to 8DDDH, the question List file?, whose first five characters are the command.
8622
LD DE,8E3BH 11 3B 8E
Point Register Pair DE to 8E3BH, five places before the name at 8E40H.
8625
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five characters of List and the space.
8628
LDIR ED B0
Copy List and a space from Register Pair HL to Register Pair DE (8E3BH), the count in Register Pair BC.
862A
LD HL,8E3BH 21 3B 8E
Point Register Pair HL to 8E3BH, the command line List name:d @PR.
862D
GOSUB to 88BFH to show the command line at Register Pair HL and run it through CMNDI@.
8630
JUMP to 884CH to wait for the keys to be let go and show the cursors again.
8633
LD HL,8CF6H 21 F6 8C
Point Register Pair HL to 8CF6H, the question Copy to which drive (.
8636
GOSUB to 8958H to show the name on the command line, the cursor put after it at 3FD8H.
8639
GOSUB to 89CEH to display the question at Register Pair HL and take the drive: 80H to cancel.
863C
CP 80H FE 80
Compare Register A against 80H, the answer of a cancelled question.
863E
If the Z FLAG is set (cancelled), JUMP to 883CH to show the title and the cursors again.
8641
LD (8BE4H),A 32 E4 8B
Store Register A, the drive to copy to, into 8BE4H.
8644
LD A,(8BE8H) 3A E8 8B
Load Register A with the drive's character from 8BE8H, the drive of the listing.
8647
LD B,A 47
Load Register B with Register A, the drive of the listing.
8648
LD A,(8BE4H) 3A E4 8B
Load Register A with the drive to copy to from 8BE4H.
864B
CP B B8
Compare Register A against Register B: the Z FLAG when it is the drive of the listing.
864C
If the NZ FLAG is set (another drive), JUMP to 8655H to copy the file.
864E
LD A,(8BE9H) 3A E9 8B
Load Register A with the second place of the drive from 8BE9H.
8651
CP C B9
Compare Register A against Register C, the second character of the drive to copy to.
8652
If the Z FLAG is set (the same drive), JUMP to 8849H to sound the high tone: no copy to itself.
8655
LD HL,8CF6H 21 F6 8C
Point Register Pair HL to 8CF6H, the question Copy to which drive (, whose first five characters are the command.
8658
LD DE,8E3BH 11 3B 8E
Point Register Pair DE to 8E3BH, five places before the name at 8E40H.
865B
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five characters of Copy and the space.
865E
LDIR ED B0
Copy Copy and a space from Register Pair HL to Register Pair DE (8E3BH), the count in Register Pair BC.
8660
LD HL,(8BEAH) 2A EA 8B
Load Register Pair HL with the contents of 8BEAH-8BEBH, the carriage return after the name and drive.
8663
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL over the carriage return.
8665
INC HL 23
INCrement Register Pair HL to the place of the colon of the drive to copy to.
8666
LD (HL),3AH 36 3A
Store 3AH, a colon, at Register Pair HL before the drive to copy to.
8668
INC HL 23
INCrement Register Pair HL to the place of the drive to copy to.
8669
LD A,(8BE4H) 3A E4 8B
Load Register A with the drive to copy to from 8BE4H.
866C
LD (HL),A 77
Store Register A, the drive to copy to, at Register Pair HL.
866D
INC HL 23
INCrement Register Pair HL to the place after the drive.
866E
LD A,(8D0CH) 3A 0C 8D
Load Register A with the second place of the drive from 8D0CH, 00H for none.
8671
CP 0DH FE 0D
Compare Register A against 0DH; 89CBH stores 00H in its place, so the byte is always put in.
8673
If the Z FLAG is set (a carriage return), JUMP to 8677H to leave it out.
8675
LD (HL),A 77
Store Register A, the second place of the drive, at Register Pair HL; 00H is left out by 88C9H.
8676
INC HL 23
INCrement Register Pair HL to the place after the drive.
8677
LD (HL),2CH 36 2C
Store 2CH, a comma, at Register Pair HL before the parameter T.
8679
INC HL 23
INCrement Register Pair HL to the place of the parameter.
867A
LD (HL),54H 36 54
Store 54H, the letter T, at Register Pair HL, the parameter of the COPY command.
867C
INC HL 23
INCrement Register Pair HL to the place after the parameter.
867D
LD (HL),0DH 36 0D
Store 0DH at Register Pair HL, the carriage return that ends the command line.
867F
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
8682
INC HL 23
INCrement Register Pair HL to the place after the second cursor.
8683
LD A,(8BE4H) 3A E4 8B
Load Register A with the drive copied to from 8BE4H.
8686
LD (HL),A 77
Store Register A, the drive, at Register Pair HL: the file is marked with the drive it went to.
8687
LD HL,8E3BH 21 3B 8E
Point Register Pair HL to 8E3BH, the command line Copy name:d :e,T.
868A
GOSUB to 88BFH to show the command line at Register Pair HL and run it through CMNDI@.
868D
JUMP to 8844H to sound the low tone and show the cursors again.

8690H - L - Listing the File

List name:d on a cleared screen (86AAH), then BREAK or CLEAR for the DOS, any other key for the directory.

8690
LD HL,8DDDH 21 DD 8D
Point Register Pair HL to 8DDDH, the question List file?.
8693
GOSUB to 896AH to ask the question at Register Pair HL: Register A returns the key, Y for yes.
8696
CP 59H FE 59
Compare Register A against 59H, the letter Y.
8698
If the NZ FLAG is set (not Y), JUMP to 883CH to show the title and the cursors again.
869B
LD HL,8DDDH 21 DD 8D
Point Register Pair HL to 8DDDH, the question List file?, whose first five characters are the command.
869E
LD DE,8E3BH 11 3B 8E
Point Register Pair DE to 8E3BH, five places before the name at 8E40H.
86A1
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five characters of List and the space.
86A4
LDIR ED B0
Copy List and a space from Register Pair HL to Register Pair DE (8E3BH), the count in Register Pair BC.
86A6
LD HL,8E3BH 21 3B 8E
Point Register Pair HL to 8E3BH, the command line List name:d.
86A9
PUSH HL E5
Save Register Pair HL, the command line, to the top of the stack for 86AAH.

86AAH - Running a Command on a Cleared Screen

The command line on the stack is shown at the top of a cleared screen and run through CMNDI@ (88C9H). Then the question Press <BREAK or CLEAR> for Dos: BREAK or CLEAR ends CODIR, any other key brings the screen of the buffer back with the title and a pause.

86AA
GOSUB to 8B8CH to save the screen into the buffer, so it can be shown again afterward.
86AD
GOSUB to 89C0H to clear the screen through the ROM's 01C9H and switch the cursor off.
86B0
POP HL E1
Restore Register Pair HL from the top of the stack: the command line to run.
86B1
PUSH HL E5
Save Register Pair HL, the command line, to the top of the stack again.
86B2
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the command line at Register Pair HL.
86B5
POP HL E1
Restore Register Pair HL from the top of the stack: the command line to run.
86B6
GOSUB to 88C9H to run the command line at Register Pair HL through CMNDI@.
86B9
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return after what the command showed.
86BB
GOSUB to 89A9H to display Register A, the carriage return, through the ROM's 0033H.
86BE
LD HL,8D11H 21 11 8D
Point Register Pair HL to 8D11H, the question Press <BREAK or CLEAR> for Dos, any other key for CO-DIR :.
86C1
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
86C4
GOSUB to 8A50H to wait for a key with a blinking block at the cursor: Register A returns the key.
86C7
CP 01H FE 01
Compare Register A against 01H, the code of the BREAK key.
86C9
If the Z FLAG is set (BREAK), JUMP to 814FH to leave CODIR.
86CC
CP 1FH FE 1F
Compare Register A against 1FH, the code of the CLEAR key.
86CE
If the Z FLAG is set (CLEAR), JUMP to 814FH to leave CODIR.
86D1
GOSUB to 89C0H to clear the screen through the ROM's 01C9H and switch the cursor off.
86D4
LD HL,(8B9BH) 2A 9B 8B
Load Register Pair HL with the contents of 8B9BH-8B9CH, the start of the screen shown in the buffer.
86D7
GOSUB to 8B7FH to copy the screen of the buffer at Register Pair HL to the video memory 3C00H.
86DA
LD HL,8BF4H 21 F4 8B
Point Register Pair HL to 8BF4H, the title line CO-DIR 2.1 - Cursor Oriented DIR..
86DD
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
86E0
LD C,00H 0E 00
Load Register C with 00H, 256 rounds of the pause below.
86E2
GOSUB to 8A48H to wait for Register C (00H, 256) times 256 turns of a loop.
86E5
JUMP to 884CH to wait for the keys to be let go and show the cursors again.

86E8H - R - Renaming the File

Rename to : takes up to 12 characters (86FBH), puts the new name over the old one on the screen and runs Rename name:d newname, marking the file with R.

86E8
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
86EB
LD (HL),8FH 36 8F
Store 8FH, a graphic block, at Register Pair HL next to the file while the new name is typed.
86ED
LD HL,8D69H 21 69 8D
Point Register Pair HL to 8D69H, the prompt Rename to : and the left border 85H.
86F0
GOSUB to 8958H to show the name on the command line, the cursor put after it at 3FD8H.
86F3
GOSUB to 8997H to display the prompt at Register Pair HL at the cursor.
86F6
LD A,8AH 3E 8A
Load Register A with 8AH, a graphic character, the right border of the field.
86F8
LD (3FF1H),A 32 F1 3F
Store Register A (8AH) at 3FF1H, 12 places after the start of the field.

86FBH - The Line Input

Takes characters into the field on the command line between the border 85H before it and 8AH after it: the backspace (08H) takes one back, a code below 1FH other than ENTER sounds the high tone, BREAK, CLEAR and SHIFT with the left arrow (18H) cancel. ENTER puts the field, upper case, after a space at 8BEAH (8BCAH for the search, a period before a password), and for the rename onto the screen and into the command Rename.

86FB
LD A,0EH 3E 0E
Load Register A with 0EH, the code that switches the cursor on.
86FD
GOSUB to 89A9H to display Register A (0EH) through the ROM's 0033H: the cursor is shown.
8700
GOSUB to 8A50H to wait for a key with a blinking block at the cursor: Register A returns the key.
8703
PUSH AF F5
Save Register Pair AF, the key in Register A, to the top of the stack.
8704
LD A,0FH 3E 0F
Load Register A with 0FH, the code that switches the cursor off.
8706
GOSUB to 89A9H to display Register A (0FH) through the ROM's 0033H: the cursor is hidden.
8709
POP AF F1
Restore Register Pair AF, the key in Register A, from the top of the stack.
870A
CP 01H FE 01
Compare Register A against 01H, the code of the BREAK key.
870C
If the Z FLAG is set (BREAK), JUMP to 87E7H to cancel the input.
870F
CP 1FH FE 1F
Compare Register A against 1FH, the code of the CLEAR key.
8711
If the Z FLAG is set (CLEAR), JUMP to 87E7H to cancel the input.
8714
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key.
8716
If the Z FLAG is set (ENTER), JUMP to 875BH to take the text of the field.
8718
CP 1FH FE 1F
Compare Register A against 1FH: the NC FLAG for a character from 20H on.
871A
If the NC FLAG is set (a character), JUMP to 8743H to put it into the field.
871C
CP 18H FE 18
Compare Register A against 18H, the code of SHIFT with the left arrow.
871E
If the Z FLAG is set (SHIFT and the left arrow), JUMP to 87E7H to cancel the input.
8721
CP 08H FE 08
Compare Register A against 08H, the code of the backspace, the left arrow.
8723
If the Z FLAG is set (the backspace), JUMP to 872AH to take a character back.
8725
GOSUB to 88F7H to sound the high tone through port FFH: the key is not taken.
8728
JUMP to 86FBH for the next key of the line input.
872A
LD (8BE4H),A 32 E4 8B
Store Register A, the backspace, into 8BE4H while the place before the cursor is tested.
872D
LD HL,(4020H) 2A 20 40
Load Register Pair HL with the contents of 4020H-4021H, the cursor of the display.
8730
DEC HL 2B
DECrement Register Pair HL to the place before the cursor.
8731
LD A,(HL) 7E
Load Register A with the character before the cursor at Register Pair HL.
8732
PUSH AF F5
Save Register Pair AF, the character before the cursor, to the top of the stack.
8733
INC HL 23
INCrement Register Pair HL back to the cursor.
8734
POP AF F1
Restore Register Pair AF, the character before the cursor, from the top of the stack.
8735
CP 85H FE 85
Compare Register A against 85H, the left border of the field.
8737
If the NZ FLAG is set (a character of the field), JUMP to 873EH to take it back.
8739
GOSUB to 88F7H to sound the high tone through port FFH: the field is empty.
873C
JUMP to 86FBH for the next key of the line input.
873E
LD A,(8BE4H) 3A E4 8B
Load Register A with the backspace from 8BE4H.
8741
JUMP to 8756H to display the backspace and take the last character off the field.
8743
LD HL,(4020H) 2A 20 40
Load Register Pair HL with the contents of 4020H-4021H, the cursor of the display.
8746
LD (8BE4H),A 32 E4 8B
Store Register A, the character typed, into 8BE4H while the cursor's place is tested.
8749
LD A,(HL) 7E
Load Register A with the character at the cursor at Register Pair HL.
874A
CP 8AH FE 8A
Compare Register A against 8AH, the right border of the field.
874C
If the NZ FLAG is set (room in the field), JUMP to 8753H to show the character.
874E
GOSUB to 88F7H to sound the high tone through port FFH: the field is full.
8751
JUMP to 86FBH for the next key of the line input.
8753
LD A,(8BE4H) 3A E4 8B
Load Register A with the character typed from 8BE4H.
8756
GOSUB to 89A9H to display Register A, the character or the backspace, through the ROM's 0033H.
8759
JUMP to 86FBH for the next key of the line input.
875B
LD HL,3FE5H 21 E5 3F
Point Register Pair HL to 3FE5H, the field of the password and of the rename.
875E
LD A,(8BEFH) 3A EF 8B
Load Register A with the mode of the line input from 8BEFH.
8761
CP 79H FE 79
Compare Register A against 79H, the mode of the search.
8763
If the NZ FLAG is set (not the search), JUMP to 8768H with the field at 3FE5H.
8765
LD HL,3FCDH 21 CD 3F
Point Register Pair HL to 3FCDH, the field of the search.
8768
LD A,(HL) 7E
Load Register A with the first character of the field at Register Pair HL.
8769
CP 20H FE 20
Compare Register A against 20H, a space: nothing was typed.
876B
If the Z FLAG is set (an empty field), JUMP to 87E7H: the search keeps its last text, the others cancel.
876E
LD DE,(8BEAH) ED 5B EA 8B
Load Register Pair DE with the contents of 8BEAH-8BEBH, where the text of the field is put.
8772
LD A,20H 3E 20
Load Register A with 20H, a space, before the text of the field.
8774
LD (DE),A 12
Store Register A, the space, at Register Pair DE.
8775
INC DE 13
INCrement Register Pair DE to the place of the text.
8776
LD B,0CH 06 0C
Load Register B with 0CH, the 12 characters of the field at most.
8778
LD A,(HL) 7E
Load Register A with the character of the field at Register Pair HL.
8779
CP 8AH FE 8A
Compare Register A against 8AH, the right border of the field.
877B
If the Z FLAG is set (the border), JUMP to 8793H to end the text.
877D
CP 20H FE 20
Compare Register A against 20H: the C FLAG for a character held below 20H in the video memory.
877F
If the NC FLAG is set (20H or above), JUMP to 8783H to keep the character.
8781
ADD A,40H C6 40
ADD 40H to Register A: the video memory's code below 20H becomes its letter.
8783
CP 60H FE 60
Compare Register A against 60H: the M FLAG for a character below the lower case letters.
8785
If the M FLAG is set (below 60H), JUMP to 878AH to keep the character as it is.
8788
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): a lower case letter becomes upper case.
878A
LD (DE),A 12
Store Register A, the character, at Register Pair DE.
878B
CP 20H FE 20
Compare Register A against 20H, a space, the end of the text in the field.
878D
If the Z FLAG is set (the end), JUMP to 8793H to end the text.
878F
INC HL 23
INCrement Register Pair HL to the next character of the field.
8790
INC DE 13
INCrement Register Pair DE to the next place of the text.
8791
DECrement Register B and loop back to 8778H for the next character of the field.
8793
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the text.
8795
LD (DE),A 12
Store Register A (0DH) at Register Pair DE after the text.
8796
LD A,(8BEFH) 3A EF 8B
Load Register A with the mode of the line input from 8BEFH.
8799
CP 79H FE 79
Compare Register A against 79H, the mode of the search.
879B
If the Z FLAG is set (the search), JUMP to 87A1H to end the input.
879D
CP 80H FE 80
Compare Register A against 80H, the mode of a password.
879F
If the NZ FLAG is set (the rename), JUMP to 87B2H to rename the file.
87A1
LD HL,(8BEAH) 2A EA 8B
Load Register Pair HL with the contents of 8BEAH-8BEBH, the space before the text.
87A4
LD (HL),2EH 36 2E
Store 2EH, a period, at Register Pair HL: the password follows the name after a period.
87A6
PUSH DE D5
Save Register Pair DE, the carriage return after the text, to the top of the stack.
87A7
POP HL E1
Restore Register Pair HL from the top of the stack: the carriage return (from Register Pair DE).
87A8
LD (8BEAH),DE ED 53 EA 8B
Store Register Pair DE, the carriage return after the text, into 8BEAH-8BEBH.
87AC
LD A,00H 3E 00
Load Register A with 00H, the mode of the line input: none.
87AE
LD (8BEFH),A 32 EF 8B
Store Register A (00H) into 8BEFH, the mode of the line input.
87B1
RET C9
RETurn to the caller, the search or the password, with the text after 8BEAH.
87B2
LD HL,(8BEAH) 2A EA 8B
Load Register Pair HL with the contents of 8BEAH-8BEBH, the space before the new name.
87B5
INC HL 23
INCrement Register Pair HL to the first character of the new name.
87B6
LD DE,(8BE0H) ED 5B E0 8B
Load Register Pair DE with the contents of 8BE0H-8BE1H, the video address of the cursor, the old name.
87BA
LD B,0CH 06 0C
Load Register B with 0CH, the 12 places of the name on the screen.
87BC
LD A,(HL) 7E
Load Register A with the next character of the new name at Register Pair HL.
87BD
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of the new name.
87BF
If the NZ FLAG is set (a character), JUMP to 87C9H to put it on the screen.
87C1
LD A,20H 3E 20
Load Register A with 20H, a space, for the places after the new name.
87C3
LD (DE),A 12
Store Register A, the space, at Register Pair DE on the screen.
87C4
INC DE 13
INCrement Register Pair DE to the next place of the name on the screen.
87C5
DECrement Register B and loop back to 87C3H until the 12 places are filled.
87C7
JUMP to 87CEH to build the command Rename with the new name.
87C9
LD (DE),A 12
Store Register A, the character of the new name, at Register Pair DE on the screen.
87CA
INC HL 23
INCrement Register Pair HL to the next character of the new name.
87CB
INC DE 13
INCrement Register Pair DE to the next place of the name on the screen.
87CC
DECrement Register B and loop back to 87BCH for the next character of the new name.
87CE
LD HL,8D69H 21 69 8D
Point Register Pair HL to 8D69H, the prompt Rename to :, whose first seven characters are the command.
87D1
LD DE,8E39H 11 39 8E
Point Register Pair DE to 8E39H, seven places before the name at 8E40H.
87D4
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the seven characters of Rename and the space.
87D7
LDIR ED B0
Copy Rename and a space from Register Pair HL to Register Pair DE (8E39H), the count in Register Pair BC.
87D9
LD HL,8E39H 21 39 8E
Point Register Pair HL to 8E39H, the command line Rename name:d newname.
87DC
GOSUB to 88BFH to show the command line at Register Pair HL and run it through CMNDI@.
87DF
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
87E2
INC HL 23
INCrement Register Pair HL to the place after the second cursor.
87E3
LD (HL),52H 36 52
Store 52H, the letter R, at Register Pair HL: the file is marked renamed.
87E5
JUMP to 87F4H to put the mark next to the file back.
87E7
CP 20H FE 20
Compare Register A against 20H, the space of an empty field.
87E9
If the NZ FLAG is set (BREAK, CLEAR or SHIFT and the left arrow), JUMP to 87F1H to cancel.
87EB
LD A,(8BEFH) 3A EF 8B
Load Register A with the mode of the line input from 8BEFH.
87EE
CP 79H FE 79
Compare Register A against 79H, the mode of the search.
87F0
RET Z C8
RETurn to the search if the Z FLAG is set: ENTER alone searches for the last text again.
87F1
GOSUB to 89AFH to clear the command line, the last line of the screen.
87F4
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place 12 characters after the cursor.
87F7
LD A,(8BECH) 3A EC 8B
Load Register A with the character kept from that place at 8BECH.
87FA
LD (HL),A 77
Store Register A, the character, at Register Pair HL: the second cursor's place as it was.
87FB
JUMP to 884CH to wait for the keys to be let go and show the cursors again.

87FEH - ENTER - Running the File

A file with the extension CMD, or any file while the space bar is held, is run as a program: its name is the command line. Any other file is run as BASIC name:d -F:03. The screen is cleared, the command line shown and given to CMNDI@ (4405H), so CODIR ends.

87FE
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8801
AND 80H E6 80
Keep only bit 7 of Register A (AND 80H), the space bar.
8803
CP 80H FE 80
Compare Register A against 80H: the Z FLAG when the space bar is held down.
8805
If the Z FLAG is set (the space bar), JUMP to 8812H to run the file as a program.
8807
LD HL,8E40H 21 40 8E
Point Register Pair HL to 8E40H, the name of the file and its drive.
880A
LD DE,8BDCH 11 DC 8B
Point Register Pair DE to 8BDCH, the byte before the extension CMD.
880D
GOSUB to 8A78H to compare the extension of the name at Register Pair HL with CMD: the Z FLAG for CMD.
8810
If the NZ FLAG is set (not CMD), JUMP to 8817H to run the file through BASIC.
8812
LD HL,8E40H 21 40 8E
Point Register Pair HL to 8E40H, the name of the file, the command line of a program.
8815
JUMP to 8831H to run the command line at Register Pair HL through CMNDI@.
8817
LD DE,(8BEAH) ED 5B EA 8B
Load Register Pair DE with the contents of 8BEAH-8BEBH, the carriage return after the name and drive.
881B
LD HL,8D77H 21 77 8D
Point Register Pair HL to 8D77H, the text -F:03 and a carriage return, the three files of BASIC.
881E
LD BC,0007H 01 07 00
Load Register Pair BC with 0007H, the space, -F:03 and the carriage return.
8821
LDIR ED B0
Copy -F:03 from Register Pair HL to Register Pair DE, after the name, the count in Register Pair BC.
8823
LD HL,8E32H 21 32 8E
Point Register Pair HL to 8E32H, the word BASIC.
8826
LD DE,8E3AH 11 3A 8E
Point Register Pair DE to 8E3AH, six places before the name at 8E40H.
8829
LD BC,0005H 01 05 00
Load Register Pair BC with 0005H, the five letters of BASIC; the space after them is at 8E3FH.
882C
LDIR ED B0
Copy BASIC from Register Pair HL to Register Pair DE (8E3AH), the count in Register Pair BC.
882E
LD HL,8E3AH 21 3A 8E
Point Register Pair HL to 8E3AH, the command line BASIC name:d -F:03.
8831
GOSUB to 89C0H to clear the screen through the ROM's 01C9H and switch the cursor off.
8834
PUSH HL E5
Save Register Pair HL, the command line, to the top of the stack.
8835
GOSUB to 4467H, DSPLY@ in SYS0/SYS, to display the command line at Register Pair HL.
8838
POP HL E1
Restore Register Pair HL, the command line, from the top of the stack.
8839
JUMP to 4405H, CMNDI@ in SYS0/SYS, to run the command line at Register Pair HL: CODIR ends.

883CH - Back to the Cursors

883CH shows the title on the command line, 8844H sounds the low tone, 8849H the high tone; then 884CH waits until no key but an arrow or the space bar is held and shows the cursors again (8159H).

883C
LD HL,8BF4H 21 F4 8B
Point Register Pair HL to 8BF4H, the title line CO-DIR 2.1 - Cursor Oriented DIR..
883F
GOSUB to 8992H to display the text at Register Pair HL on the command line, the last line of the screen.
8842
JUMP to 884CH to wait for the keys to be let go and show the cursors again.
8844
GOSUB to 88EFH to sound the low tone through port FFH: the command is done.
8847
JUMP to 884CH to wait for the keys to be let go and show the cursors again.
8849
GOSUB to 88F7H to sound the high tone through port FFH: the command is refused.
884C
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
884F
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no key of the row at 3840H is held down.
8851
If the Z FLAG is set (no key held), JUMP to 8857H to show the cursors.
8853
CP 08H FE 08
Compare Register A against 08H: the C FLAG while only ENTER, CLEAR or BREAK is held.
8855
If the C FLAG is set (ENTER, CLEAR or BREAK held), JUMP to 884CH to wait until it is let go.
8857
JUMP to 8159H to show the cursors again and take the next key.

885AH - CODIR's ABORT@

While CAT runs, ABORT@ (4030H) jumps here (805DH): ABORT@ is set back, the display hook is taken out, the high tone sounds and CODIR returns to the DOS through EXIT@.

885A
GOSUB to 8866H to point ABORT@ (4031H) back at the address it had before CODIR.
885D
GOSUB to 8B38H to take CODIR's hook out of the display driver.
8860
GOSUB to 88F7H to sound the high tone through port FFH.
8863
JUMP to 402DH, EXIT@, back to the DOS after the CAT was stopped.
8866
LD HL,(8BE2H) 2A E2 8B
Load Register Pair HL with the contents of 8BE2H-8BE3H, the address ABORT@ had before CODIR.
8869
LD (4031H),HL 22 31 40
Store Register Pair HL into 4031H-4032H, the operand of ABORT@'s jump at 4030H.
886C
RET C9
RETurn to the caller with ABORT@ jumping where it did before CODIR.

886DH - A Decimal Number and k

Displays Register Pair HL as a decimal number by the powers of ten at 8BA0H, with no zeros before the first digit (8BC8H counts the digits shown), then the letter k; with no digit shown, < before the k.

886D
PUSH IX DD E5
Save Index Register IX to the top of the stack, kept for the caller.
886F
LD A,00H 3E 00
Load Register A with 00H, no digit shown yet.
8871
LD (8BC8H),A 32 C8 8B
Store Register A (00H) into 8BC8H, the flag of a digit shown.
8874
LD IX,8BA0H DD 21 A0 8B
Load Index Register IX with 8BA0H, the table of the powers of ten from 10000 down to 1.
8878
XOR A AF
Set Register A to 00H (XOR A), the digit counted up for this power of ten.
8879
LD B,(IX+01H) DD 46 01
Load Register B with the high byte of the power of ten at Index Register IX+01H.
887C
LD C,(IX+00H) DD 4E 00
Load Register C with the low byte of the power of ten at Index Register IX+00H.
887F
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
8880
SBC HL,BC ED 42
SUBtract Register Pair BC, the power of ten, from Register Pair HL with the carry.
8882
If the C FLAG is set (it went below 0), JUMP to 8887H: the digit is counted.
8884
INC A 3C
INCrement Register A, the digit, for the power of ten taken off.
8885
JUMP to 8880H to take the power of ten off again; the C FLAG is clear.
8887
ADD HL,BC 09
ADD Register Pair BC, the power of ten taken off once too often, back to Register Pair HL.
8888
ADD A,30H C6 30
ADD 30H to Register A: the character of the digit, 0-9.
888A
CP 30H FE 30
Compare Register A against 30H, the digit 0, which may be left out.
888C
If the NZ FLAG is set (not 0), JUMP to 889AH to display the digit.
888E
PUSH AF F5
Save Register Pair AF, the digit 0, to the top of the stack.
888F
LD A,(8BC8H) 3A C8 8B
Load Register A with the flag of a digit shown from 8BC8H.
8892
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no digit has been shown yet.
8894
If the NZ FLAG is set (digits shown), JUMP to 8899H to display the 0.
8896
POP AF F1
Restore Register Pair AF, the digit 0, from the top of the stack; it is not shown.
8897
JUMP to 88A0H for the next power of ten, the 0 before the number left out.
8899
POP AF F1
Restore Register Pair AF, the digit 0, from the top of the stack.
889A
GOSUB to 89A9H to display Register A, the digit, through the ROM's 0033H.
889D
LD (8BC8H),A 32 C8 8B
Store Register A, the digit, into 8BC8H: a digit has been shown.
88A0
LD A,C 79
Load Register A with Register C, the low byte of the power of ten.
88A1
CP 01H FE 01
Compare Register A against 01H, the low byte of the power 1, the last one.
88A3
If the Z FLAG is set (the last power), JUMP to 88ABH to end the number.
88A5
INC IX DD 23
INCrement Index Register IX to the high byte of the power of ten.
88A7
INC IX DD 23
INCrement Index Register IX to the next power of ten in the table.
88A9
JUMP to 8878H for the digit of the next power of ten.
88AB
LD A,(8BC8H) 3A C8 8B
Load Register A with the flag of a digit shown from 8BC8H.
88AE
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no digit was shown, the number was 0.
88B0
If the NZ FLAG is set (digits shown), JUMP to 88B7H to display the k.
88B2
LD A,3CH 3E 3C
Load Register A with 3CH, the less than sign, for a size below one kilobyte.
88B4
GOSUB to 89A9H to display Register A, the less than sign, through the ROM's 0033H.
88B7
LD A,6BH 3E 6B
Load Register A with 6BH, the letter k, for kilobytes.
88B9
GOSUB to 89A9H to display Register A, the letter k, through the ROM's 0033H.
88BC
POP IX DD E1
Restore Index Register IX from the top of the stack, as the caller had it.
88BE
RET C9
RETurn to the caller with the size shown on the command line.

88BFH - Running a Command Line

88BFH shows the command line at Register Pair HL on the command line of the screen first. 88C9H copies up to 64 bytes from Register Pair HL to 8E86H, leaving out every 00H, and runs the copy through CMNDI@; the command returns here and the low tone sounds.

88BF
PUSH HL E5
Save Register Pair HL, the command line, to the top of the stack.
88C0
GOSUB to 8992H to display the command line at Register Pair HL on the command line of the screen.
88C3
LD A,00H 3E 00
Load Register A with 00H, no character, for 8984H, which then only sets the cursor.
88C5
GOSUB to 8984H to put the cursor at 3FC0H, the start of the command line of the screen.
88C8
POP HL E1
Restore Register Pair HL, the command line, from the top of the stack.
88C9
LD DE,8E86H 11 86 8E
Point Register Pair DE to 8E86H, the place where the command line is copied to be run.
88CC
LD B,40H 06 40
Load Register B with 40H, the 64 bytes looked at.
88CE
LD A,(HL) 7E
Load Register A with the next byte of the command line at Register Pair HL.
88CF
CP 00H FE 00
Compare Register A against 00H, a byte left out of the copy.
88D1
If the NZ FLAG is set (not 00H), JUMP to 88D8H to copy the byte.
88D3
INC HL 23
INCrement Register Pair HL past the 00H, which is not copied.
88D4
DECrement Register B and loop back to 88CEH for the next byte of the command line.
88D6
JUMP to 88DDH to run the copy: the 64 bytes are done.
88D8
LD (DE),A 12
Store Register A, the byte of the command line, at Register Pair DE in the copy.
88D9
INC HL 23
INCrement Register Pair HL to the next byte of the command line.
88DA
INC DE 13
INCrement Register Pair DE to the next place of the copy.
88DB
DECrement Register B and loop back to 88CEH for the next byte of the command line.
88DD
LD HL,8E86H 21 86 8E
Point Register Pair HL to 8E86H, the copy of the command line.
88E0
GOSUB to 4405H, CMNDI@ in SYS0/SYS, to run the command line at Register Pair HL; it returns here.
88E3
GOSUB to 88EFH to sound the low tone through port FFH: the command is done.
88E6
RET C9
RETurn to the caller after the command has run.

88E7H - The Tones

Three tones through bit 0 of port FFH, the cassette output: 88E7H the warning (5AH cycles, half period 64H), 88EFH the low tone of a command done (14H cycles, C8H), 88F7H the high tone of an error (50H cycles, 0FH). The half period is put into the operand 8901H of the LD B at 8900H. Register Pair AF and Register Pair BC are kept.

88E7
PUSH BC C5
Save Register Pair BC to the top of the stack, kept for the caller.
88E8
PUSH AF F5
Save Register Pair AF to the top of the stack, kept for the caller.
88E9
LD C,5AH 0E 5A
Load Register C with 5AH, the 90 cycles of the warning tone.
88EB
LD A,64H 3E 64
Load Register A with 64H, the half period of the warning tone.
88ED
JUMP to 88FDH to sound the tone of Register C cycles with the half period in Register A.
88EF
PUSH BC C5
Save Register Pair BC to the top of the stack, kept for the caller.
88F0
PUSH AF F5
Save Register Pair AF to the top of the stack, kept for the caller.
88F1
LD C,14H 0E 14
Load Register C with 14H, the 20 cycles of the low tone.
88F3
LD A,C8H 3E C8
Load Register A with C8H, the half period of the low tone, the longest of the three.
88F5
JUMP to 88FDH to sound the tone of Register C cycles with the half period in Register A.
88F7
PUSH BC C5
Save Register Pair BC to the top of the stack, kept for the caller.
88F8
PUSH AF F5
Save Register Pair AF to the top of the stack, kept for the caller.
88F9
LD C,50H 0E 50
Load Register C with 50H, the 80 cycles of the high tone.
88FB
LD A,0FH 3E 0F
Load Register A with 0FH, the half period of the high tone, the shortest of the three.
88FD
LD (8901H),A 32 01 89
Store Register A, the half period, into 8901H, the operand of the LD B at 8900H.
8900
LD B,14H 06 14
Load Register B with 14H; the operand 8901H holds the half period stored by 88FDH.
8902
LD A,01H 3E 01
Load Register A with 01H, bit 0 set, the cassette output high.
8904
OUT (FFH),A D3 FF
Send Register A (01H) to port FFH, the cassette output.
8906
DECrement Register B and loop to 8906H, itself: the first half of the cycle.
8908
LD A,(8901H) 3A 01 89
Load Register A with the half period from 8901H.
890B
LD B,A 47
Load Register B with Register A, the half period, for the second half of the cycle.
890C
LD A,00H 3E 00
Load Register A with 00H, bit 0 clear, the cassette output low.
890E
OUT (FFH),A D3 FF
Send Register A (00H) to port FFH, the cassette output.
8910
DECrement Register B and loop to 8910H, itself: the second half of the cycle.
8912
DEC C 0D
DECrement Register C, the cycles of the tone left.
8913
If the NZ FLAG is set (cycles left), JUMP to 8900H for the next cycle.
8915
POP AF F1
Restore Register Pair AF from the top of the stack, as the caller had it.
8916
POP BC C1
Restore Register Pair BC from the top of the stack, as the caller had it.
8917
RET C9
RETurn to the caller after the tone, the registers as they were.

8918H - The Places of the Cursors

8918H puts back the characters under the two cursors and returns the cursor's address; 8927H steps Register Pair HL 12 places on and keeps the character there at 8BECH; 8930H gives the Z FLAG while the space bar is held; 8938H gives the Z FLAG (Register A 80H) for a place to pass over: nothing at the cursor, or an asterisk 12 places on, unless the space bar is held; 8945H tests only the asterisk.

8918
LD A,(8BE7H) 3A E7 8B
Load Register A with the character kept from under the cursor at 8BE7H.
891B
LD (HL),A 77
Store Register A, the character, at Register Pair HL, the cursor's place.
891C
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place of the second cursor.
891F
LD A,(8BECH) 3A EC 8B
Load Register A with the character kept from under the second cursor at 8BECH.
8922
LD (HL),A 77
Store Register A, the character, at Register Pair HL, the second cursor's place.
8923
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
8926
RET C9
RETurn to the caller with the characters under the cursors put back.
8927
LD BC,000CH 01 0C 00
Load Register Pair BC with 000CH, the 12 places from a name to its mark.
892A
ADD HL,BC 09
ADD Register Pair BC (000CH) to Register Pair HL: the place of the file's mark.
892B
LD A,(HL) 7E
Load Register A with the character at the file's mark at Register Pair HL.
892C
LD (8BECH),A 32 EC 8B
Store Register A, the character of the mark, into 8BECH.
892F
RET C9
RETurn to the caller with the place of the mark in Register Pair HL.
8930
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8933
AND 80H E6 80
Keep only bit 7 of Register A (AND 80H), the space bar.
8935
CP 80H FE 80
Compare Register A against 80H: the Z FLAG when the space bar is held down.
8937
RET C9
RETurn to the caller with the Z FLAG when the space bar is held.
8938
LD HL,(8BE0H) 2A E0 8B
Load Register Pair HL with the contents of 8BE0H-8BE1H, the video address of the cursor.
893B
LD A,(HL) 7E
Load Register A with the character at the cursor at Register Pair HL.
893C
CP 20H FE 20
Compare Register A against 20H, a space: nothing at the cursor's place.
893E
If the Z FLAG is set (nothing there), JUMP to 8953H to return the Z FLAG.
8940
GOSUB to 8930H to test the space bar: the Z FLAG when it is held.
8943
If the Z FLAG is set (the space bar), JUMP to 894FH: the cursor may stop on any file.
8945
GOSUB to 8927H to load Register A with the character 12 places on, the file's mark.
8948
LD A,(8BECH) 3A EC 8B
Load Register A with the file's mark from 8BECH.
894B
CP 2AH FE 2A
Compare Register A against 2AH, the asterisk of a killed file.
894D
If the Z FLAG is set (a killed file), JUMP to 8953H to return the Z FLAG.
894F
LD A,00H 3E 00
Load Register A with 00H, the answer for a place the cursor may stop on.
8951
JUMP to 8955H to set the flags by Register A.
8953
LD A,80H 3E 80
Load Register A with 80H, the answer for a place to pass over.
8955
CP 80H FE 80
Compare Register A against 80H: the Z FLAG for a place to pass over.
8957
RET C9
RETurn to the caller with the Z FLAG for a place to pass over.

8958H - The Command Line of the Screen

8958H shows the name at 8E40H on the command line and puts the cursor at 3FD8H after it; 896AH also shows the question at Register Pair HL and takes a key (y becomes Y), shown when printable; 8992H clears the command line and 8997H shows a text up to its 03H or 0DH at the cursor; 89A9H displays Register A through the ROM's 0033H; 89AFH clears the command line (3FC0H); 89C0H clears the screen.

8958
PUSH HL E5
Save Register Pair HL, the question, to the top of the stack.
8959
GOSUB to 89AFH to clear the command line, the last line of the screen.
895C
LD HL,8E40H 21 40 8E
Point Register Pair HL to 8E40H, the name of the file and its drive.
895F
GOSUB to 8992H to display the name at Register Pair HL on the command line.
8962
LD HL,3FD8H 21 D8 3F
Point Register Pair HL to 3FD8H, the 25th place of the command line, after the name.
8965
LD (4020H),HL 22 20 40
Store Register Pair HL (3FD8H) into 4020H-4021H, the cursor of the display.
8968
POP HL E1
Restore Register Pair HL, the question, from the top of the stack.
8969
RET C9
RETurn to the caller with the cursor after the name.
896A
GOSUB to 8958H to show the name on the command line, the cursor put after it at 3FD8H.
896D
GOSUB to 8997H to display the question at Register Pair HL at the cursor.
8970
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place of the second cursor, the file's mark.
8973
LD (HL),8FH 36 8F
Store 8FH, a graphic block, at Register Pair HL next to the file while the key is awaited.
8975
GOSUB to 8A50H to wait for a key with a blinking block at the cursor: Register A returns the key.
8978
PUSH AF F5
Save Register Pair AF, the key in Register A, to the top of the stack.
8979
LD A,(8BECH) 3A EC 8B
Load Register A with the file's mark kept at 8BECH.
897C
LD (HL),A 77
Store Register A, the file's mark, at Register Pair HL as it was.
897D
POP AF F1
Restore Register Pair AF, the key in Register A, from the top of the stack.
897E
CP 79H FE 79
Compare Register A against 79H, the letter y.
8980
If the NZ FLAG is set (not y), JUMP to 8984H with the key as it is.
8982
LD A,59H 3E 59
Load Register A with 59H, the letter Y: y and Y are both yes.
8984
CP 21H FE 21
Compare Register A against 21H: the C FLAG for a key that is not printable.
8986
If the C FLAG is set (not printable), JUMP to 898BH without showing it.
8988
GOSUB to 89A9H to display Register A, the key, through the ROM's 0033H.
898B
LD HL,3FC0H 21 C0 3F
Point Register Pair HL to 3FC0H, the start of the command line of the screen.
898E
LD (4020H),HL 22 20 40
Store Register Pair HL (3FC0H) into 4020H-4021H, the cursor of the display.
8991
RET C9
RETurn to the caller with the key in Register A.
8992
PUSH HL E5
Save Register Pair HL, the text, to the top of the stack.
8993
GOSUB to 89AFH to clear the command line, the last line of the screen.
8996
POP HL E1
Restore Register Pair HL, the text, from the top of the stack.
8997
PUSH HL E5
Save Register Pair HL, the text, to the top of the stack.
8998
LD A,(HL) 7E
Load Register A with the next character of the text at Register Pair HL.
8999
CP 03H FE 03
Compare Register A against 03H, the end of a text.
899B
If the Z FLAG is set (03H), JUMP to 89A7H: the 03H is not shown.
899D
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return at the end of a text.
899F
If the Z FLAG is set (0DH), JUMP to 89A7H: the carriage return is not shown.
89A1
GOSUB to 89A9H to display Register A, the character, through the ROM's 0033H.
89A4
INC HL 23
INCrement Register Pair HL to the next character of the text.
89A5
JUMP to 8998H to display the next character of the text.
89A7
POP HL E1
Restore Register Pair HL, the text, from the top of the stack.
89A8
RET C9
RETurn to the caller with the text shown at the cursor.
89A9
PUSH DE D5
Save Register Pair DE to the top of the stack, which the ROM's display routine changes.
89AA
GOSUB to 0033H, the ROM's display routine, to display the character in Register A.
89AD
POP DE D1
Restore Register Pair DE from the top of the stack, as the caller had it.
89AE
RET C9
RETurn to the caller after the character is displayed.
89AF
LD HL,3FC0H 21 C0 3F
Point Register Pair HL to 3FC0H, the start of the last line of the screen, the command line.
89B2
LD (4020H),HL 22 20 40
Store Register Pair HL (3FC0H) into 4020H-4021H, the cursor of the display.
89B5
LD A,1EH 3E 1E
Load Register A with 1EH, the code that clears from the cursor to the end of the line.
89B7
GOSUB to 89A9H to display Register A (1EH): the command line is cleared.
89BA
LD A,1DH 3E 1D
Load Register A with 1DH, the code that puts the cursor at the start of the line.
89BC
GOSUB to 89A9H to display Register A (1DH): the cursor goes back to 3FC0H.
89BF
RET C9
RETurn to the caller with the command line cleared.
89C0
PUSH AF F5
Save Register Pair AF to the top of the stack, kept for the caller.
89C1
GOSUB to 01C9H, the ROM's routine that clears the screen.
89C4
LD A,0FH 3E 0F
Load Register A with 0FH, the code that switches the cursor off.
89C6
GOSUB to 89A9H to display Register A (0FH): the cursor is hidden.
89C9
POP AF F1
Restore Register Pair AF from the top of the stack, as the caller had it.
89CA
RET C9
RETurn to the caller with the screen cleared.

89CBH - Which Drive

Shows which drive (d)? (8CFDH, the default drive at 8D0BH) and takes one or two characters ended by ENTER, the backspace taking one back: Register A returns the drive, Register C the second character or 00H, and the answer becomes the default. ENTER alone gives the default drive (8BF1H is 80H from 812DH). Any other key, a space too, sounds the high tone and returns 80H, the question cancelled. 89CEH shows the question at Register Pair HL.

89CB
LD HL,8CFDH 21 FD 8C
Point Register Pair HL to 8CFDH, the end of the question Copy to which drive (, the words which drive (.
89CE
GOSUB to 8997H to display the question at Register Pair HL at the cursor, with the default drive.
89D1
LD HL,(8BEDH) 2A ED 8B
Load Register Pair HL with the contents of 8BEDH-8BEEH, the place of the second cursor, the file's mark.
89D4
LD (HL),8FH 36 8F
Store 8FH, a graphic block, at Register Pair HL next to the file while the drive is awaited.
89D6
LD A,00H 3E 00
Load Register A with 00H, the code sent before the first key of the answer.
89D8
GOSUB to 89A9H to display Register A through the ROM's 0033H: 00H, or the backspace from 89FEH.
89DB
GOSUB to 8A50H to wait for a key with a blinking block at the cursor: Register A returns the key.
89DE
CP 21H FE 21
Compare Register A against 21H: the C FLAG for ENTER, the space or another code.
89E0
If the C FLAG is set (not printable), JUMP to 8A27H for ENTER or to cancel.
89E2
CP 60H FE 60
Compare Register A against 60H: the M FLAG for a character below the lower case letters.
89E4
If the M FLAG is set (below 60H), JUMP to 89E9H to keep the character.
89E7
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): a lower case letter becomes upper case.
89E9
LD B,A 47
Load Register B with Register A, the first character of the answer.
89EA
GOSUB to 89A9H to display Register A, the character or the backspace, through the ROM's 0033H.
89ED
GOSUB to 8A50H to wait for a key with a blinking block at the cursor: Register A returns the key.
89F0
CP 60H FE 60
Compare Register A against 60H: the M FLAG for a character below the lower case letters.
89F2
If the M FLAG is set (below 60H), JUMP to 89F7H to keep the character.
89F5
AND 5FH E6 5F
Clear bit 5 of Register A (AND 5FH): a lower case letter becomes upper case.
89F7
LD C,A 4F
Load Register C with Register A, the second key of the answer.
89F8
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key after one character.
89FA
If the Z FLAG is set (ENTER), JUMP to 8A13H to end the answer of one character.
89FC
CP 08H FE 08
Compare Register A against 08H, the backspace, which takes the first character back.
89FE
If the Z FLAG is set (the backspace), JUMP to 89D8H to show it and take the first key again.
8A00
CP 21H FE 21
Compare Register A against 21H: the C FLAG for the space or another code.
8A02
If the C FLAG is set (not printable), JUMP to 8A27H to cancel the question.
8A04
GOSUB to 89A9H to display Register A, the second character, through the ROM's 0033H.
8A07
GOSUB to 8A50H to wait for a key with a blinking block at the cursor: Register A returns the key.
8A0A
CP 08H FE 08
Compare Register A against 08H, the backspace, which takes the second character back.
8A0C
If the Z FLAG is set (the backspace), JUMP to 89EAH to show it and take the second key again.
8A0E
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key after two characters.
8A10
If the NZ FLAG is set (another key), JUMP to 8A27H to cancel the question.
8A12
LD A,C 79
Load Register A with Register C, the second character of the answer.
8A13
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key in place of a second character.
8A15
If the NZ FLAG is set (a second character), JUMP to 8A19H to keep it.
8A17
LD A,00H 3E 00
Load Register A with 00H, no second character.
8A19
LD (8D0CH),A 32 0C 8D
Store Register A, the second character or 00H, into 8D0CH, the second place of the default drive.
8A1C
LD A,B 78
Load Register A with Register B, the first character of the answer, the drive.
8A1D
LD (8D0BH),A 32 0B 8D
Store Register A, the drive, into 8D0BH, the default drive of the prompts.
8A20
PUSH AF F5
Save Register Pair AF, the answer in Register A, to the top of the stack.
8A21
LD A,(8BECH) 3A EC 8B
Load Register A with the file's mark kept at 8BECH.
8A24
LD (HL),A 77
Store Register A, the file's mark, at Register Pair HL as it was.
8A25
POP AF F1
Restore Register Pair AF, the answer in Register A, from the top of the stack.
8A26
RET C9
RETurn to the caller with the drive in Register A and its second character in Register C.
8A27
GOSUB to 8A20H to put back the file's mark at Register Pair HL; Register A is kept.
8A2A
PUSH AF F5
Save Register Pair AF, the key in Register A, to the top of the stack.
8A2B
LD A,(8BF1H) 3A F1 8B
Load Register A with the flag from 8BF1H, 80H when ENTER may take the default drive.
8A2E
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when the flag is clear.
8A30
If the NZ FLAG is set (the flag set), JUMP to 8A35H to test for ENTER.
8A32
POP AF F1
Restore Register Pair AF, the key in Register A, from the top of the stack.
8A33
JUMP to 8A45H to return 80H, the question cancelled.
8A35
POP AF F1
Restore Register Pair AF, the key in Register A, from the top of the stack.
8A36
CP 0DH FE 0D
Compare Register A against 0DH, the ENTER key alone.
8A38
If the NZ FLAG is set (another key), JUMP to 8A42H to cancel with the high tone.
8A3A
LD A,(8D0CH) 3A 0C 8D
Load Register A with the second place of the default drive from 8D0CH.
8A3D
LD C,A 4F
Load Register C with Register A, the second place of the default drive.
8A3E
LD A,(8D0BH) 3A 0B 8D
Load Register A with the default drive from 8D0BH.
8A41
RET C9
RETurn to the caller with the default drive in Register A and Register C.
8A42
GOSUB to 88F7H to sound the high tone through port FFH: the key is not taken.
8A45
LD A,80H 3E 80
Load Register A with 80H, the answer of a cancelled question.
8A47
RET C9
RETurn to the caller with 80H in Register A, the question cancelled.

8A48H - A Pause

Waits Register C times 256 turns of a DJNZ loop (00H in Register C for 256 times).

8A48
LD B,00H 06 00
Load Register B with 00H, the 256 turns of the inner loop.
8A4A
DECrement Register B and loop to 8A4AH, itself, 256 turns.
8A4C
DEC C 0D
DECrement Register C, the rounds of the pause left.
8A4D
If the NZ FLAG is set (rounds left), JUMP to 8A48H for the next round.
8A4F
RET C9
RETurn to the caller after the pause of Register C rounds.

8A50H - A Key with a Blinking Block

Shows a graphic block and a space by turns at the cursor (4020H) while the ROM's 002BH is scanned, 256 scans each (the LD C,3CH has no use), until a key: Register A returns it and the cursor's place is left a space. Register Pair BC, Register Pair DE and Register Pair HL are kept.

8A50
PUSH HL E5
Save Register Pair HL to the top of the stack, kept for the caller.
8A51
PUSH DE D5
Save Register Pair DE to the top of the stack, kept for the caller.
8A52
PUSH BC C5
Save Register Pair BC to the top of the stack, kept for the caller.
8A53
LD HL,(4020H) 2A 20 40
Load Register Pair HL with the contents of 4020H-4021H, the cursor of the display.
8A56
LD C,3CH 0E 3C
Load Register C with 3CH; Register C is not used by the loop below.
8A58
LD (HL),8FH 36 8F
Store 8FH, a graphic block, at Register Pair HL, the cursor's place.
8A5A
GOSUB to 002BH, the ROM's keyboard scan, to load Register A with a key pressed, or 00H.
8A5D
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no key was pressed.
8A5F
If the NZ FLAG is set (a key), JUMP to 8A72H to return it.
8A61
DECrement Register B and loop back to 8A5AH while the block is shown.
8A63
LD C,3CH 0E 3C
Load Register C with 3CH; Register C is not used by the loop below.
8A65
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL, the cursor's place.
8A67
GOSUB to 002BH, the ROM's keyboard scan, to load Register A with a key pressed, or 00H.
8A6A
CP 00H FE 00
Compare Register A against 00H: the Z FLAG when no key was pressed.
8A6C
If the NZ FLAG is set (a key), JUMP to 8A72H to return it.
8A6E
DECrement Register B and loop back to 8A67H while the space is shown.
8A70
JUMP to 8A56H to show the block again at the cursor.
8A72
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL, the cursor's place.
8A74
POP BC C1
Restore Register Pair BC from the top of the stack, as the caller had it.
8A75
POP DE D1
Restore Register Pair DE from the top of the stack, as the caller had it.
8A76
POP HL E1
Restore Register Pair HL from the top of the stack, as the caller had it.
8A77
RET C9
RETurn to the caller with the key in Register A.

8A78H - Comparing a Name

8A78H looks for the slash in the eight characters after Register Pair HL and compares the extension after it with the three characters after Register Pair DE; 8A88H compares Register B characters after Register Pair HL and Register Pair DE. A question mark at Register Pair DE matches any character and a 0DH there ends the comparison: the Z FLAG (Register A 80H) for a match.

8A78
LD B,08H 06 08
Load Register B with 08H, the eight places after the first one where the slash can be.
8A7A
INC HL 23
INCrement Register Pair HL to the next character of the name.
8A7B
LD A,(HL) 7E
Load Register A with the character of the name at Register Pair HL.
8A7C
CP 2FH FE 2F
Compare Register A against 2FH, the slash before the extension.
8A7E
If the Z FLAG is set (the slash), JUMP to 8A86H to compare the extension.
8A80
DECrement Register B and loop back to 8A7AH for the next character of the name.
8A82
LD A,00H 3E 00
Load Register A with 00H, the answer for no match.
8A84
JUMP to 8A9AH to set the flags by Register A.
8A86
LD B,03H 06 03
Load Register B with 03H, the three characters of an extension.
8A88
INC HL 23
INCrement Register Pair HL to the next character of the name.
8A89
INC DE 13
INCrement Register Pair DE to the next character to compare it with.
8A8A
LD A,(DE) 1A
Load Register A with the character to compare with at Register Pair DE.
8A8B
CP 3FH FE 3F
Compare Register A against 3FH, the question mark, which matches any character.
8A8D
If the Z FLAG is set (a question mark), JUMP to 8A96H for the next character.
8A8F
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that ends the characters to compare.
8A91
If the Z FLAG is set (the end), JUMP to 8A98H: the name matches.
8A93
CP (HL) BE
Compare Register A against the character of the name at Register Pair HL.
8A94
If the NZ FLAG is set (they differ), JUMP to 8A82H: no match.
8A96
DECrement Register B and loop back to 8A88H for the next character.
8A98
LD A,80H 3E 80
Load Register A with 80H, the answer for a match.
8A9A
CP 80H FE 80
Compare Register A against 80H: the Z FLAG for a match.
8A9C
RET C9
RETurn to the caller with the Z FLAG when the name matches.

8A9DH - The Buffer and the Display Hook

The mark 8FH goes below the buffer (8FC0H) and after its first screen (93C0H), the first 1024 bytes from 9000H are spaces, the place of the last byte saved (8B9DH) is 8FFCH and the count of a line 44H, so the first line saved ends at 903FH. The display driver's address at 401EH is kept in the CALL at 8AD6H and 8AD6H put in its place.

8A9D
LD HL,8FC0H 21 C0 8F
Point Register Pair HL to 8FC0H, a line below the buffer.
8AA0
LD (HL),8FH 36 8F
Store 8FH, the mark of the start of the buffer, at Register Pair HL (8FC0H).
8AA2
LD A,44H 3E 44
Load Register A with 44H, the count of the first line, which starts three places before 9000H.
8AA4
LD (8B9FH),A 32 9F 8B
Store Register A (44H) into 8B9FH, the places left on the line being saved, plus one.
8AA7
LD HL,9000H 21 00 90
Point Register Pair HL to 9000H, the start of the buffer of the screens.
8AAA
LD (8B9DH),HL 22 9D 8B
Store Register Pair HL (9000H) into 8B9DH-8B9EH, the place of the last byte saved.
8AAD
LD (8B9BH),HL 22 9B 8B
Store Register Pair HL (9000H) into 8B9BH-8B9CH, the start of the screen shown in the buffer.
8AB0
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL (9000H), the first byte of the buffer.
8AB2
LD DE,9001H 11 01 90
Point Register Pair DE to 9001H, the second byte of the buffer.
8AB5
LD BC,03FFH 01 FF 03
Load Register Pair BC with 03FFH, the rest of the first 1024 bytes of the buffer.
8AB8
LDIR ED B0
Copy the space on through the buffer, from Register Pair HL to Register Pair DE, the count in Register Pair BC.
8ABA
LD HL,93C0H 21 C0 93
Point Register Pair HL to 93C0H, the place after the first screen of the buffer.
8ABD
LD (HL),8FH 36 8F
Store 8FH, the mark of the end of the buffer, at Register Pair HL (93C0H).
8ABF
LD HL,8FFCH 21 FC 8F
Point Register Pair HL to 8FFCH, the place before the first byte the hook saves.
8AC2
LD (8B9DH),HL 22 9D 8B
Store Register Pair HL (8FFCH) into 8B9DH-8B9EH, the place of the last byte saved.
8AC5
GOSUB to 8AC9H to put CODIR's hook into the display driver.
8AC8
RET C9
RETurn to the caller with the buffer ready and the hook in place.
8AC9
LD HL,(401EH) 2A 1E 40
Load Register Pair HL with the contents of 401EH-401FH, the driver's address in the display's control block.
8ACC
LD (8AD7H),HL 22 D7 8A
Store Register Pair HL, the display driver's address, into 8AD7H, the operand of the CALL at 8AD6H.
8ACF
LD HL,8AD6H 21 D6 8A
Point Register Pair HL to 8AD6H, CODIR's display hook.
8AD2
LD (401EH),HL 22 1E 40
Store Register Pair HL (8AD6H) into 401EH-401FH: every character displayed goes through 8AD6H.
8AD5
RET C9
RETurn to the caller with the hook in place in the display driver.

8AD6H - The Display Hook

Each character is displayed by the driver (the CALL's operand 8AD7H), a click sent to port FFH, and then saved at 8B9DH on: a 0DH fills the rest of the line of 64 places with spaces and puts the mark 8FH after it. The graphic 85H (shown at 80B2H after CAT), the buffer reaching 8BAAH, or BREAK at the end of a line takes the hook out (8B47H).

8AD6
GOSUB to 0000H, an operand set by 8ACCH to the display driver, to show the character.
8AD9
PUSH AF F5
Save Register Pair AF, the character in Register A, to the top of the stack.
8ADA
LD A,01H 3E 01
Load Register A with 01H, bit 0 set, the cassette output high, the start of a click.
8ADC
OUT (FFH),A D3 FF
Send Register A (01H) to port FFH, the cassette output.
8ADE
LD A,00H 3E 00
Load Register A with 00H, bit 0 clear, the cassette output low, the end of the click.
8AE0
OUT (FFH),A D3 FF
Send Register A (00H) to port FFH, the cassette output.
8AE2
POP AF F1
Restore Register Pair AF, the character in Register A, from the top of the stack.
8AE3
CP 00H FE 00
Compare Register A against 00H, no character.
8AE5
RET Z C8
RETurn to the caller if the Z FLAG is set: nothing is saved for 00H.
8AE6
PUSH HL E5
Save Register Pair HL to the top of the stack, kept for the caller.
8AE7
PUSH BC C5
Save Register Pair BC to the top of the stack, kept for the caller.
8AE8
PUSH AF F5
Save Register Pair AF, the character, to the top of the stack.
8AE9
CP 85H FE 85
Compare Register A against 85H, the graphic shown by CODIR after the listing.
8AEB
If the Z FLAG is set (85H), JUMP to 8B47H to take the hook out: the listing has ended.
8AEE
LD HL,3C3FH 21 3F 3C
Point Register Pair HL to 3C3FH, the last place of the first line of the screen.
8AF1
LD (HL),8FH 36 8F
Store 8FH, a graphic block, at Register Pair HL: the buffer is saving the listing.
8AF3
LD A,(8B9FH) 3A 9F 8B
Load Register A with the places left on the line from 8B9FH.
8AF6
CP 00H FE 00
Compare Register A against 00H, the count after a carriage return.
8AF8
If the NZ FLAG is set (within a line), JUMP to 8AFCH to count the character.
8AFA
LD A,41H 3E 41
Load Register A with 41H, the 64 places of a new line, plus one.
8AFC
DEC A 3D
DECrement Register A, the places left on the line, for this character.
8AFD
LD (8B9FH),A 32 9F 8B
Store Register A, the places left, into 8B9FH.
8B00
LD B,A 47
Load Register B with Register A, the places left on the line, for a carriage return.
8B01
LD HL,(8B9DH) 2A 9D 8B
Load Register Pair HL with the contents of 8B9DH-8B9EH, the place of the last byte saved.
8B04
INC HL 23
INCrement Register Pair HL to the place of this character.
8B05
LD (8B9DH),HL 22 9D 8B
Store Register Pair HL into 8B9DH-8B9EH, the place of the last byte saved.
8B08
POP AF F1
Restore Register Pair AF, the character in Register A, from the top of the stack.
8B09
PUSH AF F5
Save Register Pair AF, the character, to the top of the stack again.
8B0A
LD (HL),A 77
Store Register A, the character, at Register Pair HL in the buffer.
8B0B
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that ends a line.
8B0D
If the NZ FLAG is set (another character), JUMP to 8B34H to return.
8B0F
LD A,20H 3E 20
Load Register A with 20H, a space, to fill the rest of the line.
8B11
LD (HL),A 77
Store Register A, the space, at Register Pair HL in the buffer.
8B12
INC HL 23
INCrement Register Pair HL to the next place of the line.
8B13
DECrement Register B and loop back to 8B11H until the line's 64 places are filled.
8B15
LD (HL),8FH 36 8F
Store 8FH, the mark of the end of the buffer, at Register Pair HL after the line.
8B17
DEC HL 2B
DECrement Register Pair HL to the last place of the line.
8B18
LD (8B9DH),HL 22 9D 8B
Store Register Pair HL into 8B9DH-8B9EH, the place of the last byte saved.
8B1B
LD A,00H 3E 00
Load Register A with 00H, the count after a carriage return.
8B1D
LD (8B9FH),A 32 9F 8B
Store Register A (00H) into 8B9FH: the next character starts a new line.
8B20
LD HL,(8BAAH) 2A AA 8B
Load Register Pair HL with the contents of 8BAAH-8BABH, the last place the buffer may use.
8B23
LD DE,(8B9DH) ED 5B 9D 8B
Load Register Pair DE with the contents of 8B9DH-8B9EH, the place of the last byte saved.
8B27
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
8B28
SBC HL,DE ED 52
SUBtract Register Pair DE from Register Pair HL with the carry: the M FLAG when the buffer is past its end.
8B2A
If the M FLAG is set (the buffer is full), JUMP to 8B47H to take the hook out.
8B2D
LD A,(3840H) 3A 40 38
Load Register A with the keyboard row at 3840H: ENTER, CLEAR, BREAK, the four arrows and the space bar.
8B30
CP 04H FE 04
Compare Register A against 04H, the BREAK key alone; 80A7H puts FFH into this operand (8B31H).
8B32
If the Z FLAG is set (BREAK), JUMP to 8B47H to take the hook out.
8B34
POP AF F1
Restore Register Pair AF, the character, from the top of the stack.
8B35
POP BC C1
Restore Register Pair BC from the top of the stack, as the caller had it.
8B36
POP HL E1
Restore Register Pair HL from the top of the stack, as the caller had it.
8B37
RET C9
RETurn to the caller with the character displayed and saved.
8B38
LD HL,(8AD7H) 2A D7 8A
Load Register Pair HL with the contents of 8AD7H-8AD8H, the display driver's address kept in the CALL.
8B3B
LD (401EH),HL 22 1E 40
Store Register Pair HL into 401EH-401FH: the display driver is as it was.
8B3E
LD HL,3C3FH 21 3F 3C
Point Register Pair HL to 3C3FH, the last place of the first line of the screen.
8B41
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL over the block of the buffer.
8B43
GOSUB to 88F7H to sound the high tone through port FFH: the buffer is closed.
8B46
RET C9
RETurn to the caller with the hook taken out.
8B47
GOSUB to 8B38H to take the hook out of the display driver.
8B4A
JUMP to 8B34H to return from the hook with the registers restored.

8B4CH - Scrolling the Screens

8B4CH shows the screen one line back in the buffer, 8B63H one line on; each returns the Z FLAG (Register A 8FH) at the mark at the start or the end of the buffer. 8B59H saves the screen into the buffer and shows the screen at Register Pair HL; 8B7FH copies 15 lines from Register Pair HL to the screen (Register A 80H, the NZ FLAG); 8B8CH copies the screen's 15 lines back to the buffer, so changes made on it are kept.

8B4C
LD HL,(8B9BH) 2A 9B 8B
Load Register Pair HL with the contents of 8B9BH-8B9CH, the start of the screen shown in the buffer.
8B4F
LD DE,0040H 11 40 00
Load Register Pair DE with 0040H, the 64 characters of a line of the screen.
8B52
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
8B53
SBC HL,DE ED 52
SUBtract Register Pair DE (0040H) from Register Pair HL with the carry: the line before the screen.
8B55
LD A,(HL) 7E
Load Register A with the first byte of the line before the screen at Register Pair HL.
8B56
CP 8FH FE 8F
Compare Register A against 8FH, the mark at the start of the buffer.
8B58
RET Z C8
RETurn to the caller if the Z FLAG is set: the first screen is shown already.
8B59
GOSUB to 8B8CH to save the screen into the buffer.
8B5C
LD (8B9BH),HL 22 9B 8B
Store Register Pair HL into 8B9BH-8B9CH, the start of the screen to show in the buffer.
8B5F
GOSUB to 8B7FH to copy the screen of the buffer at Register Pair HL to the video memory 3C00H.
8B62
RET C9
RETurn to the caller with the screen moved, the NZ FLAG set.
8B63
LD HL,(8B9BH) 2A 9B 8B
Load Register Pair HL with the contents of 8B9BH-8B9CH, the start of the screen shown in the buffer.
8B66
LD BC,03C0H 01 C0 03
Load Register Pair BC with 03C0H, the 15 lines of a screen.
8B69
ADD HL,BC 09
ADD Register Pair BC (03C0H) to Register Pair HL: the line after the screen.
8B6A
LD A,(HL) 7E
Load Register A with the first byte of the line after the screen at Register Pair HL.
8B6B
CP 8FH FE 8F
Compare Register A against 8FH, the mark at the end of the buffer.
8B6D
RET Z C8
RETurn to the caller if the Z FLAG is set: the last screen is shown already.
8B6E
GOSUB to 8B8CH to save the screen into the buffer.
8B71
LD HL,(8B9BH) 2A 9B 8B
Load Register Pair HL with the contents of 8B9BH-8B9CH, the start of the screen shown in the buffer.
8B74
LD BC,0040H 01 40 00
Load Register Pair BC with 0040H, the 64 characters of a line of the screen.
8B77
ADD HL,BC 09
ADD Register Pair BC (0040H) to Register Pair HL: the screen one line on.
8B78
LD (8B9BH),HL 22 9B 8B
Store Register Pair HL into 8B9BH-8B9CH, the start of the screen to show in the buffer.
8B7B
GOSUB to 8B7FH to copy the screen of the buffer at Register Pair HL to the video memory 3C00H.
8B7E
RET C9
RETurn to the caller with the screen moved, the NZ FLAG set.
8B7F
LD DE,3C00H 11 00 3C
Point Register Pair DE to 3C00H, the start of the video memory.
8B82
LD BC,03C0H 01 C0 03
Load Register Pair BC with 03C0H, the 15 lines of a screen, the command line left as it is.
8B85
LDIR ED B0
Copy the screen from Register Pair HL to Register Pair DE (3C00H), the count in Register Pair BC.
8B87
LD A,80H 3E 80
Load Register A with 80H, the answer of a screen moved.
8B89
CP 1EH FE 1E
Compare Register A (80H) against 1EH: the NZ FLAG for the caller.
8B8B
RET C9
RETurn to the caller with Register A 80H and the NZ FLAG.
8B8C
PUSH HL E5
Save Register Pair HL to the top of the stack, kept for the caller.
8B8D
LD HL,3C00H 21 00 3C
Point Register Pair HL to 3C00H, the start of the video memory.
8B90
LD DE,(8B9BH) ED 5B 9B 8B
Load Register Pair DE with the contents of 8B9BH-8B9CH, the start of the screen shown in the buffer.
8B94
LD BC,03C0H 01 C0 03
Load Register Pair BC with 03C0H, the 15 lines of a screen.
8B97
LDIR ED B0
Copy the screen from Register Pair HL (3C00H) to Register Pair DE in the buffer, the count in Register Pair BC.
8B99
POP HL E1
Restore Register Pair HL from the top of the stack, as the caller had it.
8B9A
RET C9
RETurn to the caller with the screen saved in the buffer.

8B9BH - The Variables and Tables

The pointers of the buffer, the powers of ten, the warning of a changed title, the search, the words CAT and CMD, the cursor and the state of a command. 00H as loaded where CODIR sets the value itself.

8B9B-8B9C
DEFW 0000H 00 00
The start of the screen shown in the buffer (8AADH), 64 bytes a line, 15 lines a screen.
8B9D-8B9E
DEFW 0000H 00 00
The place of the last byte saved by the display hook (8B05H), 8FFCH before the first.
8B9F
DEFM "g" 67
The places left on the line being saved, plus one (8AFDH); 44H for the first line (8AA4H).
8BA0-8BA9
DEFW 2710H,03E8H,0064H,000AH,0001H 10 27 E8 03 64 00 0A 00 01 00
The powers of ten of the decimal number of 886DH: 10000, 1000, 100, 10 and 1.
8BAA-8BAB
DEFW 0000H 00 00
The last place the buffer may use, HMEM$ less 80H (807EH), tested at each line (8B20H).
8BAC-8BC7
DEFM "(C) NAME MODIFIED!" / DEFB 0AH / DEFM "RE-BOOT!" / DEFB 03H 28 43 29 20 4E 41 4D 45 20 4D 4F 44 49 46 49 45 44 21 0A 52 45 2D 42 4F 4F 54 21 03
The warning of a changed title (809DH), shown 50 times: (C) NAME MODIFIED!, a line feed and RE-BOOT!, ended by 03H.
8BC8
DEFB 00H 00
The flag of a digit shown by 886DH (889DH): no zeros are shown before the first digit.
8BC9
DEFM " " 20
The place before the search (83B7H): the line input puts a space here, then a period (87A4H).
8BCA-8BD5
DEFM "????????????" 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F
The search, up to 12 characters (83CBH): 12 question marks as loaded, which match any file.
8BD6-8BD7
DEFM " " 20 20
The place of the carriage return after a search of 12 characters, and one more space.
8BD8-8BDA
DEFM "CAT" 43 41 54
The word CAT, put at the start of the command line 8E40H (8029H): the first listing is a CAT.
8BDB-8BDC
DEFM " " 20 20
Two spaces; 8BDCH is the place before CMD that 8A78H steps on from (880AH).
8BDD-8BDF
DEFM "CMD" 43 4D 44
The extension CMD of a program, compared with that of the file by ENTER (880DH).
8BE0-8BE1
DEFW 3C80H 80 3C
The video address of the cursor (814FH on), as loaded 3C80H, the first file on line 3.
8BE2-8BE3
DEFW 0000H 00 00
The address ABORT@ had before CODIR (8057H), put back by 8866H.
8BE4
DEFB 00H 00
The key of the command (81A1H); also the mark of the search (83EBH) and the drive of a copy (8641H).
8BE5
DEFB 00H 00
The row of the cursor (81F1H), 0 at line 3 of the screen up to the last row at 823AH.
8BE6
DEFB 00H 00
The column of the cursor (81F4H), 0 to 3, 15 characters each.
8BE7
DEFB 00H 00
The character under the cursor (815DH), put back by 8918H.
8BE8
DEFM " " 20
The drive of the files shown (8117H), put after the name of the file (8498H).
8BE9
DEFB 0DH 0D
The second place of the drive shown (8128H): 0DH or 00H for none.
8BEA-8BEB
DEFW 0000H 00 00
The place where the next part of a command line goes (8468H, 84ACH), or the text of the line input.
8BEC
DEFB 00H 00
The character 12 places after the cursor, the mark of the file (892CH), put back by 8918H.
8BED-8BEE
DEFW 0000H 00 00
The place of the second cursor, 12 characters after the first (8165H), where marks are put.
8BEF
DEFB 00H 00
The mode of the line input (83B4H, 8442H): 79H the search, 80H a password, 00H the rename; then the length of the search.
8BF0
DEFB 00H 00
The key of the command, kept while a password is typed (8485H).
8BF1
DEFB 00H 00
The flag that lets ENTER take the default drive (8A2BH), set to 80H by 812DH.

8BF2H - The Texts

The title and the licence, the commands CAT with its options, the help line, the questions and prompts (each ended by 03H) and the command line built at 8E37H-8E85H, which as loaded holds a second copy of the title, written over before it is used.

8BF2-8C32
DEFB 0AH,0AH / DEFM "CO-DIR 2.1 - Cursor Oriented DIR. (C) 1983 by Hunt K. Brand." / DEFB 1DH,03H 0A 0A 43 4F 2D 44 49 52 20 32 2E 31 20 2D 20 43 75 72 73 6F 72 20 4F 72 69 65 6E 74 65 64 20 44 49 52 2E 20 28 43 29 20 31 39 38 33 20 62 79 20 20 48 75 6E 74 20 4B 2E 20 42 72 61 6E 64 2E 1D 03
The title (8041H): two line feeds, CO-DIR 2.1 - Cursor Oriented DIR. (C) 1983 by Hunt K. Brand. and 1DH, ended by 03H; 8C23H, the H of Hunt, is tested by 8090H.
8C33-8C75
DEFB 0AH,0AH,D5H / DEFM "All Rights Reserved." / DEFB 0AH,0AH,CCH / DEFM "Licensed to Micro-Systems Software, Inc." / DEFB 0DH 0A 0A D5 41 6C 6C 20 52 69 67 68 74 73 20 52 65 73 65 72 76 65 64 2E 0A 0A CC 4C 69 63 65 6E 73 65 64 20 74 6F 20 4D 69 63 72 6F 2D 53 79 73 74 65 6D 73 20 53 6F 66 74 77 61 72 65 2C 20 49 6E 63 2E 0D
The licence (8047H): All Rights Reserved. and Licensed to Micro-Systems Software, Inc., each after two line feeds and a space compression code.
8C76-8C7D
DEFM "CAT :" / DEFB 00H,00H,0DH 43 41 54 20 3A 00 00 0D
The command CAT :d (838AH): 8C7BH and 8C7CH the drive, 8C7DH a carriage return or the space before the options.
8C7E-8C81
DEFM "(I)" / DEFB 0DH 28 49 29 0D
The option (I) of SHIFT with D (8340H): the invisible files too.
8C82-8C87
DEFM "(I,A)" / DEFB 0DH 28 49 2C 41 29 0D
The options (I,A) of A (8345H): the invisible files and the allocation.
8C88-8CC7
DEFM "Choices: <SHIFT> = PW. :<ENTER> A C D F G H J K L M O P R S V Z" / DEFB 03H 43 68 6F 69 63 65 73 3A 20 3C 53 48 49 46 54 3E 20 3D 20 50 57 2E 20 3A 3C 45 4E 54 45 52 3E 20 41 20 43 20 44 20 46 20 47 20 48 20 4A 20 4B 20 4C 20 4D 20 4F 20 50 20 52 20 53 20 56 20 5A 03
The help line of H (832DH): Choices: <SHIFT> = PW. :<ENTER> and the keys; from 8CA8H the keys searched by 8398H.
8CC8-8CC9
DEFB 01H,0DH 01 0D
The last two bytes searched by 8398H: 01H and the 0DH of the ENTER key.
8CCA-8CE1
DEFM "Clear (Zero!) file???? " / DEFB 03H 43 6C 65 61 72 20 28 5A 65 72 6F 21 29 20 66 69 6C 65 3F 3F 3F 3F 20 03
The question of Z (8598H): Clear (Zero!) file????; its first six characters are the command (85A9H).
8CE2-8CF5
DEFM "CO-DIR Directory of" / DEFB 03H 43 4F 2D 44 49 52 20 44 69 72 65 63 74 6F 72 79 20 6F 66 03
The prompt of D and A (8355H): CO-DIR Directory of, followed by which drive (d)?.
8CF6-8D0A
DEFM "Copy to which drive (" 43 6F 70 79 20 74 6F 20 77 68 69 63 68 20 64 72 69 76 65 20 28
The question of C (8633H): Copy to which drive (; from 8CFDH the words which drive ( of every drive question (89CBH).
8D0B
DEFB 00H 00
The default drive (811AH, 8A1DH), shown in the brackets of the question and taken by ENTER.
8D0C
DEFB 00H 00
The second place of the default drive (8125H, 8A19H), 00H for none.
8D0D-8D10
DEFM ")? " / DEFB 03H 29 3F 20 03
The end of the drive question: the bracket, the question mark and a space, ended by 03H.
8D11-8D4C
DEFM "Press <BREAK or CLEAR> for Dos, any other key for CO-DIR : " / DEFB 03H 50 72 65 73 73 20 3C 42 52 45 41 4B 20 6F 72 20 43 4C 45 41 52 3E 20 66 6F 72 20 44 6F 73 2C 20 61 6E 79 20 6F 74 68 65 72 20 6B 65 79 20 66 6F 72 20 43 4F 2D 44 49 52 20 3A 20 03
The question after F, M, L and V (86BEH): Press <BREAK or CLEAR> for Dos, any other key for CO-DIR :.
8D4D-8D5A
DEFM "Search for: " / DEFB 85H,03H 53 65 61 72 63 68 20 66 6F 72 3A 20 85 03
The prompt of S (83BDH): Search for: and the left border 85H of the field.
8D5B-8D68
DEFM "Password : " / DEFB 85H,03H 50 61 73 73 77 6F 72 64 20 20 3A 20 85 03
The prompt of a password (8474H): Password : and the left border 85H of the field.
8D69-8D76
DEFM "Rename to : " / DEFB 85H,03H 52 65 6E 61 6D 65 20 74 6F 20 3A 20 85 03
The prompt of R (86EDH): Rename to : and the left border 85H; its first seven characters are the command (87CEH).
8D77-8D7D
DEFM " -F:03" / DEFB 0DH 20 2D 46 3A 30 33 0D
The parameter of BASIC (881BH): -F:03, three files, after the name of a program run by ENTER.
8D7E-8D9E
DEFM "Display file size (allocation)? " / DEFB 03H 44 69 73 70 6C 61 79 20 66 69 6C 65 20 73 69 7A 65 20 28 61 6C 6C 6F 63 61 74 69 6F 6E 29 3F 20 03
The question of G (8520H): Display file size (allocation)?.
8D9F-8DAA
DEFM " size is : " / DEFB 03H 20 73 69 7A 65 20 69 73 20 3A 20 03
The text after the name of G (8531H): size is :, followed by the size in kilobytes.
8DAB-8DBA
DEFM "Diskdump file? " / DEFB 03H 44 69 73 6B 64 75 6D 70 20 66 69 6C 65 3F 20 03
The question of M (85E8H): Diskdump file?; its first nine characters are the command (85F3H).
8DBB-8DD7
DEFM "Print file? (check printer) " / DEFB 03H 50 72 69 6E 74 20 66 69 6C 65 3F 20 28 63 68 65 63 6B 20 70 72 69 6E 74 65 72 29 20 03
The question of P (8605H): Print file? (check printer).
8DD8-8DDC
DEFM " @PR" / DEFB 0DH 20 40 50 52 0D
The printer @PR put after the name for P (8613H), with the carriage return.
8DDD-8DE8
DEFM "List file? " / DEFB 03H 4C 69 73 74 20 66 69 6C 65 3F 20 03
The question of L (8690H): List file?; its first five characters are the command of L and P.
8DE9-8DF5
DEFM "Load file?? " / DEFB 03H 4C 6F 61 64 20 66 69 6C 65 3F 3F 20 03
The question of O (8561H): Load file??; its first five characters are the command.
8DF6-8E0A
DEFM "Do (activate) file? " / DEFB 03H 44 6F 20 28 61 63 74 69 76 61 74 65 29 20 66 69 6C 65 3F 20 03
The question of J (857DH): Do (activate) file?; its first three characters are the command.
8E0B-8E16
DEFM "Kill file? " / DEFB 03H 4B 69 6C 6C 20 66 69 6C 65 3F 20 03
The question of K (84BBH): Kill file?; its first five characters are the command.
8E17-8E28
DEFM "Free space map of" / DEFB 03H 46 72 65 65 20 73 70 61 63 65 20 6D 61 70 20 6F 66 03
The prompt of F (85C6H): Free space map of, followed by which drive (d)?.
8E29-8E31
DEFM "FREE :0" / DEFB 0DH,0DH 46 52 45 45 20 3A 30 0D 0D
The command of F (85E1H): FREE :d, 8E2FH the drive and 8E30H its second place, then the carriage return.
8E32-8E36
DEFM "BASIC" 42 41 53 49 43
The word BASIC, the command of ENTER for a file that is not a program (8823H).
8E37-8E3F
DEFM " CO-DIR " 20 43 4F 2D 44 49 52 20 20
The place of the command word before the name (8E37H Diskdump up to 8E3DH Do); as loaded part of the second title.
8E40-8E41
DEFB 0DH,0DH 0D 0D
The command line, at 8E40H the name of the file and its drive (8451H) or CAT and its parameters (8029H).
8E42-8E5B
DEFM "CO-DIR. VER 2.1 DP/I-III" / DEFB 0DH 43 4F 2D 44 49 52 2E 20 20 56 45 52 20 32 2E 31 20 44 50 2F 49 2D 49 49 49 0D
As loaded, the second title CO-DIR. VER 2.1 DP/I-III; the command line is copied over it (8027H).
8E5C-8E76
DEFM "(C) 1983 BY HUNT K. BRAND." / DEFB 0DH 28 43 29 20 31 39 38 33 20 42 59 20 48 55 4E 54 20 4B 2E 20 42 52 41 4E 44 2E 0D
As loaded, the line (C) 1983 BY HUNT K. BRAND. of the second title, written over by the command line.
8E77-8E9F
DEFM "LICENSED TO MICRO-SYSTEMS SOFTWARE, INC." / DEFB 0DH 4C 49 43 45 4E 53 45 44 20 54 4F 20 4D 49 43 52 4F 2D 53 59 53 54 45 4D 53 20 53 4F 46 54 57 41 52 45 2C 20 49 4E 43 2E 0D
As loaded, the line LICENSED TO MICRO-SYSTEMS SOFTWARE, INC.; from 8E86H the copy of a command line to run (88C9H).
8EA0
DEFB 0DH 0D
The last byte of the file, a carriage return after the second title.
8EA1-8EC5
DEFS 37
The rest of the copy of a command line to run (88C9H), 64 bytes from 8E86H.
8FC0
DEFS 1
The mark 8FH a line before the buffer (8AA0H), where scrolling back stops (8B56H).
8FFD-8FFF
DEFS 3
The first three characters of the listing (8ABFH), saved before 9000H.
9000-93FF
DEFS 1024
The buffer of the screens, cleared to spaces at the start (8AB8H); it goes on up to HMEM$ less 80H (8BAAH).