DOSPLUS 3.5 for the Model I - SYS14/SYS Disassembled

Page Customization

Introduction/Summary

DOSPLUS 3.5 SYS14/SYS Disassembly - The Library Commands ATTRIB, KILL and PROT (Model I)

SYS14/SYS is the sixth of the high overlays: it loads at 5200H and holds three library commands, routines 3 to 5 of its table at 5200H with the request codes D3H to D5H: ATTRIB, KILL and PROT. CMNDI@ takes the codes from SYS1/SYS's table of the library commands and passes them to the overlay request handler, which loads SYS14/SYS and calls the routine with Register Pair HL at the rest of the command line. No file of the diskette requests routine 2 (D2H). The file is a load module of 6 blocks, 1445 bytes, from 5200H to 57A4H, with the transfer address 5200H and no gaps; the work area after the file starts at 57A5H. SYS14/SYS itself requests two routines of the low overlays (553AH): 25H, SYS3/SYS's routine 5, which frees a file by its logical file number, and 15H, SYS2/SYS's routine 5, the password code of 8 characters.

The Parts of SYS14/SYS

AddressContents
5200H-5209HThe routine table (routines 2-5) and routine 2 (5200H, 5208H).
520AH-53EAHATTRIB: the wildmask part, one file, the change of an entry, the evaluation block (520AH, 5244H, 52D8H, 52FDH, 5399H).
53EBH-553FHKILL: the wildmask part, one file, drive or device; the two requests (53EBH, 5416H, 54F2H, 553AH).
5540H-5576HKILL's evaluation block (5540H).
5577H-571EHPROT and its evaluation block (5577H, 56C4H).
571FH-57A4HThe helpers: the question Kill ?, the name as text, a password of 8 characters; the error exits and the question's text (571FH, 573AH, 5764H, 578AH, 579AH).

ATTRIB

ATTRIB (520AH) takes a file or a wildmask and the parameters INVIS, KEEP, MOD, PW, UPDATE, ACCESS, PROT and LRL (5399H); each value goes into the operand of an instruction of the change routine 52FDH, which sets the protection level (bits 2-0 of the entry's +00H, the value taken modulo 8), the invisible bit (bit 3 of +00H), the non-shrinkable bit (bit 7 of +01H), the modified bit (bit 6 of +01H), the record length (+04H, the low byte), and the password codes of UPDATE (+10H-+11H) and ACCESS (+12H-+13H), each made by SYS2/SYS's routine 5 from the string padded to 8 characters (5764H). One file (52D8H) is opened by OPEN@, which checks its password; ATTRIB does not test the access level OPEN@ grants, nor does it ask for the master password; the entry is read by 490CH and written back by 4915H. With a wildmask (5244H) the drive is a source field (a drive, else error 2BH) or drive 0; PW must give the diskette's master password (the GAT's +CEH; PW left out stands for eight spaces), else error 19H; then every entry in use of every directory sector that is neither an extended entry nor a system file and matches the mask is changed, and the sectors with a change are written back.

KILL

KILL (53EBH) takes a file, drive, device or wildmask and the switches QUERY, SYSTEM, INVIS, ECHO and the string PW (5540H). A file is opened and killed by KILL@ (54F2H). A drive (:d) gets bit 3 of its drive control table's +00H, the NIL bit, so it is not used again until it is set up anew. A device gets bit 3 of its control block's type; when bit 7 of the type is clear (no FORCE or JOIN) the type is first saved into +08H of its entry in the DCB table (4369H) and replaced by 80H. With a wildmask (5416H) the drive and the master password are checked as for ATTRIB, and every entry in use that is not an extended entry, is a system file only with SYSTEM (then not tested for INVIS) or an invisible file only with INVIS, and matches the mask is killed: QUERY shows the name and asks Kill ? in column 16 of the same line (571FH; Y or y kills, BREAK is error 30H), else ECHO shows the name; the file is freed by SYS3/SYS's routine 5 from its logical file number (the entry's place in bits 7-5, the sector less 2 in bits 4-0).

PROT

PROT (5577H) works on the diskette of the drive given (a drive, else error 2BH), or of drive 0, which must be ready (08H). The GAT is read into 5800H and PW must give its master password code (19H). MPW sets a new master password code (+CEH), NAME the diskette name (+D0H) and DATE the diskette date (+D8H), each 8 characters padded with spaces, and the GAT is written when one of them was given. Then every directory sector is read into 5900H: CLEAN (or CARR) zeroes every free entry, and LOCK, for every entry in use that is neither an extended entry nor a system file, stores the master password code (LOCK=Y, the new one after MPW) or the code of no password, 4296H (LOCK=N), into the update code when UPDATE is given and into the access code when ACCESS is given. The sectors with a change are written back.

Differences from the Manual

