5200H - The Routine Table
Data: SYS9/SYS's table of routines 2-5, one word each, used by SYS0/SYS's overlay request handler (its 49D3H-49E6H) for the request codes 82H-85H. CMNDI@ takes the codes of the library commands from SYS1/SYS's table: CAT 83H (51BDH), DIR 84H (51C6H), FREE 85H (51CDH). No file of the diskette requests 82H. The words for CAT and DIR point one byte apart, into the same instruction (520AH).
5200-5201
DEFW 5208H 08 52
Routine 2: 5208H, XOR A and RET, which SYS0/SYS's record locator requests when it loads SYS9/SYS back (its 4D5FH-4D6CH).
5202-5203
DEFW 520BH 0B 52
Routine 3: 520BH, CAT, the operand byte of LD A,AFH at 520AH, which reads as XOR A when entered there.
5204-5205
DEFW 520AH 0A 52
Routine 4: 520AH, DIR, which starts with LD A,AFH: the long listing flag stored to 53CFH is AFH.
5206-5207
DEFW 521DH 1D 52
Routine 5: 521DH, FREE, the operand byte of LD A,AFH at 521CH, which reads as XOR A when entered there.
5208H - Routine 2
Nothing to do when SYS0/SYS's record locator brings SYS9/SYS back.
5208
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: routine 2 has no work to do.
5209
RET C9
RETurn to SYS0/SYS's overlay request handler (49E7H) with Register A = 00H.
520AH - DIR, CAT and FREE
Routines 4 (DIR, 520AH), 3 (CAT, 520BH) and 5 (FREE, 521DH), entered from CMNDI@ through the overlay request handler with Register Pair HL at the rest of the command line. DIR stores AFH and CAT 00H to 53CFH, the operand of LD DE,0000H at 53CEH that selects the long listing; both clear the parameters INVIS, SYSTEM, KILL and ALPHA and store AFH to 531BH, the operand of LD A,00H at 531AH that sends them on to the file list. FREE enters at 521DH and stores 00H there, so it stays with the free space summary and map, and it does not clear the parameters. The command line is then evaluated by EVAL@ with the block at 55D7H: a source drive, a destination file or device, a wildmask and the parameters.
520A
LD A,AFH 3E AF
Load Register A with AFH, the long listing flag of DIR. CAT enters at 520BH, the operand byte AFH, which reads as XOR A and loads Register A with 00H.
520C
LD (53CFH),A 32 CF 53
Store Register A (AFH for DIR, 00H for CAT) to 53CFH, the low byte of the operand of LD DE,0000H at 53CEH, which 546FH also reads.
520F
XOR A AF
Set Register A to 00H by XORing it with itself, to clear the four parameters of CAT and DIR below.
5210
LD (542CH),A 32 2C 54
Store Register A (00H) to 542CH, the low byte of the INVIS value: EVAL@ stores the value of INVIS over the operand of LD DE,0000H at 542BH.
5213
LD (541EH),A 32 1E 54
Store Register A (00H) to 541EH, the low byte of the SYSTEM value: the operand of LD DE,0000H at 541DH.
5216
LD (5410H),A 32 10 54
Store Register A (00H) to 5410H, the low byte of the KILL value: the operand of LD DE,0000H at 540FH.
5219
LD (5781H),A 32 81 57
Store Register A (00H) to 5781H, the low byte of the ALPHA value, the work area after the file.
521C
LD A,AFH 3E AF
Load Register A with AFH for CAT and DIR. FREE enters at 521DH, the operand byte AFH, which reads as XOR A and loads Register A with 00H.
521E
LD (531BH),A 32 1B 53
Store Register A (AFH for CAT and DIR, 00H for FREE) to 531BH, the operand of LD A,00H at 531AH, which picks the file list or the free space map.
5221
LD IX,55D7H DD 21 D7 55
Point Index Register IX to 55D7H, the evaluation block of SYS9/SYS: source 5783H, destination 57A4H, wildmask 57C5H, parameters 55E0H.
5225
GOSUB to 4479H, EVAL@, to take the source, destination and wildmask fields and the parameters from the command line at Register Pair HL.
5228
If the NZ FLAG is set (an error in the command line), JUMP to 571BH to post the error in Register A (2EH, Invalid parameter).
522B
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a source field was given.
522F
LD C,00H 0E 00
Load Register C with 00H, drive 0, which CAT, DIR and FREE start from when no drive is given.
5231
If the Z FLAG is set (no source field), JUMP to 5245H with Register C = drive 0.
5233
LD A,(5783H) 3A 83 57
Load Register A with the flag byte of the source block at 5783H (bit 6 a name, bit 7 a device or drive, bits 0-3 its number).
5236
BIT 6,A CB 77
Test bit 6 of Register A, which EVAL@ sets for a file name: the source of CAT, DIR and FREE must be a drive.
5238
LD B,2EH 06 2E
Load Register B with 2EH, the error code Invalid parameter, for the two tests below.
523A
If the NZ FLAG is set (the source is a file name), JUMP to 571AH to post error 2EH in Register B.
523D
AND 0FH E6 0F
AND Register A with 0FH, bits 0-3: the number LOCDEV@ gave the field, 08H plus the drive for a drive, 00H-05H for a device.
523F
SUB 08H D6 08
SUBtract 08H from Register A: the drive number 0-7, or the C FLAG for a device.
5241
If the C FLAG is set (the source is a device such as @PR), JUMP to 571AH to post error 2EH in Register B.
5244
LD C,A 4F
Load Register C with Register A, the drive named in the source field.
5245
LD DE,5A00H 11 00 5A
Load Register Pair DE with 5A00H, the top of the one sector buffer at 5900H that CAT, DIR and FREE need.
5248
LD A,(5781H) 3A 81 57
Load Register A with the ALPHA value from 5781H: not zero when the names are to be sorted.
524B
OR A B7
OR Register A with itself, to set the Z FLAG when ALPHA was not given.
524C
If the Z FLAG is set (no sort), JUMP to 5251H with Register Pair DE = 5A00H.
524E
LD DE,7A00H 11 00 7A
Load Register Pair DE with 7A00H: the sort reads the whole directory into memory from 5900H, up to 32 sectors.
5251
LD HL,(4411H) 2A 11 44
Load Register Pair HL with the top of memory, HMEM$, from 4411H.
5254
SBC HL,DE ED 52
SUBtract Register Pair DE (the memory needed) from Register Pair HL (HMEM$) with the C FLAG (clear after OR A): the C FLAG when memory is too short.
5256
LD B,21H 06 21
Load Register B with 21H, the error code No memory space available; the load keeps the flags of the SBC.
5258
If the C FLAG is set (HMEM$ below the buffer's top), JUMP to 571AH to post error 21H in Register B.
525B
GOSUB to 56DBH to open the output: the display, the device of the destination field, or a file through INIT@.
525E
If the NZ FLAG is set (INIT@ failed), JUMP to 571BH to post the error in Register A.
5261
LD B,01H 06 01
Load Register B with 01H: WILD@ with Register B not zero takes a new wildmask.
5263
LD HL,57C6H 21 C6 57
Point Register Pair HL to 57C6H, the text of the wildmask block (its flag byte is at 57C5H).
5266
GOSUB to 5712H, which sets WILD@'s mask from Register Pair HL when a wildmask was given.
5269H - One Drive
The loop over the drives starts here with Register C = the drive. A drive that is not ready is an error when it was named (08H), else it is passed over. The GAT is read to 5900H, the drive's name and the diskette's name are put into the summary line, the free granules and the free directory entries are counted, and the line Drive: dd NAME - Space: free/total nnn.nk is output.
5269
LD A,00H 3E 00
Load Register A with 00H, the DISKIO% function DCHECK, to see whether the drive in Register C is ready.
526B
GOSUB to 4488H, DISKIO%, function 0 DCHECK, for the drive in Register C: the Z FLAG when the drive is ready.
526E
If the Z FLAG is set (the drive is ready), JUMP to 527CH to read its GAT.
5270
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a drive was named in the command.
5274
If the Z FLAG is set (no drive named), JUMP to 55B7H to go on to the next drive: a drive that is not ready is passed over.
5277
LD B,08H 06 08
Load Register B with 08H, the error code Drive not available, for the drive named in the command.
5279
JUMP to 571AH to post error 08H in Register B and end the command.
527C
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, the buffer for the GAT (and later for the directory sectors).
527F
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder: the granule allocation table (GAT).
5281
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, which reads a sector of the directory cylinder.
5283
GOSUB to 4488H, DISKIO%, function 6 SREAD, to read sector Register E of the drive in Register C to Register Pair HL.
5286
If the NZ FLAG is set (a read error), JUMP to 571BH to post the error in Register A.
5289
GOSUB to 44A3H, LOCDCT%, for the drive control table of drive Register C in Index Register IY.
528C
LD HL,44E8H 21 E8 44
Point Register Pair HL to 44E8H, DCTTBL, the table of the eight drives: a 4 byte entry each, the DCT address and the two character name.
528F
LD A,C 79
Load Register A with Register C, the drive number, to find its DCTTBL entry.
5290
ADD A,A 87
ADD Register A to itself: the drive number times 2.
5291
ADD A,A 87
ADD Register A to itself: the drive number times 4, the offset of its DCTTBL entry.
5292
ADD A,02H C6 02
ADD 02H to Register A: the offset of the entry's two character name, after the DCT address.
5294
LD E,A 5F
Load Register E with Register A, the low byte of the offset of the drive's name in DCTTBL.
5295
LD D,00H 16 00
Load Register D with 00H, the high byte of the offset in Register Pair DE.
5297
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: Register Pair HL points to the drive's two character name in DCTTBL.
5298
PUSH BC C5
Save Register Pair BC (Register C = the drive) to the top of the stack, since the LDIRs below count Register Pair BC down.
5299
LD DE,5727H 11 27 57
Point Register Pair DE to 5727H, the place of the drive's name in the summary line at 5720H.
529C
LD BC,0002H 01 02 00
Load Register Pair BC with 0002H, the length of a drive's name, for the LDIR below.
529F
LDIR ED B0
Move the drive's name from Register Pair HL to Register Pair DE, Register Pair BC bytes, with an LDIR.
52A1
LD HL,59D0H 21 D0 59
Point Register Pair HL to 59D0H, the diskette's name at +D0H of the GAT, eight characters.
52A4
INC DE 13
INCrement Register Pair DE by 1 past the space at 5729H, to 572AH, the place of the diskette's name.
52A5
LD C,08H 0E 08
Load Register C with 08H, the length of the diskette's name; Register B is 00H after the LDIR above.
52A7
LDIR ED B0
Move the diskette's name from Register Pair HL to Register Pair DE, Register Pair BC bytes, with an LDIR.
52A9
POP BC C1
Restore Register Pair BC (Register C = the drive) from the top of the stack.
52AA
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, the GAT: one byte for each cylinder, a set bit for each granule in use.
52AD
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the count of free granules on the diskette.
52B0
LD A,(59CCH) 3A CC 59
Load Register A with +CCH of the GAT at 59CCH, the number of cylinders less 35 (23H).
52B3
ADD A,23H C6 23
ADD 23H to Register A: the number of cylinders, the number of GAT bytes to count.
52B5
LD B,A 47
Load Register B with Register A, the count of the cylinders' GAT bytes for the DJNZ at 52C1H.
52B6
LD A,(HL) 7E
Load Register A with the GAT byte of a cylinder at Register Pair HL, one bit for each granule.
52B7
SCF 37
Set the C FLAG, which the RRA below moves into bit 7 of Register A: the byte fills with 1 bits from the top.
52B8
RRA 1F
Rotate Register A right through the C FLAG: the lowest bit goes into the C FLAG and a 1 comes in at bit 7.
52B9
If the C FLAG is set (a granule in use, or a granule the cylinder does not have), JUMP to 52BCH.
52BB
INC DE 13
INCrement the count of free granules in Register Pair DE by 1 for the 0 bit.
52BC
CP FFH FE FF
Compare Register A against FFH: the Z FLAG when no 0 bit is left in the byte, so the cylinder is counted.
52BE
If the NZ FLAG is set (0 bits left), JUMP back to 52B7H for the next bit of the byte in Register A.
52C0
INC L 2C
INCrement Register L by 1 to the GAT byte of the next cylinder.
52C1
DECrement Register B and loop back to 52B6H while Register B is not zero, for every cylinder.
52C3
PUSH DE D5
Save Register Pair DE, the count of free granules, to the top of the stack for 530AH.
52C4
LD HL,4300H 21 00 43
Point Register Pair HL to 4300H, the system buffer, for the directory sectors.
52C7
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries (0 is the GAT and 1 the HIT).
52C9
LD D,00H 16 00
Load Register D with 00H, the count of free directory entries, those without bit 4 (active) set.
52CB
LD B,D 42
Load Register B with Register D (00H), the count of all the directory entries.
52CC
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, for the directory sector in Register E.
52CE
GOSUB to 4488H, DISKIO%, function 6 SREAD, to read directory sector Register E to Register Pair HL (4300H); the registers are kept.
52D1
If the NZ FLAG is set (a read error), JUMP to 571BH to post the error in Register A.
52D4
BIT 4,(HL) CB 66
Test bit 4 of the entry's flag byte at Register Pair HL: the NZ FLAG when the entry is in use.
52D6
If the NZ FLAG is set (the entry is in use), JUMP to 52D9H past the count of free entries.
52D8
INC D 14
INCrement the count of free entries in Register D by 1 for an entry not in use.
52D9
INC B 04
INCrement the count of all entries in Register B by 1; 256 entries leave Register B at 00H.
52DA
LD A,20H 3E 20
Load Register A with 20H, the length of a directory entry.
52DC
ADD A,L 85
ADD Register L to Register A: the low byte of the next entry, with the C FLAG past the end of the sector.
52DD
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the next entry of the sector.
52DE
If the NC FLAG is set (more entries in the sector), JUMP back to 52D4H for the next entry.
52E0
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory's length in sectors from the drive control table at Index Register IY+0EH.
52E3
DEC A 3D
DECrement Register A by 1: the number of the last directory sector.
52E4
INC E 1C
INCrement Register E by 1 to the next directory sector.
52E5
CP E BB
Compare Register A (the last sector) against Register E (the next): the NC FLAG while Register E is not past the last.
52E6
If the NC FLAG is set (more directory sectors), JUMP back to 52CCH to read the next sector.
52E8
LD HL,5720H 21 20 57
Point Register Pair HL to 5720H, the summary line: Drive: with the drive's name, the diskette's name and - Space:, ended by 03H.
52EB
GOSUB to 562AH to output the text at Register Pair HL up to the 03H.
52EE
LD E,D 5A
Load Register E with Register D, the count of free directory entries.
52EF
LD D,00H 16 00
Load Register D with 00H, the high byte of the number in Register Pair DE.
52F1
GOSUB to 5694H to output Register Pair DE (the free entries) as three digits with leading zeros.
52F4
LD A,2FH 3E 2F
Load Register A with 2FH, the character /, between the free entries and the total.
52F6
GOSUB to 5621H to output the character in Register A.
52F9
LD A,B 78
Load Register A with Register B, the count of all the entries (00H for 256).
52FA
LD E,A 5F
Load Register E with Register A, the low byte of the total number of entries.
52FB
SUB 01H D6 01
SUBtract 01H from Register A: the C FLAG when the count is 00H, meaning 256 entries.
52FD
LD A,00H 3E 00
Load Register A with 00H; the load keeps the C FLAG of the SUB.
52FF
ADC A,00H CE 00
ADD 00H and the C FLAG to Register A: 01H for 256 entries, else 00H.
5301
LD D,A 57
Load Register D with Register A, the high byte of the total: Register Pair DE = the number of entries, 1-256.
5302
GOSUB to 5694H to output Register Pair DE (the total entries) as three digits with leading zeros.
5305
LD A,20H 3E 20
Load Register A with 20H, a space, between the entries and the free space.
5307
GOSUB to 5621H to output the space in Register A.
530A
POP HL E1
Restore Register Pair HL from the top of the stack: the count of free granules from 52C3H.
530B
LD A,(IY+0FH) FD 7E 0F
Load Register A with the sectors per granule from the drive control table at Index Register IY+0FH.
530E
GOSUB to 444EH, MULT@: Register Pair HL (granules) times Register A, the free sectors in Register Pair HL (high) and Register A (low).
5311
LD B,H 44
Load Register B with Register H, the top byte of the 24 bit product, which is not used.
5312
LD H,L 65
Load Register H with Register L, the middle byte of the product.
5313
LD L,A 6F
Load Register L with Register A, the low byte: Register Pair HL = the free sectors.
5314
GOSUB to 5650H to output the free sectors in Register Pair HL as kilobytes with one decimal, such as 82.5k.
5317
GOSUB to 561FH to end the summary line with a carriage return (0DH).
531A
LD A,00H 3E 00
Load Register A with the operand at 531BH: AFH for CAT and DIR, 00H for FREE (521EH stores it).
531C
OR A B7
OR Register A with itself, to set the NZ FLAG for CAT and DIR.
531D
If the NZ FLAG is set (CAT or DIR), JUMP to 53CBH for the list of the files.
5320
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when FREE was given a drive.
5324
If the Z FLAG is set (no drive named), JUMP to 55B7H for the next drive: FREE alone gives only the summary line of each drive.
5327
GOSUB to 561FH to output a carriage return (0DH), a blank line before the free space map.
532A
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, the GAT: Register L is the cylinder of the map's line.
532DH - The Free Space Map
FREE with a drive: one line for each group of cylinders, ccc-ccc: followed by a character for each granule of each cylinder, L for a granule locked out (the lockout table at +60H of the GAT, not on a rigid drive), D for the directory's granules on the directory cylinder, x for a granule in use and . for a free one. A line holds seven cylinders, or six when a cylinder has seven granules or more, with two spaces between cylinders, or one when a cylinder has five granules or more. The SPACE BAR pauses the map and BREAK ends it (563FH).
532D
LD A,(59CCH) 3A CC 59
Load Register A with +CCH of the GAT at 59CCH, the number of cylinders less 35 (23H).
5330
ADD A,22H C6 22
ADD 22H to Register A: the number of the last cylinder of the diskette.
5332
CP L BD
Compare Register A (the last cylinder) against Register L (the first cylinder of the line): the C FLAG when the map is done.
5333
If the NC FLAG is set (cylinders left), JUMP to 5338H for the next line of the map.
5335
JUMP to 55B7H, the end of the drive: the map is done.
5338
LD E,L 5D
Load Register E with Register L, the first cylinder of the line.
5339
LD D,00H 16 00
Load Register D with 00H, the high byte of the number in Register Pair DE.
533B
GOSUB to 5694H to output Register Pair DE (the first cylinder) as three digits with leading zeros.
533E
LD A,2DH 3E 2D
Load Register A with 2DH, the character -, between the line's first and last cylinders.
5340
GOSUB to 5621H to output the character in Register A.
5343
LD A,(IY+10H) FD 7E 10
Load Register A with the granules per cylinder from the drive control table at Index Register IY+10H.
5346
CP 07H FE 07
Compare Register A against 07H: the NC FLAG for seven granules or more to a cylinder.
5348
LD A,05H 3E 05
Load Register A with 05H, the cylinders after the first on a line of wide cylinders; the load keeps the flags.
534A
If the NC FLAG is set (seven granules or more), JUMP to 534DH with Register A = 05H: six cylinders to the line.
534C
INC A 3C
INCrement Register A by 1 to 06H: seven cylinders to the line.
534D
ADD A,L 85
ADD Register L (the first cylinder) to Register A: the last cylinder of the line.
534E
LD B,A 47
Load Register B with Register A, the last cylinder of a full line.
534F
LD A,(59CCH) 3A CC 59
Load Register A with +CCH of the GAT at 59CCH, the number of cylinders less 35 (23H).
5352
ADD A,22H C6 22
ADD 22H to Register A: the number of the last cylinder of the diskette.
5354
CP B B8
Compare Register A (the diskette's last cylinder) against Register B (the line's): the C FLAG when the line would run past it.
5355
If the C FLAG is set (the line is cut short), JUMP to 5358H with Register A = the diskette's last cylinder.
5357
LD A,B 78
Load Register A with Register B, the last cylinder of a full line.
5358
LD (53ABH),A 32 AB 53
Store Register A, the last cylinder of the line, to 53ABH, the operand of LD A,00H at 53AAH.
535B
LD E,A 5F
Load Register E with Register A, the last cylinder of the line; Register D is still 00H.
535C
GOSUB to 5694H to output Register Pair DE (the last cylinder) as three digits with leading zeros.
535F
LD A,3AH 3E 3A
Load Register A with 3AH, the character :, after the line's cylinders.
5361
GOSUB to 5621H to output the character in Register A.
5364
LD A,02H 3E 02
Load Register A with 02H, the number of spaces before the first cylinder's granules.
5366
GOSUB to 5634H to output Register A spaces, two before the granules of the line.
5369
LD B,00H 06 00
Load Register B with 00H, the first granule of the cylinder Register L.
536B
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of the flags at Index Register IY+03H, set for a rigid (hard) drive, which has no lockout table.
536F
If the NZ FLAG is set (a rigid drive), JUMP to 537EH past the lockout test.
5371
PUSH HL E5
Save Register Pair HL (the cylinder's GAT byte) to the top of the stack.
5372
LD A,60H 3E 60
Load Register A with 60H, the offset of the lockout table in the GAT.
5374
ADD A,L 85
ADD Register L (the cylinder) to Register A: the low byte of the cylinder's lockout byte.
5375
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the cylinder's byte of the lockout table.
5376
GOSUB to 5611H to test bit Register B (the granule) of the byte at Register Pair HL: the NZ FLAG when it is set.
5379
POP HL E1
Restore Register Pair HL (the cylinder's GAT byte) from the top of the stack; the flags are kept.
537A
LD A,4CH 3E 4C
Load Register A with 4CH, the character L, for a granule that is locked out; the load keeps the flags.
537C
If the NZ FLAG is set (the granule is locked out), JUMP to 53A0H to output the L in Register A.
537E
LD A,(IY+12H) FD 7E 12
Load Register A with the directory cylinder from the drive control table at Index Register IY+12H.
5381
CP L BD
Compare Register A (the directory cylinder) against Register L (the cylinder of the map): the Z FLAG when they are the same.
5382
If the NZ FLAG is set (not the directory cylinder), JUMP to 5397H to test the GAT bit.
5384
LD E,(IY+0EH) FD 5E 0E
Load Register E with the directory's length in sectors from the drive control table at Index Register IY+0EH.
5387
LD A,(IY+0FH) FD 7E 0F
Load Register A with the sectors per granule from the drive control table at Index Register IY+0FH.
538A
GOSUB to 4494H, SYS0/SYS's divide: Register A = Register E (the directory sectors) divided by Register A, Register E = the remainder.
538D
INC E 1C
INCrement Register E by 1, the first half of a test of the remainder in Register E for zero.
538E
DEC E 1D
DECrement Register E by 1 back to the remainder: the Z FLAG when the directory fills its last granule.
538F
If the NZ FLAG is set (a part granule), JUMP to 5392H: Register A is the number of the directory's last granule.
5391
DEC A 3D
DECrement Register A by 1: the directory ends with a whole granule, so its last granule is one less.
5392
CP B B8
Compare Register A (the directory's last granule) against Register B (the granule): the NC FLAG when the granule is the directory's.
5393
LD A,44H 3E 44
Load Register A with 44H, the character D, for a granule of the directory; the load keeps the flags.
5395
If the NC FLAG is set (a directory granule), JUMP to 53A0H to output the D in Register A.
5397
GOSUB to 5611H to test bit Register B (the granule) of the GAT byte at Register Pair HL: the NZ FLAG when the granule is in use.
539A
LD A,78H 3E 78
Load Register A with 78H, the character x, for a granule in use; the load keeps the flags.
539C
If the NZ FLAG is set (the granule is in use), JUMP to 53A0H to output the x in Register A.
539E
LD A,2EH 3E 2E
Load Register A with 2EH, the character . (period), for a free granule.
53A0
GOSUB to 5621H to output the character in Register A: L, D, x or the period.
53A3
LD A,(IY+10H) FD 7E 10
Load Register A with the granules per cylinder from the drive control table at Index Register IY+10H.
53A6
INC B 04
INCrement Register B by 1 to the next granule of the cylinder.
53A7
CP B B8
Compare Register A (the granules per cylinder) against Register B: the Z FLAG when the cylinder is done.
53A8
If the NZ FLAG is set (granules left), JUMP back to 536BH for the next granule of the cylinder.
53AA
LD A,00H 3E 00
Load Register A with the last cylinder of the line, the operand at 53ABH that 5358H stores (00H in the file).
53AC
INC L 2C
INCrement Register L by 1 to the next cylinder and its GAT byte.
53AD
CP L BD
Compare Register A (the line's last cylinder) against Register L: the C FLAG when the line is done.
53AE
If the C FLAG is set (the line is done), JUMP to 53BFH to end the line.
53B0
LD A,(IY+10H) FD 7E 10
Load Register A with the granules per cylinder from the drive control table at Index Register IY+10H.
53B3
CP 05H FE 05
Compare Register A against 05H: the C FLAG for fewer than five granules to a cylinder.
53B5
LD A,02H 3E 02
Load Register A with 02H, two spaces between narrow cylinders; the load keeps the flags.
53B7
If the C FLAG is set (fewer than five granules), JUMP to 53BAH with Register A = 02H.
53B9
DEC A 3D
DECrement Register A by 1 to 01H, one space between wide cylinders.
53BA
GOSUB to 5634H to output Register A spaces between the cylinders.
53BD
JUMP back to 5369H for the first granule of the next cylinder.
53BF
GOSUB to 561FH to end the line of the map with a carriage return (0DH).
53C2
GOSUB to 563FH for the SPACE BAR (pause) and BREAK: the Z FLAG when BREAK was pressed.
53C5
If the NZ FLAG is set (no BREAK), JUMP back to 532DH for the next line of the map.
53C8
JUMP to 55D0H to close the output and return: BREAK ends the map.
53CBH - The File List of CAT and DIR
DIR outputs the heading line 573DH first; CAT and DIR then read directory sectors 2 to the last, one at a time into 5900H. With ALPHA the list is made in two passes: the first reads every directory sector into memory from 5900H, a page for each (53FDH, 5573H), SORT@ sorts all the entries by name and extension (558DH), and the second pass lists the entries from memory without reading. 53FEH holds the pass: FFH while reading, 00H while listing (and 00H without ALPHA).
53CB
LD HL,573DH 21 3D 57
Point Register Pair HL to 573DH, DIR's heading line Filespec Attrib LRL #Secs #Recs Space Updated, ended by 0DH and 03H.
53CE
LD DE,0000H 11 00 00
Load Register Pair DE with the long listing flag (0000H in the file), the operand at 53CFH: AFH in Register E for DIR, 00H for CAT (520CH stores it).
53D1
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
53D2
DEC E 1D
DECrement Register E by 1 back to the flag: the NZ FLAG for DIR.
53D3
If the NZ FLAG is set (DIR), GOSUB to 562AH to output the heading line at Register Pair HL.
53D6
GOSUB to 561FH to output a carriage return (0DH), a blank line before the list.
53D9
LD A,04H 3E 04
Load Register A with 04H, the number of names on each line of CAT.
53DB
LD (5780H),A 32 80 57
Store Register A (04H) to 5780H, the count of the names left on CAT's line.
53DE
LD A,(5781H) 3A 81 57
Load Register A with the ALPHA value from 5781H: FFH when the names are to be sorted, else 00H.
53E1
LD (53FEH),A 32 FE 53
Store Register A to 53FEH, the operand of LD A,00H at 53FDH: the pass, FFH for the reading pass of ALPHA.
53E4
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries.
53E6
LD HL,5900H 21 00 59
Point Register Pair HL to 5900H, the buffer for a directory sector, or the first page of the sorted directory.
53E9
LD A,(5781H) 3A 81 57
Load Register A with the ALPHA value from 5781H, to see whether the directory is kept in memory.
53EC
OR A B7
OR Register A with itself, to set the Z FLAG when ALPHA was not given.
53ED
If the Z FLAG is set (no ALPHA), JUMP to 53F5H to read the sector.
53EF
LD A,(53FEH) 3A FE 53
Load Register A with the pass from 53FEH: FFH for the reading pass, 00H for the listing pass of ALPHA.
53F2
OR A B7
OR Register A with itself, to set the Z FLAG for the listing pass.
53F3
If the Z FLAG is set (the listing pass of ALPHA), JUMP to 5403H: the sector is already in memory at Register Pair HL.
53F5
LD A,06H 3E 06
Load Register A with 06H, the DISKIO% function SREAD, for the directory sector in Register E.
53F7
GOSUB to 4488H, DISKIO%, function 6 SREAD, to read directory sector Register E of drive Register C to Register Pair HL.
53FA
If the NZ FLAG is set (a read error), JUMP to 571BH to post the error in Register A.
53FD
LD A,00H 3E 00
Load Register A with the pass (00H in the file), the operand at 53FEH that 53E1H and 558DH store: FFH while ALPHA reads the directory.
53FF
OR A B7
OR Register A with itself, to set the NZ FLAG for the reading pass of ALPHA.
5400
If the NZ FLAG is set (the reading pass), JUMP to 5573H for the next sector: nothing is listed yet.
5403H - An Entry
Register Pair HL = a directory entry in the buffer. An extended entry (bit 7) is never listed; an entry not in use (bit 4 clear) only with KILL; a system file (bit 6) only with SYSTEM; an invisible file (bit 3) only with INVIS; an entry with no name is passed over, and so is one that does not match the wildmask. The parameters are kept as the operands of three LD DE,0000H instructions, where EVAL@ stores the values.
5403
PUSH HL E5
Save Register Pair HL (the entry) to the top of the stack.
5404
PUSH DE D5
Save Register Pair DE (Register E = the directory sector) to the top of the stack.
5405
PUSH BC C5
Save Register Pair BC (Register C = the drive) to the top of the stack.
5406
BIT 7,(HL) CB 7E
Test bit 7 of the entry's flag byte at Register Pair HL: the NZ FLAG for an extended entry (FXDE).
5408
If the NZ FLAG is set (an extended entry), JUMP to 5563H for the next entry: extended entries hold no name.
540B
BIT 4,(HL) CB 66
Test bit 4 of the entry's flag byte at Register Pair HL: the NZ FLAG when the entry is in use.
540D
If the NZ FLAG is set (the entry is in use), JUMP to 5419H for the system and invisible tests.
540F
LD DE,0000H 11 00 00
Load Register Pair DE with the KILL value, the operand at 5410H-5411H (0000H in the file) that EVAL@ sets to FFFFH: Register E not zero lists deleted files.
5412
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
5413
DEC E 1D
DECrement Register E by 1 back to the KILL value: the Z FLAG when KILL was not given.
5414
If the Z FLAG is set (no KILL), JUMP to 5563H for the next entry: a deleted file is not listed.
5417
JUMP to 5433H to list the deleted file: its system and invisible bits are not tested.
5419
BIT 6,(HL) CB 76
Test bit 6 of the entry's flag byte at Register Pair HL: the NZ FLAG for a system file.
541B
If the Z FLAG is set (not a system file), JUMP to 5427H for the invisible test.
541D
LD DE,0000H 11 00 00
Load Register Pair DE with the SYSTEM value, the operand at 541EH-541FH (0000H in the file) that EVAL@ sets to FFFFH: Register E not zero lists system files.
5420
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
5421
DEC E 1D
DECrement Register E by 1 back to the SYSTEM value: the Z FLAG when SYSTEM was not given.
5422
If the Z FLAG is set (no SYSTEM), JUMP to 5563H for the next entry: a system file is not listed.
5425
JUMP to 5433H to list the system file: its invisible bit is not tested.
5427
BIT 3,(HL) CB 5E
Test bit 3 of the entry's flag byte at Register Pair HL: the NZ FLAG for an invisible file.
5429
If the Z FLAG is set (a visible file), JUMP to 5433H to list it.
542B
LD DE,0000H 11 00 00
Load Register Pair DE with the INVIS value, the operand at 542CH-542DH (0000H in the file) that EVAL@ sets to FFFFH: Register E not zero lists invisible files.
542E
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
542F
DEC E 1D
DECrement Register E by 1 back to the INVIS value: the Z FLAG when INVIS was not given.
5430
If the Z FLAG is set (no INVIS), JUMP to 5563H for the next entry: an invisible file is not listed.
5433
LD A,05H 3E 05
Load Register A with 05H, the offset of the name in a directory entry.
5435
ADD A,L 85
ADD Register L to Register A: the low byte of the entry's name (an entry never crosses a page).
5436
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the name at +05H of the entry.
5437
LD A,(HL) 7E
Load Register A with the first character of the name at Register Pair HL.
5438
OR A B7
OR Register A with itself, to set the Z FLAG for a name starting with 00H, an empty entry.
5439
If the Z FLAG is set (an empty entry), JUMP to 5563H for the next entry.
543C
LD B,00H 06 00
Load Register B with 00H: WILD@ with Register B = 00H compares the name at Register Pair HL with its mask.
543E
GOSUB to 5712H, which calls WILD@ when a wildmask was given: the NZ FLAG when the name does not match.
5441
If the NZ FLAG is set (no match), JUMP to 5563H for the next entry.
5444H - The Name
NAME/EXT in a column of 15 characters: up to eight characters of the name (to the first space), a / when the extension does not start with a space, the three characters of the extension, then spaces to the 15th column.
5444
LD BC,080FH 01 0F 08
Load Register Pair BC with 080FH: Register B = 08H, the length of the name, Register C = 0FH, the width of the column.
5447
LD A,(HL) 7E
Load Register A with a character of the name at Register Pair HL.
5448
CP 20H FE 20
Compare Register A against 20H, a space: the Z FLAG at the end of the name.
544A
If the Z FLAG is set (a space), JUMP to 5453H: the rest of the name is not shown.
544C
GOSUB to 5621H to output the name's character in Register A.
544F
INC L 2C
INCrement Register L by 1 to the next character of the name.
5450
DEC C 0D
DECrement Register C by 1, the room left in the column.
5451
DECrement Register B and loop back to 5447H while Register B is not zero, for up to eight characters.
5453
LD A,B 78
Load Register A with Register B, the characters of the name not shown.
5454
ADD A,L 85
ADD Register L to Register A: the low byte of the extension at +0DH of the entry.
5455
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the extension.
5456
LD A,(HL) 7E
Load Register A with the first character of the extension at Register Pair HL.
5457
CP 20H FE 20
Compare Register A against 20H, a space: the Z FLAG when the file has no extension.
5459
If the Z FLAG is set (no extension), JUMP to 5461H without the /.
545B
LD A,2FH 3E 2F
Load Register A with 2FH, the character /, between the name and the extension.
545D
GOSUB to 5621H to output the / in Register A.
5460
DEC C 0D
DECrement Register C by 1, the room left in the column.
5461
LD B,03H 06 03
Load Register B with 03H, the length of the extension: all three characters are output, spaces too.
5463
LD A,(HL) 7E
Load Register A with a character of the extension at Register Pair HL.
5464
GOSUB to 5621H to output the extension's character in Register A.
5467
INC L 2C
INCrement Register L by 1 to the next character, and past the extension to +10H of the entry.
5468
DEC C 0D
DECrement Register C by 1, the room left in the column.
5469
DECrement Register B and loop back to 5463H while Register B is not zero, for the three characters.
546B
LD A,C 79
Load Register A with Register C, the room left in the 15 character column.
546C
GOSUB to 5634H to output Register A spaces to the end of the column.
546F
LD A,(53CFH) 3A CF 53
Load Register A with the long listing flag from 53CFH: AFH for DIR, 00H for CAT.
5472
OR A B7
OR Register A with itself, to set the Z FLAG for CAT.
5473
If the Z FLAG is set (CAT), JUMP to 5558H to count the names on the line.
5476H - The Attributes
DIR only. Seven characters: the protection level 0-7 (bits 2-0 of the flag byte), then P when either password code (+10H, +12H) is not 4296H, the code of a blank password, S for a system file (bit 6), K for a deleted file (bit 4 clear), I for an invisible file (bit 3), ! when the file may not shrink (bit 7 of +01H) and + when it was written to since its last copy or backup (bit 6 of +01H); a period for each that is not so. The letters are at 577AH.
5476
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE points to +10H of the entry, the first password code.
5477
LD A,(DE) 1A
Load Register A with the low byte of the password code at +10H from Register Pair DE.
5478
INC E 1C
INCrement Register E by 1 to the high byte of the code.
5479
LD L,A 6F
Load Register L with Register A, the low byte of the password code.
547A
LD A,(DE) 1A
Load Register A with the high byte of the password code at +11H from Register Pair DE.
547B
INC E 1C
INCrement Register E by 1 to the second password code at +12H.
547C
LD H,A 67
Load Register H with Register A: Register Pair HL = the password code at +10H.
547D
LD BC,4296H 01 96 42
Load Register Pair BC with 4296H, the code SYS2/SYS gives a blank password (eight spaces).
5480
SBC HL,BC ED 42
SUBtract Register Pair BC (4296H) from Register Pair HL with the C FLAG (clear after OR A): the Z FLAG when the code is a blank password.
5482
If the NZ FLAG is set (a password is set), JUMP to 548EH to set the C FLAG for the P.
5484
LD A,(DE) 1A
Load Register A with the low byte of the password code at +12H from Register Pair DE.
5485
INC E 1C
INCrement Register E by 1 to the high byte of the code.
5486
LD L,A 6F
Load Register L with Register A, the low byte of the password code.
5487
LD A,(DE) 1A
Load Register A with the high byte of the password code at +13H from Register Pair DE.
5488
INC E 1C
INCrement Register E by 1 to +14H of the entry, the number of sectors.
5489
LD H,A 67
Load Register H with Register A: Register Pair HL = the password code at +12H.
548A
SBC HL,BC ED 42
SUBtract Register Pair BC (4296H) from Register Pair HL with the C FLAG (clear): the Z FLAG and the NC FLAG for a blank password.
548C
If the Z FLAG is set (both passwords are blank), JUMP to 548FH with the NC FLAG: a period for P.
548E
SCF 37
Set the C FLAG: a password is set, so the P is shown.
548F
PUSH AF F5
Save Register Pair AF to the top of the stack: the C FLAG for the password flag P.
5490
LD HL,577AH 21 7A 57
Point Register Pair HL to 577AH, the attribute letters PSKI!+.
5493
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the letters, Register Pair HL = +14H of the entry.
5494
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address.
5495
AND E0H E6 E0
AND Register A with E0H: the low byte of the start of the 32 byte entry.
5497
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the entry's flag byte.
5498
LD A,(HL) 7E
Load Register A with the entry's flag byte at Register Pair HL.
5499
AND 07H E6 07
AND Register A with 07H, bits 2-0: the protection level 0-7.
549B
ADD A,30H C6 30
ADD 30H to Register A: the protection level as the ASCII digit 0-7.
549D
GOSUB to 5621H to output the protection level's digit in Register A.
54A0
POP AF F1
Restore Register Pair AF from the top of the stack: the C FLAG when a password is set.
54A1
GOSUB to 5605H to output P when the C FLAG is set, else a period; Register Pair DE moves to the next letter.
54A4
LD A,(HL) 7E
Load Register A with the entry's flag byte at Register Pair HL.
54A5
INC L 2C
INCrement Register L by 1 to +01H of the entry.
54A6
RLCA 07
Rotate Register A left: bit 7 goes into bit 0 and bit 6 into bit 7.
54A7
RLCA 07
Rotate Register A left: bit 6 of the flag byte (a system file) is now in the C FLAG.
54A8
GOSUB to 5605H to output S when the C FLAG is set, else a period; Register Pair AF is kept.
54AB
RLCA 07
Rotate Register A left: bit 5 of the flag byte goes into the C FLAG.
54AC
RLCA 07
Rotate Register A left: bit 4 of the flag byte (the entry in use) is now in the C FLAG.
54AD
CCF 3F
Complement the C FLAG: set when bit 4 is clear, a deleted file.
54AE
GOSUB to 5605H to output K when the C FLAG is set, else a period; Register Pair AF is kept.
54B1
RLCA 07
Rotate Register A left: bit 3 of the flag byte (an invisible file) is now in the C FLAG.
54B2
GOSUB to 5605H to output I when the C FLAG is set, else a period; Register Pair AF is kept.
54B5
LD A,(HL) 7E
Load Register A with the second flag byte at +01H of the entry at Register Pair HL.
54B6
INC L 2C
INCrement Register L by 1 to +02H of the entry, the day and year.
54B7
INC L 2C
INCrement Register L by 1 to +03H of the entry, the end of file byte.
54B8
LD B,(HL) 46
Load Register B with the end of file byte at Register Pair HL, the bytes used in the last sector.
54B9
INC L 2C
INCrement Register L by 1 to +04H of the entry, the logical record length.
54BA
RLCA 07
Rotate Register A left: bit 7 of +01H (the file may not shrink) is now in the C FLAG.
54BB
GOSUB to 5605H to output ! when the C FLAG is set, else a period; Register Pair AF is kept.
54BE
RLCA 07
Rotate Register A left: bit 6 of +01H (written to since the last backup) is now in the C FLAG.
54BF
GOSUB to 5605H to output + when the C FLAG is set, else a period.
54C2H - The Sizes
DIR only: the logical record length (1-256), the number of sectors (+14H), the number of records and the space the file's granules take in kilobytes, each as a number of up to five digits in a field of five, then the date of the last update.
54C2
LD A,(HL) 7E
Load Register A with the logical record length at +04H of the entry at Register Pair HL (00H for 256).
54C3
LD E,A 5F
Load Register E with Register A, the low byte of the record length.
54C4
SUB 01H D6 01
SUBtract 01H from Register A: the C FLAG when the length is 00H, meaning 256.
54C6
LD A,00H 3E 00
Load Register A with 00H; the load keeps the C FLAG of the SUB.
54C8
ADC A,00H CE 00
ADD 00H and the C FLAG to Register A: 01H for a length of 256, else 00H.
54CA
LD D,A 57
Load Register D with Register A: Register Pair DE = the logical record length, 1-256.
54CB
GOSUB to 5698H to output Register Pair DE (the record length) in a field of five characters.
54CE
LD A,02H 3E 02
Load Register A with 02H, the spaces between the columns.
54D0
GOSUB to 5634H to output Register A spaces, two between the record length and the sectors.
54D3
LD C,(HL) 4E
Load Register C with the logical record length at +04H of the entry at Register Pair HL.
54D4
LD A,10H 3E 10
Load Register A with 10H, the distance from +04H to +14H of the entry.
54D6
ADD A,L 85
ADD Register L to Register A: the low byte of +14H of the entry, the number of sectors.
54D7
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the number of sectors.
54D8
LD E,(HL) 5E
Load Register E with the low byte of the number of sectors at Register Pair HL.
54D9
INC L 2C
INCrement Register L by 1 to the high byte of the number of sectors.
54DA
LD D,(HL) 56
Load Register D with the high byte of the number of sectors at Register Pair HL.
54DB
INC L 2C
INCrement Register L by 1 to +16H of the entry, the first extent.
54DC
GOSUB to 5698H to output Register Pair DE (the number of sectors) in a field of five characters.
54DF
LD A,02H 3E 02
Load Register A with 02H, the spaces between the columns.
54E1
GOSUB to 5634H to output Register A spaces, two between the sectors and the records.
54E4
PUSH HL E5
Save Register Pair HL (+16H of the entry, the first extent) to the top of the stack.
54E5
LD A,C 79
Load Register A with Register C, the logical record length.
54E6
OR A B7
OR Register A with itself, to set the Z FLAG for a length of 256.
54E7
If the Z FLAG is set (records of 256 bytes), JUMP to 54FFH: the number of records is the number of sectors in Register Pair DE.
54E9
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = the number of sectors.
54EA
INC B 04
INCrement Register B by 1, the first half of a test of the end of file byte in Register B for zero.
54EB
DEC B 05
DECrement Register B by 1 back to the end of file byte: the Z FLAG when the last sector is full.
54EC
If the Z FLAG is set (the last sector is full), JUMP to 54EFH with all the sectors in Register Pair HL.
54EE
DEC HL 2B
DECrement Register Pair HL by 1: the full sectors only, as the end of file byte gives the bytes of the last.
54EF
LD A,C 79
Load Register A with Register C, the logical record length, the divisor.
54F0
GOSUB to 4451H, DIVD@: Register Pair HL (the full sectors) divided by Register A, the quotient in Register Pair HL and the remainder in Register A.
54F3
LD D,L 55
Load Register D with Register L, the quotient: each unit of it is 256 records.
54F4
LD H,A 67
Load Register H with Register A, the remainder: the sectors left over, times 256 bytes.
54F5
LD L,B 68
Load Register L with Register B, the end of file byte: Register Pair HL = the remainder times 256 plus the bytes of the last sector.
54F6
LD A,C 79
Load Register A with Register C, the logical record length, the divisor.
54F7
GOSUB to 4451H, DIVD@: Register Pair HL divided by Register A, the records in Register Pair HL and the bytes over in Register A.
54FA
LD E,L 5D
Load Register E with Register L: Register Pair DE = the quotient times 256 plus these records, the whole records of the file.
54FB
OR A B7
OR Register A with itself, to set the Z FLAG when no bytes are left over.
54FC
If the Z FLAG is set (no part record), JUMP to 54FFH with the number of records in Register Pair DE.
54FE
INC DE 13
INCrement Register Pair DE by 1, counting the part record at the end of the file.
54FF
GOSUB to 5698H to output Register Pair DE (the number of records) in a field of five characters.
5502
LD A,01H 3E 01
Load Register A with 01H, the space between the records and the kilobytes.
5504
GOSUB to 5634H to output Register A spaces, one between the records and the kilobytes.
5507
POP HL E1
Restore Register Pair HL (+16H of the entry, the first extent) from the top of the stack.
5508
POP BC C1
Restore Register Pair BC (Register C = the drive) from the top of the stack, where 5405H saved it.
5509
PUSH BC C5
Save Register Pair BC to the top of the stack again for 5566H.
550A
PUSH HL E5
Save Register Pair HL (+16H of the entry) to the top of the stack again for 5544H.
550B
XOR A AF
Set Register A to 00H by XORing it with itself, to clear the counts below.
550C
LD B,A 47
Load Register B with Register A (00H), the count of the extents.
550D
LD E,A 5F
Load Register E with Register A (00H), the low byte of the count of granules.
550E
LD D,A 57
Load Register D with Register A (00H): Register Pair DE = 0000H, the count of granules.
550F
LD A,(HL) 7E
Load Register A with the first byte of an extent at Register Pair HL, its cylinder (FEH or FFH ends the list).
5510
INC L 2C
INCrement Register L by 1 to the extent's second byte.
5511
CP FEH FE FE
Compare Register A against FEH: the NC FLAG for FEH (a link to an extended entry) or FFH (the end).
5513
If the NC FLAG is set (the end of the extents), JUMP to 5522H.
5515
LD A,(HL) 7E
Load Register A with the second byte of the extent at Register Pair HL: bits 7-5 the first granule, bits 4-0 the granules less 1.
5516
INC L 2C
INCrement Register L by 1 to the next extent.
5517
AND 1FH E6 1F
AND Register A with 1FH, bits 4-0: the number of granules of the extent less 1.
5519
INC A 3C
INCrement Register A by 1: the number of granules of the extent.
551A
ADD A,E 83
ADD Register E to Register A: the low byte of the count of granules.
551B
LD E,A 5F
Load Register E with Register A, the low byte of the count of granules.
551C
If the NC FLAG is set (no carry), JUMP to 551FH.
551E
INC D 14
INCrement Register D by 1, the carry into the high byte of the count.
551F
INC B 04
INCrement the count of the extents in Register B by 1.
5520
JUMP back to 550FH for the next extent of the entry, counting its granules.
5522
If the NZ FLAG is set (FFH, the end of the list), JUMP to 5533H to output the space.
5524
PUSH BC C5
Save Register Pair BC (Register C = the drive) to the top of the stack.
5525
LD B,(HL) 46
Load Register B with the logical file number of the extended entry at Register Pair HL, after the FEH.
5526
GOSUB to 449AH to read the directory sector of logical file number Register B on drive Register C to 4300H: Register Pair HL = the entry.
5529
POP BC C1
Restore Register Pair BC (Register C = the drive) from the top of the stack; the flags are kept.
552A
If the NZ FLAG is set (a read error), JUMP to 571BH to post the error in Register A.
552D
LD A,16H 3E 16
Load Register A with 16H, the offset of the first extent in a directory entry.
552F
ADD A,L 85
ADD Register L to Register A: the low byte of the extended entry's first extent.
5530
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the extended entry's extents.
5531
JUMP back to 550FH to count the extents of the extended entry.
5533
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair HL = the count of granules of the file.
5534
LD A,(IY+0FH) FD 7E 0F
Load Register A with the sectors per granule from the drive control table at Index Register IY+0FH.
5537
GOSUB to 444EH, MULT@: Register Pair HL (granules) times Register A, the sectors in Register Pair HL (high) and Register A (low).
553A
LD H,L 65
Load Register H with Register L, the middle byte of the 24 bit product.
553B
LD L,A 6F
Load Register L with Register A, the low byte: Register Pair HL = the sectors of the file's granules.
553C
GOSUB to 5650H to output the sectors in Register Pair HL as kilobytes with one decimal.
553F
LD A,02H 3E 02
Load Register A with 02H, the spaces between the columns.
5541
GOSUB to 5634H to output Register A spaces, two between the kilobytes and the date.
5544
POP HL E1
Restore Register Pair HL (+16H of the entry) from the top of the stack.
5545
LD A,L 7D
Load Register A with Register L, the low byte of the entry's address.
5546
AND E0H E6 E0
AND Register A with E0H: the low byte of the start of the 32 byte entry.
5548
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the entry's flag byte.
5549
INC L 2C
INCrement Register L by 1 to +01H of the entry, whose bits 3-0 are the month.
554A
LD A,(HL) 7E
Load Register A with the byte at +01H of the entry at Register Pair HL.
554B
INC L 2C
INCrement Register L by 1 to +02H of the entry, the day and the year.
554C
AND 0FH E6 0F
AND Register A with 0FH, bits 3-0: the month of the last update.
554E
LD B,A 47
Load Register B with Register A, the month of the last update, for 5670H.
554F
LD C,(HL) 4E
Load Register C with the byte at +02H of the entry at Register Pair HL: bits 7-3 the day, bits 2-0 the year less 1980.
5550
GOSUB to 5670H to output the date in Registers B and C as MM/DD/YY.
5553
GOSUB to 561FH to end the line with a carriage return (0DH).
5556
JUMP to 5563H for the BREAK test and the next entry of the directory.
5558
LD HL,5780H 21 80 57
Point Register Pair HL to 5780H, the count of the names left on CAT's line.
555B
DEC (HL) 35
DECrement the count at Register Pair HL by 1: the Z FLAG when the line has its four names.
555C
If the NZ FLAG is set (room on the line), JUMP to 5563H for the next entry.
555E
LD (HL),04H 36 04
Store 04H to the count at Register Pair HL, for the next line of four names.
5560
GOSUB to 561FH to end CAT's line with a carriage return (0DH).
5563H - The Next Entry
After each entry the SPACE BAR and BREAK are tested (563FH); BREAK ends the command. Then the next of the eight entries of the sector, then the next sector (or the next page of memory with ALPHA) up to the last directory sector.
5563
GOSUB to 563FH for the SPACE BAR (pause) and BREAK: the Z FLAG when BREAK was pressed.
5566
POP BC C1
Restore Register Pair BC (Register C = the drive) from the top of the stack; the flags are kept.
5567
POP DE D1
Restore Register Pair DE (Register E = the directory sector) from the top of the stack.
5568
POP HL E1
Restore Register Pair HL (the entry) from the top of the stack.
5569
If the Z FLAG is set (BREAK), JUMP to 55D0H to close the output and return.
556C
LD A,20H 3E 20
Load Register A with 20H, the length of a directory entry.
556E
ADD A,L 85
ADD Register L to Register A: the low byte of the next entry, with the C FLAG past the end of the sector.
556F
LD L,A 6F
Load Register L with Register A, so Register Pair HL points to the next entry.
5570
If the NC FLAG is set (more entries in the sector), JUMP back to 5403H for the next entry.
5573
LD A,(IY+0EH) FD 7E 0E
Load Register A with the directory's length in sectors from the drive control table at Index Register IY+0EH.
5576
DEC A 3D
DECrement Register A by 1: the number of the last directory sector.
5577
INC H 24
INCrement Register H by 1 to the next page of memory, which ALPHA uses for the next sector.
5578
INC E 1C
INCrement Register E by 1 to the next directory sector.
5579
CP E BB
Compare Register A (the last sector) against Register E (the next): the C FLAG when the directory is done.
557A
If the C FLAG is set (no more sectors), JUMP to 5586H.
557C
LD A,(5781H) 3A 81 57
Load Register A with the ALPHA value from 5781H, to see whether the sectors go to successive pages.
557F
OR A B7
OR Register A with itself, to set the NZ FLAG for ALPHA.
5580
If the NZ FLAG is set (ALPHA), JUMP to 53EFH with Register Pair HL at the next page.
5583
JUMP to 53E6H to read the next sector into 5900H.
5586
LD A,(53FEH) 3A FE 53
Load Register A with the pass from 53FEH: FFH after ALPHA's reading pass, else 00H.
5589
XOR FFH EE FF
XOR Register A with FFH: the Z FLAG when the reading pass of ALPHA has ended.
558B
If the NZ FLAG is set (the list is done), JUMP to 55ACH to end it.
558D
LD (53FEH),A 32 FE 53
Store Register A (00H) to 53FEH, the pass: the listing pass of ALPHA follows.
5590
PUSH BC C5
Save Register Pair BC (Register C = the drive) to the top of the stack.
5591
PUSH IX DD E5
Save Index Register IX (the evaluation block) to the top of the stack.
5593
LD IX,5900H DD 21 00 59
Point Index Register IX to 5900H, the first entry in memory, for SORT@.
5597
LD DE,00E0H 11 E0 00
Load Register Pair DE with 00E0H, the offset of the last entry in a sector.
559A
DEC H 25
DECrement Register H by 1 back to the page of the last directory sector.
559B
ADD HL,DE 19
ADD Register Pair DE (00E0H) to Register Pair HL: Register Pair HL = the last entry of the last sector.
559C
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the last entry, for SORT@.
559D
LD BC,0520H 01 20 05
Load Register Pair BC with 0520H: Register B = 05H, the offset of the key (the name), Register C = 20H, the length of an entry.
55A0
LD HL,000BH 21 0B 00
Load Register Pair HL with 000BH: Register L = 0BH, the length of the key (name and extension), Register H = 00H for an ascending sort.
55A3
GOSUB to 4482H, SORT@, to sort the entries from Index Register IX to Register Pair DE by their names.
55A6
POP IX DD E1
Restore Index Register IX (the evaluation block) from the top of the stack.
55A8
POP BC C1
Restore Register Pair BC (Register C = the drive) from the top of the stack.
55A9
JUMP back to 53E4H to list the sorted entries from 5900H.
55AC
LD A,(5780H) 3A 80 57
Load Register A with the count of the names left on CAT's line from 5780H.
55AF
CP 04H FE 04
Compare Register A against 04H: the NZ FLAG when CAT's last line is not finished.
55B1
If the NZ FLAG is set (a part line), GOSUB to 561FH to end it with a carriage return (0DH).
55B4
GOSUB to 561FH to output a carriage return (0DH), a blank line after the list.
55B7H - The Next Drive
A drive named in the command ends it. Without one, CAT and DIR go on to drives 1-7 only when a wildmask was given (the manual's global form); FREE goes on to every drive. Drives that are not ready are passed over (5274H).
55B7
BIT 0,(IX+00H) DD CB 00 46
Test bit 0 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a drive was named.
55BB
If the NZ FLAG is set (a drive was named), JUMP to 55D0H to close the output and return.
55BD
BIT 2,(IX+00H) DD CB 00 56
Test bit 2 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a wildmask was given.
55C1
If the NZ FLAG is set (a wildmask), JUMP to 55C9H for the next drive.
55C3
LD A,(531BH) 3A 1B 53
Load Register A with the operand at 531BH: AFH for CAT and DIR, 00H for FREE.
55C6
OR A B7
OR Register A with itself, to set the NZ FLAG for CAT and DIR.
55C7
If the NZ FLAG is set (CAT or DIR without a wildmask), JUMP to 55D0H: only drive 0 is listed.
55C9
LD A,07H 3E 07
Load Register A with 07H, the number of the last drive the loop tries.
55CB
INC C 0C
INCrement Register C by 1 to the next drive number, for the loop over the drives.
55CC
CP C B9
Compare Register A (07H) against Register C (the next drive): the NC FLAG while the drive is 7 or less.
55CD
If the NC FLAG is set (drives left), JUMP back to 5269H for the next drive.
55D0
GOSUB to 5708H to close the output file: the Z FLAG for a device, else the result of CLOSE@.
55D3
If the NZ FLAG is set (CLOSE@ failed), JUMP to 571BH to post the error in Register A.
55D6
RET C9
RETurn to the caller of CMNDI@ with the Z FLAG: the command is done.
55D7H - The Evaluation Block
Data: the 9 byte block EVAL@ (4479H) fills from the command line (5221H): the flags, then the addresses of the source, destination and wildmask blocks (33 bytes each, after the file at 5783H, 57A4H and 57C5H) and of the parameter table.
55D7
DEFB 00H 00
The flags EVAL@ sets: bit 0 a source (the drive), bit 1 a destination (the output), bit 2 a wildmask, bit 3 parameters.
55D8-55D9
DEFW 5783H 83 57
The address of the source block, 5783H: the flag byte, then the field, a drive such as :1.
55DA-55DB
DEFW 57A4H A4 57
The address of the destination block, 57A4H: the flag byte, then the file or device that takes the output.
55DC-55DD
DEFW 57C5H C5 57
The address of the wildmask block, 57C5H: the flag byte, then the wildmask for WILD@ (5263H).
55DE-55DF
DEFW 55E0H E0 55
The address of the parameter table at 55E0H, the four parameters of CAT and DIR.
55E0H - The Parameters
Data: EVAL@'s parameter table, four 9 byte entries (a six character name, the address of the value, the type byte) and 00H at the end. Each type byte is 20H, a logical value: the name alone, or =Y, YES or ON, stores FFFFH; =N, NO or OFF 0000H; a name may be shortened to its first letters (the manual's S, I, K and A). FREE takes the same table: its map and summary do not look at the values, but ALPHA still raises the memory needed (5248H).
55E0-55E5
DEFM "INVIS " 49 4E 56 49 53 20
The name of the first parameter, INVIS: list invisible files too.
55E6-55E7
DEFW 542CH 2C 54
INVIS's value goes to 542CH-542DH, the operand of LD DE,0000H at 542BH, tested by INC E and DEC E.
55E8
DEFB 20H 20
The type byte of INVIS: 20H, bit 5, a logical value, so the name alone sets it.
55E9-55EE
DEFM "SYSTEM" 53 59 53 54 45 4D
The name of the second parameter, SYSTEM: list system files too.
55EF-55F0
DEFW 541EH 1E 54
SYSTEM's value goes to 541EH-541FH, the operand of LD DE,0000H at 541DH.
55F1
DEFB 20H 20
The type byte of SYSTEM: 20H, bit 5, a logical value, so the name alone sets it.
55F2-55F7
DEFM "KILL " 4B 49 4C 4C 20 20
The name of the third parameter, KILL: list deleted files too.
55F8-55F9
DEFW 5410H 10 54
KILL's value goes to 5410H-5411H, the operand of LD DE,0000H at 540FH.
55FA
DEFB 20H 20
The type byte of KILL: 20H, bit 5, a logical value, so the name alone sets it.
55FB-5600
DEFM "ALPHA " 41 4C 50 48 41 20
The name of the fourth parameter, ALPHA: list the names in alphabetical order.
5601-5602
DEFW 5781H 81 57
ALPHA's value goes to 5781H-5782H, in the work area after the file.
5603
DEFB 20H 20
The type byte of ALPHA: 20H, bit 5, a logical value, so the name alone sets it.
5604
DEFB 00H 00
The end of the parameter table for EVAL@: a 00H in place of the next name.
5605H - Output a Letter or a Period
Outputs the attribute letter at Register Pair DE when the C FLAG is set, else a period, and moves Register Pair DE to the next letter. Register Pair AF is kept, so the caller can go on rotating its flag byte.
5605
PUSH AF F5
Save Register Pair AF (the flag byte and the C FLAG) to the top of the stack.
5606
LD A,(DE) 1A
Load Register A with the attribute letter at Register Pair DE (577AH-577FH).
5607
INC DE 13
INCrement Register Pair DE by 1 to the next attribute letter; the C FLAG is kept.
5608
If the C FLAG is set (the attribute holds), JUMP to 560CH to output the letter in Register A.
560A
LD A,2EH 3E 2E
Load Register A with 2EH, a period, for an attribute that does not hold.
560C
GOSUB to 5621H to output the character in Register A, the letter or the period.
560F
POP AF F1
Restore Register Pair AF (the flag byte and the C FLAG) from the top of the stack.
5610
RET C9
RETurn to the caller with Register Pair AF as it was and Register Pair DE at the next letter.
5611H - Test a Granule's Bit
Register B = a granule 0-7, Register Pair HL = a byte of the GAT or the lockout table: returns the NZ FLAG when bit Register B of the byte is set. The bit number is put into the instruction BIT n,(HL) at 561CH (its second byte, 561DH).
5611
LD A,B 78
Load Register A with Register B, the granule's number.
5612
AND 07H E6 07
AND Register A with 07H, bits 2-0: the bit number 0-7.
5614
RLCA 07
Rotate Register A left: the bit number times 2.
5615
RLCA 07
Rotate Register A left: the bit number times 4.
5616
RLCA 07
Rotate Register A left: the bit number times 8, its place in the second byte of a BIT instruction.
5617
OR 46H F6 46
OR Register A with 46H, the second byte of BIT 0,(HL): Register A = the second byte of BIT n,(HL) for bit Register B.
5619
LD (561DH),A 32 1D 56
Store Register A to 561DH, the second byte of the BIT instruction at 561CH.
561C
BIT 0,(HL) CB 46
Test bit n (stored at 561DH; 0 in the file) of the byte at Register Pair HL: the NZ FLAG when the bit is set.
561E
RET C9
RETurn to the caller with the NZ FLAG when the granule's bit is set.
561FH - Output a Character
561FH outputs a carriage return (0DH); 5621H outputs the character in Register A, through the control block at 57A5H: the display's or a device's (type 90H, made by 56F7H) or the file's that INIT@ opened (56EBH). The ROM's 001BH hands it to SYS0/SYS (4033H).
561F
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end a line.
5621
PUSH DE D5
Save Register Pair DE to the top of the stack.
5622
LD DE,57A5H 11 A5 57
Point Register Pair DE to 57A5H, the control block of the output: a device (90H) or the file opened by INIT@.
5625
GOSUB to 001BH, the ROM's output of the character in Register A to the control block at Register Pair DE.
5628
POP DE D1
Restore Register Pair DE from the top of the stack.
5629
RET C9
RETurn to the caller with the character output.
562AH - Output a Text
Outputs the text at Register Pair HL up to the 03H that ends it; Register Pair HL returns at the 03H.
562A
LD A,(HL) 7E
Load Register A with a character of the text at Register Pair HL.
562B
CP 03H FE 03
Compare Register A against 03H: the Z FLAG at the end of the text.
562D
RET Z C8
If the Z FLAG is set (the end of the text), RETurn to the caller.
562E
GOSUB to 5621H to output the character in Register A.
5631
INC HL 23
INCrement Register Pair HL by 1 to the next character of the text.
5632
JUMP back to 562AH for the next character of the text at Register Pair HL.
5634H - Output Spaces
Outputs Register A spaces (Register A must not be 0); Register Pair AF returns with Register A = 00H.
5634
PUSH AF F5
Save Register Pair AF (Register A = the spaces still to output) to the top of the stack.
5635
LD A,20H 3E 20
Load Register A with 20H, a space, the character to output for each count.
5637
GOSUB to 5621H to output the space in Register A.
563A
POP AF F1
Restore Register Pair AF (Register A = the spaces still to output) from the top of the stack.
563B
DEC A 3D
DECrement Register A by 1, the spaces still to output.
563C
If the NZ FLAG is set (more spaces), JUMP back to 5634H for the next space.
563E
RET C9
RETurn to the caller with the spaces output and Register A = 00H.
563FH - The SPACE BAR and BREAK
Returns the Z FLAG when BREAK is pressed, else the NZ FLAG. While a DO file runs (bit 5 of SFLAG1$) the keyboard is not read. The SPACE BAR pauses until the next key, and that key may be BREAK.
563F
LD A,(4297H) 3A 97 42
Load Register A with SFLAG1$ from 4297H, the system flags (bit 5: a DO file is running).
5642
AND 20H E6 20
AND Register A with 20H, bit 5: the NZ FLAG while a DO file runs.
5644
RET NZ C0
If the NZ FLAG is set (a DO file runs), RETurn with the NZ FLAG: the keyboard is not read.
5645
GOSUB to 002BH, the ROM's keyboard scan: Register A = the key pressed, or 00H.
5648
CP 20H FE 20
Compare Register A against 20H, the SPACE BAR: the Z FLAG to pause.
564A
If the Z FLAG is set (the SPACE BAR), GOSUB to 0049H, the ROM's wait for a key: Register A = the key that ends the pause.
564D
CP 01H FE 01
Compare Register A against 01H, the BREAK key: the Z FLAG when BREAK was pressed.
564F
RET C9
RETurn to the caller with the Z FLAG for BREAK, else the NZ FLAG.
5650H - Output Kilobytes
Register Pair HL = a number of sectors of 256 bytes: outputs it as kilobytes with one decimal (the sectors divided by 4, then .0, .2, .5 or .7 for the quarter left) and a k, such as 82.5k, the integer part in a field of five characters.
5650
LD A,04H 3E 04
Load Register A with 04H, the sectors of 256 bytes in a kilobyte, the divisor.
5652
GOSUB to 4451H, DIVD@: Register Pair HL divided by Register A, the kilobytes in Register Pair HL and the sectors over in Register A.
5655
PUSH AF F5
Save Register Pair AF (Register A = the sectors over, 0-3) to the top of the stack.
5656
EX DE,HL EB
Exchange Register Pair DE with Register Pair HL: Register Pair DE = the kilobytes.
5657
GOSUB to 5698H to output Register Pair DE (the kilobytes) in a field of five characters.
565A
LD A,2EH 3E 2E
Load Register A with 2EH, the decimal point between the kilobytes and the tenths.
565C
GOSUB to 5621H to output the decimal point in Register A.
565F
POP AF F1
Restore Register Pair AF (Register A = the sectors over, 0-3) from the top of the stack.
5660
LD E,A 5F
Load Register E with Register A, the sectors over, for the multiply by 5 below.
5661
ADD A,A 87
ADD Register A to itself: the sectors over times 2.
5662
ADD A,A 87
ADD Register A to itself: the sectors over times 4.
5663
ADD A,E 83
ADD Register E to Register A: the sectors over times 5.
5664
SRL A CB 3F
Shift Register A right by one bit: the sectors over times 5 divided by 2, the tenths 0, 2, 5 or 7.
5666
ADD A,30H C6 30
ADD 30H to Register A: the tenths as an ASCII digit.
5668
GOSUB to 5621H to output the tenths' digit in Register A.
566B
LD A,6BH 3E 6B
Load Register A with 6BH, the character k (lower case).
566D
JUMP to 5621H to output the k in Register A and return to the caller.
5670H - Output a Date
Register B = the month, Register C = the day (bits 7-3) and the year less 1980 (bits 2-0): outputs MM/DD/YY with two digits each, the year 80-87.
5670
LD E,B 58
Load Register E with Register B, the month, the number for 5690H.
5671
LD D,00H 16 00
Load Register D with 00H, the high byte of the number in Register Pair DE.
5673
GOSUB to 5690H to output Register Pair DE (the month) as two digits.
5676
LD A,2FH 3E 2F
Load Register A with 2FH, the character /, after the month.
5678
GOSUB to 5621H to output the character in Register A.
567B
LD A,C 79
Load Register A with Register C, the day and the year.
567C
RRCA 0F
Rotate Register A right: the first of three, to bring bits 7-3 (the day) down.
567D
RRCA 0F
Rotate Register A right: the second of three, for the day.
567E
RRCA 0F
Rotate Register A right: the day is now in bits 4-0 of Register A.
567F
AND 1FH E6 1F
AND Register A with 1FH, bits 4-0: the day of the month.
5681
LD E,A 5F
Load Register E with Register A, the day; Register D is still 00H.
5682
GOSUB to 5690H to output Register Pair DE (the day) as two digits.
5685
LD A,2FH 3E 2F
Load Register A with 2FH, the character /, after the day.
5687
GOSUB to 5621H to output the character in Register A.
568A
LD A,C 79
Load Register A with Register C, the day and the year.
568B
AND 07H E6 07
AND Register A with 07H, bits 2-0: the year less 1980.
568D
ADD A,50H C6 50
ADD 50H (80) to Register A: the year less 1900, 80-87.
568F
LD E,A 5F
Load Register E with Register A, the year; the code goes on into 5690H, which outputs it and returns.
5690H - Output a Number
Register Pair DE = a number: 5690H outputs it as two digits, 5694H as three, both with leading zeros, and 5698H in a field of five characters with leading spaces. Register A is the count of leading zeros that may be left out (bit 7: put a space in place of each). The registers other than Register Pair AF are kept (4485H). The ROM's 132FH turns the number into five digits at 56D5H.
5690
LD A,03H 3E 03
Load Register A with 03H: up to three of the five digits left out, two digits shown.
5692
JUMP to 569AH with Register A = 03H, the count of the zeros that may be left out.
5694
LD A,02H 3E 02
Load Register A with 02H: up to two of the five digits left out, three digits shown.
5696
JUMP to 569AH with Register A = 02H, the count of the zeros that may be left out.
5698
LD A,84H 3E 84
Load Register A with 84H: up to four leading zeros, each output as a space (bit 7), a field of five.
569A
GOSUB to 4485H, which calls 569DH with Register Pairs BC, DE, HL and Index Registers IX and IY saved, and returns to the caller.
569D
PUSH AF F5
Save Register Pair AF (Register A = the zeros that may be left out) to the top of the stack.
569E
LD HL,56D5H 21 D5 56
Point Register Pair HL to 56D5H, the buffer for the five digits.
56A1
GOSUB to 56C6H to turn Register Pair DE into five ASCII digits at Register Pair HL.
56A4
POP BC C1
Restore Register Pair BC from the top of the stack: Register B = the zeros that may be left out, with bit 7.
56A5
LD C,05H 0E 05
Load Register C with 05H, the number of digits.
56A7
BIT 7,B CB 78
Test bit 7 of Register B: the NZ FLAG when each zero left out is output as a space.
56A9
PUSH AF F5
Save Register Pair AF (the Z FLAG of the test) to the top of the stack.
56AA
RES 7,B CB B8
Reset bit 7 of Register B: Register B = the count of the zeros that may be left out.
56AC
LD A,(HL) 7E
Load Register A with a digit at Register Pair HL.
56AD
CP 30H FE 30
Compare Register A against 30H, the digit 0: the Z FLAG for a leading zero.
56AF
If the NZ FLAG is set (not a zero), JUMP to 56BCH to output the rest of the digits.
56B1
POP AF F1
Restore Register Pair AF (the Z FLAG of the bit 7 test) from the top of the stack.
56B2
PUSH AF F5
Save Register Pair AF to the top of the stack again for the next digit.
56B3
LD A,20H 3E 20
Load Register A with 20H, a space; the load keeps the flags.
56B5
If the NZ FLAG is set (bit 7 was set), GOSUB to 5621H to output the space in Register A in place of the zero.
56B8
INC HL 23
INCrement Register Pair HL by 1 to the next digit.
56B9
DEC C 0D
DECrement Register C by 1, the count of the digits left to output.
56BA
DECrement Register B and loop back to 56ACH while Register B is not zero, for the zeros that may be left out.
56BC
POP AF F1
Restore Register Pair AF from the top of the stack, to balance the stack.
56BD
LD A,(HL) 7E
Load Register A with a digit at Register Pair HL.
56BE
GOSUB to 5621H to output the digit in Register A.
56C1
INC HL 23
INCrement Register Pair HL by 1 to the next digit.
56C2
DEC C 0D
DECrement Register C by 1, the count of the digits left to output.
56C3
If the NZ FLAG is set (digits left), JUMP back to 56BDH for the next digit.
56C5
RET C9
RETurn through 4485H, which restores the registers, to the caller.
56C6H - A Number to Digits
Register Pair DE = a number, Register Pair HL = a buffer: the ROM's 132FH (FOUTCI) turns the integer at 4121H into five ASCII digits with leading zeros at Register Pair HL and a 00H after them; Register Pair BC = 0000H asks for no decimal point and no commas. Register Pairs BC and HL are kept.
56C6
PUSH BC C5
Save Register Pair BC to the top of the stack.
56C7
PUSH HL E5
Save Register Pair HL (the buffer) to the top of the stack.
56C8
LD (4121H),DE ED 53 21 41
Store Register Pair DE (the number) to 4121H, the integer the ROM's 132FH converts.
56CC
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H: no decimal point and no commas in the ROM's digits.
56CF
GOSUB to 132FH, the ROM's integer to ASCII, to store the five digits of the number at Register Pair HL.
56D2
POP HL E1
Restore Register Pair HL (the buffer) from the top of the stack.
56D3
POP BC C1
Restore Register Pair BC from the top of the stack.
56D4
RET C9
RETurn to the caller with the digits at Register Pair HL.
56D5H - The Digit Buffer
Not in the file: no load block fills 56D5H-56DAH, which 569EH and the ROM's 132FH use for the digits of a number.
56D5-56DA
DEFS 6
The five digits of a number and the 00H after them, stored by the ROM's 132FH (56CFH) and output by 56ACH-56C3H.
56DBH - Open the Output
The output goes to the display (@DO, device 1) unless a destination was given. A destination with a name or a drive (bit 6 or bit 3 of its flag byte at 57A4H) is a file: INIT@ opens or creates it with the control block at 57A5H (the destination's text) and the buffer 5800H. Any other destination is a device: its number (bits 0-2) goes to LOCDCB%, and its control block address and the type 90H are stored at 57A5H-57A7H. Returns the Z FLAG, or the NZ FLAG with INIT@'s error in Register A.
56DB
LD B,01H 06 01
Load Register B with 01H, the number of the display's control block, @DO, the output when no destination is given.
56DD
BIT 1,(IX+00H) DD CB 00 4E
Test bit 1 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a destination was given.
56E1
If the Z FLAG is set (no destination), JUMP to 56F7H to output to the display.
56E3
LD A,(57A4H) 3A A4 57
Load Register A with the flag byte of the destination block at 57A4H (bit 6 a name, bit 7 a device or drive with its number in bits 0-3).
56E6
LD B,A 47
Load Register B with Register A, the destination's flag byte, whose bits 0-2 are a device's number.
56E7
AND 48H E6 48
AND Register A with 48H, bits 6 and 3: the NZ FLAG for a file name or a drive.
56E9
If the Z FLAG is set (a device), JUMP to 56F7H to output to it.
56EB
LD B,00H 06 00
Load Register B with 00H, the logical record length of 256 for INIT@.
56ED
LD DE,57A5H 11 A5 57
Point Register Pair DE to 57A5H, the destination's text, which INIT@ takes as the file control block.
56F0
LD HL,5800H 21 00 58
Point Register Pair HL to 5800H, the buffer of the output file.
56F3
GOSUB to 4420H, INIT@, to open the file of the control block at Register Pair DE, or create it.
56F6
RET C9
RETurn to the caller with the result of INIT@: the Z FLAG when the file is open (the C FLAG when it is new).
56F7
LD A,B 78
Load Register A with Register B, the device's number from LOCDEV@ (01H for @DO).
56F8
AND 07H E6 07
AND Register A with 07H, bits 2-0: the device's number 0-5 in the DCB table.
56FA
GOSUB to 44A0H, LOCDCB%, for the address of the device's control block in Register Pair DE.
56FD
LD (57A6H),DE ED 53 A6 57
Store Register Pair DE, the device's control block, to 57A6H, +01H of the output's control block.
5701
LD A,90H 3E 90
Load Register A with 90H, the type of a control block that passes the I/O to a device (bit 7 open, bit 4 the device's).
5703
LD (57A5H),A 32 A5 57
Store Register A (90H) to 57A5H, the type byte of the output's control block.
5706
XOR A AF
Set Register A to 00H by XORing it with itself, and set the Z FLAG: the output is ready.
5707
RET C9
RETurn to the caller with the Z FLAG and Register A = 00H.
5708H - Close the Output
Closes the output file through CLOSE@ (4428H) unless the output is a device (type 90H). Returns the Z FLAG, or the NZ FLAG with CLOSE@'s error in Register A.
5708
LD DE,57A5H 11 A5 57
Point Register Pair DE to 57A5H, the control block of the output.
570B
LD A,(DE) 1A
Load Register A with the type byte of the control block at Register Pair DE.
570C
CP 90H FE 90
Compare Register A against 90H: the Z FLAG for a device, which needs no closing.
570E
If the NZ FLAG is set (a file), GOSUB to 4428H, CLOSE@, to close the file of the control block at Register Pair DE.
5711
RET C9
RETurn to the caller with the Z FLAG, or the NZ FLAG and the error of CLOSE@ in Register A.
5712H - WILD@ When a Wildmask Was Given
Calls WILD@ (447CH) only when the command had a wildmask: with Register B not zero it sets the mask from the text at Register Pair HL, with Register B = 00H it compares the name at Register Pair HL with the mask (the NZ FLAG for no match). Without a wildmask it returns the Z FLAG: every name matches.
5712
BIT 2,(IX+00H) DD CB 00 56
Test bit 2 of the evaluation block's flags at Index Register IX+00H: the NZ FLAG when a wildmask was given.
5716
If the NZ FLAG is set (a wildmask), GOSUB to 447CH, WILD@, with Register B and Register Pair HL as they are.
5719
RET C9
RETurn to the caller with the Z FLAG for a match (or no wildmask), else the NZ FLAG.
571AH - Posting an Error
571AH takes the error code from Register B, 571BH from Register A. Bit 6 is set, so ERROR@ (SYS5/SYS) displays the message without its frame; bit 7 is clear, so ERROR@ then ends the command through ABORT@.
571A
LD A,B 78
Load Register A with Register B, the error code (2EH, 21H or 08H).
571B
OR 40H F6 40
OR Register A with 40H: bit 6 set, the message without the frame.
571D
JUMP to 4409H, ERROR@, to post the error in Register A and end the command.
5720H - The Summary Line
Data: the line Drive: dd NAME - Space: that starts each drive's output (52E8H), ended by 03H for 562AH. 5299H-52A7H put the drive's name and the diskette's name into it; the file holds NS and diskname there.
5720-5726
DEFM "Drive: " 44 72 69 76 65 3A 20
The text before the drive's two character name.
5727-5728
DEFM "NS" 4E 53
The drive's two character name, copied from DCTTBL (5299H-529FH); the file holds NS.
5729
DEFM " " 20
The space between the drive's name and the diskette's name, passed over by 52A4H.
572A-5731
DEFM "diskname" 64 69 73 6B 6E 61 6D 65
The diskette's name, eight characters copied from +D0H of its GAT (52A1H-52A7H).
5732-573B
DEFM " - Space: " 20 2D 20 53 70 61 63 65 3A 20
The text before the free entries, the total entries and the free kilobytes, which 52EEH-5314H output.
573C
DEFB 03H 03
03H, which ends the summary line for 562AH; the free counts follow it on the line.
573DH - DIR's Heading
Data: the heading line of DIR's columns (53CBH), ended by 0DH and 03H.
573D-574C
DEFM "Filespec " 46 69 6C 65 73 70 65 63 20 20 20 20 20 20 20 20
The heading of the 15 character column of the names, and a space.
574D-5754
DEFM "Attrib " 41 74 74 72 69 62 20 20
The heading of the seven attribute characters.
5755-5759
DEFM "LRL " 4C 52 4C 20 20
The heading of the logical record length, LRL, with two spaces after it.
575A-5760
DEFM "#Secs " 23 53 65 63 73 20 20
The heading of the number of sectors, +14H of the entry.
5761-5768
DEFM "#Recs " 23 52 65 63 73 20 20 20
The heading of the number of records, from the sectors, the end of file byte and the record length.
5769-5770
DEFM "Space " 53 70 61 63 65 20 20 20
The heading of the kilobytes of the file's granules.
5771-5777
DEFM "Updated" 55 70 64 61 74 65 64
The heading of the date of the last update, MM/DD/YY.
5778-5779
DEFB 0DH,03H 0D 03
0DH, the carriage return that ends the line, and 03H, which ends the text for 562AH.
577AH - The Attribute Letters
Data: the six letters of DIR's attributes after the protection level, output by 5605H in this order, a period for each that does not hold.
577A-577F
DEFM "PSKI!+" 50 53 4B 49 21 2B
P a password, S a system file, K a deleted file, I invisible, ! the file may not shrink, + written to since the last backup.
5780H - The Work Area
Not in the file: SYS9/SYS uses the memory after its last byte (577FH) for its counters, the three blocks of EVAL@, the output file's buffer and the directory buffer.
5780
DEFS 1
The count of the names left on CAT's line, set to 04H by 53DBH and 555EH, counted down by 555BH.
5781-5782
DEFS 2
The value of ALPHA from EVAL@: FFFFH to sort the names, cleared (the low byte) by CAT and DIR at 5219H.
5783-57A3
DEFS 33
The source block of EVAL@: the flag byte (5233H) and the source field, the drive.
57A4
DEFS 1
The flag byte of the destination block of EVAL@ (56E3H): bit 6 a name, bit 7 a device or drive.
57A5-57C4
DEFS 32
The destination's text, which becomes the control block of the output: a file's (INIT@, 56EDH) or type 90H with a device's control block address (5701H).
57C5
DEFS 1
The flag byte of the wildmask block of EVAL@.
57C6-57E5
DEFS 32
The text of the wildmask, from which WILD@ sets its mask (5263H).
5800-58FF
DEFS 256
The buffer of the output file, given to INIT@ (56F0H).
5900-79FF
DEFS 8448
The GAT, then the directory sectors: one sector at 5900H, or the whole directory a page a sector with ALPHA (7A00H is the top checked at 524EH).