5200H - DIRCHECK
DIRCHECK/CMD's transfer address, entered from the DOS command level with Register Pair HL at the command line after the word DIRCHECK: DIRCHECK [FROM] :dr [TO] filespec/devicespec (GAT,HIT,FILES,CYL0). DIRCHECK reads the whole directory cylinder of the drive, builds its own granule allocation table and hash index table from the file entries, reports every difference and every faulty entry, and with GAT, HIT or FILES writes its own tables or the repaired entries back. It needs HMEM$ at 7F00H or above for its buffers.
5200
PUSH HL E5
Save Register Pair HL, the command line pointer after DIRCHECK, to the top of the stack while the heading is shown.
5201
LD HL,572FH 21 2F 57
Point Register Pair HL to 572FH, DIRCHECK's heading (DIRCHECK - DOSPLUS directory checker - 3.50) and the copyright line.
5204
GOSUB to 4467H, DSPLY@, to display the text at Register Pair HL up to and with the 0DH after the copyright line.
5207
LD HL,(4411H) 2A 11 44
Load Register Pair HL with the contents of 4411H-4412H, HMEM$, the highest address the programs may use.
520A
LD BC,7F00H 01 00 7F
Load Register Pair BC with 7F00H, the end of the buffers: the directory is read from 5D00H on, up to 34 sectors.
520D
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
520E
SBC HL,BC ED 42
SUBtract Register Pair BC (7F00H) from Register Pair HL (HMEM$) with the carry: the C FLAG when HMEM$ is below 7F00H.
5210
If the C FLAG is set (HMEM$ below 7F00H), JUMP to 56F1H for the error 21H, No memory space available.
5213
POP HL E1
Restore Register Pair HL, the command line pointer, from the top of the stack.
5214H - The Fields and the Asterisk Prompt
EVAL@ takes the drive, the output and the parameters into the blocks of 5701H. When the command line holds no field and no parameter, DIRCHECK shows an asterisk and takes up to 63 characters into 5B00H, which EVAL@ evaluates again; BREAK is the error 30H, Terminated.
5214
LD IX,5701H DD 21 01 57
Point Index Register IX to 5701H, DIRCHECK's evaluation block for EVAL@ (drive, output and the four parameters).
5218
GOSUB to 4479H, EVAL@, to take the fields and the parameters of the command line at Register Pair HL into the blocks.
521B
If the NZ FLAG is set (EVAL@ found an error, its code in Register A), JUMP to 56FCH to post the error.
521E
LD A,(IX+00H) DD 7E 00
Load Register A with the flag byte of the evaluation block at Index Register IX+00H, which EVAL@ has set.
5221
AND 0FH E6 0F
AND Register A with 0FH, the bits of the source, the destination, the wildmask and the parameters.
5223
If the NZ FLAG is set (something was given), JUMP to 5237H to take the drive.
5225
LD A,2AH 3E 2A
Load Register A with 2AH, the asterisk shown as the prompt when the command line holds nothing.
5227
GOSUB to 0033H, the ROM's display of the character in Register A, the prompt.
522A
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, the buffer for the reply (later DIRCHECK's own granule allocation table).
522D
LD B,3FH 06 3F
Load Register B with 3FH, the most characters of the reply: 63.
522F
GOSUB to 0040H, the ROM's line input of up to Register B characters into the buffer at Register Pair HL; the C FLAG for BREAK.
5232
If the C FLAG is set (BREAK), JUMP to 56FAH for the error 30H, Terminated.
5235
JUMP to 5214H to evaluate the reply at Register Pair HL as the command line.
5237H - The Drive and the Output
The source field must be a drive (:dr), with the flag bits 7 and 3 and no name; without a source field DIRCHECK checks drive 0. Any other source field is the error 2BH, Illegal devicespec. The drive is kept at 597AH and the output is opened (5548H).
5237
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the flag byte at Index Register IX+00H, set by EVAL@ when a source field was given.
523B
LD C,00H 0E 00
Load Register C with 00H, drive 0, for a command line with no source field.
523D
If the Z FLAG is set (no source field), JUMP to 524AH with Register C = drive 0.
523F
LD A,(5981H) 3A 81 59
Load Register A with the flag byte of the source block from 5981H: bit 7 a device or a drive, bit 6 a name, bit 3 a drive.
5242
LD C,A 4F
Load Register C with Register A, keeping the flag byte of the source block for its drive number.
5243
AND C8H E6 C8
AND Register A with C8H, keeping bit 7 (a device or a drive), bit 6 (a name) and bit 3 (a drive).
5245
CP 88H FE 88
Compare Register A against 88H, a drive without a name: bits 7 and 3 set, bit 6 clear.
5247
If the NZ FLAG is set (not a drive), JUMP to 56F4H for the error 2BH, Illegal devicespec.
524A
LD A,C 79
Load Register A with Register C, the flag byte of the source block, or 00H for drive 0.
524B
AND 07H E6 07
AND Register A with 07H, keeping bits 0-2, the drive number LOCDEV@ put there.
524D
LD (597AH),A 32 7A 59
Store Register A, the drive to check, into 597AH, where the reads and the writes take it.
5250
GOSUB to 5548H to open the output: the display, the device or the file of the destination field.
5253
If the NZ FLAG is set (INIT@ refused the file, its error code in Register A), JUMP to 56FCH to post the error.
5256H - Read the Directory
DCHECK of the drive, then every sector of the directory cylinder, 0 up to DCT+0EH less 1, is read by SREAD into 5D00H on: the GAT at 5D00H, the HIT at 5E00H and the entries from 5F00H.
5256
LD A,(597AH) 3A 7A 59
Load Register A with the drive from 597AH, kept there at 524DH.
5259
LD C,A 4F
Load Register C with Register A, the drive, for DISKIO% and LOCDCT%.
525A
LD A,00H 3E 00
Load Register A with 00H, the function DCHECK of DISKIO%, which checks that drive Register C is there.
525C
GOSUB to 4488H, DISKIO%, to check drive Register C.
525F
If the NZ FLAG is set (the drive is not there), JUMP to 56F7H for the error 08H, Drive not available.
5262
GOSUB to 44A3H, LOCDCT%, to point Index Register IY to the drive control table of drive Register C.
5265
LD E,00H 1E 00
Load Register E with 00H, the first sector of the directory cylinder, the GAT.
5267
LD HL,5D00H 21 00 5D
Point Register Pair HL to 5D00H, the buffer of the first directory sector.
526A
LD A,06H 3E 06
Load Register A with 06H, the function SREAD of DISKIO%: read sector Register E of the directory cylinder.
526C
GOSUB to 4488H, DISKIO%, to read the directory sector Register E of drive Register C into Register Pair HL.
526F
If the NZ FLAG is set (the sector could not be read, its code in Register A), JUMP to 56FCH to post the error.
5272
INC H 24
INCrement Register H: Register Pair HL to the next page, the buffer of the next sector.
5273
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory length, DCT+0EH, at Index Register IY+0EH: the sectors of the directory.
5276
DEC A 3D
DECrement Register A: the number of the last sector of the directory.
5277
INC E 1C
INCrement Register E to the next sector of the directory cylinder.
5278
CP E BB
Compare Register A, the last sector, against Register E, the next one: the NC FLAG while it is not past the last.
5279
If the NC FLAG is set (more sectors), JUMP to 526AH to read the next sector.
527BH - The Cylinder Count
The GAT's cylinder count (GAT+CCH plus 35) may be at most 96 on a floppy drive and 200 on a rigid drive; above that the message Cylinder count of nnn invalid is shown and the greatest count is used. The count is kept at 597BH. The message shows the byte at 597BH, which is stored only after it.
527B
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of the drive control table's flags, DCT+03H, at Index Register IY+03H: set for a rigid drive.
527F
LD B,61H 06 61
Load Register B with 61H, one more than 96 cylinders, the limit for a floppy drive.
5281
If the Z FLAG is set (a floppy drive), JUMP to 5285H with Register B = 61H.
5283
LD B,C9H 06 C9
Load Register B with C9H, one more than 200 cylinders, the limit for a rigid drive.
5285
LD A,(5DCCH) 3A CC 5D
Load Register A with the byte of the GAT at 5DCCH, GAT+CCH: the cylinders less 35.
5288
ADD A,23H C6 23
ADD 23H to Register A: the cylinder count of the diskette, 35 more.
528A
CP B B8
Compare Register A, the count, against Register B, the limit: the NC FLAG when the count is too large.
528B
DEC B 05
DECrement Register B to the greatest count allowed, 60H or C8H; the flags of the compare are kept.
528C
If the NC FLAG is set (the count is too large), GOSUB to 55FAH for the message Cylinder count of nnn invalid.
528F
If the C FLAG is set (the count is good), JUMP to 5292H to keep it.
5291
LD A,B 78
Load Register A with Register B, the greatest count allowed: 96 or 200 cylinders.
5292
LD (597BH),A 32 7B 59
Store Register A, the cylinder count to check, into 597BH.
5295H - Empty Tables
The mask of the granules a cylinder does not have: FFH with the bits 0 up to DCT+10H less 1 reset, kept at 597CH. DIRCHECK's own GAT at 5B00H is made of the mask for each cylinder of the count and FFH for the rest; its own HIT at 5C00H is cleared to 00H.
5295
LD E,(IY+10H) FD 5E 10
Load Register E with the granules per cylinder, DCT+10H, at Index Register IY+10H.
5298
LD A,FFH 3E FF
Load Register A with FFH, every bit set: the mask before the granules of a cylinder are reset in it.
529A
DEC E 1D
DECrement Register E to the number of the last granule of a cylinder.
529B
GOSUB to 5528H to reset bit Register E of Register A: granule Register E is one the cylinder has.
529E
DEC E 1D
DECrement Register E to the granule before; the S FLAG after granule 0.
529F
If the P FLAG is set (Register E is 00H or above), JUMP to 529BH to reset the bit of the next granule.
52A2
LD (597CH),A 32 7C 59
Store Register A, the mask of the granules a cylinder does not have, into 597CH.
52A5
LD HL,597BH 21 7B 59
Point Register Pair HL to 597BH, the cylinder count.
52A8
LD B,(HL) 46
Load Register B with the cylinder count at Register Pair HL: the bytes of the GAT made of the mask.
52A9
PUSH BC C5
Save Register Pair BC, the count in Register B, to the top of the stack.
52AA
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, DIRCHECK's own granule allocation table.
52AD
LD (HL),A 77
Store Register A, the mask, into the GAT byte of the cylinder at Register Pair HL: no granule in use yet.
52AE
INC L 2C
INCrement Register L to the next cylinder's byte of the GAT.
52AF
DECrement Register B and, while it is not zero, LOOP BACK to 52ADH for the next cylinder (DJNZ).
52B1
LD (HL),FFH 36 FF
Store FFH into the byte at Register Pair HL: past the cylinder count every granule counts as in use.
52B3
INC L 2C
INCrement Register L to the next byte; the Z FLAG at the end of the page.
52B4
If the NZ FLAG is set (more of the page), JUMP to 52B1H to set the next byte to FFH.
52B6
POP BC C1
Restore Register Pair BC, the count in Register B, from the top of the stack.
52B7
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, DIRCHECK's own hash index table.
52BA
LD (HL),00H 36 00
Store 00H into the byte of the HIT at Register Pair HL: no entry in use yet.
52BC
INC L 2C
INCrement Register L to the next byte of the HIT; the Z FLAG at the end of the page.
52BD
If the NZ FLAG is set (more of the HIT), JUMP to 52BAH to clear the next byte.
52BFH - The Entries
Every entry of the sectors 2 on (5F00H up), 32 bytes each, is looked at. An inactive entry (bit 4 clear) is passed over; an extended entry (FXDE, bit 7) is checked at 53A5H. For a file's first entry the logical file number (DEC) is kept at 597DH, the hash code of its name is made and put into the HIT at 5C00H plus the DEC, and the granules its sector count needs (+14H divided by DCT+0FH, rounded up) are kept at 597FH.
52BF
LD HL,5F00H 21 00 5F
Point Register Pair HL to 5F00H, the first entry of the directory, in the buffer of sector 2.
52C2
PUSH HL E5
Save Register Pair HL, the address of the entry, to the top of the stack.
52C3
BIT 4,(HL) CB 66
Test bit 4 of the entry's flag byte at Register Pair HL: set for an active entry.
52C5
If the Z FLAG is set (an inactive entry), JUMP to 53C4H for the next entry.
52C8
GOSUB to 54F2H for the logical file number of the entry at Register Pair HL in Register B.
52CB
LD A,B 78
Load Register A with Register B, the logical file number of the entry.
52CC
LD (597DH),A 32 7D 59
Store Register A, the logical file number of the entry, into 597DH, for the messages about it.
52CF
BIT 7,(HL) CB 7E
Test bit 7 of the entry's flag byte at Register Pair HL: set for an extended entry (FXDE).
52D1
If the NZ FLAG is set (an extended entry), JUMP to 53A5H to check its link from the file's entry.
52D4
LD E,B 58
Load Register E with Register B, the logical file number: the offset of its byte in the HIT.
52D5
LD D,5CH 16 5C
Load Register D with 5CH: Register Pair DE = the entry's byte in DIRCHECK's own HIT at 5C00H.
52D7
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address.
52D8
ADD A,05H C6 05
ADD 05H to Register A: the offset of the name, +05H.
52DA
LD L,A 6F
Load Register L with Register A: Register Pair HL to the name of the entry.
52DB
GOSUB to 5505H for the hash code of the eleven characters of the name and extension at Register Pair HL.
52DE
LD (597EH),A 32 7E 59
Store Register A, the hash code, into 597EH, for the extended entries of this file.
52E1
LD (DE),A 12
Store Register A, the hash code, into the entry's byte of the HIT at Register Pair DE.
52E2
LD A,L 7D
Load Register A with Register L, the low byte of the name's address.
52E3
ADD A,0FH C6 0F
ADD 0FH to Register A: from +05H to +14H, the sectors of the file.
52E5
LD L,A 6F
Load Register L with Register A: Register Pair HL to the low byte of the sector count, +14H.
52E6
LD E,(HL) 5E
Load Register E with the low byte of the sector count at Register Pair HL.
52E7
INC L 2C
INCrement Register L to the high byte of the sector count, +15H.
52E8
LD D,(HL) 56
Load Register D with the high byte of the sector count at Register Pair HL: Register Pair DE = the sectors of the file.
52E9
INC L 2C
INCrement Register L to +16H, the first extent of the entry.
52EA
EX DE,HL EB
EXchange Register Pair DE with Register Pair HL: HL the sector count, DE the first extent.
52EB
PUSH DE D5
Save Register Pair DE, the address of the first extent, to the top of the stack.
52EC
LD A,(IY+0FH) FD 7E 0F
Load Register A with the sectors per granule, DCT+0FH, at Index Register IY+0FH.
52EF
GOSUB to 4451H, DIVD@, to divide Register Pair HL by Register A: the granules in Register Pair HL, the sectors left over in Register A.
52F2
OR A B7
Test Register A, the sectors left over: the Z FLAG when the count fills whole granules.
52F3
If the Z FLAG is set (no sectors left over), JUMP to 52F6H with the granules in Register Pair HL.
52F5
INC HL 23
INCrement Register Pair HL: one more granule holds the sectors left over.
52F6
LD (597FH),HL 22 7F 59
Store Register Pair HL, the granules the file needs, into 597FH-5980H.
52F9
POP HL E1
Restore Register Pair HL, the address of the first extent, from the top of the stack.
52FA
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the count of the granules found in the extents.
52FDH - The Extents
Each entry has four extents at +16H and a fifth pair at +1EH, which must hold FFH (the end) or FEH and the logical file number of an extended entry. Each extent (a cylinder, then the starting granule in bits 7-5 and the granules less 1 in bits 4-0) is taken granule by granule, from its last one down: a cylinder past the count is Granule assigned past cyl count, a granule already set in DIRCHECK's GAT is Granule multiply assigned; the granule is then set and counted in Register Pair DE.
52FD
LD B,05H 06 05
Load Register B with 05H, the four extents and the fifth pair of the entry.
52FF
LD A,(HL) 7E
Load Register A with the first byte of the extent at Register Pair HL: a cylinder, FEH or FFH.
5300
INC L 2C
INCrement Register L to the second byte of the extent.
5301
CP FEH FE FE
Compare Register A against FEH: the NC FLAG for FEH (a link) or FFH (the end), the Z FLAG for FEH.
5303
If the NC FLAG is set (FEH or FFH), JUMP to 534CH to take the link or the end.
5305
DEC B 05
DECrement Register B, the pairs left; the Z FLAG at the fifth pair, which may not be an extent.
5306
If the Z FLAG is set (an extent in the fifth pair), GOSUB to 560CH for the message Terminating SD not found.
5309
If the Z FLAG is set (the fifth pair), JUMP to 537FH to end the entry with FFH FFH.
530B
PUSH BC C5
Save Register Pair BC, the pairs left in Register B, to the top of the stack.
530C
LD B,(HL) 46
Load Register B with the extent's second byte at Register Pair HL: the starting granule and the granules less 1.
530D
DEC L 2D
DECrement Register L back to the cylinder, the first byte of the extent.
530E
PUSH DE D5
Save Register Pair DE, the count of the granules found, to the top of the stack.
530F
LD A,B 78
Load Register A with Register B, the second byte of the extent.
5310
AND E0H E6 E0
AND Register A with E0H, keeping bits 7-5, the starting granule on the cylinder.
5312
RLCA 07
Rotate Register A left one bit, the first of three that bring bits 7-5 to bits 2-0 (RLCA).
5313
RLCA 07
Rotate Register A left one bit, the second of three that bring the starting granule down (RLCA).
5314
RLCA 07
Rotate Register A left one bit, the third of three: the starting granule in bits 2-0 (RLCA).
5315
LD E,A 5F
Load Register E with Register A, the starting granule of the extent.
5316
LD A,B 78
Load Register A with Register B, the second byte of the extent, less the granules done.
5317
AND 1FH E6 1F
AND Register A with 1FH, keeping bits 4-0: the granules of the extent left, less 1.
5319
ADD A,E 83
ADD Register E, the starting granule, to Register A: the granule to set, counted from the extent's cylinder.
531A
LD E,A 5F
Load Register E with Register A, the granule counted from the extent's cylinder.
531B
LD A,(IY+10H) FD 7E 10
Load Register A with the granules per cylinder, DCT+10H, at Index Register IY+10H.
531E
GOSUB to 4494H, the 8 bit divide: Register A = Register E divided by Register A, Register E = the remainder, the granule on its cylinder.
5321
ADD A,(HL) 86
ADD the extent's cylinder at Register Pair HL to Register A: the cylinder of the granule.
5322
LD D,A 57
Load Register D with Register A, the cylinder of the granule.
5323
LD A,(597BH) 3A 7B 59
Load Register A with the cylinder count from 597BH.
5326
DEC A 3D
DECrement Register A to the last cylinder of the diskette.
5327
CP D BA
Compare Register A, the last cylinder, against Register D: the C FLAG for a granule past the last cylinder.
5328
If the C FLAG is set (past the cylinder count), GOSUB to 5614H for the message Granule assigned past cyl count.
532B
If the C FLAG is set (past the count), JUMP to 533DH, the granule is counted but not set.
532D
PUSH HL E5
Save Register Pair HL, the address of the extent, to the top of the stack.
532E
LD L,D 6A
Load Register L with Register D, the cylinder of the granule.
532F
LD H,5BH 26 5B
Load Register H with 5BH: Register Pair HL = the cylinder's byte in DIRCHECK's own GAT at 5B00H.
5331
LD A,(HL) 7E
Load Register A with the GAT byte of the cylinder at Register Pair HL.
5332
GOSUB to 5538H to test bit Register E of Register A: the NZ FLAG when the granule is in use already.
5335
If the NZ FLAG is set (in use already), GOSUB to 561CH for the message Granule multiply assigned.
5338
GOSUB to 5518H to set bit Register E of Register A: the granule is in use.
533B
LD (HL),A 77
Store Register A, the GAT byte with the granule set, back at Register Pair HL.
533C
POP HL E1
Restore Register Pair HL, the address of the extent, from the top of the stack.
533D
POP DE D1
Restore Register Pair DE, the count of the granules found, from the top of the stack.
533E
INC DE 13
INCrement Register Pair DE: one more granule found for the file.
533F
LD A,B 78
Load Register A with Register B, the second byte of the extent, less the granules done.
5340
AND 1FH E6 1F
AND Register A with 1FH, the granules left less 1: the Z FLAG when the first granule of the extent is done.
5342
If the Z FLAG is set (the extent is done), JUMP to 5347H for the next extent.
5344
DEC B 05
DECrement Register B: one granule fewer left, the next one down.
5345
JUMP to 530EH for the granule before in the extent.
5347
POP BC C1
Restore Register Pair BC, the pairs left in Register B, from the top of the stack.
5348
INC L 2C
INCrement Register L to the second byte of the extent.
5349
INC L 2C
INCrement Register L to the next extent, two bytes on.
534A
JUMP to 52FFH for the next extent of the entry.
534CH - A Link or the End
FFH ends the entry. FEH is right only in the fifth pair, and the extended entry it names must be an FXDE whose back link (+01H) is this entry; it is then made active if it is not (Extended directory entry deleted), gets the file's hash code in the HIT, and its own extents are taken with the same count. Any other FEH is Invalid linking SD, and the pair is made FFH FFH.
534C
If the NZ FLAG is set (FFH, the end), JUMP to 5384H to compare the granules found with those needed.
534E
PUSH HL E5
Save Register Pair HL, the address of the link's second byte, to the top of the stack.
534F
DEC B 05
DECrement Register B, the pairs left: the Z FLAG only when FEH is in the fifth pair, +1EH.
5350
If the NZ FLAG is set (FEH in an extent's place), JUMP to 537BH for the message Invalid linking SD.
5352
GOSUB to 54F2H for the logical file number of the entry at Register Pair HL in Register B.
5355
LD C,B 48
Load Register C with Register B, the logical file number of this entry, which the extended one must link back to.
5356
LD B,(HL) 46
Load Register B with the byte after FEH at Register Pair HL: the logical file number of the extended entry.
5357
GOSUB to 54FCH to point Register Pair HL to the entry of logical file number Register B in the buffers.
535A
BIT 7,(HL) CB 7E
Test bit 7 of the flag byte at Register Pair HL: set for an extended entry (FXDE).
535C
If the Z FLAG is set (not an extended entry), JUMP to 537BH for the message Invalid linking SD.
535E
INC L 2C
INCrement Register L to +01H, the extended entry's back link.
535F
LD A,(HL) 7E
Load Register A with the back link at Register Pair HL: the logical file number of the entry before it.
5360
DEC L 2D
DECrement Register L back to the extended entry's flag byte.
5361
CP C B9
Compare Register A, the back link, against Register C, the logical file number of this entry.
5362
If the NZ FLAG is set (it links back elsewhere), JUMP to 537BH for the message Invalid linking SD.
5364
PUSH HL E5
Save Register Pair HL, the address of the extended entry, to the top of the stack.
5365
BIT 4,(HL) CB 66
Test bit 4 of the extended entry's flag byte at Register Pair HL: set for an active entry.
5367
If the Z FLAG is set (not active), GOSUB to 5624H for the message Extended directory entry deleted.
536A
SET 4,(HL) CB E6
Set bit 4 of the flag byte at Register Pair HL: the extended entry is active in the buffer.
536C
LD L,B 68
Load Register L with Register B, the logical file number of the extended entry: its offset in the HIT.
536D
LD H,5CH 26 5C
Load Register H with 5CH: Register Pair HL = its byte in DIRCHECK's own HIT at 5C00H.
536F
LD A,(597EH) 3A 7E 59
Load Register A with the hash code of the file's name from 597EH.
5372
LD (HL),A 77
Store Register A, the file's hash code, into the extended entry's byte of the HIT at Register Pair HL.
5373
POP HL E1
Restore Register Pair HL, the address of the extended entry, from the top of the stack.
5374
LD A,16H 3E 16
Load Register A with 16H, the offset of the first extent of an entry.
5376
ADD A,L 85
ADD Register L to Register A: the low byte of the extended entry's first extent, +16H.
5377
LD L,A 6F
Load Register L with Register A: Register Pair HL to the extended entry's extents.
5378
POP AF F1
Restore Register Pair AF from the top of the stack, which drops the address saved at 534EH.
5379
JUMP to 52FDH to take the extents of the extended entry, the count in Register Pair DE going on.
537B
POP HL E1
Restore Register Pair HL, the address of the link's second byte, from the top of the stack.
537C
GOSUB to 562CH for the message Invalid linking SD with the file's name.
537F
LD (HL),FFH 36 FF
Store FFH into the second byte of the pair at Register Pair HL.
5381
DEC L 2D
DECrement Register L to the first byte of the pair.
5382
LD (HL),FFH 36 FF
Store FFH into the first byte of the pair at Register Pair HL: the entry ends here.
5384H - The Granules Needed
When the extents hold fewer granules than the sector count needs, the message EOF greater than allocated space is shown and the sector count at +14H is set to the granules found times DCT+0FH. More granules than needed are not reported.
5384
LD HL,(597FH) 2A 7F 59
Load Register Pair HL with the granules the file needs, from 597FH-5980H.
5387
OR A B7
Clear the C FLAG (OR A with Register A itself) for the 16 bit subtraction below.
5388
SBC HL,DE ED 52
SUBtract Register Pair DE, the granules found, from Register Pair HL with the carry.
538A
If the Z FLAG is set (as many found as needed), JUMP to 53C4H for the next entry.
538C
If the C FLAG is set (more found than needed), JUMP to 53C4H for the next entry.
538F
GOSUB to 5634H for the message EOF greater than allocated space with the file's name.
5392
EX DE,HL EB
EXchange Register Pair DE with Register Pair HL: Register Pair HL = the granules found.
5393
LD A,(IY+0FH) FD 7E 0F
Load Register A with the sectors per granule, DCT+0FH, at Index Register IY+0FH.
5396
GOSUB to 444EH, MULT@, to multiply Register Pair HL by Register A: the sectors of the granules found.
5399
POP IX DD E1
Restore Index Register IX from the top of the stack: the address of the file's entry, saved at 52C2H.
539B
PUSH IX DD E5
Save Index Register IX, the address of the entry, to the top of the stack again for 53C4H.
539D
LD (IX+14H),L DD 75 14
Store Register L, the low byte of the new sector count, into the entry at Index Register IX+14H.
53A0
LD (IX+15H),H DD 74 15
Store Register H, the high byte of the new sector count, into the entry at Index Register IX+15H.
53A3
JUMP to 53C4H for the next entry, the sector count now set.
53A5H - An Extended Entry
An active extended entry must be linked from the entry its back link names: that entry must be active and hold FEH and this entry's number in its fifth pair. Otherwise the message Extended directory entry unassigned at nnH is shown and the extended entry's flag byte is set to 00H.
53A5
LD C,B 48
Load Register C with Register B, the logical file number of the extended entry.
53A6
INC L 2C
INCrement Register L to +01H, the extended entry's back link.
53A7
LD B,(HL) 46
Load Register B with the back link at Register Pair HL: the logical file number of the entry before it.
53A8
GOSUB to 54FCH to point Register Pair HL to the entry of logical file number Register B in the buffers.
53AB
BIT 4,(HL) CB 66
Test bit 4 of that entry's flag byte at Register Pair HL: set for an active entry.
53AD
If the Z FLAG is set (not active), JUMP to 53BDH for the message Extended directory entry unassigned.
53AF
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address.
53B0
ADD A,1EH C6 1E
ADD 1EH to Register A: the offset of the fifth pair, +1EH.
53B2
LD L,A 6F
Load Register L with Register A: Register Pair HL to the entry's fifth pair.
53B3
LD A,(HL) 7E
Load Register A with the first byte of the fifth pair at Register Pair HL.
53B4
INC L 2C
INCrement Register L to the second byte of the fifth pair, +1FH.
53B5
CP FEH FE FE
Compare Register A against FEH, the link to an extended entry.
53B7
If the NZ FLAG is set (no link), JUMP to 53BDH for the message Extended directory entry unassigned.
53B9
LD A,(HL) 7E
Load Register A with the logical file number in the link at Register Pair HL.
53BA
CP C B9
Compare Register A against Register C, the logical file number of this extended entry.
53BB
If the Z FLAG is set (linked from there), JUMP to 53C4H for the next entry.
53BD
POP HL E1
Restore Register Pair HL, the address of the extended entry, from the top of the stack.
53BE
PUSH HL E5
Save Register Pair HL, the address of the extended entry, to the top of the stack again for 53C4H.
53BF
GOSUB to 563CH for the message Extended directory entry unassigned at nnH, its logical file number.
53C2
LD (HL),00H 36 00
Store 00H into the extended entry's flag byte at Register Pair HL: the entry is no longer in use.
53C4H - The Next Entry
After each entry the keyboard is looked at (SPACE BAR pauses, BREAK is Terminated), then the next entry, 20H on, up to the end of the last directory sector.
53C4
POP HL E1
Restore Register Pair HL, the address of the entry, from the top of the stack.
53C5
GOSUB to 55D0H to look at the keyboard: the SPACE BAR waits for a key, the Z FLAG for BREAK.
53C8
If the Z FLAG is set (BREAK), JUMP to 56FAH for the error 30H, Terminated.
53CB
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a directory entry.
53CE
ADD HL,BC 09
ADD Register Pair BC (0020H) to Register Pair HL, to the next entry.
53CF
LD A,H 7C
Load Register A with Register H, the page of the entry.
53D0
SUB 5DH D6 5D
SUBtract 5DH from Register A: the directory sector the entry is in.
53D2
CP (IY+0EH) FD BE 0E
Compare Register A against the directory length, DCT+0EH, at Index Register IY+0EH: the C FLAG for a sector of the directory.
53D5
If the C FLAG is set (more entries), JUMP to 52C2H to look at the next entry.
53D8H - BOOT/SYS and DIR/SYS
The first entry of sector 2 (logical file number 00H) must have the hash code A2H, that of BOOT/SYS, and the first of sector 3 (01H) C4H, that of DIR/SYS; each must have a sector count that is not 0000H.
53D8
LD A,(5C00H) 3A 00 5C
Load Register A with the byte of DIRCHECK's own HIT at 5C00H, the hash code of logical file number 00H.
53DB
CP A2H FE A2
Compare Register A against A2H, the hash code of BOOT/SYS.
53DD
If the NZ FLAG is set (not BOOT/SYS), GOSUB to 568AH for the message BOOT/SYS not found.
53E0
If the NZ FLAG is set (not found), JUMP to 53EAH to look for DIR/SYS.
53E2
LD HL,(5F14H) 2A 14 5F
Load Register Pair HL with the sector count of BOOT/SYS's entry from 5F14H-5F15H.
53E5
LD A,H 7C
Load Register A with Register H, the high byte of the sector count.
53E6
OR L B5
OR Register A with Register L, the low byte: the Z FLAG for a sector count of 0000H.
53E7
If the Z FLAG is set (no sectors), GOSUB to 5693H for the message BOOT/SYS not assigned space.
53EA
LD A,(5C01H) 3A 01 5C
Load Register A with the byte of DIRCHECK's own HIT at 5C01H, the hash code of logical file number 01H.
53ED
CP C4H FE C4
Compare Register A against C4H, the hash code of DIR/SYS.
53EF
If the NZ FLAG is set (not DIR/SYS), GOSUB to 569CH for the message DIR/SYS not found.
53F2
If the NZ FLAG is set (not found), JUMP to 53FDH to compare the tables.
53F5
LD HL,(6014H) 2A 14 60
Load Register Pair HL with the sector count of DIR/SYS's entry from 6014H-6015H.
53F8
LD A,H 7C
Load Register A with Register H, the high byte of the sector count.
53F9
OR L B5
OR Register A with Register L, the low byte: the Z FLAG for a sector count of 0000H.
53FA
If the Z FLAG is set (no sectors), GOSUB to 56A5H for the message DIR/SYS not assigned space.
53FDH - Compare the GATs
For each cylinder of the count: with CYL0, cylinder 0 of DIRCHECK's own GAT is set to FFH. On a floppy drive a granule in use that the diskette's lock out table (GAT+60H) locks out is Locked gran assigned to file at nnH, and the lock out table is copied into DIRCHECK's tables with the mask (the locked out granules count as in use). Then every byte that differs from the diskette's GAT is Extraneous or unassigned gran at nnH, the cylinder.
53FD
PUSH IY FD E5
Save Index Register IY, the address of the drive control table, to the top of the stack.
53FF
LD A,(597BH) 3A 7B 59
Load Register A with the cylinder count from 597BH.
5402
LD B,A 47
Load Register B with Register A, the cylinders to compare.
5403
LD IX,5B00H DD 21 00 5B
Point Index Register IX to 5B00H, DIRCHECK's own GAT.
5407
LD IY,5D00H FD 21 00 5D
Point Index Register IY to 5D00H, the diskette's GAT as read.
540B
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 540CH-540DH where EVAL@ stores the value of CYL0: FFFFH for Y, 0000H for N or none.
540E
INC E 1C
INCrement Register E, the low byte of CYL0's value, the first of two that test it.
540F
DEC E 1D
DECrement Register E again: the Z FLAG when CYL0 was not given.
5410
If the Z FLAG is set (no CYL0), JUMP to 5416H to compare cylinder 0 as it is.
5412
LD (IX+00H),FFH DD 36 00 FF
Store FFH into cylinder 0 of DIRCHECK's own GAT at Index Register IX+00H: every granule of cylinder 0 counts as in use.
5416
EX (SP),IY FD E3
EXchange Index Register IY with the top of the stack at the Stack Pointer: Index Register IY = the drive control table again.
5418
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of the drive control table's flags, DCT+03H, at Index Register IY+03H: set for a rigid drive.
541C
EX (SP),IY FD E3
EXchange Index Register IY with the top of the stack at the Stack Pointer: Index Register IY = the diskette's GAT again.
541E
If the NZ FLAG is set (a rigid drive, no lock out table), JUMP to 543BH to compare the cylinder's byte.
5420
LD A,(597CH) 3A 7C 59
Load Register A with the mask of the granules a cylinder does not have from 597CH.
5423
XOR (IX+00H) DD AE 00
XOR Register A with DIRCHECK's GAT byte at Index Register IX+00H: the granules in use that the cylinder has.
5426
AND (IY+60H) FD A6 60
AND Register A with the diskette's lock out byte at Index Register IY+60H: the NZ FLAG for a locked out granule in use.
5429
If the NZ FLAG is set (a locked out granule in use), GOSUB to 56AEH for the message Locked gran assigned to file at nnH.
542C
LD A,(597CH) 3A 7C 59
Load Register A with the mask of the granules a cylinder does not have from 597CH.
542F
OR (IY+60H) FD B6 60
OR Register A with the diskette's lock out byte at Index Register IY+60H.
5432
LD (IX+60H),A DD 77 60
Store Register A, the lock out byte with the mask, into DIRCHECK's lock out table at Index Register IX+60H.
5435
OR (IX+00H) DD B6 00
OR Register A with DIRCHECK's GAT byte at Index Register IX+00H: the locked out granules count as in use.
5438
LD (IX+00H),A DD 77 00
Store Register A into DIRCHECK's GAT byte of the cylinder at Index Register IX+00H.
543B
LD A,(IX+00H) DD 7E 00
Load Register A with DIRCHECK's GAT byte of the cylinder at Index Register IX+00H.
543E
XOR (IY+00H) FD AE 00
XOR Register A with the diskette's GAT byte at Index Register IY+00H: the NZ FLAG when they differ.
5441
If the NZ FLAG is set (they differ), GOSUB to 56C1H for the message Extraneous or unassigned gran at nnH.
5444
INC IX DD 23
INCrement Index Register IX to the next cylinder of DIRCHECK's GAT.
5446
INC IY FD 23
INCrement Index Register IY to the next cylinder of the diskette's GAT.
5448
DECrement Register B and, while it is not zero, LOOP BACK to 5416H for the next cylinder (DJNZ).
544A
POP IY FD E1
Restore Index Register IY, the address of the drive control table, from the top of the stack.
544CH - Compare the HITs
Each of the 256 bytes of DIRCHECK's own HIT is compared with the diskette's HIT: a code where DIRCHECK has 00H is Extraneous HIT code at nnH, any other difference Invalid HIT code at nnH, the logical file number.
544C
LD DE,5C00H 11 00 5C
Point Register Pair DE to 5C00H, DIRCHECK's own HIT.
544F
LD HL,5E00H 21 00 5E
Point Register Pair HL to 5E00H, the diskette's HIT as read.
5452
LD A,(DE) 1A
Load Register A with DIRCHECK's HIT byte at Register Pair DE.
5453
CP (HL) BE
Compare Register A against the diskette's HIT byte at Register Pair HL.
5454
If the Z FLAG is set (the same), JUMP to 545DH for the next byte.
5456
OR A B7
Test Register A, DIRCHECK's byte: the Z FLAG when DIRCHECK has no entry there.
5457
If the Z FLAG is set (no entry), GOSUB to 56D1H for the message Extraneous HIT code at nnH.
545A
If the NZ FLAG is set (another code), GOSUB to 56E1H for the message Invalid HIT code at nnH.
545D
INC L 2C
INCrement Register L to the next byte of the diskette's HIT.
545E
INC E 1C
INCrement Register E to the next byte of DIRCHECK's HIT; the Z FLAG after the last.
545F
If the NZ FLAG is set (more bytes), JUMP to 5452H to compare the next byte.
5461H - GAT: Write DIRCHECK's GAT
With GAT, DIRCHECK's own GAT is written as sector 0 of the directory cylinder (SWRITE): the diskette's bytes +CEH-+FFH (the password code, the name and the date) are copied into it, +CBH is set to 35H, +CCH to the cylinder count less 35, and +CDH to 01H on a rigid drive or, on a floppy, the sides less 1 in bit 5 from DCT+0CH: so the surface count comes from the drive's configuration.
5461
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 5462H-5463H where EVAL@ stores the value of GAT: FFFFH for Y, 0000H for N or none.
5464
INC E 1C
INCrement Register E, the low byte of GAT's value, the first of two that test it.
5465
DEC E 1D
DECrement Register E again: the Z FLAG when GAT was not given.
5466
If the Z FLAG is set (no GAT), JUMP to 54A3H for the HIT.
5468
LD HL,5DCEH 21 CE 5D
Point Register Pair HL to 5DCEH, the diskette's GAT+CEH, the password code, the name and the date.
546B
LD DE,5BCEH 11 CE 5B
Point Register Pair DE to 5BCEH, the same place in DIRCHECK's own GAT.
546E
LD BC,0032H 01 32 00
Load Register Pair BC with 0032H, the 50 bytes +CEH-+FFH.
5471
LDIR ED B0
Copy the 50 bytes from Register Pair HL to Register Pair DE, counted by Register Pair BC (LDIR).
5473
LD A,35H 3E 35
Load Register A with 35H, the byte of GAT+CBH: 35 cylinders, the base of the count.
5475
LD (5BCBH),A 32 CB 5B
Store Register A (35H) into 5BCBH, DIRCHECK's GAT+CBH.
5478
LD A,(597BH) 3A 7B 59
Load Register A with the cylinder count from 597BH.
547B
SUB 23H D6 23
SUBtract 23H from Register A: the cylinders less 35, the form of GAT+CCH.
547D
LD (5BCCH),A 32 CC 5B
Store Register A into 5BCCH, DIRCHECK's GAT+CCH.
5480
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of the drive control table's flags, DCT+03H, at Index Register IY+03H: set for a rigid drive.
5484
LD A,01H 3E 01
Load Register A with 01H, the byte of GAT+CDH for a rigid drive.
5486
If the NZ FLAG is set (a rigid drive), JUMP to 548FH to store 01H.
5488
LD A,(IY+0CH) FD 7E 0C
Load Register A with the surfaces, DCT+0CH, at Index Register IY+0CH: 1 or 2 from the drive's configuration.
548B
DEC A 3D
DECrement Register A: 00H for one side, 01H for two.
548C
RRCA 0F
Rotate Register A right one bit, the first of three that bring bit 0 to bit 5 (RRCA).
548D
RRCA 0F
Rotate Register A right one bit, the second of three that bring the sides to bit 5 (RRCA).
548E
RRCA 0F
Rotate Register A right one bit, the third of three: 20H for two sides (RRCA).
548F
LD (5BCDH),A 32 CD 5B
Store Register A into 5BCDH, DIRCHECK's GAT+CDH.
5492
LD A,(597AH) 3A 7A 59
Load Register A with the drive from 597AH, the one checked.
5495
LD C,A 4F
Load Register C with Register A, the drive, for DISKIO%.
5496
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder, the GAT.
5498
LD HL,5B00H 21 00 5B
Point Register Pair HL to 5B00H, DIRCHECK's own GAT.
549B
LD A,07H 3E 07
Load Register A with 07H, the function SWRITE of DISKIO%: write sector Register E of the directory cylinder.
549D
GOSUB to 4488H, DISKIO%, to write the GAT at Register Pair HL to drive Register C.
54A0
If the NZ FLAG is set (the write failed, its code in Register A), JUMP to 56FCH to post the error.
54A3H - HIT and FILES
With HIT, DIRCHECK's own HIT is written as sector 1; with FILES, the entry sectors 2 up to DCT+0EH less 1 are written back from the buffers, with the repairs made in them.
54A3
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 54A4H-54A5H where EVAL@ stores the value of HIT: FFFFH for Y, 0000H for N or none.
54A6
INC E 1C
INCrement Register E, the low byte of HIT's value, the first of two that test it.
54A7
DEC E 1D
DECrement Register E again: the Z FLAG when HIT was not given.
54A8
If the Z FLAG is set (no HIT), JUMP to 54BBH for FILES.
54AA
LD A,(597AH) 3A 7A 59
Load Register A with the drive from 597AH, the one checked.
54AD
LD C,A 4F
Load Register C with Register A, the drive, for DISKIO%.
54AE
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder, the HIT.
54B0
LD HL,5C00H 21 00 5C
Point Register Pair HL to 5C00H, DIRCHECK's own HIT.
54B3
LD A,07H 3E 07
Load Register A with 07H, the function SWRITE of DISKIO%: write sector Register E of the directory cylinder.
54B5
GOSUB to 4488H, DISKIO%, to write the HIT at Register Pair HL to drive Register C.
54B8
If the NZ FLAG is set (the write failed, its code in Register A), JUMP to 56FCH to post the error.
54BB
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 54BCH-54BDH where EVAL@ stores the value of FILES: FFFFH for Y, 0000H for N or none.
54BE
INC E 1C
INCrement Register E, the low byte of FILES's value, the first of two that test it.
54BF
DEC E 1D
DECrement Register E again: the Z FLAG when FILES was not given.
54C0
If the Z FLAG is set (no FILES), JUMP to 54DCH for the total.
54C2
LD A,(597AH) 3A 7A 59
Load Register A with the drive from 597AH, the one checked.
54C5
LD C,A 4F
Load Register C with Register A, the drive, for DISKIO%.
54C6
LD E,02H 1E 02
Load Register E with 02H, sector 2 of the directory cylinder, the first sector of entries.
54C8
LD HL,5F00H 21 00 5F
Point Register Pair HL to 5F00H, the buffer of sector 2.
54CB
LD A,07H 3E 07
Load Register A with 07H, the function SWRITE of DISKIO%: write sector Register E of the directory cylinder.
54CD
GOSUB to 4488H, DISKIO%, to write the sector at Register Pair HL to drive Register C.
54D0
If the NZ FLAG is set (the write failed, its code in Register A), JUMP to 56FCH to post the error.
54D3
INC H 24
INCrement Register H: Register Pair HL to the buffer of the next sector.
54D4
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory length, DCT+0EH, at Index Register IY+0EH: the sectors of the directory.
54D7
DEC A 3D
DECrement Register A: the number of the last sector of the directory.
54D8
INC E 1C
INCrement Register E to the next sector of the directory cylinder.
54D9
CP E BB
Compare Register A, the last sector, against Register E, the next one: the NC FLAG while it is not past the last.
54DA
If the NC FLAG is set (more sectors), JUMP to 54CBH to write the next sector.
54DCH - The Total
The count of messages at 5979H goes into the line DIRCHECK complete, nnn total errors, which is sent like the messages (and counted after it is sent); the output is closed and DIRCHECK returns to the DOS.
54DC
LD A,(5979H) 3A 79 59
Load Register A with the count of the messages sent, from 5979H.
54DF
LD HL,579FH 21 9F 57
Point Register Pair HL to 579FH, the three digits in the line DIRCHECK complete, 000 total errors.
54E2
GOSUB to 55B2H to write Register A as three decimal digits at Register Pair HL.
54E5
LD HL,578CH 21 8C 57
Point Register Pair HL to 578CH, the line DIRCHECK complete, nnn total errors.
54E8
GOSUB to 5588H to send the line at Register Pair HL to the output.
54EB
GOSUB to 5575H to close the output when it is a file.
54EE
If the NZ FLAG is set (CLOSE@ failed, its code in Register A), JUMP to 56FCH to post the error.
54F1
RET C9
RETurn to the DOS, whose return address was under the command line pointer.
54F2H - An Entry's Logical File Number
54F2H: the logical file number (DEC) of the entry at Register Pair HL in Register B: the entry's place in its sector (bits 7-5 of Register L) OR its sector less 2 (Register H less 5FH). 54FCH: the reverse, Register Pair HL to the entry of logical file number Register B.
54F2
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address.
54F3
AND E0H E6 E0
AND Register A with E0H, keeping bits 7-5: the entry's place in its sector.
54F5
LD B,A 47
Load Register B with Register A, the entry's place in bits 7-5.
54F6
LD A,H 7C
Load Register A with Register H, the page of the entry.
54F7
SUB 5FH D6 5F
SUBtract 5FH from Register A: the sector of the entry less 2.
54F9
OR B B0
OR Register A with Register B, the entry's place: the logical file number.
54FA
LD B,A 47
Load Register B with Register A, the logical file number of the entry.
54FB
RET C9
RETurn to the caller with the logical file number in Register B.
54FC
LD A,B 78
Load Register A with Register B, the logical file number.
54FD
AND E0H E6 E0
AND Register A with E0H, keeping bits 7-5: the entry's place in its sector.
54FF
LD L,A 6F
Load Register L with Register A, the low byte of the entry's address.
5500
XOR B A8
XOR Register A with Register B: bits 4-0 of the logical file number, the sector less 2.
5501
ADD A,5FH C6 5F
ADD 5FH to Register A: the page of the sector's buffer.
5503
LD H,A 67
Load Register H with Register A: Register Pair HL = the entry in the buffers.
5504
RET C9
RETurn to the caller with Register Pair HL at the entry of logical file number Register B.
5505H - The Hash Code of a Name
The 11 characters at Register Pair HL, each XORed in and the result rotated left; 00H becomes 01H, as the DOS's hash codes are never 00H.
5505
PUSH BC C5
Save Register Pair BC to the top of the stack.
5506
PUSH HL E5
Save Register Pair HL, the address of the name, to the top of the stack.
5507
LD BC,0B00H 01 00 0B
Load Register Pair BC with 0B00H: Register B = 0BH, the eleven characters, Register C = 00H, the code so far.
550A
LD A,(HL) 7E
Load Register A with the character of the name at Register Pair HL.
550B
INC HL 23
INCrement Register Pair HL to the next character of the name.
550C
XOR C A9
XOR Register A with Register C, the code so far.
550D
RLCA 07
Rotate Register A left one bit (RLCA), so each character is mixed in at another place.
550E
LD C,A 4F
Load Register C with Register A, the code so far.
550F
DECrement Register B and, while it is not zero, LOOP BACK to 550AH for the next character (DJNZ).
5511
OR A B7
Test Register A, the code: the Z FLAG for 00H.
5512
If the NZ FLAG is set (not 00H), JUMP to 5515H with the code in Register A.
5514
INC A 3C
INCrement Register A: a code of 00H becomes 01H.
5515
POP HL E1
Restore Register Pair HL, the address of the name, from the top of the stack.
5516
POP BC C1
Restore Register Pair BC from the top of the stack.
5517
RET C9
RETurn to the caller with the hash code in Register A.
5518H - Set, Reset and Test a Bit
Bit Register E (0-7) of Register A is set (5518H), reset (5528H) or tested (5538H) by an instruction whose second byte is made from Register E and stored into it before it runs.
5518
PUSH AF F5
Save Register Pair AF, the GAT byte in Register A, to the top of the stack.
5519
LD A,E 7B
Load Register A with Register E, the number of the bit.
551A
AND 07H E6 07
AND Register A with 07H, keeping the bit number 0-7.
551C
RLCA 07
Rotate Register A left one bit, the first of three that bring the bit number to bits 5-3 (RLCA).
551D
RLCA 07
Rotate Register A left one bit, the second of three that bring the bit number up (RLCA).
551E
RLCA 07
Rotate Register A left one bit, the third of three: the bit number in bits 5-3 (RLCA).
551F
OR C7H F6 C7
OR Register A with C7H, making the second byte of SET n,A.
5521
LD (5526H),A 32 26 55
Store Register A into 5526H, the second byte of the SET below.
5524
POP AF F1
Restore Register Pair AF, the GAT byte in Register A, from the top of the stack.
5525
SET 0,A CB C7
Set bit n of Register A, n made at 5526H: the granule is in use (SET 0,A as loaded).
5527
RET C9
RETurn to the caller with the bit of the granule set in Register A.
5528
PUSH AF F5
Save Register Pair AF, the mask in Register A, to the top of the stack.
5529
LD A,E 7B
Load Register A with Register E, the number of the bit.
552A
AND 07H E6 07
AND Register A with 07H, keeping the bit number 0-7.
552C
RLCA 07
Rotate Register A left one bit, the first of three that bring the bit number to bits 5-3 (RLCA).
552D
RLCA 07
Rotate Register A left one bit, the second of three that bring the bit number up (RLCA).
552E
RLCA 07
Rotate Register A left one bit, the third of three: the bit number in bits 5-3 (RLCA).
552F
OR 87H F6 87
OR Register A with 87H, making the second byte of RES n,A.
5531
LD (5536H),A 32 36 55
Store Register A into 5536H, the second byte of the RES below.
5534
POP AF F1
Restore Register Pair AF, the mask in Register A, from the top of the stack.
5535
RES 0,A CB 87
Reset bit n of Register A, n made at 5536H: a granule the cylinder has (RES 0,A as loaded).
5537
RET C9
RETurn to the caller with the bit reset in Register A.
5538
PUSH AF F5
Save Register Pair AF, the GAT byte in Register A, to the top of the stack.
5539
LD A,E 7B
Load Register A with Register E, the number of the bit.
553A
AND 07H E6 07
AND Register A with 07H, keeping the bit number 0-7.
553C
RLCA 07
Rotate Register A left one bit, the first of three that bring the bit number to bits 5-3 (RLCA).
553D
RLCA 07
Rotate Register A left one bit, the second of three that bring the bit number up (RLCA).
553E
RLCA 07
Rotate Register A left one bit, the third of three: the bit number in bits 5-3 (RLCA).
553F
OR 47H F6 47
OR Register A with 47H, making the second byte of BIT n,A.
5541
LD (5546H),A 32 46 55
Store Register A into 5546H, the second byte of the BIT below.
5544
POP AF F1
Restore Register Pair AF, the GAT byte in Register A, from the top of the stack.
5545
BIT 0,A CB 47
Test bit n of Register A, n made at 5546H: the NZ FLAG when the granule is in use (BIT 0,A as loaded).
5547
RET C9
RETurn to the caller with the NZ FLAG for a granule in use.
5548H - The Output
No destination: device 1 (@DO). A destination with a name or a drive (flag bits 6 or 3): INIT@ with the field's text at 59A3H as the file control block and the buffer 5A00H. Any other destination: its device number (flag bits 0-2) is given to LOCDCB%, and 59A3H becomes a FORCE control block (type 90H, the DCB address at 59A4H). Every character goes out by the ROM's 001BH with Register Pair DE = 59A3H; 5575H closes a file at the end.
5548
LD B,01H 06 01
Load Register B with 01H, device 1 (@DO), the output when no destination is given.
554A
BIT 1,(IX+00H) DD CB 00 4E
Test bit 1 of the flag byte at Index Register IX+00H, set by EVAL@ when a destination field was given.
554E
If the Z FLAG is set (no destination), JUMP to 5564H with Register B = 01H.
5550
LD A,(59A2H) 3A A2 59
Load Register A with the flag byte of the destination block from 59A2H: bit 6 a name, bit 3 a drive, bits 0-2 a number.
5553
LD B,A 47
Load Register B with Register A, the flag byte of the destination, for its device number.
5554
AND 48H E6 48
AND Register A with 48H, keeping bit 6 (a name) and bit 3 (a drive).
5556
If the Z FLAG is set (a device), JUMP to 5564H with its flag byte in Register B.
5558
LD B,00H 06 00
Load Register B with 00H, a logical record length of 256 for INIT@.
555A
LD DE,59A3H 11 A3 59
Point Register Pair DE to 59A3H, the destination field's text, used as the file control block.
555D
LD HL,5A00H 21 00 5A
Point Register Pair HL to 5A00H, the buffer of the output file.
5560
GOSUB to 4420H, INIT@, to open the file of the file control block at Register Pair DE, or make it.
5563
RET C9
RETurn to the caller with the Z FLAG when INIT@ opened the file, else its error code in Register A.
5564
LD A,B 78
Load Register A with Register B, the device number or the destination's flag byte.
5565
AND 07H E6 07
AND Register A with 07H, keeping bits 0-2, the device number.
5567
GOSUB to 44A0H, LOCDCB%, for the address of the device control block of device Register A in Register Pair DE.
556A
LD (59A4H),DE ED 53 A4 59
Store Register Pair DE, the address of the device control block, into 59A4H-59A5H.
556E
LD A,90H 3E 90
Load Register A with 90H, the type byte of a FORCE control block, which hands the bytes to the DCB after it.
5570
LD (59A3H),A 32 A3 59
Store Register A (90H) into 59A3H, the type byte of the output's control block.
5573
XOR A AF
Set Register A to 00H (XOR A) and the Z FLAG: the output is open.
5574
RET C9
RETurn to the caller with the Z FLAG, the device opened.
5575
LD DE,59A3H 11 A3 59
Point Register Pair DE to 59A3H, the control block of the output.
5578
LD A,(DE) 1A
Load Register A with the type byte of the control block at Register Pair DE.
5579
CP 90H FE 90
Compare Register A against 90H, the type byte of the FORCE control block of a device.
557B
If the NZ FLAG is set (a file), GOSUB to 4428H, CLOSE@, to close the file at Register Pair DE.
557E
RET C9
RETurn to the caller with the Z FLAG, or CLOSE@'s error code in Register A with the NZ FLAG.
557F
PUSH AF F5
Save Register Pair AF, the character in Register A, to the top of the stack.
5580
LD DE,59A3H 11 A3 59
Point Register Pair DE to 59A3H, the control block of the output.
5583
GOSUB to 001BH, the ROM's output of the byte in Register A to the control block at Register Pair DE.
5586
POP AF F1
Restore Register Pair AF, the character in Register A, from the top of the stack.
5587
RET C9
RETurn to the caller with the character sent.
5588H - A Message Line
Sends the text at Register Pair HL up to and with its 0DH, looks at the keyboard (BREAK is Terminated) and counts one error at 5979H.
5588
LD A,(HL) 7E
Load Register A with the character of the text at Register Pair HL.
5589
GOSUB to 557FH to send the character in Register A to the output.
558C
CP 0DH FE 0D
Compare Register A against 0DH, the carriage return that ends the line.
558E
If the Z FLAG is set (the end of the line), JUMP to 5593H.
5590
INC HL 23
INCrement Register Pair HL to the next character of the text.
5591
JUMP to 5588H to send the next character of the text.
5593
GOSUB to 55D0H to look at the keyboard: the SPACE BAR waits for a key, the Z FLAG for BREAK.
5596
If the Z FLAG is set (BREAK), JUMP to 56FAH for the error 30H, Terminated.
5599
LD HL,5979H 21 79 59
Point Register Pair HL to 5979H, the count of the messages sent.
559C
INC (HL) 34
INCrement the count of the messages at Register Pair HL: one error more.
559D
RET C9
RETurn to the caller with the line sent and counted.
559EH - Numbers in the Texts
559EH: Register A as two hexadecimal digits at Register Pair HL. 55B2H: Register A as three decimal digits at Register Pair HL. Register Pair HL ends after the digits.
559E
PUSH AF F5
Save Register Pair AF, the byte in Register A, to the top of the stack.
559F
RRA 1F
Rotate Register A right through the carry, the first of four that bring the high digit down (RRA).
55A0
RRA 1F
Rotate Register A right through the carry, the second of four that bring the high digit down (RRA).
55A1
RRA 1F
Rotate Register A right through the carry, the third of four that bring the high digit down (RRA).
55A2
RRA 1F
Rotate Register A right through the carry, the fourth: the high digit in bits 3-0 (RRA).
55A3
GOSUB to 55A7H to write the high digit in Register A at Register Pair HL.
55A6
POP AF F1
Restore Register Pair AF, the byte in Register A, from the top of the stack, for its low digit.
55A7
AND 0FH E6 0F
AND Register A with 0FH, keeping the digit 0-15 in bits 3-0.
55A9
ADD A,90H C6 90
ADD 90H to Register A, the first step of the DAA trick that makes a hexadecimal digit.
55AB
DAA 27
Decimal adjust Register A (DAA): 90H-99H for 0-9, 00H-05H with the C FLAG for 10-15.
55AC
ADC A,40H CE 40
ADD 40H with the carry to Register A, the second step of the DAA trick.
55AE
DAA 27
Decimal adjust Register A (DAA): the character 0-9 or A-F of the digit.
55AF
LD (HL),A 77
Store Register A, the character of the digit, at Register Pair HL.
55B0
INC HL 23
INCrement Register Pair HL to the place of the next character.
55B1
RET C9
RETurn to the caller with the hexadecimal digit written.
55B2
PUSH DE D5
Save Register Pair DE to the top of the stack.
55B3
LD DE,3030H 11 30 30
Load Register Pair DE with 3030H, the characters 0 and 0 for the hundreds and the tens.
55B6
SUB 64H D6 64
SUBtract 64H, one hundred, from Register A: the C FLAG when it goes below zero.
55B8
If the C FLAG is set (below zero), JUMP to 55BDH for the tens.
55BA
INC D 14
INCrement Register D, the character of the hundreds digit.
55BB
JUMP to 55B6H to take away another hundred from Register A.
55BD
ADD A,64H C6 64
ADD 64H to Register A, giving back the hundred taken away too many: the tens and the units.
55BF
SUB 0AH D6 0A
SUBtract 0AH, ten, from Register A: the C FLAG when it goes below zero.
55C1
If the C FLAG is set (below zero), JUMP to 55C6H for the units.
55C3
INC E 1C
INCrement Register E, the character of the tens digit.
55C4
JUMP to 55BFH to take away another ten from Register A.
55C6
ADD A,3AH C6 3A
ADD 3AH to Register A: the ten taken away too many and 30H, the units digit as a character.
55C8
LD (HL),D 72
Store Register D, the hundreds digit, at Register Pair HL.
55C9
INC HL 23
INCrement Register Pair HL to the place of the tens.
55CA
LD (HL),E 73
Store Register E, the tens digit, at Register Pair HL.
55CB
INC HL 23
INCrement Register Pair HL to the place of the units.
55CC
LD (HL),A 77
Store Register A, the units digit, at Register Pair HL.
55CD
INC HL 23
INCrement Register Pair HL to the place after the three digits.
55CE
POP DE D1
Restore Register Pair DE from the top of the stack.
55CF
RET C9
RETurn to the caller with the three digits written.
55D0H - The Keyboard
While a DO file runs (SFLAG1$ bit 5) the keyboard is not looked at. Otherwise the SPACE BAR waits for the next key; BREAK, then or at once, returns the Z FLAG.
55D0
LD A,(4297H) 3A 97 42
Load Register A with SFLAG1$ from 4297H, the system flags.
55D3
AND 20H E6 20
AND Register A with 20H, keeping bit 5, set while a DO file runs.
55D5
RET NZ C0
If the NZ FLAG is set (a DO file runs), RETurn with the NZ FLAG: no key is taken.
55D6
GOSUB to 002BH, the ROM's scan of the keyboard: Register A = the key pressed, or 00H.
55D9
CP 20H FE 20
Compare Register A against 20H, the SPACE BAR.
55DB
If the Z FLAG is set (the SPACE BAR), GOSUB to 0049H, the ROM's wait for a key: Register A = the next key.
55DE
CP 01H FE 01
Compare Register A against 01H, the BREAK key: the Z FLAG for BREAK.
55E0
RET C9
RETurn to the caller with the Z FLAG for BREAK.
55E1H - Keep the Registers
Called at the start of a message routine: the rest of the routine, from the return address, is called as a subroutine (the address stored into the CALL at 55EEH) with every register saved, so the routine returns to its own caller with all the registers and flags as they were.
55E1
EX (SP),HL E3
EXchange Register Pair HL with the top of the stack at the Stack Pointer: Register Pair HL = the return address, the rest of the routine.
55E2
LD (55EFH),HL 22 EF 55
Store Register Pair HL, the rest of the routine, into 55EFH-55F0H, the operand of the CALL at 55EEH.
55E5
POP HL E1
Restore Register Pair HL, the caller's Register Pair HL, from the top of the stack.
55E6
PUSH AF F5
Save Register Pair AF, the caller's Register A and flags, to the top of the stack.
55E7
PUSH BC C5
Save Register Pair BC, the caller's Register Pair BC, to the top of the stack.
55E8
PUSH DE D5
Save Register Pair DE, the caller's Register Pair DE, to the top of the stack.
55E9
PUSH HL E5
Save Register Pair HL, the caller's Register Pair HL, to the top of the stack.
55EA
PUSH IX DD E5
Save Index Register IX, the caller's value, to the top of the stack.
55EC
PUSH IY FD E5
Save Index Register IY, the caller's value, to the top of the stack.
55EE
GOSUB to the rest of the routine, the address stored at 55EFH (0000H as loaded).
55F1
POP IY FD E1
Restore Index Register IY, the caller's value, from the top of the stack.
55F3
POP IX DD E1
Restore Index Register IX, the caller's value, from the top of the stack.
55F5
POP HL E1
Restore Register Pair HL, the caller's Register Pair HL, from the top of the stack.
55F6
POP DE D1
Restore Register Pair DE, the caller's Register Pair DE, from the top of the stack.
55F7
POP BC C1
Restore Register Pair BC, the caller's Register Pair BC, from the top of the stack.
55F8
POP AF F1
Restore Register Pair AF, the caller's Register A and flags, from the top of the stack.
55F9
RET C9
RETurn to the caller of the message routine with every register as it was.
55FAH - The Messages
Each message routine keeps the registers (55E1H). 55FAH the cylinder count; 560CH-5634H a message after the file's name and extension (564EH, the entry of logical file number 597DH), 563CH one with the logical file number in hexadecimal, 568AH-56A5H BOOT/SYS and DIR/SYS, 56AEH and 56C1H one with the cylinder (the low byte of Index Register IX), 56D1H and 56E1H one with the place in the HIT (Register L). 56C1H does not keep the registers.
55FA
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
55FD
LD A,(597BH) 3A 7B 59
Load Register A with the byte at 597BH, the cylinder count, stored only at 5292H after this message.
5600
LD HL,57C2H 21 C2 57
Point Register Pair HL to 57C2H, the three digits in the line Cylinder count of 000 invalid.
5603
GOSUB to 55B2H to write Register A as three decimal digits at Register Pair HL.
5606
LD HL,57B0H 21 B0 57
Point Register Pair HL to 57B0H, the line Cylinder count of nnn invalid.
5609
JUMP to 5588H to send the line at Register Pair HL and count it.
560C
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
560F
LD HL,57CEH 21 CE 57
Point Register Pair HL to 57CEH, the message Terminating SD not found.
5612
JUMP to 564EH to send the file's name, then the message at Register Pair HL.
5614
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
5617
LD HL,57E7H 21 E7 57
Point Register Pair HL to 57E7H, the message Granule assigned past cyl count.
561A
JUMP to 564EH to send the file's name, then the message at Register Pair HL.
561C
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
561F
LD HL,5807H 21 07 58
Point Register Pair HL to 5807H, the message Granule multiply assigned.
5622
JUMP to 564EH to send the file's name, then the message at Register Pair HL.
5624
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
5627
LD HL,5821H 21 21 58
Point Register Pair HL to 5821H, the message Extended directory entry deleted.
562A
JUMP to 564EH to send the file's name, then the message at Register Pair HL.
562C
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
562F
LD HL,5842H 21 42 58
Point Register Pair HL to 5842H, the message Invalid linking SD.
5632
JUMP to 564EH to send the file's name, then the message at Register Pair HL.
5634
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
5637
LD HL,5855H 21 55 58
Point Register Pair HL to 5855H, the message EOF greater than allocated space.
563A
JUMP to 564EH to send the file's name, then the message at Register Pair HL.
563C
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
563F
LD A,(597DH) 3A 7D 59
Load Register A with the logical file number from 597DH, that of the extended entry.
5642
LD HL,589DH 21 9D 58
Point Register Pair HL to 589DH, the two digits in the message Extended directory entry unassigned at 00H.
5645
GOSUB to 559EH to write Register A as two hexadecimal digits at Register Pair HL.
5648
LD HL,5876H 21 76 58
Point Register Pair HL to 5876H, the message Extended directory entry unassigned at nnH.
564B
JUMP to 5588H to send the line at Register Pair HL and count it.
564E
PUSH HL E5
Save Register Pair HL, the address of the message, to the top of the stack.
564F
LD A,(597DH) 3A 7D 59
Load Register A with the logical file number from 597DH, that of the file's entry.
5652
LD B,A 47
Load Register B with Register A, the logical file number.
5653
GOSUB to 54FCH to point Register Pair HL to the entry of logical file number Register B in the buffers.
5656
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address.
5657
ADD A,05H C6 05
ADD 05H to Register A: the offset of the name, +05H.
5659
LD L,A 6F
Load Register L with Register A: Register Pair HL to the name of the entry.
565A
LD B,08H 06 08
Load Register B with 08H, the eight characters of a name.
565C
LD A,(HL) 7E
Load Register A with the character of the name at Register Pair HL.
565D
CP 20H FE 20
Compare Register A against 20H, the space that pads a short name.
565F
If the Z FLAG is set (the end of the name), JUMP to 5667H for the extension.
5661
GOSUB to 557FH to send the character in Register A to the output.
5664
INC L 2C
INCrement Register L to the next character of the name.
5665
DECrement Register B and, while it is not zero, LOOP BACK to 565CH for the next character (DJNZ).
5667
LD A,B 78
Load Register A with Register B, the characters of the name not sent.
5668
ADD A,L 85
ADD Register L to Register A: the low byte of the extension's address, +0DH.
5669
LD L,A 6F
Load Register L with Register A: Register Pair HL to the extension of the entry.
566A
LD A,(HL) 7E
Load Register A with the first character of the extension at Register Pair HL.
566B
CP 20H FE 20
Compare Register A against 20H, the space of an entry with no extension.
566D
If the Z FLAG is set (no extension), JUMP to 5681H to end the line.
566F
LD A,2FH 3E 2F
Load Register A with 2FH, the slash between the name and the extension.
5671
GOSUB to 557FH to send the slash in Register A to the output.
5674
LD B,03H 06 03
Load Register B with 03H, the three characters of an extension.
5676
LD A,(HL) 7E
Load Register A with the character of the extension at Register Pair HL.
5677
CP 20H FE 20
Compare Register A against 20H, the space that pads a short extension.
5679
If the Z FLAG is set (the end of the extension), JUMP to 5681H to end the line.
567B
GOSUB to 557FH to send the character in Register A to the output.
567E
INC L 2C
INCrement Register L to the next character of the extension.
567F
DECrement Register B and, while it is not zero, LOOP BACK to 5676H for the next character (DJNZ).
5681
LD A,0DH 3E 0D
Load Register A with 0DH, the carriage return that ends the line of the name.
5683
GOSUB to 557FH to send the carriage return in Register A to the output.
5686
POP HL E1
Restore Register Pair HL, the address of the message, from the top of the stack.
5687
JUMP to 5588H to send the message at Register Pair HL and count it.
568A
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
568D
LD HL,58A1H 21 A1 58
Point Register Pair HL to 58A1H, the message BOOT/SYS not found.
5690
JUMP to 5588H to send the line at Register Pair HL and count it.
5693
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
5696
LD HL,58B4H 21 B4 58
Point Register Pair HL to 58B4H, the message BOOT/SYS not assigned space.
5699
JUMP to 5588H to send the line at Register Pair HL and count it.
569C
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
569F
LD HL,58D0H 21 D0 58
Point Register Pair HL to 58D0H, the message DIR/SYS not found.
56A2
JUMP to 5588H to send the line at Register Pair HL and count it.
56A5
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
56A8
LD HL,58E2H 21 E2 58
Point Register Pair HL to 58E2H, the message DIR/SYS not assigned space.
56AB
JUMP to 5588H to send the line at Register Pair HL and count it.
56AE
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
56B1
PUSH IX DD E5
Save Index Register IX, the address of the cylinder's byte in DIRCHECK's GAT, to the top of the stack.
56B3
POP DE D1
Restore Register Pair DE from the top of the stack: Register E = the low byte of Index Register IX, the cylinder.
56B4
LD HL,591DH 21 1D 59
Point Register Pair HL to 591DH, the two digits in the message Locked gran assigned to file at 00H.
56B7
LD A,E 7B
Load Register A with Register E, the cylinder.
56B8
GOSUB to 559EH to write Register A as two hexadecimal digits at Register Pair HL.
56BB
LD HL,58FDH 21 FD 58
Point Register Pair HL to 58FDH, the message Locked gran assigned to file at nnH.
56BE
JUMP to 5588H to send the line at Register Pair HL and count it.
56C1
PUSH IX DD E5
Save Index Register IX, the address of the cylinder's byte in DIRCHECK's GAT, to the top of the stack.
56C3
POP DE D1
Restore Register Pair DE from the top of the stack: Register E = the low byte of Index Register IX, the cylinder.
56C4
LD HL,5942H 21 42 59
Point Register Pair HL to 5942H, the two digits in the message Extraneous or unassigned gran at 00H.
56C7
LD A,E 7B
Load Register A with Register E, the cylinder.
56C8
GOSUB to 559EH to write Register A as two hexadecimal digits at Register Pair HL.
56CB
LD HL,5921H 21 21 59
Point Register Pair HL to 5921H, the message Extraneous or unassigned gran at nnH.
56CE
JUMP to 5588H to send the line at Register Pair HL and count it.
56D1
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
56D4
LD A,L 7D
Load Register A with Register L, the place in the HIT: the logical file number.
56D5
LD HL,595DH 21 5D 59
Point Register Pair HL to 595DH, the two digits in the message Extraneous HIT code at 00H.
56D8
GOSUB to 559EH to write Register A as two hexadecimal digits at Register Pair HL.
56DB
LD HL,5946H 21 46 59
Point Register Pair HL to 5946H, the message Extraneous HIT code at nnH.
56DE
JUMP to 5588H to send the line at Register Pair HL and count it.
56E1
GOSUB to 55E1H, so the rest of this routine runs with every register kept.
56E4
LD A,L 7D
Load Register A with Register L, the place in the HIT: the logical file number.
56E5
LD HL,5975H 21 75 59
Point Register Pair HL to 5975H, the two digits in the message Invalid HIT code at 00H.
56E8
GOSUB to 559EH to write Register A as two hexadecimal digits at Register Pair HL.
56EB
LD HL,5961H 21 61 59
Point Register Pair HL to 5961H, the message Invalid HIT code at nnH.
56EE
JUMP to 5588H to send the line at Register Pair HL and count it.
56F1H - The Errors
56F1H the error 21H, No memory space available; 56F4H, inside the LD BC at 56F3H, 2BH, Illegal devicespec; 56F7H, inside the LD BC at 56F6H, 08H, Drive not available; 56FAH, inside the LD BC at 56F9H, 30H, Terminated; 56FCH any error code in Register A. Each is posted with bit 6 set (no frame) and bit 7 clear, so ERROR@ ends through ABORT@.
56F1
LD A,21H 3E 21
Load Register A with 21H, the error code of No memory space available, and fall into the LD BC below.
56F3
LD BC,2B3EH 01 3E 2B
56F4H enters inside this LD BC,2B3EH: its bytes 3EH 2BH read as LD A,2BH, Illegal devicespec; from above it only loads Register Pair BC.
56F6
LD BC,083EH 01 3E 08
56F7H enters inside this LD BC,083EH: its bytes 3EH 08H read as LD A,08H, Drive not available; from above it only loads Register Pair BC.
56F9
LD BC,303EH 01 3E 30
56FAH enters inside this LD BC,303EH: its bytes 3EH 30H read as LD A,30H, Terminated; from above it only loads Register Pair BC.
56FC
OR 40H F6 40
OR Register A with 40H, setting bit 6 of the error code: ERROR@ shows the message without the frame of asterisks.
56FE
JUMP to 4409H, ERROR@, with the error code in Register A; with bit 7 clear ERROR@ does not return but ends through ABORT@.
5701H - The Evaluation Block, the Texts and the Variables
Data: the evaluation block and its parameter table (GAT, HIT, FILES, CYL0, each a logical value stored into the operand of a LD DE), the heading, the total line and the messages, each ended by 0DH, with the places their numbers are written into, and the count of the messages. 597AH on is not loaded: the variables, the field blocks, the output's buffer and the tables.
5701
DEFB 00H 00
The flags of the evaluation block, set by EVAL@: bit 0 the source, 1 the destination, 2 the wildmask, 3 the parameters.
5702-5703
DEFW 5981H 81 59
The address of the source field's block, 5981H, the drive to check.
5704-5705
DEFW 59A2H A2 59
The address of the destination field's block, 59A2H, the output.
5706-5707
DEFW 59A2H A2 59
The address of the wildmask field's block, the destination's block again: DIRCHECK takes no wildmask.
5708-5709
DEFW 570AH 0A 57
The address of the parameter block, 570AH, the entries GAT, HIT, FILES and CYL0.
570A-570F
DEFM "GAT " 47 41 54 20 20 20
The name of the parameter GAT (or G): write DIRCHECK's own granule allocation table.
5710-5711
DEFW 5462H 62 54
The address for GAT's value, the operand of LD DE at 5461H.
5712
DEFB 20H 20
The type byte of GAT: a logical value only (bit 5), Y or N, or the name alone for Y.
5713-5718
DEFM "HIT " 48 49 54 20 20 20
The name of the parameter HIT (or H): write DIRCHECK's own hash index table.
5719-571A
DEFW 54A4H A4 54
The address for HIT's value, the operand of LD DE at 54A3H.
571B
DEFB 20H 20
The type byte of HIT: a logical value only (bit 5), Y or N, or the name alone for Y.
571C-5721
DEFM "FILES " 46 49 4C 45 53 20
The name of the parameter FILES (or F): write the entry sectors back with their repairs.
5722-5723
DEFW 54BCH BC 54
The address for FILES's value, the operand of LD DE at 54BBH.
5724
DEFB 20H 20
The type byte of FILES: a logical value only (bit 5), Y or N, or the name alone for Y.
5725-572A
DEFM "CYL0 " 43 59 4C 30 20 20
The name of the parameter CYL0 (or C): every granule of cylinder 0 counts as in use.
572B-572C
DEFW 540CH 0C 54
The address for CYL0's value, the operand of LD DE at 540BH.
572D
DEFB 20H 20
The type byte of CYL0: a logical value only (bit 5), Y or N, or the name alone for Y.
572E
DEFB 00H 00
The 00H that ends the parameter table for EVAL@.
572F-575A
DEFM "DIRCHECK - DOSPLUS directory checker - 3.50" / DEFB 0AH 44 49 52 43 48 45 43 4B 20 2D 20 44 4F 53 50 4C 55 53 20 64 69 72 65 63 74 6F 72 79 20 63 68 65 63 6B 65 72 20 2D 20 33 2E 35 30 0A
The heading (5201H): DIRCHECK - DOSPLUS directory checker - 3.50 and a line feed.
575B-578A
DEFM "(c) Copyright 1983, Micro-Systems Software Inc." / DEFB 0AH 28 63 29 20 43 6F 70 79 72 69 67 68 74 20 31 39 38 33 2C 20 4D 69 63 72 6F 2D 53 79 73 74 65 6D 73 20 53 6F 66 74 77 61 72 65 20 49 6E 63 2E 0A
The copyright line of the heading and a line feed.
578B
DEFB 0DH 0D
The carriage return that ends the heading for DSPLY@.
578C-57AF
DEFM "DIRCHECK complete, 000 total errors" / DEFB 0DH 44 49 52 43 48 45 43 4B 20 63 6F 6D 70 6C 65 74 65 2C 20 30 30 30 20 74 6F 74 61 6C 20 65 72 72 6F 72 73 0D
The last line (54E5H); the count of the messages is written over 000 at 579FH.
57B0-57CD
DEFM "Cylinder count of 000 invalid" / DEFB 0DH 43 79 6C 69 6E 64 65 72 20 63 6F 75 6E 74 20 6F 66 20 30 30 30 20 69 6E 76 61 6C 69 64 0D
Message (5606H): the GAT's count is too large; the number is written over 000 at 57C2H.
57CE-57E6
DEFM "Terminating SD not found" / DEFB 0DH 54 65 72 6D 69 6E 61 74 69 6E 67 20 53 44 20 6E 6F 74 20 66 6F 75 6E 64 0D
Message (560FH): the fifth pair of an entry holds an extent, not FFH or FEH.
57E7-5806
DEFM "Granule assigned past cyl count" / DEFB 0DH 47 72 61 6E 75 6C 65 20 61 73 73 69 67 6E 65 64 20 70 61 73 74 20 63 79 6C 20 63 6F 75 6E 74 0D
Message (5617H): an extent reaches past the last cylinder.
5807-5820
DEFM "Granule multiply assigned" / DEFB 0DH 47 72 61 6E 75 6C 65 20 6D 75 6C 74 69 70 6C 79 20 61 73 73 69 67 6E 65 64 0D
Message (561FH): a granule belongs to more than one extent.
5821-5841
DEFM "Extended directory entry deleted" / DEFB 0DH 45 78 74 65 6E 64 65 64 20 64 69 72 65 63 74 6F 72 79 20 65 6E 74 72 79 20 64 65 6C 65 74 65 64 0D
Message (5627H): a file links to an extended entry that is not active.
5842-5854
DEFM "Invalid linking SD" / DEFB 0DH 49 6E 76 61 6C 69 64 20 6C 69 6E 6B 69 6E 67 20 53 44 0D
Message (562FH): a link FEH in an extent's place, or to an entry that is not its extended entry.
5855-5875
DEFM "EOF greater than allocated space" / DEFB 0DH 45 4F 46 20 67 72 65 61 74 65 72 20 74 68 61 6E 20 61 6C 6C 6F 63 61 74 65 64 20 73 70 61 63 65 0D
Message (5637H): the sector count needs more granules than the extents hold.
5876-58A0
DEFM "Extended directory entry unassigned at 00H" / DEFB 0DH 45 78 74 65 6E 64 65 64 20 64 69 72 65 63 74 6F 72 79 20 65 6E 74 72 79 20 75 6E 61 73 73 69 67 6E 65 64 20 61 74 20 30 30 48 0D
Message (5648H): an extended entry no file links to; its number is written at 589DH.
58A1-58B3
DEFM "BOOT/SYS not found" / DEFB 0DH 42 4F 4F 54 2F 53 59 53 20 6E 6F 74 20 66 6F 75 6E 64 0D
Message (568DH): the first entry of sector 2 is not BOOT/SYS.
58B4-58CF
DEFM "BOOT/SYS not assigned space" / DEFB 0DH 42 4F 4F 54 2F 53 59 53 20 6E 6F 74 20 61 73 73 69 67 6E 65 64 20 73 70 61 63 65 0D
Message (5696H): BOOT/SYS has a sector count of 0000H.
58D0-58E1
DEFM "DIR/SYS not found" / DEFB 0DH 44 49 52 2F 53 59 53 20 6E 6F 74 20 66 6F 75 6E 64 0D
Message (569FH): the first entry of sector 3 is not DIR/SYS.
58E2-58FC
DEFM "DIR/SYS not assigned space" / DEFB 0DH 44 49 52 2F 53 59 53 20 6E 6F 74 20 61 73 73 69 67 6E 65 64 20 73 70 61 63 65 0D
Message (56A8H): DIR/SYS has a sector count of 0000H.
58FD-5920
DEFM "Locked gran assigned to file at 00H" / DEFB 0DH 4C 6F 63 6B 65 64 20 67 72 61 6E 20 61 73 73 69 67 6E 65 64 20 74 6F 20 66 69 6C 65 20 61 74 20 30 30 48 0D
Message (56BBH): a locked out granule is in use; the cylinder is written at 591DH.
5921-5945
DEFM "Extraneous or unassigned gran at 00H" / DEFB 0DH 45 78 74 72 61 6E 65 6F 75 73 20 6F 72 20 75 6E 61 73 73 69 67 6E 65 64 20 67 72 61 6E 20 61 74 20 30 30 48 0D
Message (56CBH): the GAT byte of a cylinder differs; the cylinder is written at 5942H.
5946-5960
DEFM "Extraneous HIT code at 00H" / DEFB 0DH 45 78 74 72 61 6E 65 6F 75 73 20 48 49 54 20 63 6F 64 65 20 61 74 20 30 30 48 0D
Message (56DBH): a HIT code with no entry; its place is written at 595DH.
5961-5978
DEFM "Invalid HIT code at 00H" / DEFB 0DH 49 6E 76 61 6C 69 64 20 48 49 54 20 63 6F 64 65 20 61 74 20 30 30 48 0D
Message (56EBH): a HIT code that is not the entry's; its place is written at 5975H.
5979
DEFB 00H 00
The count of the messages sent (559CH), shown in the last line (54DCH).
597A
DEFS 1
The drive to check (524DH), read for each DISKIO% call.
597B
DEFS 1
The cylinder count used (5292H): GAT+CCH plus 35, at most 96 or 200.
597C
DEFS 1
The mask of the granules a cylinder does not have (52A2H).
597D
DEFS 1
The logical file number of the entry being checked (52CCH), for the messages.
597E
DEFS 1
The hash code of the file's name (52DEH), put into the HIT for its extended entries.
597F-5980
DEFS 2
The granules the file's sector count needs (52F6H), compared at 5384H.
5981-59A1
DEFS 33
The source field's block (5702H): its flag byte at 5981H (523FH) and the drive's text.
59A2-59C2
DEFS 33
The destination field's block (5704H): its flag byte at 59A2H (5550H) and the text from 59A3H, the file control block of an output file or, for a device, the type byte 90H and the DCB address (556AH).
5A00-5AFF
DEFS 256
The buffer of an output file (555DH), given to INIT@.
5B00-5BFF
DEFS 256
The reply to the asterisk prompt (522AH), then DIRCHECK's own GAT (52AAH), with its lock out table at 5B60H.
5C00-5CFF
DEFS 256
DIRCHECK's own HIT (52B7H), the hash code of each active entry at its logical file number.
5D00-5DFF
DEFS 256
Sector 0 of the directory cylinder as read (5267H): the diskette's GAT.
5E00-5EFF
DEFS 256
Sector 1 of the directory cylinder as read: the diskette's HIT (544FH).
5F00-5FFF
DEFS 256
Sector 2 of the directory cylinder, the first eight entries, BOOT/SYS first (52BFH).
6000-7EFF
DEFS 7936
Sectors 3 on of the directory cylinder, up to DCT+0EH less 1, DIR/SYS first (53F5H).