PROT's LOCK changes no file unless UPDATE or ACCESS is given too: both start as 00H and are tested as switches, so LOCK alone does nothing, where the manual says LOCK assigns or removes both passwords unless ACC or UPD says otherwise. PROT's table names the parameters UPDATE and ACCESS (the manual's UPD and ACC are taken as abbreviations), and has a second name CARR for CLEAN's value, which the manual does not list. PROT without a drive works on drive 0. ATTRIB of one file needs only the file's own password, which OPEN@ checks, and the level it grants is not tested. ATTRIB's PROT is not checked: any value is taken modulo 8, and LRL keeps the low byte of its value.

Variables

Self-Modified Operands

Address
Size
Contents
527EH-527FH
2 bytes
PW (ATTRIB)
The value of PW (ATTRIB): the operand of LD HL,0000H at 527DH.
5307H-5308H
2 bytes
PROT
The value of PROT: the operand of LD DE,0000H at 5306H.
5320H-5321H
2 bytes
INVIS (ATTRIB)
The value of INVIS (ATTRIB): the operand of LD DE,0000H at 531FH.
5335H-5336H
2 bytes
KEEP
The value of KEEP: the operand of LD DE,0000H at 5334H.
534AH-534BH
2 bytes
MOD
The value of MOD: the operand of LD DE,0000H at 5349H.
535FH-5360H
2 bytes
LRL
The value of LRL: the operand of LD DE,0000H at 535EH.
536AH-536BH
2 bytes
UPDATE (ATTRIB)
The value of UPDATE (ATTRIB): the operand of LD HL,0000H at 5369H.
5382H-5383H
2 bytes
ACCESS (ATTRIB)
The value of ACCESS (ATTRIB): the operand of LD HL,0000H at 5381H.
5450H-5451H
2 bytes
PW (KILL)
The value of PW (KILL): the operand of LD HL,0000H at 544FH.
547FH-5480H
2 bytes
SYSTEM
The value of SYSTEM: the operand of LD DE,0000H at 547EH.
548CH-548DH
2 bytes
INVIS (KILL)
The value of INVIS (KILL): the operand of LD DE,0000H at 548BH.
54A4H-54A5H
2 bytes
QUERY
The value of QUERY: the operand of LD DE,0000H at 54A3H.
54B8H-54B9H
2 bytes
ECHO
The value of ECHO: the operand of LD DE,0000H at 54B7H.
55D6H-55D7H
2 bytes
PW (PROT)
The value of PW (PROT): the operand of LD HL,0000H at 55D5H.
55ECH-55EDH
2 bytes
MPW
The value of MPW: the operand of LD HL,0000H at 55EBH.
5601H-5602H
2 bytes
NAME
The value of NAME: the operand of LD HL,0000H at 5600H.
5613H-5614H
2 bytes
DATE
The value of DATE: the operand of LD HL,0000H at 5612H.
564EH-564FH
2 bytes
CLEAN
The value of CLEAN: the operand of LD DE,0000H at 564DH.
5670H-5671H
2 bytes
LOCK
The value of LOCK: the operand of LD DE,0000H at 566FH.
5681H-5682H
2 bytes
UPDATE (PROT)
The value of UPDATE (PROT): the operand of LD BC,0000H at 5680H.
5693H-5694H
2 bytes
ACCESS (PROT)
The value of ACCESS (PROT): the operand of LD BC,0000H at 5692H.
52C4H
1 byte
ATTRIB's Change Flag
The operand of LD A,00H at 52C3H: FFH when the sector was changed.
56AFH
1 byte
PROT's Change Flag
The operand of LD A,00H at 56AEH: FFH when the GAT or the sector was changed.

Work Areas

Address
Size
Contents
57A5H-57C5H
33 bytes
Source Block
The field of EVAL@: the file, drive or device (57A5H).
57C6H-57FFH
58 bytes
Wildmask Block
The wildmask of EVAL@; its text 57C7H also holds a password of 8 characters and the answer of QUERY (57C6H).
5800H-58FFH
256 bytes
GAT Buffer
The GAT, and the directory sectors of ATTRIB and KILL (5800H).
5900H-59FFH
256 bytes
Directory Buffer
PROT's directory sectors (5900H).

Outside Routines

AddressContents
4479HSYS0/SYS: EVAL@.
447CHSYS0/SYS: WILD@.
4424HSYS0/SYS: OPEN@.
442CHSYS0/SYS: KILL@ (5501H).
4485HSYS0/SYS: DISKIO%, functions 0 DCHECK, 6 SREAD and 7 SWRITE.
448BHSYS0/SYS: LOCDCT%.
490CHSYS0/SYS: read the directory sector of an entry (52ECH).
4915HSYS0/SYS: write it back (52F5H).
4525HSYS0/SYS: run a routine with the registers saved (52FDH, 573AH).
4934HSYS0/SYS: Register A times Register E (551FH).
4467HSYS0/SYS: DSPLY@.
4409HSYS0/SYS: ERROR@ (5797H).
0033HROM: show the character in Register A on the display.
0040HROM: take a line from the keyboard (572CH).

Disassembly

5200H - The Routine Table

Data: SYS14/SYS's table of routines 2-5, one word each, used by SYS0/SYS's overlay request handler (its 49C9H-49DCH) for the request codes D2H-D5H. CMNDI@ takes the codes of the library commands from SYS1/SYS's table: ATTRIB D3H (51BBH), KILL D4H (51D3H), PROT D5H (51D8H). No file of the diskette requests D2H.

5200-5201
DEFW 5208H 08 52
Routine 2: 5208H, XOR A and RET, which SYS0/SYS's record locator requests when it loads SYS14/SYS back (its 4D55H-4D62H).
5202-5203
DEFW 520AH 0A 52
Routine 3: 520AH, ATTRIB (D3H): change the attributes and passwords of a file or of the files of a wildmask.
5204-5205
DEFW 53EBH EB 53
Routine 4: 53EBH, KILL (D4H): kill a file or the files of a wildmask, or disable a drive or a device.
5206-5207
DEFW 5577H 77 55
Routine 5: 5577H, PROT (D5H): the master password, name and date of a diskette and the passwords of its files.

5208H - Routine 2

Nothing to do when SYS0/SYS's record locator brings SYS14/SYS back.

5208
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: routine 2 has no work to do.
5209
RET C9
RETurn to SYS0/SYS's overlay request handler (49DDH) with Register A = 00H.

520AH - ATTRIB

Routine 3, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. The parameters (table 53A2H) go into the operands of the change routine 52FDH: INVIS, KEEP and MOD start as 53H (not given), PW, UPDATE and ACCESS as 0000H (no string), PROT and LRL as FFFFH (not given). EVAL@ takes the fields with the block at 5399H; no field is error 2FH. A file (no wildmask) is changed alone (52D8H); with a wildmask every matching file of the drive is changed (5244H).

520A
LD A,53H 3E 53
Load Register A with 53H, the mark of a switch that was not given, for INVIS, KEEP and MOD.
520C
LD (534AH),A 32 4A 53
Store Register A (53H) into 534AH, the operand of LD DE,0000H at 5349H, the value of MOD.
520F
LD (5335H),A 32 35 53
Store Register A (53H) into 5335H, the operand of LD DE,0000H at 5334H, the value of KEEP.
5212
LD (5320H),A 32 20 53
Store Register A (53H) into 5320H, the operand of LD DE,0000H at 531FH, the value of INVIS.
5215
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value of a string parameter not given.
5218
LD (527EH),BC ED 43 7E 52
Store Register Pair BC (0000H) into 527EH-527FH, the operand of LD HL,0000H at 527DH, the address of PW's string.
521C
LD (5382H),BC ED 43 82 53
Store Register Pair BC (0000H) into 5382H-5383H, the operand of LD HL,0000H at 5381H, the address of ACCESS's string.
5220
LD (536AH),BC ED 43 6A 53
Store Register Pair BC (0000H) into 536AH-536BH, the operand of LD HL,0000H at 5369H, the address of UPDATE's string.
5224
DEC BC 0B
DECrement Register Pair BC by 1: FFFFH, the value of a number not given.
5225
LD (535FH),BC ED 43 5F 53
Store Register Pair BC (FFFFH) into 535FH-5360H, the operand of LD DE,0000H at 535EH, the value of LRL.
5229
LD (5307H),BC ED 43 07 53
Store Register Pair BC (FFFFH) into 5307H-5308H, the operand of LD DE,0000H at 5306H, the value of PROT.
522D
LD IX,5399H DD 21 99 53
Point Index Register IX to 5399H, ATTRIB's evaluation block: the source and destination blocks 57A5H, the wildmask block 57C6H, the parameters 53A2H.
5231
GOSUB to 4479H, EVAL@, to take the fields and parameters from the command line at Register Pair HL: the NZ FLAG on an error.
5234
If the NZ FLAG is set (EVAL@ failed), JUMP to 5795H to post the error in Register A.
5237
LD A,(IX+00H) DD 7E 00
Load Register A with the flags of the evaluation block at Index Register IX+00H: bits 0-2 the fields given.
523A
AND 07H E6 07
AND Register A with 07H, bits 0-2: the Z FLAG when no field was given.
523C
If the Z FLAG is set (no field), JUMP to 578AH to post error 2FH, I/o field not found.
523F
AND 04H E6 04
AND Register A with 04H, bit 2: the Z FLAG when no wildmask was given.
5241
If the Z FLAG is set (no wildmask), JUMP to 52D8H to change one file.

5244H - ATTRIB with a Wildmask

WILD@ sets the mask from the wildmask block; the drive is that of a source field, which must be a drive (else error 2BH), or drive 0. The drive must be ready (08H). The GAT is read into 5800H and the master password code at its +CEH must be that of PW (eight spaces when PW is not given), else error 19H. Then every directory sector from 2 on is read into 5800H; every entry in use that is neither an extended entry nor a system file and matches the mask is changed by 52FDH, and a sector with a change is written back.

5244
LD HL,57C7H 21 C7 57
Point Register Pair HL to 57C7H, the text of the wildmask block (after its flag byte at 57C6H).
5247
LD B,01H 06 01
Load Register B with 01H: WILD@ sets the mask from the text rather than comparing.
5249
GOSUB to 447CH, WILD@, to set the wildmask from the text at Register Pair HL.
524C
LD C,00H 0E 00
Load Register C with 00H, drive 0, the drive when no source field is given.
524E
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a source field was given.
5252
If the Z FLAG is set (no source), JUMP to 5263H with drive 0 in Register C.
5254
LD A,(57A5H) 3A A5 57
Load Register A with the flag byte of the source block at 57A5H.
5257
LD C,A 4F
Load Register C with Register A, the flag byte, whose bits 0-2 hold a drive number.
5258
AND C8H E6 C8
AND Register A with C8H, bits 7, 6 and 3: device, name and drive.
525A
CP 88H FE 88
Compare Register A against 88H: a drive without a name.
525C
If the NZ FLAG is set (not a drive), JUMP to 578DH to post error 2BH, Illegal devicespec.
525F
LD A,C 79
Load Register A with Register C, the flag byte of the source block.
5260
AND 07H E6 07
AND Register A with 07H, bits 0-2: the drive number.
5262
LD C,A 4F
Load Register C with Register A, the drive for DISKIO%.
5263
LD A,00H 3E 00
Load Register A with 00H, the DISKIO% function DCHECK, to see whether the drive in Register C is ready.
5265
GOSUB to 4485H, DISKIO%, function 0 DCHECK: the NZ FLAG when the drive is not ready.
5268
LD A,08H 3E 08
Load Register A with 08H, the error code Drive not available (LD does not change the flags).
526A
If the NZ FLAG is set (not ready), JUMP to 5795H to post error 08H, Drive not available.
526D
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
526F
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer for the GAT and the directory sectors.
5272
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
5274
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read the GAT of the drive in Register C to 5800H.
5277
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
527A
GOSUB to 448BH, LOCDCT%, to point Index Register IY to the drive control table of the drive in Register C.
527D
LD HL,0000H 21 00 00
Load Register Pair HL with the address of PW's string, the operand 527EH-527FH: 0000H when PW is not given.
5280
GOSUB to 5764H to put the string at Register Pair HL into 57C7H as 8 characters padded with spaces: Register Pair DE = 57C7H.
5283
GOSUB to 553DH, SYS2/SYS's routine 5, for the password code of the 8 characters at Register Pair DE in Register Pair HL.
5286
LD DE,(58CEH) ED 5B CE 58
Load Register Pair DE with the diskette's master password code from 58CEH-58CFH, +CEH of the GAT.
528A
OR A B7
OR Register A with itself to clear the C FLAG for the SBC below.
528B
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the Z FLAG when PW's code is the master password code.
528D
If the NZ FLAG is set (a wrong master password), JUMP to 5790H to post error 19H, File access denied.
5290
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries.
5292
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer for the directory sector.
5295
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
5297
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read directory sector Register E to 5800H.
529A
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
529D
XOR A AF
Set Register A to 00H by XORing it with itself: no change in this sector yet.
529E
LD (52C4H),A 32 C4 52
Store Register A (00H) into 52C4H, the operand of LD A,00H at 52C3H, the flag that the sector was changed.
52A1
BIT 4,(HL) CB 66
Test bit 4 of the entry's flag byte at Register Pair HL: set when the entry is in use.
52A3
If the Z FLAG is set (a free entry), JUMP to 52BDH for the next entry.
52A5
BIT 7,(HL) CB 7E
Test bit 7 of the entry's flag byte at Register Pair HL: set for an extended directory entry.
52A7
If the NZ FLAG is set (an extended entry), JUMP to 52BDH for the next entry.
52A9
BIT 6,(HL) CB 76
Test bit 6 of the entry's flag byte at Register Pair HL: set for a system file.
52AB
If the NZ FLAG is set (a system file), JUMP to 52BDH: system files are never changed by a wildmask.
52AD
PUSH BC C5
Save Register Pair BC, the drive in Register C, to the top of the stack.
52AE
PUSH HL E5
Save Register Pair HL, the entry, to the top of the stack.
52AF
LD A,05H 3E 05
Load Register A with 05H, the offset of the name in a directory entry.
52B1
ADD A,L 85
ADD Register L to Register A: the low byte of the entry's name.
52B2
LD L,A 6F
Load Register L with Register A: Register Pair HL = the name of the entry (entry+05H).
52B3
LD B,00H 06 00
Load Register B with 00H: WILD@ compares the name at Register Pair HL with the mask.
52B5
GOSUB to 447CH, WILD@, to compare the name and extension at Register Pair HL with the mask: the Z FLAG when they match.
52B8
POP HL E1
Restore Register Pair HL, the entry, from the top of the stack.
52B9
POP BC C1
Restore Register Pair BC, the drive, from the top of the stack.
52BA
If the Z FLAG is set (the name matches), GOSUB to 52FDH to change the entry at Register Pair HL.
52BD
LD A,20H 3E 20
Load Register A with 20H, the 32 bytes of a directory entry.
52BF
ADD A,L 85
ADD Register L to Register A: the low byte of the next entry.
52C0
LD L,A 6F
Load Register L with Register A: Register Pair HL = the next entry, the C FLAG past the end of the sector.
52C1
If the NC FLAG is set (an entry left in the sector), LOOP back to 52A1H.
52C3
LD A,00H 3E 00
Load Register A with the change flag, the operand 52C4H: 00H as assembled, FFH after a change by 52FDH.
52C5
OR A B7
OR Register A with itself to set the flags: the NZ FLAG when the sector was changed.
52C6
LD A,07H 3E 07
Load Register A with 07H, the DISKIO% function SWRITE (LD does not change the flags).
52C8
If the NZ FLAG is set (changed), GOSUB to 4485H, DISKIO%, function 7 SWRITE, to write directory sector Register E back.
52CB
If the NZ FLAG is set (the write failed), JUMP to 5795H to post the error in Register A.
52CE
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory's length in sectors from the drive control table at Index Register IY+0EH.
52D1
DEC A 3D
DECrement Register A by 1: the number of the last directory sector.
52D2
INC E 1C
INCrement Register E by 1, the next directory sector.
52D3
CP E BB
Compare Register A against Register E: the NC FLAG while Register E is not past the last sector.
52D4
If the NC FLAG is set (a sector left), LOOP back to 5292H to read it.
52D6
XOR A AF
Set Register A to 00H by XORing it with itself: no error.
52D7
RET C9
RETurn to CMNDI@ through the overlay request handler with Register A = 00H.

52D8H - ATTRIB of One File

The source must be a file (a name, else error 2CH). OPEN@ opens it, which checks its password; the access level it grants is not tested. The file's directory entry is read by 490CH from the logical file number and drive in the file control block (+07H, +06H), changed by 52FDH and written back by 4915H. The master password is not asked for.

52D8
LD DE,57A5H 11 A5 57
Point Register Pair DE to 57A5H, the source block: its flag byte, then the file specification.
52DB
LD A,(DE) 1A
Load Register A with the flag byte of the source block at Register Pair DE.
52DC
INC DE 13
INCrement Register Pair DE by 1, to the file specification, the file control block for OPEN@.
52DD
BIT 6,A CB 77
Test bit 6 of Register A, the flag of a name: the NZ FLAG when a file name was given.
52DF
If the Z FLAG is set (no file name), JUMP to 5793H to post error 2CH, Illegal filespec.
52E2
GOSUB to 4424H, OPEN@, to open the file at Register Pair DE: the NZ FLAG and the code in Register A on an error.
52E5
If the NZ FLAG is set (not opened), JUMP to 5795H to post the error in Register A.
52E8
LD BC,(57ACH) ED 4B AC 57
Load Register Pair BC from 57ACH-57ADH, the file control block's +06H (the drive, Register C) and +07H (the logical file number, Register B).
52EC
GOSUB to 490CH to read the directory sector of the entry of logical file number Register B on drive Register C: Register Pair HL = the entry.
52EF
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
52F2
GOSUB to 52FDH to change the directory entry at Register Pair HL by the parameters given.
52F5
GOSUB to 4915H to write the directory sector of the entry back to the drive.
52F8
If the NZ FLAG is set (the write failed), JUMP to 5795H to post the error in Register A.
52FB
XOR A AF
Set Register A to 00H by XORing it with itself: no error.
52FC
RET C9
RETurn to CMNDI@ through the overlay request handler with Register A = 00H.

52FDH - Change an Entry

Changes the directory entry at Register Pair HL by the parameters given, each the operand of an instruction below, and sets the change flag 52C4H when one was given: PROT the level (bits 2-0 of +00H, any value taken modulo 8), INVIS bit 3 of +00H, KEEP bit 7 of +01H, MOD bit 6 of +01H, LRL +04H (the low byte), UPDATE the code at +10H-+11H, ACCESS the code at +12H-+13H, each code from the string by SYS2/SYS's routine 5. The registers are kept (4525H).

52FD
GOSUB to 4525H, which runs the code after this call with Register Pairs BC, DE, HL and Index Registers IX and IY saved.
5300
PUSH HL E5
Save Register Pair HL, the directory entry, to the top of the stack.
5301
POP IX DD E1
Restore Index Register IX from the top of the stack: Index Register IX = the entry.
5303
LD HL,52C4H 21 C4 52
Point Register Pair HL to 52C4H, the change flag, which each parameter given sets to FFH.
5306
LD DE,0000H 11 00 00
Load Register Pair DE with the value of PROT, the operand 5307H-5308H (0000H as assembled): FFFFH when PROT is not given.
5309
INC D 14
INCrement Register D by 1: the Z FLAG when the high byte is FFH, PROT not given.
530A
If the Z FLAG is set (no PROT), JUMP to 531FH to keep the protection level.
530C
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the change flag 52C4H: the sector is to be written.
530E
LD A,(IX+00H) DD 7E 00
Load Register A with the flag byte of the entry at Index Register IX+00H.
5311
AND F8H E6 F8
AND Register A with F8H, which clears bits 2-0, the protection level.
5313
LD (IX+00H),A DD 77 00
Store Register A into the flag byte of the entry at Index Register IX+00H.
5316
LD A,E 7B
Load Register A with Register E, the low byte of PROT's value.
5317
AND 07H E6 07
AND Register A with 07H, bits 2-0: the new level, the value modulo 8.
5319
OR (IX+00H) DD B6 00
OR Register A with the flag byte of the entry at Index Register IX+00H.
531C
LD (IX+00H),A DD 77 00
Store Register A into the flag byte at Index Register IX+00H with the new protection level.
531F
LD DE,0000H 11 00 00
Load Register Pair DE with the value of INVIS, the operand 5320H-5321H (0000H as assembled): 53H in Register E when INVIS is not given.
5322
LD A,E 7B
Load Register A with Register E, the low byte of INVIS's value.
5323
CP 53H FE 53
Compare Register A against 53H, the mark of a switch that was not given.
5325
If the Z FLAG is set (no INVIS), JUMP to 5334H to keep the invisible bit.
5327
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the change flag 52C4H: the sector is to be written.
5329
RES 3,(IX+00H) DD CB 00 9E
Reset bit 3 of the flag byte at Index Register IX+00H, the invisible bit: the file is shown.
532D
OR A B7
OR Register A with itself to set the flags: the Z FLAG for INVIS=N.
532E
If the Z FLAG is set (INVIS=N), JUMP to 5334H with the file visible.
5330
SET 3,(IX+00H) DD CB 00 DE
Set bit 3 of the flag byte at Index Register IX+00H: the file is invisible.
5334
LD DE,0000H 11 00 00
Load Register Pair DE with the value of KEEP, the operand 5335H-5336H (0000H as assembled): 53H in Register E when KEEP is not given.
5337
LD A,E 7B
Load Register A with Register E, the low byte of KEEP's value.
5338
CP 53H FE 53
Compare Register A against 53H, the mark of a switch that was not given.
533A
If the Z FLAG is set (no KEEP), JUMP to 5349H to keep the non-shrinkable bit.
533C
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the change flag 52C4H: the sector is to be written.
533E
RES 7,(IX+01H) DD CB 01 BE
Reset bit 7 of the entry's +01H at Index Register IX+01H, the non-shrinkable bit: CLOSE@ may free granules.
5342
OR A B7
OR Register A with itself to set the flags: the Z FLAG for KEEP=N.
5343
If the Z FLAG is set (KEEP=N), JUMP to 5349H with the file shrinkable.
5345
SET 7,(IX+01H) DD CB 01 FE
Set bit 7 of the entry's +01H at Index Register IX+01H: the file is non-shrinkable.
5349
LD DE,0000H 11 00 00
Load Register Pair DE with the value of MOD, the operand 534AH-534BH (0000H as assembled): 53H in Register E when MOD is not given.
534C
LD A,E 7B
Load Register A with Register E, the low byte of MOD's value.
534D
CP 53H FE 53
Compare Register A against 53H, the mark of a switch that was not given.
534F
If the Z FLAG is set (no MOD), JUMP to 535EH to keep the modified bit.
5351
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the change flag 52C4H: the sector is to be written.
5353
RES 6,(IX+01H) DD CB 01 B6
Reset bit 6 of the entry's +01H at Index Register IX+01H, the flag that the file was modified.
5357
OR A B7
OR Register A with itself to set the flags: the Z FLAG for MOD=N.
5358
If the Z FLAG is set (MOD=N), JUMP to 535EH with the flag clear.
535A
SET 6,(IX+01H) DD CB 01 F6
Set bit 6 of the entry's +01H at Index Register IX+01H: the file is marked as modified.
535E
LD DE,0000H 11 00 00
Load Register Pair DE with the value of LRL, the operand 535FH-5360H (0000H as assembled): FFFFH when LRL is not given.
5361
INC D 14
INCrement Register D by 1: the Z FLAG when the high byte is FFH, LRL not given.
5362
If the Z FLAG is set (no LRL), JUMP to 5369H to keep the record length.
5364
LD (HL),FFH 36 FF
Store FFH at Register Pair HL, the change flag 52C4H: the sector is to be written.
5366
LD (IX+04H),E DD 73 04
Store Register E, the low byte of LRL's value, into the entry's record length at Index Register IX+04H (256 gives 00H).
5369
LD HL,0000H 21 00 00
Load Register Pair HL with the address of UPDATE's string, the operand 536AH-536BH: 0000H when UPDATE is not given.
536C
LD A,H 7C
Load Register A with Register H, the high byte of the address.
536D
OR L B5
OR Register A with Register L: the Z FLAG when the address is 0000H.
536E
If the Z FLAG is set (no UPDATE), JUMP to 5381H to keep the update password.
5370
GOSUB to 5764H to put the string at Register Pair HL into 57C7H as 8 characters padded with spaces: Register Pair DE = 57C7H.
5373
GOSUB to 553DH, SYS2/SYS's routine 5, for the password code of the 8 characters at Register Pair DE in Register Pair HL.
5376
LD (IX+10H),L DD 75 10
Store Register L, the low byte of the code, into the update password code at Index Register IX+10H.
5379
LD (IX+11H),H DD 74 11
Store Register H, the high byte of the code, into Index Register IX+11H.
537C
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
537E
LD (52C4H),A 32 C4 52
Store Register A (FFH) into the change flag 52C4H: the sector is to be written.
5381
LD HL,0000H 21 00 00
Load Register Pair HL with the address of ACCESS's string, the operand 5382H-5383H: 0000H when ACCESS is not given.
5384
LD A,H 7C
Load Register A with Register H, the high byte of the address.
5385
OR L B5
OR Register A with Register L: the Z FLAG when the address is 0000H.
5386
RET Z C8
If the Z FLAG is set (no ACCESS), RETurn through 4525H with the registers restored.
5387
GOSUB to 5764H to put the string at Register Pair HL into 57C7H as 8 characters padded with spaces: Register Pair DE = 57C7H.
538A
GOSUB to 553DH, SYS2/SYS's routine 5, for the password code of the 8 characters at Register Pair DE in Register Pair HL.
538D
LD (IX+12H),L DD 75 12
Store Register L, the low byte of the code, into the access password code at Index Register IX+12H.
5390
LD (IX+13H),H DD 74 13
Store Register H, the high byte of the code, into Index Register IX+13H.
5393
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
5395
LD (52C4H),A 32 C4 52
Store Register A (FFH) into the change flag 52C4H: the sector is to be written.
5398
RET C9
RETurn through 4525H, which restores the registers, to the caller.

5399H - ATTRIB's Evaluation Block

Data: the block that Index Register IX points to for EVAL@ (522DH): EVAL@'s flags, the addresses of the source, destination and wildmask blocks, and the parameter table: the name (6 characters), the address its value is stored to (the operands of 52FDH and 527DH) and a type byte (20H a switch, 40H a number, 80H a string, whose address is stored).

5399
DEFB 00H 00
The flags of ATTRIB's evaluation block, set by EVAL@: bits 0-2 the source, destination and wildmask fields.
539A-539B
DEFW 57A5H A5 57
The address of the source block, 57A5H: the file, or the drive of a wildmask.
539C-539D
DEFW 57A5H A5 57
The address of the destination block: 57A5H again, the same as the source.
539E-539F
DEFW 57C6H C6 57
The address of the wildmask block, 57C6H: the flag byte, then the wildmask.
53A0-53A1
DEFW 53A2H A2 53
The address of ATTRIB's parameter table at 53A2H.
53A2-53A7
DEFM "INVIS " 49 4E 56 49 53 20
The name INVIS: the file invisible (Y) or shown (N).
53A8-53A9
DEFW 5320H 20 53
INVIS's value goes to 5320H-5321H, the operand of LD DE,0000H at 531FH.
53AA
DEFB 20H 20
The type byte of INVIS: 20H, bit 5, a switch, so the name alone sets it.
53AB-53B0
DEFM "KEEP " 4B 45 45 50 20 20
The name KEEP: the file non-shrinkable (Y) or not (N).
53B1-53B2
DEFW 5335H 35 53
KEEP's value goes to 5335H-5336H, the operand of LD DE,0000H at 5334H.
53B3
DEFB 20H 20
The type byte of KEEP: 20H, bit 5, a switch, so the name alone sets it.
53B4-53B9
DEFM "MOD " 4D 4F 44 20 20 20
The name MOD: the flag that the file was modified, set (Y) or cleared (N).
53BA-53BB
DEFW 534AH 4A 53
MOD's value goes to 534AH-534BH, the operand of LD DE,0000H at 5349H.
53BC
DEFB 20H 20
The type byte of MOD: 20H, bit 5, a switch, so the name alone sets it.
53BD-53C2
DEFM "PW " 50 57 20 20 20 20
The name PW: the diskette's master password, needed with a wildmask.
53C3-53C4
DEFW 527EH 7E 52
PW's string address goes to 527EH-527FH, the operand of LD HL,0000H at 527DH.
53C5
DEFB 80H 80
The type byte of PW: 80H, bit 7, a string, whose address is stored.
53C6-53CB
DEFM "UPDATE" 55 50 44 41 54 45
The name UPDATE: the new update password of the file.
53CC-53CD
DEFW 536AH 6A 53
UPDATE's string address goes to 536AH-536BH, the operand of LD HL,0000H at 5369H.
53CE
DEFB 80H 80
The type byte of UPDATE: 80H, bit 7, a string, whose address is stored.
53CF-53D4
DEFM "ACCESS" 41 43 43 45 53 53
The name ACCESS: the new access password of the file.
53D5-53D6
DEFW 5382H 82 53
ACCESS's string address goes to 5382H-5383H, the operand of LD HL,0000H at 5381H.
53D7
DEFB 80H 80
The type byte of ACCESS: 80H, bit 7, a string, whose address is stored.
53D8-53DD
DEFM "PROT " 50 52 4F 54 20 20
The name PROT: the new protection level of the file, 0-7.
53DE-53DF
DEFW 5307H 07 53
PROT's value goes to 5307H-5308H, the operand of LD DE,0000H at 5306H.
53E0
DEFB 40H 40
The type byte of PROT: 40H, bit 6, a number, the level 0-7.
53E1-53E6
DEFM "LRL " 4C 52 4C 20 20 20
The name LRL: the new logical record length of the file.
53E7-53E8
DEFW 535FH 5F 53
LRL's value goes to 535FH-5360H, the operand of LD DE,0000H at 535EH.
53E9
DEFB 40H 40
The type byte of LRL: 40H, bit 6, a number, the record length.
53EA
DEFB 00H 00
The end of ATTRIB's parameter table: a 00H in place of the next name.

53EBH - KILL

Routine 4, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. The switches QUERY, SYSTEM, INVIS and ECHO (table 5549H) start as 00H and PW as 0000H; EVAL@ takes the fields with the block at 5540H, and no field is error 2FH. Without a wildmask one file, drive or device is killed (54F2H); with a wildmask the files of a drive (5416H).

53EB
XOR A AF
Set Register A to 00H by XORing it with itself, the value of a switch that was not given.
53EC
LD (54A4H),A 32 A4 54
Store Register A (00H) into 54A4H, the operand of LD DE,0000H at 54A3H, the value of QUERY.
53EF
LD (547FH),A 32 7F 54
Store Register A (00H) into 547FH, the operand of LD DE,0000H at 547EH, the value of SYSTEM.
53F2
LD (548CH),A 32 8C 54
Store Register A (00H) into 548CH, the operand of LD DE,0000H at 548BH, the value of INVIS.
53F5
LD (54B8H),A 32 B8 54
Store Register A (00H) into 54B8H, the operand of LD DE,0000H at 54B7H, the value of ECHO.
53F8
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value of a string parameter not given.
53FB
LD (5450H),BC ED 43 50 54
Store Register Pair BC (0000H) into 5450H-5451H, the operand of LD HL,0000H at 544FH, the address of PW's string.
53FF
LD IX,5540H DD 21 40 55
Point Index Register IX to 5540H, KILL's evaluation block: the source and destination blocks 57A5H, the wildmask block 57C6H, the parameters 5549H.
5403
GOSUB to 4479H, EVAL@, to take the fields and parameters from the command line at Register Pair HL: the NZ FLAG on an error.
5406
If the NZ FLAG is set (EVAL@ failed), JUMP to 5795H to post the error in Register A.
5409
LD A,(IX+00H) DD 7E 00
Load Register A with the flags of the evaluation block at Index Register IX+00H: bits 0-2 the fields given.
540C
AND 07H E6 07
AND Register A with 07H, bits 0-2: the Z FLAG when no field was given.
540E
If the Z FLAG is set (no field), JUMP to 578AH to post error 2FH, I/o field not found.
5411
AND 04H E6 04
AND Register A with 04H, bit 2: the Z FLAG when no wildmask was given.
5413
If the Z FLAG is set (no wildmask), JUMP to 54F2H to kill one file, drive or device.

5416H - KILL with a Wildmask

As ATTRIB's wildmask part: the mask, the drive (a source field must be a drive, 2BH), DCHECK (08H), the GAT and the master password (PW, 19H). Every directory sector from 2 on is read into 5800H; an entry is killed when it is in use, not an extended entry, a system file only with SYSTEM, else an invisible file only with INVIS, and its name matches the mask. QUERY shows the name and asks Kill ? (Y kills it), else ECHO shows the name; the file is freed by SYS3/SYS's routine 5 from its logical file number.

5416
LD HL,57C7H 21 C7 57
Point Register Pair HL to 57C7H, the text of the wildmask block (after its flag byte at 57C6H).
5419
LD B,01H 06 01
Load Register B with 01H: WILD@ sets the mask from the text rather than comparing.
541B
GOSUB to 447CH, WILD@, to set the wildmask from the text at Register Pair HL.
541E
LD C,00H 0E 00
Load Register C with 00H, drive 0, the drive when no source field is given.
5420
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a source field was given.
5424
If the Z FLAG is set (no source), JUMP to 5435H with drive 0 in Register C.
5426
LD A,(57A5H) 3A A5 57
Load Register A with the flag byte of the source block at 57A5H.
5429
LD C,A 4F
Load Register C with Register A, the flag byte, whose bits 0-2 hold a drive number.
542A
AND C8H E6 C8
AND Register A with C8H, bits 7, 6 and 3: device, name and drive.
542C
CP 88H FE 88
Compare Register A against 88H: a drive without a name.
542E
If the NZ FLAG is set (not a drive), JUMP to 578DH to post error 2BH, Illegal devicespec.
5431
LD A,C 79
Load Register A with Register C, the flag byte of the source block.
5432
AND 07H E6 07
AND Register A with 07H, bits 0-2: the drive number.
5434
LD C,A 4F
Load Register C with Register A, the drive for DISKIO%.
5435
LD A,00H 3E 00
Load Register A with 00H, the DISKIO% function DCHECK, to see whether the drive in Register C is ready.
5437
GOSUB to 4485H, DISKIO%, function 0 DCHECK: the NZ FLAG when the drive is not ready.
543A
LD A,08H 3E 08
Load Register A with 08H, the error code Drive not available (LD does not change the flags).
543C
If the NZ FLAG is set (not ready), JUMP to 5795H to post error 08H, Drive not available.
543F
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
5441
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer for the GAT and the directory sectors.
5444
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
5446
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read the GAT of the drive in Register C to 5800H.
5449
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
544C
GOSUB to 448BH, LOCDCT%, to point Index Register IY to the drive control table of the drive in Register C.
544F
LD HL,0000H 21 00 00
Load Register Pair HL with the address of PW's string, the operand 5450H-5451H: 0000H when PW is not given.
5452
GOSUB to 5764H to put the string at Register Pair HL into 57C7H as 8 characters padded with spaces: Register Pair DE = 57C7H.
5455
GOSUB to 553DH, SYS2/SYS's routine 5, for the password code of the 8 characters at Register Pair DE in Register Pair HL.
5458
LD DE,(58CEH) ED 5B CE 58
Load Register Pair DE with the diskette's master password code from 58CEH-58CFH, +CEH of the GAT.
545C
OR A B7
OR Register A with itself to clear the C FLAG for the SBC below.
545D
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the Z FLAG when PW's code is the master password code.
545F
If the NZ FLAG is set (a wrong master password), JUMP to 5790H to post error 19H, File access denied.
5462
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries.
5464
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer for the directory sector.
5467
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
5469
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read directory sector Register E to 5800H.
546C
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
546F
PUSH BC C5
Save Register Pair BC, the drive in Register C, to the top of the stack.
5470
PUSH DE D5
Save Register Pair DE, the sector in Register E, to the top of the stack.
5471
PUSH HL E5
Save Register Pair HL, the entry, to the top of the stack.
5472
BIT 4,(HL) CB 66
Test bit 4 of the entry's flag byte at Register Pair HL: set when the entry is in use.
5474
If the Z FLAG is set (a free entry), JUMP to 54DEH for the next entry.
5476
BIT 7,(HL) CB 7E
Test bit 7 of the entry's flag byte at Register Pair HL: set for an extended directory entry.
5478
If the NZ FLAG is set (an extended entry), JUMP to 54DEH for the next entry.
547A
BIT 6,(HL) CB 76
Test bit 6 of the entry's flag byte at Register Pair HL: set for a system file.
547C
If the Z FLAG is set (not a system file), JUMP to 5487H to test the invisible bit.
547E
LD DE,0000H 11 00 00
Load Register Pair DE with the value of SYSTEM, the operand 547FH-5480H (0000H as assembled): 00H in Register E when not given.
5481
INC E 1C
INCrement Register E by 1, to test the low byte.
5482
DEC E 1D
DECrement Register E by 1, back to its value: the Z FLAG when SYSTEM was not given.
5483
If the Z FLAG is set (no SYSTEM), JUMP to 54DEH: the system file is kept.
5485
JUMP to 5492H to compare the name: a system file with SYSTEM is not tested for INVIS.
5487
BIT 3,(HL) CB 5E
Test bit 3 of the entry's flag byte at Register Pair HL: set for an invisible file.
5489
If the Z FLAG is set (visible), JUMP to 5492H to compare the name.
548B
LD DE,0000H 11 00 00
Load Register Pair DE with the value of INVIS, the operand 548CH-548DH (0000H as assembled): 00H in Register E when not given.
548E
INC E 1C
INCrement Register E by 1, to test the low byte.
548F
DEC E 1D
DECrement Register E by 1, back to its value: the Z FLAG when INVIS was not given.
5490
If the Z FLAG is set (no INVIS), JUMP to 54DEH: the invisible file is kept.
5492
LD A,05H 3E 05
Load Register A with 05H, the offset of the name in a directory entry.
5494
ADD A,L 85
ADD Register L to Register A: the low byte of the entry's name.
5495
LD L,A 6F
Load Register L with Register A: Register Pair HL = the name of the entry (entry+05H).
5496
LD B,00H 06 00
Load Register B with 00H: WILD@ compares the name at Register Pair HL with the mask.
5498
GOSUB to 447CH, WILD@, to compare the name and extension at Register Pair HL with the mask: the Z FLAG when they match.
549B
If the NZ FLAG is set (no match), JUMP to 54DEH for the next entry.
549D
LD DE,57A6H 11 A6 57
Point Register Pair DE to 57A6H, the place for the text NAME/EXT of the entry.
54A0
GOSUB to 573AH to put the name and extension at Register Pair HL as NAME/EXT with a 03H at Register Pair DE.
54A3
LD DE,0000H 11 00 00
Load Register Pair DE with the value of QUERY, the operand 54A4H-54A5H (0000H as assembled): 00H in Register E when not given.
54A6
INC E 1C
INCrement Register E by 1, to test the low byte.
54A7
DEC E 1D
DECrement Register E by 1, back to its value: the Z FLAG when QUERY was not given.
54A8
If the Z FLAG is set (no QUERY), JUMP to 54B7H to test ECHO.
54AA
LD HL,57A6H 21 A6 57
Point Register Pair HL to 57A6H, the text NAME/EXT of the entry.
54AD
LD DE,579AH 11 9A 57
Point Register Pair DE to 579AH, the question Kill ? after a new line, 16 spaces and the cursor up.
54B0
GOSUB to 571FH to show the name and the question and take the answer: the Z FLAG for Y.
54B3
If the NZ FLAG is set (not Y), JUMP to 54DEH: the file is kept.
54B5
JUMP to 54C9H to kill the file: ECHO is not tested after QUERY.
54B7
LD DE,0000H 11 00 00
Load Register Pair DE with the value of ECHO, the operand 54B8H-54B9H (0000H as assembled): 00H in Register E when not given.
54BA
INC E 1C
INCrement Register E by 1, to test the low byte.
54BB
DEC E 1D
DECrement Register E by 1, back to its value: the Z FLAG when ECHO was not given.
54BC
If the Z FLAG is set (no ECHO), JUMP to 54C9H to kill the file without showing it.
54BE
LD HL,57A6H 21 A6 57
Point Register Pair HL to 57A6H, the text NAME/EXT of the entry.
54C1
GOSUB to 4467H, DSPLY@, to show the name at Register Pair HL up to its 03H.
54C4
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the line.
54C6
GOSUB to 0033H, the ROM's routine that shows the character in Register A (0DH) on the display.
54C9
POP HL E1
Restore Register Pair HL, the entry, from the top of the stack.
54CA
POP DE D1
Restore Register Pair DE, the sector in Register E, from the top of the stack.
54CB
POP BC C1
Restore Register Pair BC, the drive in Register C, from the top of the stack.
54CC
PUSH BC C5
Save Register Pair BC, the drive, to the top of the stack again.
54CD
PUSH DE D5
Save Register Pair DE, the sector, to the top of the stack again.
54CE
PUSH HL E5
Save Register Pair HL, the entry, to the top of the stack again.
54CF
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address in the buffer.
54D0
AND E0H E6 E0
AND Register A with E0H, bits 7-5: the entry's place in the sector, the high bits of its logical file number.
54D2
LD B,A 47
Load Register B with Register A, the entry's place.
54D3
LD A,E 7B
Load Register A with Register E, the directory sector.
54D4
SUB 02H D6 02
SUBtract 02H from Register A: the sector less 2, the low bits of the logical file number.
54D6
OR B B0
OR Register A with Register B: Register A = the logical file number of the entry.
54D7
LD B,A 47
Load Register B with Register A: Register B = the logical file number, Register C = the drive.
54D8
GOSUB to 553AH, SYS3/SYS's routine 5, to free the file of logical file number Register B on drive Register C.
54DB
If the NZ FLAG is set (an error), JUMP to 5795H to post the error in Register A.
54DE
POP HL E1
Restore Register Pair HL, the entry, from the top of the stack.
54DF
POP DE D1
Restore Register Pair DE, the sector, from the top of the stack.
54E0
POP BC C1
Restore Register Pair BC, the drive, from the top of the stack.
54E1
LD A,20H 3E 20
Load Register A with 20H, the 32 bytes of a directory entry.
54E3
ADD A,L 85
ADD Register L to Register A: the low byte of the next entry.
54E4
LD L,A 6F
Load Register L with Register A: Register Pair HL = the next entry, the C FLAG past the end of the sector.
54E5
If the NC FLAG is set (an entry left in the sector), LOOP back to 546FH.
54E7
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory's length in sectors from the drive control table at Index Register IY+0EH.
54EA
DEC A 3D
DECrement Register A by 1: the number of the last directory sector.
54EB
INC E 1C
INCrement Register E by 1, the next directory sector.
54EC
CP E BB
Compare Register A against Register E: the NC FLAG while Register E is not past the last sector.
54ED
If the NC FLAG is set (a sector left), JUMP to 5464H to read it.
54F0
XOR A AF
Set Register A to 00H by XORing it with itself: no error.
54F1
RET C9
RETurn to CMNDI@ through the overlay request handler with Register A = 00H.

54F2H - KILL of One File, Drive or Device

A file is opened by OPEN@ and killed by KILL@, which checks its access level. A drive (:d) gets bit 3 of its drive control table's +00H, the NIL bit, so it is not used any more. A device gets bit 3 of its control block's type: when bit 7 of the type is clear (no FORCE or JOIN), the type is first saved into +08H of the device's entry in the DCB table and replaced by 80H.

54F2
LD DE,57A5H 11 A5 57
Point Register Pair DE to 57A5H, the source block: its flag byte, then the specification.
54F5
LD A,(DE) 1A
Load Register A with the flag byte of the source block at Register Pair DE.
54F6
INC DE 13
INCrement Register Pair DE by 1, to the file specification, the file control block for OPEN@.
54F7
BIT 6,A CB 77
Test bit 6 of Register A, the flag of a name: the NZ FLAG when a file name was given.
54F9
If the Z FLAG is set (no file name), JUMP to 5508H for a drive or a device.
54FB
GOSUB to 4424H, OPEN@, to open the file at Register Pair DE: the NZ FLAG and the code in Register A on an error.
54FE
If the NZ FLAG is set (not opened), JUMP to 5795H to post the error in Register A.
5501
GOSUB to 442CH, KILL@, to kill the open file at Register Pair DE: the NZ FLAG on an error.
5504
If the NZ FLAG is set (not killed), JUMP to 5795H to post the error in Register A.
5507
RET C9
RETurn to CMNDI@ through the overlay request handler with the file killed.
5508
BIT 3,A CB 5F
Test bit 3 of Register A, the flag of a drive: the NZ FLAG for a drive.
550A
If the Z FLAG is set (a device), JUMP to 5517H.
550C
AND 07H E6 07
AND Register A with 07H, bits 0-2: the drive number.
550E
LD C,A 4F
Load Register C with Register A, the drive for LOCDCT%.
550F
GOSUB to 448BH, LOCDCT%, to point Index Register IY to the drive control table of the drive in Register C.
5512
SET 3,(IY+00H) FD CB 00 DE
Set bit 3 of the drive control table's type at Index Register IY+00H, the NIL bit: the drive is disabled.
5516
RET C9
RETurn to CMNDI@ through the overlay request handler with the drive disabled.
5517
LD E,0BH 1E 0B
Load Register E with 0BH, the 11 bytes of an entry of the DCB table.
5519
LD IY,4369H FD 21 69 43
Point Index Register IY to 4369H, SYS0/SYS's DCB table, the entry of device 0.
551D
AND 07H E6 07
AND Register A with 07H, bits 0-2: the device number.
551F
GOSUB to 4934H to multiply Register A, the device number, by Register E (0BH): the offset of its entry.
5522
LD E,A 5F
Load Register E with Register A, the offset of the entry.
5523
LD D,00H 16 00
Load Register D with 00H: Register Pair DE = the offset.
5525
ADD IY,DE FD 19
ADD Register Pair DE to Index Register IY: Index Register IY = the device's entry of the DCB table.
5527
LD L,(IY+00H) FD 6E 00
Load Register L with the low byte of the device's DCB address at Index Register IY+00H.
552A
LD H,(IY+01H) FD 66 01
Load Register H with the high byte of the DCB address at Index Register IY+01H: Register Pair HL = the DCB.
552D
BIT 7,(HL) CB 7E
Test bit 7 of the DCB's type byte at Register Pair HL: set while the device is FORCEd or JOINed.
552F
If the NZ FLAG is set (FORCE or JOIN), JUMP to 5537H: the type was saved already.
5531
LD A,(HL) 7E
Load Register A with the DCB's type byte at Register Pair HL.
5532
LD (IY+08H),A FD 77 08
Store Register A, the type, into the entry's saved type at Index Register IY+08H.
5535
LD (HL),80H 36 80
Store 80H at Register Pair HL, the DCB's type byte.
5537
SET 3,(HL) CB DE
Set bit 3 of the DCB's type byte at Register Pair HL, the NIL bit: the device is disabled.
5539
RET C9
RETurn to CMNDI@ through the overlay request handler with the device disabled.

553AH - Two Requests

553AH requests 25H, SYS3/SYS's routine 5, which frees the file of logical file number Register B on drive Register C; 553DH requests 15H, SYS2/SYS's routine 5, which returns in Register Pair HL the password code of the 8 characters at Register Pair DE. Each is entered by a GOSUB; the overlay request handler drops the return address of the RST 28H, so the routine returns straight to the caller.

553A
LD A,25H 3E 25
Load Register A with 25H, the request code of SYS3/SYS's routine 5, which frees a file by its logical file number.
553C
RST 28H EF
Request the overlay routine in Register A through RST 28H, SYS0/SYS's overlay request handler.
553D
LD A,15H 3E 15
Load Register A with 15H, the request code of SYS2/SYS's routine 5, the password code of 8 characters.
553F
RST 28H EF
Request the overlay routine in Register A through RST 28H, SYS0/SYS's overlay request handler.

5540H - KILL's Evaluation Block

Data: the block that Index Register IX points to for EVAL@ (53FFH): EVAL@'s flags, the addresses of the source, destination and wildmask blocks, and the parameter table (name, address of the value, type byte).

5540
DEFB 00H 00
The flags of KILL's evaluation block, set by EVAL@: bits 0-2 the source, destination and wildmask fields.
5541-5542
DEFW 57A5H A5 57
The address of the source block, 57A5H: the file, drive or device, or the drive of a wildmask.
5543-5544
DEFW 57A5H A5 57
The address of the destination block: 57A5H again, the same as the source.
5545-5546
DEFW 57C6H C6 57
The address of the wildmask block, 57C6H: the flag byte, then the wildmask.
5547-5548
DEFW 5549H 49 55
The address of KILL's parameter table at 5549H.
5549-554E
DEFM "QUERY " 51 55 45 52 59 20
The name QUERY: ask Kill ? for each file of a wildmask.
554F-5550
DEFW 54A4H A4 54
QUERY's value goes to 54A4H-54A5H, the operand of LD DE,0000H at 54A3H.
5551
DEFB 20H 20
The type byte of QUERY: 20H, bit 5, a switch, so the name alone sets it.
5552-5557
DEFM "SYSTEM" 53 59 53 54 45 4D
The name SYSTEM: system files are killed too.
5558-5559
DEFW 547FH 7F 54
SYSTEM's value goes to 547FH-5480H, the operand of LD DE,0000H at 547EH.
555A
DEFB 20H 20
The type byte of SYSTEM: 20H, bit 5, a switch, so the name alone sets it.
555B-5560
DEFM "INVIS " 49 4E 56 49 53 20
The name INVIS: invisible files are killed too.
5561-5562
DEFW 548CH 8C 54
INVIS's value goes to 548CH-548DH, the operand of LD DE,0000H at 548BH.
5563
DEFB 20H 20
The type byte of INVIS: 20H, bit 5, a switch, so the name alone sets it.
5564-5569
DEFM "ECHO " 45 43 48 4F 20 20
The name ECHO: show the name of each file killed.
556A-556B
DEFW 54B8H B8 54
ECHO's value goes to 54B8H-54B9H, the operand of LD DE,0000H at 54B7H.
556C
DEFB 20H 20
The type byte of ECHO: 20H, bit 5, a switch, so the name alone sets it.
556D-5572
DEFM "PW " 50 57 20 20 20 20
The name PW: the diskette's master password, needed with a wildmask.
5573-5574
DEFW 5450H 50 54
PW's string address goes to 5450H-5451H, the operand of LD HL,0000H at 544FH.
5575
DEFB 80H 80
The type byte of PW: 80H, bit 7, a string, whose address is stored.
5576
DEFB 00H 00
The end of KILL's parameter table: a 00H in place of the next name.

5577H - PROT

Routine 5, entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. The parameters (table 56CDH) go into operands: UPDATE, ACCESS and CLEAN start as 00H, LOCK as 53H (not given), PW, MPW, NAME and DATE as 0000H. The drive is that of a field, which must be a drive (2BH), or drive 0; it must be ready (08H). The GAT is read into 5800H and its master password code must be that of PW (19H). MPW gives the GAT a new master password code, NAME the diskette name (+D0H), DATE the date (+D8H), and the GAT is written when one was given. Then every directory sector is read into 5900H: CLEAN zeroes every free entry, LOCK sets the codes UPDATE and ACCESS name, and a changed sector is written back.

5577
XOR A AF
Set Register A to 00H by XORing it with itself, the value of a switch that was not given.
5578
LD (5693H),A 32 93 56
Store Register A (00H) into 5693H, the operand of LD BC,0000H at 5692H, the value of ACCESS.
557B
LD (5681H),A 32 81 56
Store Register A (00H) into 5681H, the operand of LD BC,0000H at 5680H, the value of UPDATE.
557E
LD (564EH),A 32 4E 56
Store Register A (00H) into 564EH, the operand of LD DE,0000H at 564DH, the value of CLEAN.
5581
LD A,53H 3E 53
Load Register A with 53H, the mark of a switch that was not given, for LOCK.
5583
LD (5670H),A 32 70 56
Store Register A (53H) into 5670H, the operand of LD DE,0000H at 566FH, the value of LOCK.
5586
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, the value of a string parameter not given.
5589
LD (5601H),BC ED 43 01 56
Store Register Pair BC (0000H) into 5601H-5602H, the operand of LD HL,0000H at 5600H, the address of NAME's string.
558D
LD (5613H),BC ED 43 13 56
Store Register Pair BC (0000H) into 5613H-5614H, the operand of LD HL,0000H at 5612H, the address of DATE's string.
5591
LD (55D6H),BC ED 43 D6 55
Store Register Pair BC (0000H) into 55D6H-55D7H, the operand of LD HL,0000H at 55D5H, the address of PW's string.
5595
LD (55ECH),BC ED 43 EC 55
Store Register Pair BC (0000H) into 55ECH-55EDH, the operand of LD HL,0000H at 55EBH, the address of MPW's string.
5599
LD IX,56C4H DD 21 C4 56
Point Index Register IX to 56C4H, PROT's evaluation block: all three blocks 57A5H, the parameters 56CDH.
559D
GOSUB to 4479H, EVAL@, to take the field and the parameters from the command line at Register Pair HL: the NZ FLAG on an error.
55A0
If the NZ FLAG is set (EVAL@ failed), JUMP to 5795H to post the error in Register A.
55A3
LD C,00H 0E 00
Load Register C with 00H, drive 0, the drive when no field is given.
55A5
LD A,(IX+00H) DD 7E 00
Load Register A with the flags of the evaluation block at Index Register IX+00H: bits 0-2 the fields given.
55A8
AND 07H E6 07
AND Register A with 07H, bits 0-2: the Z FLAG when no field was given.
55AA
If the Z FLAG is set (no field), JUMP to 55BBH with drive 0 in Register C.
55AC
LD A,(57A5H) 3A A5 57
Load Register A with the flag byte of the field's block at 57A5H.
55AF
LD C,A 4F
Load Register C with Register A, the flag byte, whose bits 0-2 hold a drive number.
55B0
AND C8H E6 C8
AND Register A with C8H, bits 7, 6 and 3: device, name and drive.
55B2
CP 88H FE 88
Compare Register A against 88H: a drive without a name.
55B4
If the NZ FLAG is set (not a drive), JUMP to 578DH to post error 2BH, Illegal devicespec.
55B7
LD A,C 79
Load Register A with Register C, the flag byte of the field's block.
55B8
AND 07H E6 07
AND Register A with 07H, bits 0-2: the drive number.
55BA
LD C,A 4F
Load Register C with Register A, the drive for DISKIO%.
55BB
LD A,00H 3E 00
Load Register A with 00H, the DISKIO% function DCHECK, to see whether the drive in Register C is ready.
55BD
GOSUB to 4485H, DISKIO%, function 0 DCHECK: the NZ FLAG when the drive is not ready.
55C0
LD A,08H 3E 08
Load Register A with 08H, the error code Drive not available (LD does not change the flags).
55C2
If the NZ FLAG is set (not ready), JUMP to 5795H to post error 08H, Drive not available.
55C5
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
55C7
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer for the GAT.
55CA
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
55CC
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read the GAT of the drive in Register C to 5800H.
55CF
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
55D2
GOSUB to 448BH, LOCDCT%, to point Index Register IY to the drive control table of the drive in Register C.
55D5
LD HL,0000H 21 00 00
Load Register Pair HL with the address of PW's string, the operand 55D6H-55D7H: 0000H when PW is not given.
55D8
GOSUB to 5764H to put the string at Register Pair HL into 57C7H as 8 characters padded with spaces: Register Pair DE = 57C7H.
55DB
GOSUB to 553DH, SYS2/SYS's routine 5, for the password code of the 8 characters at Register Pair DE in Register Pair HL.
55DE
LD DE,(58CEH) ED 5B CE 58
Load Register Pair DE with the diskette's master password code from 58CEH-58CFH, +CEH of the GAT.
55E2
XOR A AF
Set Register A to 00H by XORing it with itself, which also clears the C FLAG for the SBC below.
55E3
SBC HL,DE ED 52
Subtract Register Pair DE from Register Pair HL: the Z FLAG when PW's code is the master password code.
55E5
If the NZ FLAG is set (a wrong master password), JUMP to 5790H to post error 19H, File access denied.
55E8
LD (56AFH),A 32 AF 56
Store Register A (00H) into 56AFH, the operand of LD A,00H at 56AEH, the flag that a sector was changed: the GAT not yet.
55EB
LD HL,0000H 21 00 00
Load Register Pair HL with the address of MPW's string, the operand 55ECH-55EDH: 0000H when MPW is not given.
55EE
LD A,H 7C
Load Register A with Register H, the high byte of the address.
55EF
OR L B5
OR Register A with Register L: the Z FLAG when the address is 0000H.
55F0
If the Z FLAG is set (no MPW), JUMP to 5600H to keep the master password.
55F2
GOSUB to 5764H to put the string at Register Pair HL into 57C7H as 8 characters padded with spaces: Register Pair DE = 57C7H.
55F5
GOSUB to 553DH, SYS2/SYS's routine 5, for the password code of the 8 characters at Register Pair DE in Register Pair HL.
55F8
LD (58CEH),HL 22 CE 58
Store Register Pair HL, the new code, into the master password code at 58CEH-58CFH, +CEH of the GAT.
55FB
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
55FD
LD (56AFH),A 32 AF 56
Store Register A (FFH) into the change flag 56AFH: the GAT is to be written.
5600
LD HL,0000H 21 00 00
Load Register Pair HL with the address of NAME's string, the operand 5601H-5602H: 0000H when NAME is not given.
5603
LD A,H 7C
Load Register A with Register H, the high byte of the address.
5604
OR L B5
OR Register A with Register L: the Z FLAG when the address is 0000H.
5605
If the Z FLAG is set (no NAME), JUMP to 5612H to keep the diskette name.
5607
LD DE,58D0H 11 D0 58
Point Register Pair DE to 58D0H, +D0H of the GAT, the 8 character diskette name.
560A
GOSUB to 5767H to put the string at Register Pair HL into the GAT at Register Pair DE as 8 characters padded with spaces.
560D
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
560F
LD (56AFH),A 32 AF 56
Store Register A (FFH) into the change flag 56AFH: the GAT is to be written.
5612
LD HL,0000H 21 00 00
Load Register Pair HL with the address of DATE's string, the operand 5613H-5614H: 0000H when DATE is not given.
5615
LD A,H 7C
Load Register A with Register H, the high byte of the address.
5616
OR L B5
OR Register A with Register L: the Z FLAG when the address is 0000H.
5617
If the Z FLAG is set (no DATE), JUMP to 5624H to keep the diskette date.
5619
LD DE,58D8H 11 D8 58
Point Register Pair DE to 58D8H, +D8H of the GAT, the 8 character diskette date.
561C
GOSUB to 5767H to put the string at Register Pair HL into the GAT at Register Pair DE as 8 characters padded with spaces.
561F
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
5621
LD (56AFH),A 32 AF 56
Store Register A (FFH) into the change flag 56AFH: the GAT is to be written.
5624
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
5626
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the GAT in the buffer.
5629
LD A,(56AFH) 3A AF 56
Load Register A with the change flag from 56AFH: FFH when MPW, NAME or DATE changed the GAT.
562C
OR A B7
OR Register A with itself to set the flags: the NZ FLAG when the GAT was changed.
562D
LD A,07H 3E 07
Load Register A with 07H, the DISKIO% function SWRITE (LD does not change the flags).
562F
If the NZ FLAG is set (changed), GOSUB to 4485H, DISKIO%, function 7 SWRITE, to write the GAT back.
5632
If the NZ FLAG is set (the write failed), JUMP to 5795H to post the error in Register A.
5635
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries.
5637
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, the buffer for the directory sector.
563A
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
563C
GOSUB to 4485H, DISKIO%, function 6 SREAD, to read directory sector Register E to 5900H.
563F
If the NZ FLAG is set (the read failed), JUMP to 5795H to post the error in Register A.
5642
XOR A AF
Set Register A to 00H by XORing it with itself: no change in this sector yet.
5643
LD (56AFH),A 32 AF 56
Store Register A (00H) into the change flag 56AFH, the operand of LD A,00H at 56AEH.
5646
PUSH BC C5
Save Register Pair BC, the drive in Register C, to the top of the stack.
5647
PUSH DE D5
Save Register Pair DE, the sector in Register E, to the top of the stack.
5648
PUSH HL E5
Save Register Pair HL, the entry, to the top of the stack.
5649
BIT 4,(HL) CB 66
Test bit 4 of the entry's flag byte at Register Pair HL: set when the entry is in use.
564B
If the NZ FLAG is set (in use), JUMP to 5662H for LOCK.
564D
LD DE,0000H 11 00 00
Load Register Pair DE with the value of CLEAN, the operand 564EH-564FH (0000H as assembled): 00H in Register E when not given.
5650
INC E 1C
INCrement Register E by 1, to test the low byte.
5651
DEC E 1D
DECrement Register E by 1, back to its value: the Z FLAG when CLEAN was not given.
5652
If the Z FLAG is set (no CLEAN), JUMP to 56A4H to keep the free entry as it is.
5654
LD B,20H 06 20
Load Register B with 20H, the 32 bytes of the free entry.
5656
LD (HL),00H 36 00
Store 00H at Register Pair HL, a byte of the free entry.
5658
INC HL 23
INCrement Register Pair HL by 1, to the next byte of the entry.
5659
DECrement Register B and LOOP back to 5656H until the 32 bytes are 00H.
565B
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
565D
LD (56AFH),A 32 AF 56
Store Register A (FFH) into the change flag 56AFH: the sector is to be written.
5660
JUMP to 56A4H for the next entry of the directory sector.
5662
BIT 7,(HL) CB 7E
Test bit 7 of the entry's flag byte at Register Pair HL: set for an extended directory entry.
5664
If the NZ FLAG is set (an extended entry), JUMP to 56A4H for the next entry.
5667
BIT 6,(HL) CB 76
Test bit 6 of the entry's flag byte at Register Pair HL: set for a system file.
5669
If the NZ FLAG is set (a system file), JUMP to 56A4H: LOCK leaves system files alone.
566C
PUSH HL E5
Save Register Pair HL, the entry, to the top of the stack.
566D
POP IX DD E1
Restore Index Register IX from the top of the stack: Index Register IX = the entry.
566F
LD DE,0000H 11 00 00
Load Register Pair DE with the value of LOCK, the operand 5670H-5671H (0000H as assembled): 53H in Register E when LOCK is not given.
5672
LD A,E 7B
Load Register A with Register E, the low byte of LOCK's value.
5673
CP 53H FE 53
Compare Register A against 53H, the mark of a switch that was not given.
5675
If the Z FLAG is set (no LOCK), JUMP to 56A4H for the next entry.
5677
LD HL,4296H 21 96 42
Load Register Pair HL with 4296H, the password code of eight spaces, no password: the code for LOCK=N.
567A
OR A B7
OR Register A with itself to set the flags: the Z FLAG for LOCK=N.
567B
If the Z FLAG is set (LOCK=N), JUMP to 5680H with the code of no password.
567D
LD HL,(58CEH) 2A CE 58
Load Register Pair HL with the master password code from 58CEH-58CFH, +CEH of the GAT (the new one after MPW).
5680
LD BC,0000H 01 00 00
Load Register Pair BC with the value of UPDATE, the operand 5681H-5682H (0000H as assembled): 00H in Register C when not given.
5683
INC C 0C
INCrement Register C by 1, to test the low byte.
5684
DEC C 0D
DECrement Register C by 1, back to its value: the Z FLAG when UPDATE was not given or is N.
5685
If the Z FLAG is set (no UPDATE), JUMP to 5692H to keep the update password.
5687
LD (IX+10H),L DD 75 10
Store Register L, the low byte of the code, into the update password code at Index Register IX+10H.
568A
LD (IX+11H),H DD 74 11
Store Register H, the high byte of the code, into Index Register IX+11H.
568D
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
568F
LD (56AFH),A 32 AF 56
Store Register A (FFH) into the change flag 56AFH: the sector is to be written.
5692
LD BC,0000H 01 00 00
Load Register Pair BC with the value of ACCESS, the operand 5693H-5694H (0000H as assembled): 00H in Register C when not given.
5695
INC C 0C
INCrement Register C by 1, to test the low byte.
5696
DEC C 0D
DECrement Register C by 1, back to its value: the Z FLAG when ACCESS was not given or is N.
5697
If the Z FLAG is set (no ACCESS), JUMP to 56A4H to keep the access password.
5699
LD (IX+12H),L DD 75 12
Store Register L, the low byte of the code, into the access password code at Index Register IX+12H.
569C
LD (IX+13H),H DD 74 13
Store Register H, the high byte of the code, into Index Register IX+13H.
569F
LD A,FFH 3E FF
Load Register A with FFH, the value of the change flag.
56A1
LD (56AFH),A 32 AF 56
Store Register A (FFH) into the change flag 56AFH: the sector is to be written.
56A4
POP HL E1
Restore Register Pair HL, the entry, from the top of the stack.
56A5
POP DE D1
Restore Register Pair DE, the sector, from the top of the stack.
56A6
POP BC C1
Restore Register Pair BC, the drive, from the top of the stack.
56A7
LD A,20H 3E 20
Load Register A with 20H, the 32 bytes of a directory entry.
56A9
ADD A,L 85
ADD Register L to Register A: the low byte of the next entry.
56AA
LD L,A 6F
Load Register L with Register A: Register Pair HL = the next entry, the C FLAG past the end of the sector.
56AB
If the NC FLAG is set (an entry left in the sector), JUMP to 5646H for it.
56AE
LD A,00H 3E 00
Load Register A with the change flag, the operand 56AFH: 00H as assembled, FFH after a change.
56B0
OR A B7
OR Register A with itself to set the flags: the NZ FLAG when the sector was changed.
56B1
LD A,07H 3E 07
Load Register A with 07H, the DISKIO% function SWRITE (LD does not change the flags).
56B3
If the NZ FLAG is set (changed), GOSUB to 4485H, DISKIO%, function 7 SWRITE, to write directory sector Register E back.
56B6
If the NZ FLAG is set (the write failed), JUMP to 5795H to post the error in Register A.
56B9
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory's length in sectors from the drive control table at Index Register IY+0EH.
56BC
DEC A 3D
DECrement Register A by 1: the number of the last directory sector.
56BD
INC E 1C
INCrement Register E by 1, the next directory sector.
56BE
CP E BB
Compare Register A against Register E: the NC FLAG while Register E is not past the last sector.
56BF
If the NC FLAG is set (a sector left), JUMP to 5637H to read it.
56C2
XOR A AF
Set Register A to 00H by XORing it with itself: no error.
56C3
RET C9
RETurn to CMNDI@ through the overlay request handler with Register A = 00H.

56C4H - PROT's Evaluation Block

Data: the block that Index Register IX points to for EVAL@ (5599H): EVAL@'s flags, the addresses of the source, destination and wildmask blocks (all 57A5H, so the one field given lands there), and the parameter table (name, address of the value, type byte).

56C4
DEFB 00H 00
The flags of PROT's evaluation block, set by EVAL@: bits 0-2 tell which fields were given (55A5H).
56C5-56C6
DEFW 57A5H A5 57
The address of the source block, 57A5H: the drive whose diskette is changed.
56C7-56C8
DEFW 57A5H A5 57
The address of the destination block: 57A5H again, the same as the source.
56C9-56CA
DEFW 57A5H A5 57
The address of the wildmask block: 57A5H again, the same as the source.
56CB-56CC
DEFW 56CDH CD 56
The address of PROT's parameter table at 56CDH.
56CD-56D2
DEFM "PW " 50 57 20 20 20 20
The name PW: the diskette's current master password.
56D3-56D4
DEFW 55D6H D6 55
PW's string address goes to 55D6H-55D7H, the operand of LD HL,0000H at 55D5H.
56D5
DEFB 80H 80
The type byte of PW: 80H, bit 7, a string, whose address is stored.
56D6-56DB
DEFM "MPW " 4D 50 57 20 20 20
The name MPW: the new master password of the diskette.
56DC-56DD
DEFW 55ECH EC 55
MPW's string address goes to 55ECH-55EDH, the operand of LD HL,0000H at 55EBH.
56DE
DEFB 80H 80
The type byte of MPW: 80H, bit 7, a string, whose address is stored.
56DF-56E4
DEFM "NAME " 4E 41 4D 45 20 20
The name NAME: the new name of the diskette, +D0H of the GAT.
56E5-56E6
DEFW 5601H 01 56
NAME's string address goes to 5601H-5602H, the operand of LD HL,0000H at 5600H.
56E7
DEFB 80H 80
The type byte of NAME: 80H, bit 7, a string, whose address is stored.
56E8-56ED
DEFM "DATE " 44 41 54 45 20 20
The name DATE: the new date of the diskette, +D8H of the GAT, any 8 characters.
56EE-56EF
DEFW 5613H 13 56
DATE's string address goes to 5613H-5614H, the operand of LD HL,0000H at 5612H.
56F0
DEFB 80H 80
The type byte of DATE: 80H, bit 7, a string, whose address is stored.
56F1-56F6
DEFM "LOCK " 4C 4F 43 4B 20 20
The name LOCK: give the files the master password (Y) or no password (N).
56F7-56F8
DEFW 5670H 70 56
LOCK's value goes to 5670H-5671H, the operand of LD DE,0000H at 566FH.
56F9
DEFB 20H 20
The type byte of LOCK: 20H, bit 5, a switch, so the name alone sets it.
56FA-56FF
DEFM "UPDATE" 55 50 44 41 54 45
The name UPDATE: LOCK sets the update password codes.
5700-5701
DEFW 5681H 81 56
UPDATE's value goes to 5681H-5682H, the operand of LD BC,0000H at 5680H.
5702
DEFB 20H 20
The type byte of UPDATE: 20H, bit 5, a switch, so the name alone sets it.
5703-5708
DEFM "ACCESS" 41 43 43 45 53 53
The name ACCESS: LOCK sets the access password codes.
5709-570A
DEFW 5693H 93 56
ACCESS's value goes to 5693H-5694H, the operand of LD BC,0000H at 5692H.
570B
DEFB 20H 20
The type byte of ACCESS: 20H, bit 5, a switch, so the name alone sets it.
570C-5711
DEFM "CLEAN " 43 4C 45 41 4E 20
The name CLEAN: zero every free entry of the directory.
5712-5713
DEFW 564EH 4E 56
CLEAN's value goes to 564EH-564FH, the operand of LD DE,0000H at 564DH.
5714
DEFB 20H 20
The type byte of CLEAN: 20H, bit 5, a switch, so the name alone sets it.
5715-571A
DEFM "CARR " 43 41 52 52 20 20
A second name, CARR, which the manual does not list, for the same value as CLEAN.
571B-571C
DEFW 564EH 4E 56
CARR's value goes to 564EH-564FH, the operand at 564DH, the same as CLEAN's.
571D
DEFB 20H 20
The type byte of CARR: 20H, bit 5, a switch, so the name alone sets it.
571E
DEFB 00H 00
The end of PROT's parameter table: a 00H in place of the next name.

571FH - Ask Kill ?

Shows the text at Register Pair HL (the file's name) and the question at Register Pair DE, and takes an answer of one character by the ROM's 0040H into 57C7H: the Z FLAG when it is Y or y. BREAK posts error 30H, Terminated.

571F
PUSH DE D5
Save Register Pair DE, the question, to the top of the stack.
5720
GOSUB to 4467H, DSPLY@, to show the name at Register Pair HL up to its 03H.
5723
POP HL E1
Restore Register Pair HL, the question, from the top of the stack.
5724
GOSUB to 4467H, DSPLY@, to show the question at Register Pair HL up to its 03H.
5727
LD B,01H 06 01
Load Register B with 01H, the answer of one character.
5729
LD HL,57C7H 21 C7 57
Point Register Pair HL to 57C7H, the buffer for the answer.
572C
GOSUB to 0040H, the ROM's routine that takes a line of up to Register B characters into Register Pair HL: the C FLAG for BREAK.
572F
LD A,30H 3E 30
Load Register A with 30H, the error code Terminated (LD does not change the flags).
5731
If the C FLAG is set (BREAK), JUMP to 5795H to post error 30H, Terminated.
5734
LD A,(HL) 7E
Load Register A with the answer at Register Pair HL.
5735
RES 5,A CB AF
Reset bit 5 of Register A, which makes a small letter a capital.
5737
SUB 59H D6 59
SUBtract 59H, the letter Y, from Register A: the Z FLAG for the answer Y.
5739
RET C9
RETurn to the caller with the Z FLAG for the answer Y.

573AH - The Name as Text

Puts the name and extension at Register Pair HL (directory form, 8 and 3 characters padded with spaces) at Register Pair DE as NAME/EXT, the extension left out when it is blank, ended by 03H. The registers are kept (4525H).

573A
GOSUB to 4525H, which runs the code after this call with Register Pairs BC, DE, HL and Index Registers IX and IY saved.
573D
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the 8 characters of the name.
5740
LD A,(HL) 7E
Load Register A with the character of the name at Register Pair HL.
5741
CP 20H FE 20
Compare Register A against 20H, the space that pads the name.
5743
If the Z FLAG is set (a space), JUMP to 574AH: the name ends here.
5745
LDI ED A0
Copy the character from Register Pair HL to Register Pair DE (LDI), counting Register Pair BC down.
5747
If the P/V FLAG is set (Register Pair BC not 0000H), LOOP back to 5740H through JP PE,5740H.
574A
ADD HL,BC 09
ADD Register Pair BC, the characters of the name left, to Register Pair HL: Register Pair HL = the extension.
574B
LD A,(HL) 7E
Load Register A with the first character of the extension at Register Pair HL.
574C
CP 20H FE 20
Compare Register A against 20H, the space of a blank extension.
574E
If the Z FLAG is set (no extension), JUMP to 5760H to end the text.
5750
LD A,2FH 3E 2F
Load Register A with 2FH, the slash before the extension.
5752
LD (DE),A 12
Store Register A, the slash, at Register Pair DE.
5753
INC DE 13
INCrement Register Pair DE by 1, past the slash.
5754
LD C,03H 0E 03
Load Register C with 03H, the 3 characters of the extension (Register B is 00H).
5756
LD A,(HL) 7E
Load Register A with the character of the extension at Register Pair HL.
5757
CP 20H FE 20
Compare Register A against 20H, the space that pads the extension.
5759
If the Z FLAG is set (a space), JUMP to 5760H: the extension ends here.
575B
LDI ED A0
Copy the character from Register Pair HL to Register Pair DE (LDI), counting Register Pair BC down.
575D
If the P/V FLAG is set (Register Pair BC not 0000H), LOOP back to 5756H through JP PE,5756H.
5760
LD A,03H 3E 03
Load Register A with 03H, the byte that ends a text for DSPLY@.
5762
LD (DE),A 12
Store Register A (03H) at Register Pair DE, after the text.
5763
RET C9
RETurn through 4525H, which restores the registers, to the caller.

5764H - A Password of 8 Characters

5764H: into 57C7H; 5767H: into Register Pair DE. Copies the string at Register Pair HL (0000H: no string) as 8 characters: the string ends at a control code or a quotation mark (22H or 27H), or after 8 characters, and the rest is filled with spaces. Returns Register Pair DE at the 8 characters.

5764
LD DE,57C7H 11 C7 57
Point Register Pair DE to 57C7H, the buffer for the 8 characters of a password.
5767
PUSH DE D5
Save Register Pair DE, the start of the 8 characters, to the top of the stack.
5768
LD B,08H 06 08
Load Register B with 08H, the 8 characters to fill.
576A
LD A,H 7C
Load Register A with Register H, the high byte of the string's address.
576B
OR L B5
OR Register A with Register L: the Z FLAG when the address is 0000H, no string.
576C
If the Z FLAG is set (no string), JUMP to 5782H to fill all 8 characters with spaces.
576E
LD A,(HL) 7E
Load Register A with the character of the string at Register Pair HL.
576F
LD (DE),A 12
Store Register A, the character, at Register Pair DE.
5770
CP 20H FE 20
Compare Register A against 20H, the space: the C FLAG for a control code.
5772
If the C FLAG is set (a control code, the end of the line), JUMP to 5782H to fill the rest with spaces.
5774
CP 22H FE 22
Compare Register A against 22H, the double quotation mark that closes a string.
5776
If the Z FLAG is set (the closing quotation mark), JUMP to 5782H to fill the rest with spaces.
5778
CP 27H FE 27
Compare Register A against 27H, the single quotation mark that closes a string.
577A
If the Z FLAG is set (the closing quotation mark), JUMP to 5782H to fill the rest with spaces.
577C
INC HL 23
INCrement Register Pair HL by 1, to the next character of the string.
577D
INC DE 13
INCrement Register Pair DE by 1, to the next of the 8 characters.
577E
DECrement Register B and LOOP back to 576EH until 8 characters are copied.
5780
POP DE D1
Restore Register Pair DE, the start of the 8 characters, from the top of the stack.
5781
RET C9
RETurn to the caller with the 8 characters at Register Pair DE.
5782
LD A,20H 3E 20
Load Register A with 20H, the space that fills the rest.
5784
LD (DE),A 12
Store Register A, the space, at Register Pair DE.
5785
INC DE 13
INCrement Register Pair DE by 1, to the next of the 8 characters.
5786
DECrement Register B and LOOP back to 5782H until the 8 characters are filled.
5788
POP DE D1
Restore Register Pair DE, the start of the 8 characters, from the top of the stack.
5789
RET C9
RETurn to the caller with the 8 characters at Register Pair DE.

578AH - The Error Exits

Four entries, each loading its error code into Register A: 578AH 2FH I/o field not found, 578DH 2BH Illegal devicespec, 5790H 19H File access denied due to password protection, 5793H 2CH Illegal filespec. Each LD A,n after the first is the operand of an LD BC,nn entered from the entry above it. 5795H posts the error in Register A by ERROR@ with bit 6 set (no frame), and ERROR@ ends with ABORT@.

578A
LD A,2FH 3E 2F
Load Register A with 2FH, the error code I/o field not found.
578C
LD BC,2B3EH 01 3E 2B
578DH enters inside this LD BC,2B3EH: its bytes 3EH 2BH read as LD A,2BH, the error code Illegal devicespec; from above it only loads Register Pair BC.
578F
LD BC,193EH 01 3E 19
5790H enters inside this LD BC,193EH: its bytes 3EH 19H read as LD A,19H, the error code File access denied; from above it only loads Register Pair BC.
5792
LD BC,2C3EH 01 3E 2C
5793H enters inside this LD BC,2C3EH: its bytes 3EH 2CH read as LD A,2CH, the error code Illegal filespec; from above it only loads Register Pair BC.
5795
OR 40H F6 40
OR Register A, the error code, with 40H, bit 6, so that ERROR@ shows the message without its frame.
5797
JUMP to 4409H, ERROR@, to show the message of the error in Register A and end through ABORT@.

579AH - The Question

Data: the question of KILL's QUERY (54ADH), shown after the file's name.

579A-579C
DEFB 0AH,D0H,1BH 0A D0 1B
A new line (0AH), 16 spaces (D0H, the ROM's space compression) and the cursor up a line (1BH): the question starts in column 16 of the name's line.
579D-57A3
DEFM "Kill ? " 4B 69 6C 6C 20 3F 20
The question Kill ? with a space after it, before the answer.
57A4
DEFB 03H 03
The byte that ends the question for DSPLY@ (5724H), the last byte of the file.

57A5H - The Work Area

Not in the file: SYS14/SYS uses the memory after its last byte (57A4H) for the field blocks of EVAL@, the 8 characters of a password, the answer of QUERY, and the sector buffers.

57A5-57C5
DEFS 33
The source block of EVAL@ (57A5H the flag byte, 57A6H the file control block of OPEN@); also the text NAME/EXT of KILL (57A6H).
57C6-57FF
DEFS 58
The wildmask block of EVAL@ (57C6H the flag byte, 57C7H the wildmask), whose text 57C7H later holds the 8 characters of a password (5764H) and the answer of QUERY (5729H).
5800-58FF
DEFS 256
The buffer of the GAT (master password code 58CEH, name 58D0H, date 58D8H) and, for ATTRIB and KILL, of the directory sectors.
5900-59FF
DEFS 256
The buffer of PROT's directory sectors (5637H), while the GAT stays at 5800H.