5200H - RESTORE
RESTORE/CMD's transfer address, entered from the DOS command level with Register Pair HL at the command line after the word RESTORE: RESTORE filespec. RESTORE brings back a killed file: KILL leaves a file's directory entry in place with bit 4 (active) clear. RESTORE finds the entry by the name, takes the granules of its extents back in the GAT, sets the entry active again (and each extended entry it links to), puts the file's hash code back into the hash index table, and writes the GAT and the HIT. When a granule of the file is in use by now, the entries are left as they were and the message Disk space has been re-allocated ends RESTORE through ABORT@.
5200
PUSH HL E5
Save Register Pair HL, the command line pointer after RESTORE, to the top of the stack while the heading is shown.
5201
LD HL,53B5H 21 B5 53
Point Register Pair HL to 53B5H, RESTORE's heading (RESTORE - DOSPLUS File restoration - 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 DE,5434H 11 34 54
Point Register Pair DE to 5434H, the file control block for the file specification.
520B
GOSUB to 441CH, FSPEC@, to move the file specification at Register Pair HL into the file control block at Register Pair DE.
520E
If the Z FLAG is set (a valid file specification), JUMP to 5227H.
5210
CP 20H FE 20
Compare Register A, the character FSPEC@ stopped at, against 20H: the NC FLAG for a printable character.
5212
If the NC FLAG is set (a bad file specification), JUMP to 5360H for the error 2CH, Illegal filespec.
5215
LD A,2AH 3E 2A
Load Register A with 2AH, the asterisk shown as the prompt when the command line holds no file specification.
5217
GOSUB to 0033H, the ROM's display of the character in Register A, the prompt.
521A
LD B,3FH 06 3F
Load Register B with 3FH, the most characters of the reply: 63.
521C
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, the buffer for the reply (later the GAT).
521F
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.
5222
If the C FLAG is set (BREAK), JUMP to 5366H for the error 30H, Terminated.
5225
JUMP to 5208H to take the file specification from the reply at Register Pair HL.
5227
LD A,(DE) 1A
Load Register A with the first character of the file control block at Register Pair DE.
5228
CP 40H FE 40
Compare Register A against 40H, the character @ that starts a device name.
522A
If the Z FLAG is set (a device, not a file), JUMP to 5360H for the error 2CH, Illegal filespec.
522D
LD DE,5434H 11 34 54
Point Register Pair DE to 5434H, the file control block, for OPEN@; Register Pair HL still points into the command line.
5230
GOSUB to 4424H, OPEN@, to look for the file of the file control block at Register Pair DE among the active files.
5233
If the Z FLAG is set (the file is open: it exists), JUMP to 5363H for the error 31H, File already exists.
5236
CP 18H FE 18
Compare Register A, the error code of OPEN@, against 18H, File not in directory: the only error RESTORE goes on after.
5238
If the NZ FLAG is set (another error), JUMP to 5368H to post the error in Register A.
523B
GOSUB to 535AH (SYS2/SYS routine 8) for Register Pair HL = 51E0H, the name and extension OPEN@ looked for.
523E
GOSUB to 5357H (SYS2/SYS routine 7) for Register A = the hash index code of the 11 characters at Register Pair HL.
5241
LD (5431H),A 32 31 54
Store Register A, the hash index code of the file, into 5431H for the hash index table at the end.
5244
GOSUB to 535DH (SYS2/SYS routine 9) for Register A and Register C = the drive of the specification, FFH when none was given.
5247
INC C 0C
INCrement Register C by 1: the Z FLAG when Register C was FFH, no drive given, which leaves drive 0.
5248
If the Z FLAG is set (no drive), JUMP to 524BH with Register C = 00H, drive 0.
524A
DEC C 0D
DECrement Register C by 1, back to the drive of the specification.
524B
GOSUB to 44A3H, LOCDCT%, to point Index Register IY to the drive control table of drive Register C.
524E
LD HL,4300H 21 00 43
Point Register Pair HL to 4300H, SYS0/SYS's sector buffer, for the sectors of the directory.
5251
LD E,02H 1E 02
Load Register E with 02H, the first directory sector with file entries (0 is the GAT, 1 the HIT).
5253H - Find the Killed Entry
Reads each entry sector of the directory into 4300H and compares the name and extension of each entry that is neither active (bit 4) nor an extended entry (bit 7) with the name OPEN@ looked for. The first such entry is the file to restore; past the last sector the error is 18H, File not in directory.
5253
LD A,06H 3E 06
Load Register A with 06H, the function SREAD of DISKIO%, which reads a sector of the directory cylinder.
5255
GOSUB to 4488H, DISKIO%, to read sector Register E of the directory of drive Register C into the buffer at Register Pair HL.
5258
If the NZ FLAG is set (the read failed, its error code in Register A), JUMP to 5368H to post the error.
525B
PUSH DE D5
Save Register Pair DE, the sector in Register E, to the top of the stack.
525C
PUSH HL E5
Save Register Pair HL, the address of the entry in the buffer, to the top of the stack.
525D
BIT 4,(HL) CB 66
Test bit 4 of the flag byte of the entry at Register Pair HL: set for an active file.
525F
If the NZ FLAG is set (an active file), JUMP to 5309H for the next entry.
5262
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).
5264
If the NZ FLAG is set (an extended entry), JUMP to 5309H for the next entry.
5267
LD DE,0005H 11 05 00
Load Register Pair DE with 0005H, the offset of the name in a directory entry.
526A
ADD HL,DE 19
ADD Register Pair DE (0005H) to Register Pair HL: the name of the entry, +05H.
526B
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair DE = the name of the entry.
526C
GOSUB to 535AH (SYS2/SYS routine 8) for Register Pair HL = 51E0H, the name and extension looked for.
526F
EX DE,HL EB
Exchange Register Pair DE and Register Pair HL: Register Pair HL = the name of the entry, Register Pair DE = 51E0H.
5270
LD B,0BH 06 0B
Load Register B with 0BH, the 11 characters of the name and extension.
5272
LD A,(DE) 1A
Load Register A with the next character looked for at Register Pair DE.
5273
CP (HL) BE
Compare Register A against the character of the entry at Register Pair HL.
5274
If the NZ FLAG is set (they differ), JUMP to 5309H for the next entry.
5277
INC HL 23
INCrement Register Pair HL by 1, to the next character of the entry.
5278
INC DE 13
INCrement Register Pair DE by 1, to the next character looked for.
5279
DECrement Register B and, while it is not zero, LOOP BACK to 5272H for the next character (DJNZ).
527B
POP HL E1
Restore Register Pair HL, the address of the entry in the buffer, from the top of the stack.
527C
POP DE D1
Restore Register Pair DE, the sector in Register E, from the top of the stack.
527D
LD B,L 45
Load Register B with Register L, the offset of the entry in its sector: bits 7-5 the entry, 00H-E0H.
527E
LD A,E 7B
Load Register A with Register E, the directory sector of the entry.
527F
SUB 02H D6 02
SUBtract 02H from Register A: the sector counted from the first entry sector, bits 4-0 of a logical file number.
5281
OR B B0
OR Register A with Register B: the logical file number of the entry, entry in bits 7-5 and sector in bits 4-0.
5282
LD B,A 47
Load Register B with Register A, the logical file number of the entry, for the sector routines of SYS0/SYS.
5283
LD (5433H),A 32 33 54
Store Register A, the logical file number of the file's first entry, into 5433H, the end of the undo loop at 52B3H.
5286
GOSUB to 536DH to read the GAT, directory sector 0, into 5500H.
5289
If the NZ FLAG is set (error 14H, Gat read error, in Register A), JUMP to 5368H to post it.
528C
GOSUB to 5391H to read the HIT, directory sector 1, into 5600H.
528F
If the NZ FLAG is set (error 16H, Hit read error, in Register A), JUMP to 5368H to post it.
5292H - Take Back the Granules
For the entry at Register Pair HL (in 4300H) each extent descriptor from +16H (a cylinder, then bits 7-5 the first granule and bits 4-0 the granules less 1) has its granules set in the GAT at 5500H by 5320H. A descriptor starting with FEH links to an extended entry, FFH ends the file.
5292
LD DE,0016H 11 16 00
Load Register Pair DE with 0016H, the offset of the first extent descriptor in a directory entry.
5295
ADD HL,DE 19
ADD Register Pair DE (0016H) to Register Pair HL: the first extent descriptor of the entry, +16H.
5296
LD E,(HL) 5E
Load Register E with the first byte of the descriptor at Register Pair HL: the cylinder, or FEH or FFH.
5297
INC HL 23
INCrement Register Pair HL by 1, to the second byte of the descriptor.
5298
LD D,(HL) 56
Load Register D with the second byte at Register Pair HL: the granules, or the link after FEH.
5299
LD A,E 7B
Load Register A with Register E, the first byte of the descriptor.
529A
CP FEH FE FE
Compare Register A against FEH: the NC FLAG for FEH (a link to an extended entry) or FFH (the end).
529C
If the NC FLAG is set (no more extents in this entry), JUMP to 52C9H to set the entry active.
529E
INC HL 23
INCrement Register Pair HL by 1, to the next descriptor of the entry.
529F
GOSUB to 5320H to set the granules of the extent of cylinder Register E and Register D in the GAT; the NZ FLAG for a granule in use.
52A2
If the Z FLAG is set (the granules were free and are taken), LOOP BACK to 5296H for the next extent.
52A4H - Space Taken by Now
A granule of the file is in use by another file: the entries of the file set active so far are made inactive again and written back, from the last back to the first (the reverse links at +01H of the extended entries); the GAT and the HIT are not written. Then Disk space has been re-allocated and ABORT@.
52A4
LD A,L 7D
Load Register A with Register L, the low byte of the address in the entry.
52A5
AND E0H E6 E0
AND Register A with E0H to keep bits 7-5: the start of the entry within the 256 byte buffer.
52A7
LD L,A 6F
Load Register L with Register A: Register Pair HL = the start of the entry in the buffer.
52A8
RES 4,(HL) CB A6
Reset bit 4 of the flag byte of the entry at Register Pair HL: the entry is not active.
52AA
GOSUB to 449DH to write the directory sector of logical file number Register B on drive Register C from 4300H.
52AD
If the NZ FLAG is set (the write failed, its error code in Register A), JUMP to 5368H to post the error.
52B0
LD A,(5433H) 3A 33 54
Load Register A with the logical file number of the file's first entry from 5433H.
52B3
CP B B8
Compare Register A against Register B, the entry just written: the Z FLAG when the first entry is done.
52B4
If the Z FLAG is set (back at the first entry), JUMP to 52C0H for the message.
52B6
INC HL 23
INCrement Register Pair HL by 1, to +01H of the extended entry, its reverse link.
52B7
LD B,(HL) 46
Load Register B with the byte at Register Pair HL, the logical file number of the entry before it.
52B8
GOSUB to 449AH to read the directory sector of logical file number Register B on drive Register C into 4300H; Register Pair HL returns the entry.
52BB
If the NZ FLAG is set (the read failed, its error code in Register A), JUMP to 5368H to post the error.
52BE
JUMP to 52A8H to make the entry at Register Pair HL inactive again.
52C0
LD HL,5410H 21 10 54
Point Register Pair HL to 5410H, the message Disk space has been re-allocated.
52C3
GOSUB to 4467H, DSPLY@, to display the message at Register Pair HL up to its 0DH.
52C6
JUMP to 4030H, ABORT@: the file cannot be restored.
52C9H - The Entry Restored
All extents of the entry were taken: the entry is set active and written, its hash code put into its byte of the HIT (5600H + the logical file number). A link FEH goes on with the extended entry when its flag bit 7 is set and its reverse link names this entry; FFH ends RESTORE with the GAT and the HIT written.
52C9
LD A,L 7D
Load Register A with Register L, the low byte of the address in the entry.
52CA
AND E0H E6 E0
AND Register A with E0H to keep bits 7-5: the start of the entry within the 256 byte buffer.
52CC
LD L,A 6F
Load Register L with Register A: Register Pair HL = the start of the entry in the buffer.
52CD
SET 4,(HL) CB E6
Set bit 4 of the flag byte of the entry at Register Pair HL: the entry is active again.
52CF
GOSUB to 449DH to write the directory sector of logical file number Register B on drive Register C from 4300H.
52D2
If the NZ FLAG is set (the write failed, its error code in Register A), JUMP to 5368H to post the error.
52D5
LD H,56H 26 56
Load Register H with 56H, the high byte of 5600H, the HIT in memory.
52D7
LD L,B 68
Load Register L with Register B: Register Pair HL = 5600H + the logical file number, the entry's byte in the HIT.
52D8
LD A,(5431H) 3A 31 54
Load Register A with the hash index code of the file from 5431H.
52DB
LD (HL),A 77
Store Register A, the hash index code, into the byte of the HIT at Register Pair HL.
52DC
LD HL,5432H 21 32 54
Point Register Pair HL to 5432H, the logical file number of the last entry restored.
52DF
LD (HL),B 70
Store Register B, the logical file number of this entry, into 5432H at Register Pair HL.
52E0
LD B,D 42
Load Register B with Register D, the byte after FEH: the logical file number of the extended entry.
52E1
LD A,E 7B
Load Register A with Register E, the first byte of the last descriptor, FEH or FFH.
52E2
CP FEH FE FE
Compare Register A against FEH: the Z FLAG for a link to an extended entry.
52E4
If the NZ FLAG is set (FFH, the end of the file), JUMP to 52FEH to write the GAT and the HIT.
52E6
GOSUB to 449AH to read the directory sector of logical file number Register B into 4300H; Register Pair HL returns the extended entry.
52E9
If the NZ FLAG is set (the read failed, its error code in Register A), JUMP to 5368H to post the error.
52EC
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).
52EE
If the Z FLAG is set (not an extended entry), JUMP to 52F8H: the chain is broken.
52F0
INC HL 23
INCrement Register Pair HL by 1, to +01H of the extended entry, its reverse link.
52F1
LD A,(5432H) 3A 32 54
Load Register A with the logical file number of the entry restored last from 5432H.
52F4
CP (HL) BE
Compare Register A against the reverse link at Register Pair HL: the Z FLAG when it names that entry.
52F5
DEC HL 2B
DECrement Register Pair HL by 1, back to the start of the extended entry; the flags of the compare stay.
52F6
If the Z FLAG is set (the link is right), JUMP to 5292H to take the extents of the extended entry.
52F8
LD A,(5432H) 3A 32 54
Load Register A with the logical file number of the entry restored last from 5432H.
52FB
LD B,A 47
Load Register B with Register A, the entry restored last, for the undo loop.
52FC
JUMP to 52B8H to read that entry back and make the chain inactive again, with the message Disk space has been re-allocated.
52FE
GOSUB to 537FH to write the GAT, directory sector 0, from 5500H.
5301
If the NZ FLAG is set (error 15H, Gat write error, in Register A), JUMP to 5368H to post it.
5303
GOSUB to 53A3H to write the HIT, directory sector 1, from 5600H.
5306
If the NZ FLAG is set (error 17H, Hit write error, in Register A), JUMP to 5368H to post it.
5308
RET C9
RETurn to the DOS, which called RESTORE from the command level: the file is restored, without a message.
5309H - The Next Entry
32 bytes on in the sector, or the next sector of the directory up to DCT+0EH less 1, the last sector of the directory.
5309
POP HL E1
Restore Register Pair HL, the address of the entry in the buffer, from the top of the stack.
530A
POP DE D1
Restore Register Pair DE, the sector in Register E, from the top of the stack.
530B
LD A,20H 3E 20
Load Register A with 20H, the length of a directory entry.
530D
ADD A,L 85
ADD Register L to Register A: the low byte of the next entry, the C FLAG past the end of the sector.
530E
LD L,A 6F
Load Register L with Register A: Register Pair HL = the next entry in the buffer.
530F
If the NC FLAG is set (still in the sector), JUMP to 525BH to test the next entry.
5312
LD A,(IY+0EH) FD 7E 0E
Load Register A with the length of the directory in sectors from DCT+0EH at Index Register IY+0EH.
5315
DEC A 3D
DECrement Register A by 1: the number of the last sector of the directory.
5316
INC E 1C
INCrement Register E by 1, the next directory sector.
5317
CP E BB
Compare Register A, the last sector, against Register E: the NC FLAG while Register E is not past it.
5318
If the NC FLAG is set (another sector), JUMP to 5253H to read it.
531B
LD A,18H 3E 18
Load Register A with 18H, the error code of File not in directory: no killed entry has the name.
531D
JUMP to 5368H to post the error in Register A.
5320H - Set the Granules of an Extent
Register E is the cylinder, Register D the second byte of the descriptor: bits 7-5 the first granule, bits 4-0 the count less 1. Each granule's bit is tested and set in the GAT at 5500H + the cylinder, going on into the next cylinder after DCT+10H granules. The NZ FLAG returns at the first granule already in use (the granules before it stay set in the buffer).
5320
PUSH DE D5
Save Register Pair DE, the descriptor in Registers D and E, to the top of the stack.
5321
PUSH HL E5
Save Register Pair HL, the place in the entry, to the top of the stack.
5322
LD L,E 6B
Load Register L with Register E, the cylinder of the extent.
5323
LD H,55H 26 55
Load Register H with 55H: Register Pair HL = 5500H + the cylinder, the cylinder's byte in the GAT.
5325
LD A,D 7A
Load Register A with Register D, the second byte of the descriptor.
5326
AND 1FH E6 1F
AND Register A with 1FH to keep bits 4-0, the count of granules less 1.
5328
LD E,A 5F
Load Register E with Register A, the count less 1.
5329
INC E 1C
INCrement Register E by 1, the count of granules of the extent.
532A
XOR D AA
XOR Register A with Register D: bits 7-5 of the descriptor, the first granule, with bits 4-0 clear.
532B
RLCA 07
Rotate Register A left (RLCA), the first of three moves of bits 7-5 to bits 2-0.
532C
RLCA 07
Rotate Register A left (RLCA), the second of three moves of the first granule.
532D
RLCA 07
Rotate Register A left (RLCA): Register A = the first granule, 0-7.
532E
GOSUB to 5341H to test and set the bit of granule Register A in the GAT byte at Register Pair HL; the NZ FLAG when it was set.
5331
If the NZ FLAG is set (the granule is in use), JUMP to 533EH to return the NZ FLAG.
5333
INC A 3C
INCrement Register A by 1, the number of the next granule of the extent.
5334
CP (IY+10H) FD BE 10
Compare Register A against DCT+10H, the granules per cylinder, at Index Register IY+10H.
5337
If the C FLAG is set (still on this cylinder), JUMP to 533BH.
5339
XOR A AF
Set Register A to 00H by XORing it with itself: granule 0 of the next cylinder.
533A
INC HL 23
INCrement Register Pair HL by 1, to the GAT byte of the next cylinder.
533B
DEC E 1D
DECrement Register E by 1, the count of granules still to set.
533C
If the NZ FLAG is set (more granules), LOOP BACK to 532EH for the next one.
533E
POP HL E1
Restore Register Pair HL, the place in the entry, from the top of the stack.
533F
POP DE D1
Restore Register Pair DE, the descriptor, from the top of the stack.
5340
RET C9
RETurn to the caller: the Z FLAG when every granule of the extent was free and is now set.
5341H - Test and Set a Bit
Register A = the bit number (0-7): 5341H makes the second bytes of BIT n,(HL) and SET n,(HL) at 5351H and 5353H (46H and C6H with n in bits 5-3), then tests and sets the bit at Register Pair HL. The Z FLAG returns when the bit was clear; Register A returns as it came.
5341
LD D,A 57
Load Register D with Register A, the bit number, to keep it.
5342
AND 07H E6 07
AND Register A with 07H to keep bits 2-0, the bit number.
5344
RLCA 07
Rotate Register A left (RLCA), the first of three moves of the bit number to bits 5-3.
5345
RLCA 07
Rotate Register A left (RLCA), the second of three moves of the bit number.
5346
RLCA 07
Rotate Register A left (RLCA): Register A = the bit number in bits 5-3.
5347
OR 46H F6 46
OR Register A with 46H: the second byte of BIT n,(HL) for the bit number in bits 5-3.
5349
LD (5352H),A 32 52 53
Store Register A into 5352H, the second byte of the BIT instruction at 5351H.
534C
OR C6H F6 C6
OR Register A with C6H: the second byte of SET n,(HL) (bits 7 and 6 set) for the same bit.
534E
LD (5354H),A 32 54 53
Store Register A into 5354H, the second byte of the SET instruction at 5353H.
5351
BIT 0,(HL) CB 46
Test bit n of the byte at Register Pair HL, the second byte 5352H set at 5349H (BIT 0 as loaded): the Z FLAG when the granule is free.
5353
SET 0,(HL) CB C6
Set bit n of the byte at Register Pair HL, the second byte 5354H set at 534EH (SET 0 as loaded); the flags of the BIT stay.
5355
LD A,D 7A
Load Register A with Register D, the bit number as it came.
5356
RET C9
RETurn to the caller with the Z FLAG when the bit was clear before.
5357H - SYS2/SYS Routines
Three overlay requests by RST 28H with the code in Register A: 17H routine 7 (5357H), the hash index code of the 11 characters at Register Pair HL; 18H routine 8 (535AH), Register Pair HL = 51E0H, the name and extension of the last specification; 19H routine 9 (535DH), Register A and Register C = its drive.
5357
LD A,17H 3E 17
Load Register A with 17H, the request code of SYS2/SYS routine 7, the hash index code.
5359
RST 28H EF
RST 28H: SYS0/SYS's overlay request for the code in Register A, which returns to the caller of 5357H.
535A
LD A,18H 3E 18
Load Register A with 18H, the request code of SYS2/SYS routine 8, the name buffer.
535C
RST 28H EF
RST 28H: SYS0/SYS's overlay request for the code in Register A, which returns to the caller of 535AH.
535D
LD A,19H 3E 19
Load Register A with 19H, the request code of SYS2/SYS routine 9, the drive.
535F
RST 28H EF
RST 28H: SYS0/SYS's overlay request for the code in Register A, which returns to the caller of 535DH.
5360H - The Errors
5360H the error 2CH, Illegal filespec; 5363H, inside the LD BC at 5362H, 31H, File already exists; 5366H, inside the LD BC at 5365H, 30H, Terminated; 5368H any error code in Register A. Each is posted with bit 6 set (no frame) and bit 7 clear, so ERROR@ ends through ABORT@.
5360
LD A,2CH 3E 2C
Load Register A with 2CH, the error code of Illegal filespec, and fall into the LD BC below.
5362
LD BC,313EH 01 3E 31
5363H enters inside this LD BC,313EH: its bytes 3EH 31H read as LD A,31H, File already exists; from above it only loads Register Pair BC.
5365
LD BC,303EH 01 3E 30
5366H enters inside this LD BC,303EH: its bytes 3EH 30H read as LD A,30H, Terminated; from above it only loads Register Pair BC.
5368
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.
536A
JUMP to 4409H, ERROR@, with the error code in Register A; with bit 7 clear ERROR@ does not return but ends through ABORT@.
536DH - The GAT and the HIT
536DH reads the GAT (sector 0) into 5500H, 537FH writes it, 5391H reads the HIT (sector 1) into 5600H, 53A3H writes it, each by SREAD (06H) or SWRITE (07H) of DISKIO% on drive Register C. Register Pairs DE and HL are kept; the NZ FLAG returns with Register A = 14H, 15H, 16H or 17H.
536D
PUSH DE D5
Save Register Pair DE to the top of the stack while the GAT is read.
536E
PUSH HL E5
Save Register Pair HL to the top of the stack while the GAT is read.
536F
LD E,00H 1E 00
Load Register E with 00H, directory sector 0, the GAT.
5371
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, RESTORE's copy of the GAT.
5374
LD A,06H 3E 06
Load Register A with 06H, the function SREAD of DISKIO%.
5376
GOSUB to 4488H, DISKIO%, to read sector Register E of the directory of drive Register C into the buffer at Register Pair HL.
5379
POP HL E1
Restore Register Pair HL from the top of the stack, as it was before the GAT was read.
537A
POP DE D1
Restore Register Pair DE from the top of the stack, as it was before the GAT was read.
537B
RET Z C8
If the Z FLAG is set (the read worked), RETurn to the caller.
537C
LD A,14H 3E 14
Load Register A with 14H, the error code of Gat read error, with the NZ FLAG of DISKIO%.
537E
RET C9
RETurn to the caller with the error code 14H in Register A and the NZ FLAG.
537F
PUSH DE D5
Save Register Pair DE to the top of the stack while the GAT is written.
5380
PUSH HL E5
Save Register Pair HL to the top of the stack while the GAT is written.
5381
LD E,00H 1E 00
Load Register E with 00H, directory sector 0, the GAT.
5383
LD HL,5500H 21 00 55
Point Register Pair HL to 5500H, RESTORE's copy of the GAT with the granules taken back.
5386
LD A,07H 3E 07
Load Register A with 07H, the function SWRITE of DISKIO%, which writes a sector of the directory cylinder.
5388
GOSUB to 4488H, DISKIO%, to write sector Register E of the directory of drive Register C from the buffer at Register Pair HL.
538B
POP HL E1
Restore Register Pair HL from the top of the stack, as it was before the GAT was written.
538C
POP DE D1
Restore Register Pair DE from the top of the stack, as it was before the GAT was written.
538D
RET Z C8
If the Z FLAG is set (the write worked), RETurn to the caller.
538E
LD A,15H 3E 15
Load Register A with 15H, the error code of Gat write error, with the NZ FLAG of DISKIO%.
5390
RET C9
RETurn to the caller with the error code 15H in Register A and the NZ FLAG.
5391
PUSH DE D5
Save Register Pair DE to the top of the stack while the HIT is read.
5392
PUSH HL E5
Save Register Pair HL to the top of the stack while the HIT is read.
5393
LD E,01H 1E 01
Load Register E with 01H, directory sector 1, the HIT.
5395
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, RESTORE's copy of the HIT.
5398
LD A,06H 3E 06
Load Register A with 06H, the function SREAD of DISKIO%.
539A
GOSUB to 4488H, DISKIO%, to read sector Register E of the directory of drive Register C into the buffer at Register Pair HL.
539D
POP HL E1
Restore Register Pair HL from the top of the stack, as it was before the HIT was read.
539E
POP DE D1
Restore Register Pair DE from the top of the stack, as it was before the HIT was read.
539F
RET Z C8
If the Z FLAG is set (the read worked), RETurn to the caller.
53A0
LD A,16H 3E 16
Load Register A with 16H, the error code of Hit read error, with the NZ FLAG of DISKIO%.
53A2
RET C9
RETurn to the caller with the error code 16H in Register A and the NZ FLAG.
53A3
PUSH DE D5
Save Register Pair DE to the top of the stack while the HIT is written.
53A4
PUSH HL E5
Save Register Pair HL to the top of the stack while the HIT is written.
53A5
LD E,01H 1E 01
Load Register E with 01H, directory sector 1, the HIT.
53A7
LD HL,5600H 21 00 56
Point Register Pair HL to 5600H, RESTORE's copy of the HIT with the file's code put back.
53AA
LD A,07H 3E 07
Load Register A with 07H, the function SWRITE of DISKIO%.
53AC
GOSUB to 4488H, DISKIO%, to write sector Register E of the directory of drive Register C from the buffer at Register Pair HL.
53AF
POP HL E1
Restore Register Pair HL from the top of the stack, as it was before the HIT was written.
53B0
POP DE D1
Restore Register Pair DE from the top of the stack, as it was before the HIT was written.
53B1
RET Z C8
If the Z FLAG is set (the write worked), RETurn to the caller.
53B2
LD A,17H 3E 17
Load Register A with 17H, the error code of Hit write error, with the NZ FLAG of DISKIO%.
53B4
RET C9
RETurn to the caller with the error code 17H in Register A and the NZ FLAG.
53B5-540F
DEFM "RESTORE - DOSPLUS File restoration - 3.50" / DEFB 0AH / DEFM "(c) Copyright 1983, Micro-Systems Software Inc." / DEFB 0AH,0DH 52 45 53 54 4F 52 45 20 2D 20 44 4F 53 50 4C 55 53 20 46 69 6C 65 20 72 65 73 74 6F 72 61 74 69 6F 6E 20 2D 20 33 2E 35 30 0A 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 heading (5201H): RESTORE - DOSPLUS File restoration - 3.50, a line feed, the copyright line, a line feed and the 0DH at which DSPLY@ stops.
5410-5430
DEFM "Disk space has been re-allocated" / DEFB 0DH 44 69 73 6B 20 73 70 61 63 65 20 68 61 73 20 62 65 65 6E 20 72 65 2D 61 6C 6C 6F 63 61 74 65 64 0D
The message when a granule of the file is in use by now, or the chain of extended entries is broken (52C0H).
5431
DEFS 1
The hash index code of the file (5241H), put into the HIT at 52DBH.
5432
DEFS 1
The logical file number of the entry restored last (52DFH), which the reverse link of the next extended entry must name.
5433
DEFS 1
The logical file number of the file's first entry (5283H), where the undo loop stops (52B0H).
5434-5453
DEFS 32
The file control block of the file specification (5208H, FSPEC@ and OPEN@).
5500-55FF
DEFS 256
The reply to the asterisk prompt (521CH), then the GAT of the drive (536DH), with the granules of the file set.
5600-56FF
DEFS 256
The HIT of the drive (5391H), with the file's hash index code put back (52DBH).