DOSPLUS 3.5 for the Model I - SYS14/SYS Disassembled
Page Customization
Page Index
SYS14/SYS
Other Navigation
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
| Address | Contents |
|---|---|
| 5200H-5209H | The routine table (routines 2-5) and routine 2 (5200H, 5208H). |
| 520AH-53EAH | ATTRIB: the wildmask part, one file, the change of an entry, the evaluation block (520AH, 5244H, 52D8H, 52FDH, 5399H). |
| 53EBH-553FH | KILL: the wildmask part, one file, drive or device; the two requests (53EBH, 5416H, 54F2H, 553AH). |
| 5540H-5576H | KILL's evaluation block (5540H). |
| 5577H-571EH | PROT and its evaluation block (5577H, 56C4H). |
| 571FH-57A4H | The 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
| Address | Contents |
|---|---|
| 4479H | SYS0/SYS: EVAL@. |
| 447CH | SYS0/SYS: WILD@. |
| 4424H | SYS0/SYS: OPEN@. |
| 442CH | SYS0/SYS: KILL@ (5501H). |
| 4485H | SYS0/SYS: DISKIO%, functions 0 DCHECK, 6 SREAD and 7 SWRITE. |
| 448BH | SYS0/SYS: LOCDCT%. |
| 490CH | SYS0/SYS: read the directory sector of an entry (52ECH). |
| 4915H | SYS0/SYS: write it back (52F5H). |
| 4525H | SYS0/SYS: run a routine with the registers saved (52FDH, 573AH). |
| 4934H | SYS0/SYS: Register A times Register E (551FH). |
| 4467H | SYS0/SYS: DSPLY@. |
| 4409H | SYS0/SYS: ERROR@ (5797H). |
| 0033H | ROM: show the character in Register A on the display. |
| 0040H | ROM: 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.
5208H - Routine 2
Nothing to do when SYS0/SYS's record locator brings SYS14/SYS back.
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).
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.
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.
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).
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).
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).
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.
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.
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.
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).
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.
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).
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.
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).
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.
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@.
579AH - The Question
Data: the question of KILL's QUERY (54ADH), shown after the file's name.
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.