5200H - MAP
MAP/CMD's transfer address, entered from the DOS command level with Register Pair HL at the command line after the word MAP: MAP [FROM] :dr [TO] filespec/@devicespec [USING] wildmask (SYSTEM,INVIS,HEX). MAP reads the GAT of the drive for the diskette's name and date, then every entry sector of the directory, and for each active file that passes the SYSTEM and INVIS switches and the wildmask shows its name and each extent as the first and the last cylinder and sector, through the extended entries. The output goes to the display, a device or a file. It returns to the DOS by RET.
5200
PUSH HL E5
Save Register Pair HL, the command line pointer after MAP, to the top of the stack while the heading is shown.
5201
LD HL,5455H 21 55 54
Point Register Pair HL to 5455H, MAP's heading (MAP - DOSPLUS Disk/file mapper - 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
POP HL E1
Restore Register Pair HL, the command line pointer, from the top of the stack.
5208
LD IX,54ACH DD 21 AC 54
Point Index Register IX to 54ACH, MAP's evaluation block for EVAL@ (drive, output, wildmask and parameters).
520C
GOSUB to 4479H, EVAL@, to take the fields and the parameters of the command line at Register Pair HL into the blocks.
520F
If the NZ FLAG is set (EVAL@ found an error, 2EH in Register A), JUMP to 5450H to post the error.
5212H - No Field: the Asterisk Prompt
When the command line holds no field and no parameter, MAP shows an asterisk and takes up to 63 characters as a new command line, which EVAL@ evaluates again; BREAK is the error 30H, Terminated.
5212
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.
5215
AND 0FH E6 0F
AND Register A with 0FH, the bits of the source, the destination, the wildmask and the parameters.
5217
If the NZ FLAG is set (something was given), JUMP to 522BH to take the drive.
5219
LD A,2AH 3E 2A
Load Register A with 2AH, the asterisk shown as the prompt when the command line holds nothing.
521B
GOSUB to 0033H, the ROM's display of the character in Register A, the prompt.
521E
LD B,3FH 06 3F
Load Register B with 3FH, the most characters of the reply: 63.
5220
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, the buffer for the reply (later the GAT and the directory sectors).
5223
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.
5226
If the C FLAG is set (BREAK), JUMP to 544EH for the error 30H, Terminated.
5229
JUMP to 5208H to evaluate the reply at Register Pair HL as the command line.
522BH - The Drive
The source field must be a drive (:dr), with the flag bits 7 and 3 and no name; without a source field MAP maps drive 0. Any other source field is the error 2BH, Illegal devicespec.
522B
LD C,00H 0E 00
Load Register C with 00H, drive 0, for a command line with no source field.
522D
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.
5231
If the Z FLAG is set (no source field), JUMP to 5242H with Register C = drive 0.
5233
LD A,(54D2H) 3A D2 54
Load Register A with the flag byte of the source block from 54D2H: bit 7 a device or a drive, bit 6 a name, bit 3 a drive.
5236
LD C,A 4F
Load Register C with Register A, keeping the flag byte of the source block for its drive number.
5237
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).
5239
CP 88H FE 88
Compare Register A against 88H, a drive without a name: bits 7 and 3 set, bit 6 clear.
523B
If the NZ FLAG is set (not a drive), JUMP to 5448H for the error 2BH, Illegal devicespec.
523E
LD A,C 79
Load Register A with Register C, the flag byte of the source block again.
523F
AND 07H E6 07
AND Register A with 07H, keeping bits 0-2, the drive number LOCDEV@ put there.
5241
LD C,A 4F
Load Register C with Register A, the drive to map, which stays in Register C to the end.
5242H - The Output, the Wildmask and the Diskette
Opens the output (53EFH), sets the wildmask when one was given (WILD@ with Register B = 01H), checks the drive with DCHECK, reads the GAT into 5600H and shows the diskette's name (GAT+D0H) and date (GAT+D8H) as the first line.
5242
GOSUB to 53EFH to open the output: the display, the device or the file of the destination field.
5245
If the NZ FLAG is set (INIT@ refused the file, its error code in Register A), JUMP to 5450H to post the error.
5248
LD B,01H 06 01
Load Register B with 01H, which makes WILD@ set the wildmask from the specification at Register Pair HL.
524A
LD HL,5515H 21 15 55
Point Register Pair HL to 5515H, the text of the wildmask block, the specification after USING or with a wildcard.
524D
GOSUB to 5426H to call WILD@ with Register B = 01H when a wildmask field was given, so the wildmask is set.
5250
LD A,00H 3E 00
Load Register A with 00H, the function DCHECK of DISKIO%, which checks that drive Register C is there.
5252
GOSUB to 4488H, DISKIO%, to check drive Register C.
5255
If the NZ FLAG is set (the drive is not there), JUMP to 544BH for the error 08H, Drive not available.
5258
LD E,00H 1E 00
Load Register E with 00H, directory sector 0, the GAT.
525A
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, MAP's buffer for the GAT and then for each directory sector.
525D
LD A,06H 3E 06
Load Register A with 06H, the function SREAD of DISKIO%, which reads a sector of the directory cylinder.
525F
GOSUB to 4488H, DISKIO%, to read sector Register E of the directory of drive Register C into the buffer at Register Pair HL.
5262
If the NZ FLAG is set (the read failed, its error code in Register A), JUMP to 5450H to post the error.
5265
GOSUB to 44A3H, LOCDCT%, to point Index Register IY to the drive control table of drive Register C.
5268
LD L,D0H 2E D0
Load Register L with D0H: Register Pair HL = 56D0H, the diskette's name at GAT+D0H.
526A
LD B,08H 06 08
Load Register B with 08H, the eight characters of the diskette's name.
526C
LD A,(HL) 7E
Load Register A with the next character of the name at Register Pair HL.
526D
GOSUB to 542EH to send the character in Register A to the output.
5270
INC L 2C
INCrement Register L by 1, to the next character of the name in the GAT.
5271
DECrement Register B and, while it is not zero, LOOP BACK to 526CH for the next character (DJNZ).
5273
LD A,20H 3E 20
Load Register A with 20H, a space between the name and the date.
5275
GOSUB to 542EH to send the space in Register A to the output.
5278
LD A,20H 3E 20
Load Register A with 20H, a second space between the name and the date.
527A
GOSUB to 542EH to send the space in Register A to the output.
527D
LD B,08H 06 08
Load Register B with 08H, the eight characters of the date at GAT+D8H, where Register Pair HL now points.
527F
LD A,(HL) 7E
Load Register A with the next character of the date at Register Pair HL.
5280
GOSUB to 542EH to send the character in Register A to the output.
5283
INC L 2C
INCrement Register L by 1, to the next character of the date in the GAT.
5284
DECrement Register B and, while it is not zero, LOOP BACK to 527FH for the next character (DJNZ).
5286
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the line of the name and the date.
5288
GOSUB to 542EH to send the carriage return in Register A to the output.
528BH - The Directory Entries
Reads the entry sectors of the directory, sector 2 up to the last (DCT+0EH less 1), into 5600H. An entry is shown when it is active (bit 4), not an extended entry (bit 7), a system file (bit 6) only with SYSTEM, an invisible file (bit 3) only with INVIS, and its name and extension match the wildmask.
528B
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries (0 is the GAT, 1 the HIT).
528D
LD L,00H 2E 00
Load Register L with 00H: Register Pair HL = 5600H, the start of the buffer.
528F
LD A,06H 3E 06
Load Register A with 06H, the function SREAD of DISKIO%, which reads a sector of the directory cylinder.
5291
GOSUB to 4488H, DISKIO%, to read sector Register E of the directory of drive Register C into the buffer at Register Pair HL.
5294
If the NZ FLAG is set (the read failed, its error code in Register A), JUMP to 5450H to post the error.
5297
PUSH BC C5
Save Register Pair BC, the drive in Register C, to the top of the stack.
5298
PUSH DE D5
Save Register Pair DE, the sector in Register E, to the top of the stack.
5299
PUSH HL E5
Save Register Pair HL, the address of the entry in the buffer, to the top of the stack.
529A
BIT 4,(HL) CB 66
Test bit 4 of the flag byte of the entry at Register Pair HL: set for an active file.
529C
If the Z FLAG is set (not active), JUMP to 5370H for the next entry.
529F
BIT 7,(HL) CB 7E
Test bit 7 of the flag byte of the entry at Register Pair HL: set for an extended entry (FXDE).
52A1
If the NZ FLAG is set (an extended entry), JUMP to 5370H for the next entry.
52A4
BIT 6,(HL) CB 76
Test bit 6 of the flag byte of the entry at Register Pair HL: set for a system file.
52A6
If the Z FLAG is set (not a system file), JUMP to 52B2H for the invisible test.
52A8
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 52A9H-52AAH where EVAL@ stores the value of SYSTEM: FFFFH for Y, 0000H for N or none.
52AB
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
52AC
DEC E 1D
DECrement Register E by 1, back to the value of SYSTEM: the Z FLAG when it is 00H.
52AD
If the Z FLAG is set (SYSTEM not given), JUMP to 5370H for the next entry: a system file is left out.
52B0
JUMP to 52BEH to take the name: a system file is shown whether it is invisible or not.
52B2
BIT 3,(HL) CB 5E
Test bit 3 of the flag byte of the entry at Register Pair HL: set for an invisible file.
52B4
If the Z FLAG is set (a visible file), JUMP to 52BEH to take the name.
52B6
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 52B7H-52B8H where EVAL@ stores the value of INVIS: FFFFH for Y, 0000H for N or none.
52B9
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
52BA
DEC E 1D
DECrement Register E by 1, back to the value of INVIS: the Z FLAG when it is 00H.
52BB
If the Z FLAG is set (INVIS not given), JUMP to 5370H for the next entry: an invisible file is left out.
52BEH - The Name
Compares the name and extension of the entry with the wildmask, then sends the name and, when there is one, a slash and the extension, without their padding spaces; Register E counts the 16 columns down for the spaces before the first extent.
52BE
LD A,05H 3E 05
Load Register A with 05H, the offset of the name in a directory entry.
52C0
ADD A,L 85
ADD Register A to Register L, the low byte of the entry's address: the name at +05H.
52C1
LD L,A 6F
Load Register L with Register A: Register Pair HL = the name of the entry.
52C2
LD B,00H 06 00
Load Register B with 00H, which makes WILD@ compare the 11 bytes at Register Pair HL with the wildmask.
52C4
GOSUB to 5426H to call WILD@ with Register B = 00H when a wildmask was given; with none the Z FLAG comes back.
52C7
If the NZ FLAG is set (the name does not match the wildmask), JUMP to 5370H for the next entry.
52CA
LD E,10H 1E 10
Load Register E with 10H, the 16 columns of the name field, counted down for each character sent.
52CC
LD B,08H 06 08
Load Register B with 08H, the most characters of the name.
52CE
LD A,(HL) 7E
Load Register A with the next character of the name at Register Pair HL.
52CF
CP 20H FE 20
Compare Register A against 20H, the space that pads a short name.
52D1
If the Z FLAG is set (the end of the name), JUMP to 52DAH for the extension.
52D3
GOSUB to 542EH to send the character of the name in Register A to the output.
52D6
DEC E 1D
DECrement Register E by 1, one column of the name field used.
52D7
INC L 2C
INCrement Register L by 1, to the next character of the name.
52D8
DECrement Register B and, while it is not zero, LOOP BACK to 52CEH for the next character (DJNZ).
52DA
LD A,L 7D
Load Register A with Register L, the low byte of the address of the first space of the name, or of the extension.
52DB
ADD A,B 80
ADD Register B, the characters of the name left, to Register A: the low byte of the extension at +0DH.
52DC
LD L,A 6F
Load Register L with Register A: Register Pair HL = the extension of the entry.
52DD
LD A,(HL) 7E
Load Register A with the first character of the extension at Register Pair HL.
52DE
CP 20H FE 20
Compare Register A against 20H, a space: a file without an extension.
52E0
If the Z FLAG is set (no extension), JUMP to 52F6H for the extents.
52E2
LD A,2FH 3E 2F
Load Register A with 2FH, the slash between the name and the extension.
52E4
GOSUB to 542EH to send the slash in Register A to the output.
52E7
DEC E 1D
DECrement Register E by 1, one column of the name field used by the slash.
52E8
LD B,03H 06 03
Load Register B with 03H, the most characters of the extension.
52EA
LD A,(HL) 7E
Load Register A with the next character of the extension at Register Pair HL.
52EB
CP 20H FE 20
Compare Register A against 20H, the space that pads a short extension.
52ED
If the Z FLAG is set (the end of the extension), JUMP to 52F6H for the extents.
52EF
GOSUB to 542EH to send the character of the extension in Register A to the output.
52F2
DEC E 1D
DECrement Register E by 1, one column of the name field used.
52F3
INC L 2C
INCrement Register L by 1, to the next character of the extension.
52F4
DECrement Register B and, while it is not zero, LOOP BACK to 52EAH for the next character (DJNZ).
52F6H - The Extents
Each extent of the entry (+16H on, two bytes: the cylinder, then the starting granule in bits 7-5 and the granules less 1 in bits 4-0) is shown on a line of its own as the first cylinder and sector, a minus sign and the last cylinder and sector; the first line after the name, the others after 16 spaces. 5357H follows a link (FEH) to an extended entry and ends at FFH. Between lines the SPACE BAR pauses and BREAK ends MAP.
52F6
POP HL E1
Restore Register Pair HL, the address of the entry in the buffer, from the top of the stack.
52F7
PUSH HL E5
Save Register Pair HL, the address of the entry, to the top of the stack again for 5370H.
52F8
LD A,16H 3E 16
Load Register A with 16H, the offset of the first extent in a directory entry.
52FA
ADD A,L 85
ADD Register A to Register L, the low byte of the entry's address: the first extent at +16H.
52FB
LD L,A 6F
Load Register L with Register A: Register Pair HL = the first extent of the entry.
52FC
XOR A AF
Set Register A to 00H (XOR A), the value that marks the line of the name as not yet ended.
52FD
LD (54D1H),A 32 D1 54
Store Register A (00H) into 54D1H, the last character the extents have sent: none yet.
5300
LD B,E 43
Load Register B with Register E, the columns of the name field left: the spaces before the first extent.
5301
LD A,(HL) 7E
Load Register A with the cylinder of the extent at Register Pair HL, or FEH (a link) or FFH (the end).
5302
INC L 2C
INCrement Register L by 1, to the second byte of the extent, or the logical file number after FEH.
5303
CP FEH FE FE
Compare Register A against FEH: the NC FLAG for FEH and FFH, which are not cylinders.
5305
If the NC FLAG is set (a link or the end), JUMP to 5357H.
5307
LD D,A 57
Load Register D with Register A, the first cylinder of the extent.
5308
LD A,(HL) 7E
Load Register A with the second byte of the extent at Register Pair HL: bits 7-5 the starting granule.
5309
RLCA 07
Rotate Register A left one bit, the first of three that bring bits 7-5 to bits 2-0 (RLCA).
530A
RLCA 07
Rotate Register A left one bit, the second of three (RLCA).
530B
RLCA 07
Rotate Register A left one bit, the third of three: the starting granule in bits 2-0 (RLCA).
530C
AND 07H E6 07
AND Register A with 07H, keeping the starting granule of the extent, 0-7.
530E
LD E,A 5F
Load Register E with Register A: Register Pair DE = the cylinder and the starting granule of the extent.
530F
PUSH DE D5
Save Register Pair DE, the cylinder and the starting granule, to the top of the stack for the end of the extent.
5310
LD A,20H 3E 20
Load Register A with 20H, a space before the extent.
5312
GOSUB to 542EH to send the space in Register A to the output.
5315
DECrement Register B and, while it is not zero, LOOP BACK to 5310H for the next space (DJNZ).
5317
GOSUB to 538AH to turn the cylinder in Register D and the granule in Register E into the cylinder and the sector.
531A
GOSUB to 539CH to send the first cylinder in Register D and sector in Register E, with a comma between them.
531D
LD A,20H 3E 20
Load Register A with 20H, the space before the minus sign.
531F
GOSUB to 542EH to send the space in Register A to the output.
5322
LD A,2DH 3E 2D
Load Register A with 2DH, the minus sign between the first and the last sector of the extent.
5324
GOSUB to 542EH to send the minus sign in Register A to the output.
5327
LD A,20H 3E 20
Load Register A with 20H, the space after the minus sign.
5329
GOSUB to 542EH to send the space in Register A to the output.
532C
POP DE D1
Restore Register Pair DE, the cylinder and the starting granule of the extent, from the top of the stack.
532D
LD A,(HL) 7E
Load Register A with the second byte of the extent at Register Pair HL again: bits 4-0 the granules less 1.
532E
INC L 2C
INCrement Register L by 1, to the next extent of the entry.
532F
AND 1FH E6 1F
AND Register A with 1FH, keeping the count of granules less 1.
5331
INC A 3C
INCrement Register A by 1: the number of granules in the extent.
5332
ADD A,E 83
ADD Register E, the starting granule, to Register A: the granule after the last of the extent.
5333
LD E,A 5F
Load Register E with Register A: Register Pair DE = the cylinder and the granule after the extent.
5334
GOSUB to 538AH to turn Register D and Register E into the cylinder and the sector after the extent.
5337
DEC E 1D
DECrement Register E by 1: the last sector of the extent, or FFH when the extent ends a cylinder.
5338
If the P FLAG is set (Register E is a sector), JUMP to 5340H to show it.
533B
LD E,(IY+11H) FD 5E 11
Load Register E with the sectors per cylinder from DCT+11H, Index Register IY+11H.
533E
DEC E 1D
DECrement Register E by 1: the last sector of a cylinder.
533F
DEC D 15
DECrement Register D by 1: the cylinder before, where the extent ends.
5340
GOSUB to 539CH to send the last cylinder in Register D and sector in Register E, with a comma between them.
5343
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the line of the extent.
5345
LD (54D1H),A 32 D1 54
Store Register A (0DH) into 54D1H: the last character sent ended a line.
5348
GOSUB to 542EH to send the carriage return in Register A to the output.
534B
GOSUB to 5437H for the pause on the SPACE BAR and the test for BREAK; the Z FLAG for BREAK.
534E
LD B,10H 06 10
Load Register B with 10H, the 16 spaces that start the line of the next extent.
5350
If the NZ FLAG is set (no BREAK), JUMP to 5301H for the next extent.
5352
POP HL E1
Restore Register Pair HL, the address of the entry, from the top of the stack, after BREAK.
5353
POP DE D1
Restore Register Pair DE, the sector in Register E, from the top of the stack.
5354
POP BC C1
Restore Register Pair BC, the drive in Register C, from the top of the stack.
5355
JUMP to 5383H to close the output and end MAP after BREAK.
5357H - A Link or the End of the Entry
FEH links to the extended entry whose logical file number follows: its sector is read into 4300H by 449AH and the extents go on there. FFH ends the entry; when the name has had no extent, a carriage return ends its line.
5357
If the NZ FLAG is set (FFH, the end of the entry), JUMP to 5368H.
5359
PUSH BC C5
Save Register Pair BC, the spaces in Register B and the drive in Register C, to the top of the stack.
535A
LD B,(HL) 46
Load Register B with the logical file number of the extended entry at Register Pair HL, the byte after FEH.
535B
GOSUB to 449AH to read the directory sector of logical file number Register B on drive Register C into 4300H; Register Pair HL = the entry.
535E
If the NZ FLAG is set (the read failed, its error code in Register A), JUMP to 5450H to post the error.
5361
LD A,16H 3E 16
Load Register A with 16H, the offset of the first extent in a directory entry.
5363
ADD A,L 85
ADD Register A to Register L, the low byte of the extended entry's address: its first extent at +16H.
5364
LD L,A 6F
Load Register L with Register A: Register Pair HL = the first extent of the extended entry.
5365
POP BC C1
Restore Register Pair BC, the spaces in Register B and the drive in Register C, from the top of the stack.
5366
JUMP to 5301H for the extents of the extended entry.
5368
LD A,(54D1H) 3A D1 54
Load Register A with the last character the extents sent from 54D1H: 00H when none was sent.
536B
XOR 0DH EE 0D
XOR Register A with 0DH: Register A = 0DH, with the NZ FLAG, when no extent ended the line of the name.
536D
If the NZ FLAG is set, GOSUB to 542EH to send the carriage return in Register A that ends the line of the name.
5370H - The Next Entry
The next of the eight entries of the sector, then the next sector up to the last of the directory (DCT+0EH less 1); at the end the output is closed and MAP returns to the DOS.
5370
POP HL E1
Restore Register Pair HL, the address of the entry in the buffer, from the top of the stack.
5371
POP DE D1
Restore Register Pair DE, the sector in Register E, from the top of the stack.
5372
POP BC C1
Restore Register Pair BC, the drive in Register C, from the top of the stack.
5373
LD A,20H 3E 20
Load Register A with 20H, the 32 bytes of a directory entry.
5375
ADD A,L 85
ADD Register A to Register L, the low byte of the entry's address: the C FLAG past the last entry of the sector.
5376
LD L,A 6F
Load Register L with Register A: Register Pair HL = the next entry, or 5600H again.
5377
If the NC FLAG is set (another entry in the sector), JUMP to 5297H for it.
537A
LD A,(IY+0EH) FD 7E 0E
Load Register A with the length of the directory in sectors from DCT+0EH, Index Register IY+0EH.
537D
DEC A 3D
DECrement Register A by 1: the number of the last directory sector.
537E
INC E 1C
INCrement Register E by 1, to the next directory sector.
537F
CP E BB
Compare Register A, the last directory sector, against Register E: the NC FLAG while Register E is not past it.
5380
If the NC FLAG is set (another sector), JUMP to 528FH to read it into 5600H.
5383
GOSUB to 541CH to close the output when it is a file.
5386
If the NZ FLAG is set (CLOSE@ failed, its error code in Register A), JUMP to 5450H to post the error.
5389
RET C9
RETurn to the DOS, which called MAP from the command level.
538AH - A Granule to a Cylinder and a Sector
Register D = a cylinder and Register E = a granule counted from that cylinder (it may pass the granules of one cylinder): returns Register D = the cylinder of the granule and Register E = its first sector, by SYS0/SYS's 8 bit divide (4494H) and multiply (4491H).
538A
LD A,(IY+10H) FD 7E 10
Load Register A with the granules per cylinder from DCT+10H, Index Register IY+10H.
538D
GOSUB to 4494H, the 8 bit divide: Register A = Register E divided by Register A, Register E = the remainder, the granule on its cylinder.
5390
ADD A,D 82
ADD Register D, the cylinder of the extent, to Register A, the whole cylinders the granule number passes.
5391
LD D,A 57
Load Register D with Register A, the cylinder of the granule.
5392
LD A,(IY+0FH) FD 7E 0F
Load Register A with the sectors per granule from DCT+0FH, Index Register IY+0FH.
5395
PUSH DE D5
Save Register Pair DE, the cylinder and the granule on it, to the top of the stack around the multiply.
5396
GOSUB to 4491H, the 8 bit multiply: Register A = Register A times Register E, the first sector of the granule.
5399
POP DE D1
Restore Register Pair DE, the cylinder in Register D, from the top of the stack.
539A
LD E,A 5F
Load Register E with Register A, the first sector of the granule: Register Pair DE = the cylinder and the sector.
539B
RET C9
RETurn to the caller with the cylinder in Register D and the sector in Register E.
539CH - Show a Cylinder and a Sector
Sends Register D, a comma and Register E as numbers: three decimal digits each, or with HEX two hexadecimal digits each (53D6H).
539C
LD A,D 7A
Load Register A with Register D, the cylinder.
539D
GOSUB to 53AAH to send the cylinder in Register A as a number.
53A0
LD A,2CH 3E 2C
Load Register A with 2CH, the comma between the cylinder and the sector.
53A2
GOSUB to 542EH to send the comma in Register A to the output.
53A5
LD A,E 7B
Load Register A with Register E, the sector of the cylinder and sector pair.
53A6
GOSUB to 53AAH to send the sector in Register A as a number.
53A9
RET C9
RETurn to the caller with the cylinder and the sector sent.
53AAH - A Number
Sends Register A as three decimal digits (000-255) to the output, or with HEX as two hexadecimal digits (53D6H). Register Pair DE is saved.
53AA
PUSH DE D5
Save Register Pair DE to the top of the stack while the digits are made in it.
53AB
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, the operand 53ACH-53ADH where EVAL@ stores the value of HEX: FFFFH for Y, 0000H for N or none.
53AE
INC E 1C
INCrement Register E by 1, the first half of a test of Register E for zero.
53AF
DEC E 1D
DECrement Register E by 1, back to the value of HEX: the NZ FLAG when it is FFH.
53B0
If the NZ FLAG is set (HEX given), JUMP to 53D6H for two hexadecimal digits.
53B2
LD DE,3030H 11 30 30
Load Register Pair DE with 3030H, the characters 0 and 0 for the hundreds in Register D and the tens in Register E.
53B5
SUB 64H D6 64
SUBtract 64H (100) from Register A: the C FLAG when Register A was below 100.
53B7
If the C FLAG is set (no hundred left), JUMP to 53BCH for the tens.
53B9
INC D 14
INCrement Register D by 1, the hundreds digit up by one.
53BA
JUMP to 53B5H to take off another hundred from Register A.
53BC
ADD A,64H C6 64
ADD 64H (100) to Register A, undoing the last subtraction: Register A = the number less its hundreds.
53BE
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A: the C FLAG when Register A was below 10.
53C0
If the C FLAG is set (no ten left), JUMP to 53C5H for the units.
53C2
INC E 1C
INCrement Register E by 1, the tens digit up by one.
53C3
JUMP to 53BEH to take off another ten from Register A.
53C5
PUSH AF F5
Save Register Pair AF, the units less 10 in Register A, to the top of the stack while the digits are sent.
53C6
LD A,D 7A
Load Register A with Register D, the hundreds digit.
53C7
GOSUB to 542EH to send the hundreds digit in Register A to the output.
53CA
LD A,E 7B
Load Register A with Register E, the tens digit.
53CB
GOSUB to 542EH to send the tens digit in Register A to the output.
53CE
POP AF F1
Restore Register Pair AF, the units less 10 in Register A, from the top of the stack.
53CF
ADD A,3AH C6 3A
ADD 3AH to Register A: the units less 10 plus 3AH is the units digit, 30H-39H.
53D1
GOSUB to 542EH to send the units digit in Register A to the output.
53D4
POP DE D1
Restore Register Pair DE from the top of the stack, as it was before the number.
53D5
RET C9
RETurn to the caller with the number sent in three decimal digits.
53D6H - A Number in Hexadecimal
Two hexadecimal digits of Register A, made by the DAA method; each digit goes to the ROM's 0033H, so with HEX the digits of the cylinders and sectors always go to the display, while the commas, spaces and names go to the output of MAP.
53D6
PUSH AF F5
Save Register Pair AF, the number in Register A, to the top of the stack for the low digit.
53D7
RRA 1F
Rotate Register A right through the C FLAG, the first of four that bring the high digit to bits 3-0 (RRA).
53D8
RRA 1F
Rotate Register A right through the C FLAG, the second of four (RRA).
53D9
RRA 1F
Rotate Register A right through the C FLAG, the third of four (RRA).
53DA
RRA 1F
Rotate Register A right through the C FLAG, the fourth of four: the high digit in bits 3-0 (RRA).
53DB
GOSUB to 53E4H to display the high digit in bits 3-0 of Register A.
53DE
POP AF F1
Restore Register Pair AF, the number in Register A, from the top of the stack.
53DF
GOSUB to 53E4H to display the low digit in bits 3-0 of Register A.
53E2
POP DE D1
Restore Register Pair DE from the top of the stack, saved by 53AAH.
53E3
RET C9
RETurn to the caller with the two hexadecimal digits shown.
53E4
AND 0FH E6 0F
AND Register A with 0FH, keeping the digit in bits 3-0.
53E6
ADD A,90H C6 90
ADD 90H to Register A, the first step of the DAA method for a hexadecimal digit.
53E8
DAA 27
Decimal adjust Register A (DAA): 90H-99H for 0-9, or 00H-05H with the C FLAG for 0AH-0FH.
53E9
ADC A,40H CE 40
ADD 40H and the C FLAG to Register A (ADC), the third step of the DAA method.
53EB
DAA 27
Decimal adjust Register A (DAA): the character 0-9 or A-F of the digit.
53EC
JUMP to 0033H, the ROM's display of the character in Register A, which returns to the caller: the display, not the output of MAP.
53EFH - Open the Output
No destination field: device 1, the display. A destination with a name, or with a drive, is opened by INIT@ as a file with the field's text as its file control block (54F4H) and the buffer 5700H. A device: its DCB from LOCDCB%, and 54F4H made a control block of type 90H (a FORCE) pointing to it, so every character goes through 54F4H.
53EF
LD B,01H 06 01
Load Register B with 01H, device 1, the display, for a command line with no destination field.
53F1
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.
53F5
If the Z FLAG is set (no destination), JUMP to 540BH with Register B = device 1.
53F7
LD A,(54F3H) 3A F3 54
Load Register A with the flag byte of the destination block from 54F3H: bit 6 a name, bit 3 a drive, bits 0-2 a number.
53FA
LD B,A 47
Load Register B with Register A, keeping the flag byte for the device number.
53FB
AND 48H E6 48
AND Register A with 48H, keeping bit 6 (a name) and bit 3 (a drive).
53FD
If the Z FLAG is set (neither: a device), JUMP to 540BH with the device number in Register B.
53FF
LD B,00H 06 00
Load Register B with 00H, the logical record length for INIT@: 256 byte records.
5401
LD DE,54F4H 11 F4 54
Point Register Pair DE to 54F4H, the text of the destination field, which INIT@ takes as the file control block.
5404
LD HL,5700H 21 00 57
Point Register Pair HL to 5700H, the 256 byte buffer of the output file.
5407
GOSUB to 4420H, INIT@, to open the file of the file control block at Register Pair DE, making it when it is not there.
540A
RET C9
RETurn to the caller with the Z FLAG of INIT@, or the NZ FLAG and its error code in Register A.
540B
LD A,B 78
Load Register A with Register B, the device number (01H, or the flag byte of the destination).
540C
AND 07H E6 07
AND Register A with 07H, keeping bits 0-2, the device number.
540E
GOSUB to 44A0H, LOCDCB%, for Register Pair DE = the DCB of device Register A.
5411
LD (54F5H),DE ED 53 F5 54
Store Register Pair DE, the DCB of the device, into 54F5H-54F6H, the word after the type byte of MAP's control block.
5415
LD A,90H 3E 90
Load Register A with 90H, the type byte of a FORCEd device: bit 7 and bit 4.
5417
LD (54F4H),A 32 F4 54
Store Register A (90H) into 54F4H, the type byte of MAP's control block, which now passes every character to the device.
541A
XOR A AF
Set Register A to 00H (XOR A), with the Z FLAG: the output is open.
541B
RET C9
RETurn to the caller with the Z FLAG and Register A = 00H.
541CH - Close the Output
CLOSE@ of the output when it is a file; a device (type 90H at 54F4H) needs nothing.
541C
LD DE,54F4H 11 F4 54
Point Register Pair DE to 54F4H, the control block of the output.
541F
LD A,(DE) 1A
Load Register A with the type byte of the control block at Register Pair DE.
5420
CP 90H FE 90
Compare Register A against 90H, the type byte MAP gives to a device.
5422
If the NZ FLAG is set (a file), GOSUB to 4428H, CLOSE@, to close the file of the file control block at Register Pair DE.
5425
RET C9
RETurn to the caller with the Z FLAG, or the NZ FLAG and the error code of CLOSE@ in Register A.
5426H - WILD@ When a Wildmask Was Given
Calls WILD@ (447CH) only when bit 2 of the evaluation block's flags is set; without a wildmask it returns the Z FLAG, so every name matches.
5426
BIT 2,(IX+00H) DD CB 00 56
Test bit 2 of the flag byte at Index Register IX+00H, set by EVAL@ when a wildmask field was given.
542A
If the NZ FLAG is set (a wildmask), GOSUB to 447CH, WILD@, with Register B and Register Pair HL as the caller set them.
542D
RET C9
RETurn to the caller with the Z FLAG for a match or when no wildmask was given.
542EH - Send a Character
Sends Register A through the ROM's 001BH to the control block at 54F4H: the file control block of an output file or MAP's FORCE block of a device. Register Pair DE is saved.
542E
PUSH DE D5
Save Register Pair DE to the top of the stack while the character is sent.
542F
LD DE,54F4H 11 F4 54
Point Register Pair DE to 54F4H, the control block of the output.
5432
GOSUB to 001BH, the ROM's output of the character in Register A to the control block at Register Pair DE.
5435
POP DE D1
Restore Register Pair DE from the top of the stack, as it was before the character.
5436
RET C9
RETurn to the caller with the character sent.
5437H - The SPACE BAR and BREAK
While a DO file runs (bit 5 of SFLAG1$ at 4297H) nothing is tested. Otherwise the keyboard is scanned once: the SPACE BAR waits for the next key, and BREAK (01H), pressed or taken as that next key, returns the Z FLAG.
5437
LD A,(4297H) 3A 97 42
Load Register A with SFLAG1$ from 4297H, the system flags.
543A
AND 20H E6 20
AND Register A with 20H, keeping bit 5, set while a DO file runs.
543C
RET NZ C0
If the NZ FLAG is set (a DO file runs), RETurn to the caller with the NZ FLAG: no pause and no BREAK.
543D
GOSUB to 002BH, the ROM's scan of the keyboard: Register A = the key pressed, or 00H.
5440
CP 20H FE 20
Compare Register A against 20H, the SPACE BAR.
5442
If the Z FLAG is set (the SPACE BAR), GOSUB to 0049H, the ROM's wait for a key: Register A = the next key.
5445
CP 01H FE 01
Compare Register A against 01H, the BREAK key: the Z FLAG for BREAK.
5447
RET C9
RETurn to the caller with the Z FLAG for BREAK.
5448H - The Errors
5448H the error 2BH, Illegal devicespec; 544BH, inside the LD BC at 544AH, 08H, Drive not available; 544EH, inside the LD BC at 544DH, 30H, Terminated; 5450H any error code in Register A. Each is posted with bit 6 set (no frame) and bit 7 clear, so ERROR@ ends through ABORT@.
5448
LD A,2BH 3E 2B
Load Register A with 2BH, the error code of Illegal devicespec, and fall into the LD BC below.
544A
LD BC,083EH 01 3E 08
544BH 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.
544D
LD BC,303EH 01 3E 30
544EH enters inside this LD BC,303EH: its bytes 3EH 30H read as LD A,30H, Terminated; from above it only loads Register Pair BC.
5450
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.
5452
JUMP to 4409H, ERROR@, with the error code in Register A; with bit 7 clear ERROR@ does not return but ends through ABORT@.
5455H - The Heading, the Evaluation Block and the Parameters
Data: the heading, the evaluation block of EVAL@ (5208H) and the parameter block (9 byte entries: a six character name, the address for the value, the type byte 20H for a logical value). The address of each value is the operand of a LD DE instruction, so the switches are read straight from the code. 54D1H on is not loaded.
5455-547A
DEFM "MAP - DOSPLUS Disk/file mapper - 3.50" / DEFB 0AH 4D 41 50 20 2D 20 44 4F 53 50 4C 55 53 20 44 69 73 6B 2F 66 69 6C 65 20 6D 61 70 70 65 72 20 2D 20 33 2E 35 30 0A
The heading (5201H): MAP - DOSPLUS Disk/file mapper - 3.50 and a line feed.
547B-54AB
DEFM "(c) Copyright 1983, Micro-Systems Software Inc." / DEFB 0AH,0DH 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 0D
The copyright line, a line feed and the 0DH at which DSPLY@ stops.
54AC
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.
54AD-54AE
DEFW 54D2H D2 54
The address of the source field's block, 54D2H, the drive to map.
54AF-54B0
DEFW 54F3H F3 54
The address of the destination field's block, 54F3H, the output.
54B1-54B2
DEFW 5514H 14 55
The address of the wildmask field's block, 5514H.
54B3-54B4
DEFW 54B5H B5 54
The address of the parameter block, 54B5H, the entries SYSTEM, INVIS and HEX.
54B5-54BA
DEFM "SYSTEM" 53 59 53 54 45 4D
The name of the parameter SYSTEM (or S): system files are shown too.
54BB-54BC
DEFW 52A9H A9 52
The address for SYSTEM's value, the operand of LD DE at 52A8H.
54BD
DEFB 20H 20
The type byte of SYSTEM: a logical value only (bit 5), Y or N, or the name alone for Y.
54BE-54C3
DEFM "INVIS " 49 4E 56 49 53 20
The name of the parameter INVIS (or I): invisible files are shown too.
54C4-54C5
DEFW 52B7H B7 52
The address for INVIS's value, the operand of LD DE at 52B6H.
54C6
DEFB 20H 20
The type byte of INVIS: a logical value only (bit 5).
54C7-54CC
DEFM "HEX " 48 45 58 20 20 20
The name of the parameter HEX (or H): cylinders and sectors in hexadecimal.
54CD-54CE
DEFW 53ACH AC 53
The address for HEX's value, the operand of LD DE at 53ABH.
54CF
DEFB 20H 20
The type byte of HEX: a logical value only (bit 5).
54D0
DEFB 00H 00
The 00H that ends the parameter block of SYSTEM, INVIS and HEX.
54D1
DEFS 1
The last character the extents of an entry have sent (52FDH, 5345H): 00H, or 0DH after an extent's line.
54D2-54F2
DEFS 33
The source field's block (54ADH): its flag byte at 54D2H (5233H) and the drive's text.
54F3-5513
DEFS 33
The destination field's block (54AFH): its flag byte at 54F3H (53F7H) and the text from 54F4H, the file control block of an output file or, for a device, the type byte 90H and the DCB address (5411H).
5514-5534
DEFS 33
The wildmask field's block (54B1H): its flag byte and the text from 5515H, given to WILD@ (524AH).
5600-56FF
DEFS 256
The reply to the asterisk prompt (5220H), then the GAT (525AH) and each directory sector (528FH).
5700-57FF
DEFS 256
The buffer of an output file (5404H), given to INIT@.