5200H - Start: Show the Banner and Choose FORMAT or BACKUP
The transfer address of DOUBLE/CMD, which SYS1/SYS runs through @RUN (4433H) for the command DOUBLE, with Register Pair HL past the space after the name (SYS1/SYS 4E80H). The interrupts are turned off for the whole run and turned on again only at 5235H, so the clock task of SYS0/SYS stops while DOUBLE works. The first letter of the rest of the line picks the job: F for DOUBLE FORMAT, B for DOUBLE BACKUP; anything else is COMMAND SYNTAX ERROR.
5200
DI F3
Disable the interrupts: DOUBLE/CMD drives the controller itself with timing loops, and 5235H turns them on again at the end.
5201
PUSH HL E5
Save Register Pair HL, the command line after the word DOUBLE and its space, on the stack while the banner is shown.
5202
LD HL,5983H 21 83 59
Load Register Pair HL with 5983H, the banner: clear screen, PERCOM DBLDOS FORMAT/BACKUP UTILITY VERSION 1.21 and the copyright line.
5205
Call 4467H to show the text at Register Pair HL (5983H) up to its carriage return through ROM 0033H.
5208
POP HL E1
Restore Register Pair HL, the command line after DOUBLE, from the stack.
5209
LD A,(HL) 7E
Load Register A with the first character of the rest of the command line at Register Pair HL.
520A
CP 46H FE 46
Compare Register A with 46H, the letter F of FORMAT; the Z FLAG is set when the line goes on with F.
520C
If the Z FLAG is set (F), jump to 523AH, DOUBLE FORMAT, which checks the whole word FORMAT itself.
520F
CP 42H FE 42
Compare Register A with 42H, the letter B of BACKUP; the Z FLAG is set when the line goes on with B.
5211
If the Z FLAG is set (B), jump to 5393H, DOUBLE BACKUP, which checks the whole word BACKUP itself.
5214H - The Ends of DOUBLE: Error, Abort and Completion
5214H shows COMMAND SYNTAX ERROR; 5217H shows the error text at Register Pair HL; both go on to DOUBLE DENSITY UTILITY ABORTED (521AH). 521DH is the end of a finished job, with FORMAT COMPLETED or BACKUP COMPLETED in Register Pair HL. Every way out puts the Doubler back in double density and, when drive 0 took part, asks for the DBLDOS diskette in drive 0 before DOS READY, as the manual says (3.3.1).
5214
LD HL,59DDH 21 DD 59
Load Register Pair HL with 59DDH, the text COMMAND SYNTAX ERROR: the line is not DOUBLE FORMAT or DOUBLE BACKUP in the form expected.
5217
Call 4467H to show the error text at Register Pair HL on the screen up to its carriage return.
521A
LD HL,59F2H 21 F2 59
Load Register Pair HL with 59F2H, the text DOUBLE DENSITY UTILITY ABORTED; the (A)BORT answer of 5578H also comes here.
521D
Call 4467H to show the text at Register Pair HL: ABORTED, or FORMAT COMPLETED or BACKUP COMPLETED from 5390H and 549AH.
5220
Call 58FBH to switch the Doubler to double density (command FFH, then D0H), the density DoubleDOS expects after DOUBLE.
5223
LD A,(5239H) 3A 39 52
Load Register A with the byte at 5239H, whose bit 0 tells that drive 0 was named for the job (set by 5245H and 53BBH).
5226
RRA 1F
Rotate Register A right by one bit: bit 0 of 5239H goes into the C FLAG.
5227
If the NC FLAG is set (drive 0 was not used), jump to 5235H to return to DOS READY at once.
522A
XOR A AF
Clear Register A to 00H for the store at 549FH.
522B
LD (549FH),A 32 9F 54
Store Register A (00H) at 549FH, the flag of a backup with two drives, so that 54DEH asks for the diskette and waits for ENTER.
522E
LD HL,5B91H 21 91 5B
Load Register Pair HL with 5B91H, the name DBLDOS, which 54DEH shows in MOUNT DBLDOS DISK IN DRIVE 0 AND PUSH ENTER.
5231
INC A 3C
Increment Register A to 01H, the select bit of drive 0.
5232
Call 54DEH to select drive Register A (drive 0), keeping the head positions of 4300H-4303H, and to wait for the DBLDOS diskette.
5235
EI FB
Enable the interrupts again (turned off at 5200H): the clock and the other tasks of SYS0/SYS run on.
5236
Jump to 402DH, the vector of DOS READY (JP 4400H), the end of DOUBLE/CMD.
5239
DEFB 00H 00
The flag at 5239H: bit 0 set when drive 0 is the drive formatted or the source or destination of a backup (5245H, 53A1H, 53BBH); 5223H then asks for the DBLDOS diskette at the end.
523AH - DOUBLE FORMAT: Ask for the Name, the Date and the Tracks
The form is DOUBLE FORMAT :n with n the drive 0-3; the manual writes DOUBLE FORMAT N (3.3.1) and gives the prompts as DISK NAME?, CREATION DATE? and HOW MANY TRACKS?, but the texts here are DISKETTE NAME?, CREATION DATE? and NUMBER OF TRACKS (DEFAULT 40)?. The GAT of the new diskette is built at 4D00H: the name at 4DD0H, the date at 4DD8H (the date of DoubleDOS when one is set, else typed), the track count 18-80 at 56BCH. No test is made that the diskette is blank, as the manual warns.
523A
LD DE,5A11H 11 11 5A
Load Register Pair DE with 5A11H, the word FORMAT ended by 00H, to compare with the command line.
523D
Call 5913H to compare the word at Register Pair DE (5A11H) with the line at Register Pair HL; a difference ends at COMMAND SYNTAX ERROR, a match leaves Register Pair HL past FORMAT.
5240
Call 561EH to read :n from the line at Register Pair HL: the select bit of drive n goes to 4309H and Register A; a bad drive ends at INVALID DRIVE NUMBER.
5243
AND 01H E6 01
AND Register A, the select bit of the drive, with 01H: 01H when the drive is drive 0, else 00H.
5245
LD (5239H),A 32 39 52
Store Register A at 5239H: bit 0 set when drive 0 is formatted, so that the end asks for the DBLDOS diskette again (5223H).
5248
LD HL,4DD0H 21 D0 4D
Load Register Pair HL with 4DD0H, bytes D0H-FFH of the GAT image at 4D00H: the name, the date and the place of the AUTO command.
524B
LD B,30H 06 30
Load Register B with 30H, the 48 bytes 4DD0H-4DFFH to fill with spaces.
524D
LD (HL),20H 36 20
Store a space (20H) at Register Pair HL in the GAT image.
524F
INC HL 23
Increment Register Pair HL to the next byte of the GAT image.
5250
Decrement Register B and jump back to 524DH until the 48 bytes 4DD0H-4DFFH are spaces. GAT bytes E0H-FFH stay spaces: a diskette made by FORMAT has no 0DH at E0H (the system diskette has), but it has no system to boot either.
5252
LD HL,5A22H 21 22 5A
Load Register Pair HL with 5A22H, the prompt DISKETTE NAME? and a space, ended by 03H so that the cursor stays on the line.
5255
Call 4467H to show the prompt at Register Pair HL (5A22H) up to its 03H.
5258
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the start of the GAT image, as the buffer of the typed name.
525B
LD B,08H 06 08
Load Register B with 08H, the most characters of a diskette name.
525D
Call 0040H, the line input of the ROM: up to Register B (8) characters into the buffer at Register Pair HL, Register B returning the count typed. The C FLAG of BREAK is not tested.
5260
LD A,B 78
Copy Register B, the number of characters typed, into Register A.
5261
OR A B7
Set the flags from Register A, the count: the Z FLAG is set when only ENTER was pressed.
5262
If the Z FLAG is set (no name typed), jump back to 5252H to ask again: the name may not be empty.
5264
LD DE,4DD0H 11 D0 4D
Load Register Pair DE with 4DD0H, the place of the diskette name in the GAT image.
5267
LD C,A 4F
Copy Register A, the length of the name, into Register C, the low byte of the count of the copy.
5268
LD B,00H 06 00
Load Register B with 00H: Register Pair BC is the length of the name, 1-8.
526A
LDIR ED B0
Copy Register Pair BC bytes, the typed name, from Register Pair HL (4D00H, which 0040H returned) to Register Pair DE (4DD0H); the spaces after it stay.
526C
LD A,(4045H) 3A 45 40
Load Register A with the byte at 4045H, the day of the date of DoubleDOS (00H when no DATE has been given).
526F
OR A B7
Set the flags from Register A, the day: the Z FLAG is set when no date is set.
5270
If the Z FLAG is set (no date), jump to 527AH to ask for the creation date.
5272
LD HL,4DD8H 21 D8 4D
Load Register Pair HL with 4DD8H, the place of the creation date in the GAT image.
5275
Call 4470H to write the date of DoubleDOS (4044H-4046H) at Register Pair HL (4DD8H) as MM/DD/YY.
5278
Jump to 529BH to ask for the number of tracks.
527A
LD HL,5A32H 21 32 5A
Load Register Pair HL with 5A32H, the prompt CREATION DATE? and a space, ended by 03H.
527D
Call 4467H to show the prompt at Register Pair HL (5A32H) up to its 03H.
5280
LD HL,4DD8H 21 D8 4D
Load Register Pair HL with 4DD8H, the place of the date in the GAT image, as the buffer of the typed date.
5283
LD B,08H 06 08
Load Register B with 08H, the eight characters of a date MM/DD/YY.
5285
Call 0040H, the line input of the ROM: up to Register B (8) characters into the GAT image at Register Pair HL (4DD8H), Register B returning the count.
5288
LD A,B 78
Copy Register B, the number of characters typed, into Register A.
5289
CP 08H FE 08
Compare Register A with 08H: the Z FLAG is set when all eight characters were typed.
528B
If the NZ FLAG is set (fewer than eight), jump back to 527AH to ask again.
528D
LD A,(4DDAH) 3A DA 4D
Load Register A with the byte at 4DDAH, the third character of the date.
5290
CP 2FH FE 2F
Compare Register A with 2FH, the slash between month and day.
5292
If the NZ FLAG is set (no slash), jump back to 527AH to ask again.
5294
LD A,(4DDDH) 3A DD 4D
Load Register A with the byte at 4DDDH, the sixth character of the date.
5297
CP 2FH FE 2F
Compare Register A with 2FH, the slash between day and year. The other six characters are not checked: any letters pass.
5299
If the NZ FLAG is set (no slash), jump back to 527AH to ask again.
529B
LD HL,5A42H 21 42 5A
Load Register Pair HL with 5A42H, the prompt NUMBER OF TRACKS (DEFAULT 40)? and a space, ended by 03H.
529E
Call 4467H to show the prompt at Register Pair HL (5A42H) up to its 03H.
52A1
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the start of the GAT image, as the buffer of the typed number.
52A4
LD B,02H 06 02
Load Register B with 02H, the two digits of the number of tracks.
52A6
Call 0040H, the line input of the ROM: up to Register B (2) characters at Register Pair HL (4D00H), Register B returning the count.
52A9
LD A,28H 3E 28
Load Register A with 28H, 40 tracks, the default when only ENTER is pressed.
52AB
INC B 04
Increment Register B, the count typed; with the DEC B that follows it sets the Z FLAG when the count is 0 and keeps Register A.
52AC
DEC B 05
Decrement Register B back to the count: the Z FLAG is set when nothing was typed.
52AD
If the Z FLAG is set (only ENTER), jump to 52D1H with Register A 28H, 40 tracks.
52AF
LD A,B 78
Copy Register B, the count typed, into Register A.
52B0
CP 02H FE 02
Compare Register A with 02H: one digit alone is not taken.
52B2
If the NZ FLAG is set (not two characters), jump back to 529BH to ask again.
52B4
DEC HL 2B
Decrement Register Pair HL to 4CFFH, one before the buffer, since 5647H moves on before it reads.
52B5
Call 5647H to read the digit at Register Pair HL plus one (4D00H): Register A its value, the C FLAG when it is not a digit.
52B8
If the C FLAG is set (not a digit), jump back to 529BH to ask again.
52BA
LD B,A 47
Copy Register A, the tens digit, into Register B, the count of the multiplying loop.
52BB
XOR A AF
Clear Register A to 00H, the sum of the loop.
52BC
ADD A,0AH C6 0A
Add 0AH to Register A: ten for each count of Register B.
52BE
If the C FLAG is set (more than 255: a tens digit of 0 makes Register B count 256 times), jump back to 529BH to ask again.
52C0
Decrement Register B and jump back to 52BCH until Register A is ten times the tens digit.
52C2
LD B,A 47
Copy Register A, ten times the tens digit, into Register B for the add at 52C8H.
52C3
Call 5647H to read the second digit at Register Pair HL plus one (4D01H) into Register A, the C FLAG when it is not a digit.
52C6
If the C FLAG is set (not a digit), jump back to 529BH to ask again.
52C8
ADD A,B 80
Add Register B, the tens, to Register A, the units: Register A is the number of tracks typed.
52C9
CP 12H FE 12
Compare Register A with 12H, 18 tracks, the fewest the manual allows (3.3.1).
52CB
If the C FLAG is set (fewer than 18), jump back to 529BH to ask again.
52CD
CP 51H FE 51
Compare Register A with 51H, 81: the NC FLAG is set for more than 80 tracks.
52CF
If the NC FLAG is set (more than 80), jump back to 529BH to ask again.
52D1H - DOUBLE FORMAT: Build the GAT, Format and Verify
With the number of tracks in Register A the GAT image at 4D00H is finished: two free granules (FCH) for every logical track that fits on cylinders 1 to the last, FFH from there to CFH, so that FREE counts only real granules and the flaw table 4DC0H-4DC9H starts empty (FFH); CBH 21H, CCH the logical tracks, CDH the cylinders, CEH-CFH 42E0H. Then every track is formatted (5650H) and every sector verified (5881H): a flawed sector locks its granule out and goes into the flaw table.
52D1
LD (56BCH),A 32 BC 56
Store Register A, the number of tracks (cylinders) of the new diskette, at 56BCH, the count used by the format and verify loops.
52D4
LD D,A 57
Copy Register A, the number of cylinders, into Register D for the conversion at 592DH.
52D5
LD E,00H 1E 00
Load Register E with 00H, sector 0: Register Pair DE is cylinder D sector 0, the first sector after the last cylinder.
52D7
Call 592DH to turn cylinder Register D, sector Register E into the logical track and sector of DoubleDOS: Register D returns the number of whole logical tracks of ten sectors on cylinders 1 to the last.
52DA
LD B,D 42
Copy Register D, the number of logical tracks, into Register B, the count of the GAT bytes to make free.
52DB
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the GAT image: byte n is logical track n, one bit for each of its two granules.
52DE
LD (HL),FCH 36 FC
Store FCH at Register Pair HL: bits 0 and 1 clear, both granules of the logical track free.
52E0
INC HL 23
Increment Register Pair HL to the GAT byte of the next logical track.
52E1
Decrement Register B and jump back to 52DEH until every logical track of the diskette has its FCH.
52E3
LD (HL),FFH 36 FF
Store FFH at Register Pair HL: a logical track that the diskette does not have, or a byte of the flaw table, in use.
52E5
INC HL 23
Increment Register Pair HL to the next byte of the GAT image.
52E6
LD A,L 7D
Copy Register L, the low byte of the address, into Register A for the end test.
52E7
CP D0H FE D0
Compare Register A with D0H: bytes up to CFH are filled, which makes the flaw table 4DC0H-4DC9H empty (FFH).
52E9
If the NZ FLAG is set (not yet 4DD0H), jump back to 52E3H for the next byte.
52EB
LD A,21H 3E 21
Load Register A with 21H, the byte that DoubleDOS keeps at GAT byte CBH (the DOS identification page names it).
52ED
LD (4DCBH),A 32 CB 4D
Store Register A (21H) at 4DCBH, GAT byte CBH.
52F0
LD A,D 7A
Copy Register D, the number of logical tracks, into Register A.
52F1
LD (4DCCH),A 32 CC 4D
Store Register A at 4DCCH, GAT byte CCH, the number of logical tracks of the diskette (3DH on the 35 track system diskette).
52F4
LD A,(56BCH) 3A BC 56
Load Register A with the number of cylinders at 56BCH.
52F7
LD (4DCDH),A 32 CD 4D
Store Register A at 4DCDH, GAT byte CDH, the number of cylinders, which BACKUP reads as the size of a source (5410H).
52FA
LD HL,42E0H 21 E0 42
Load Register Pair HL with 42E0H, the address in the GAT buffer of SYS0/SYS of byte E0H, the AUTO command.
52FD
LD (4DCEH),HL 22 CE 4D
Store Register Pair HL (42E0H) at 4DCEH-4DCFH, GAT bytes CEH-CFH, as on the system diskette.
5300
Call 5650H to format the diskette in the selected drive: cylinder 0 in single density, cylinders 1 to the last in double density.
5303
Call 58F7H to switch the Doubler to single density (command FEH, then D0H) for the verify of cylinder 0.
5306
Call 577BH to give the Restore command 03H and wait: the head goes to cylinder 0.
5309
Call 5881H to verify the ten sectors of cylinder 0; a flawed sector locks out a granule (5881H names how) and goes into the flaw table.
530C
Call 58FBH to switch the Doubler to double density (command FFH, then D0H) for cylinders 1 to the last.
530F
LD A,(56BCH) 3A BC 56
Load Register A with the number of cylinders at 56BCH.
5312
DEC A 3D
Decrement Register A: the cylinders after cylinder 0.
5313
LD B,A 47
Copy Register A into Register B, the count of the verify loop.
5314
LD A,53H 3E 53
Load Register A with 53H, the Step In command with the track register updated, stepping rate 3.
5316
Call 577DH to give the command in Register A (53H) to the controller and wait until it is done: the head moves in by one cylinder.
5319
Call 5881H to verify the eighteen sectors of the cylinder the head is on, locking out a granule for each flawed sector.
531C
Decrement Register B and jump back to 5314H until every cylinder has been verified.
531E
LD HL,5B5DH 21 5D 5B
Load Register Pair HL with 5B5DH, a line feed and INITIALIZING SYSTEM INFORMATION.
5321
Call 4467H to show the text at Register Pair HL (5B5DH) up to its carriage return.
5324
Call 58F7H to switch the Doubler to single density (command FEH, then D0H) for the boot sector.
5327
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, cylinder 0 sector 0, the boot sector.
532A
LD BC,5965H 01 65 59
Load Register Pair BC with 5965H, the boot sector of a diskette without a system, which shows NO SYSTEM.
532D
Call 5825H to write 256 bytes from Register Pair BC (5965H) to cylinder Register D, sector Register E (0, 0) with the ordinary data mark and read it back; an error ends at VERIFY ERROR.
5330
Call 58FBH to switch the Doubler to double density (command FFH, then D0H) for the directory.
5333
LD A,FFH 3E FF
Load Register A with FFH, both granules in use.
5335
LD (4D11H),A 32 11 4D
Store Register A (FFH) at 4D11H, GAT byte 11H: logical track 17, the directory, is in use.
5338
LD DE,1100H 11 00 11
Load Register Pair DE with 1100H, logical track 17 sector 0, the GAT.
533B
Call 5949H to turn the logical track Register D and sector Register E into the cylinder and sector: Register Pair DE 0A08H, cylinder 10 sector 8.
533E
Call 581AH to write the GAT image at 4D00H to cylinder Register D, sector Register E with the deleted data mark of the directory and read it back.
5341
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the buffer, to clear it for the HIT.
5344
LD B,00H 06 00
Load Register B with 00H, a count of 256 for the DJNZ loop.
5346
LD (HL),00H 36 00
Store 00H at Register Pair HL: an empty place of the HIT.
5348
INC HL 23
Increment Register Pair HL to the next byte of the buffer.
5349
Decrement Register B and jump back to 5346H until the 256 bytes 4D00H-4DFFH are 00H.
534B
LD A,2CH 3E 2C
Load Register A with 2CH, the hash code of the name DIR/SYS.
534D
LD (4D00H),A 32 00 4D
Store Register A (2CH) at 4D00H, HIT byte 0, the hash of directory record 0, the entry of DIR/SYS.
5350
LD DE,1101H 11 01 11
Load Register Pair DE with 1101H, logical track 17 sector 1, the HIT.
5353
Call 5949H to turn the logical track Register D and sector Register E into the cylinder and sector: Register Pair DE 0A09H.
5356
Call 581AH to write the HIT at 4D00H to cylinder Register D, sector Register E with the deleted data mark and read it back.
5359
LD HL,5C45H 21 45 5C
Load Register Pair HL with 5C45H, the directory entry of DIR/SYS kept in DOUBLE/CMD.
535C
LD DE,4D00H 11 00 4D
Load Register Pair DE with 4D00H, the first entry of the first directory sector.
535F
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a directory entry.
5362
LDIR ED B0
Copy Register Pair BC (0020H) bytes from Register Pair HL (5C45H) to Register Pair DE (4D00H); the seven other entries of the sector stay 00H.
5364
LD DE,1102H 11 02 11
Load Register Pair DE with 1102H, logical track 17 sector 2, the first sector of directory entries (directory records 00H-07H, entry 0 of each sector numbered in bits 7-5).
5367
Call 5949H to turn the logical track Register D and sector Register E into the cylinder and sector: Register Pair DE 0A0AH.
536A
Call 581AH to write the sector at 4D00H to cylinder Register D, sector Register E with the deleted data mark and read it back.
536D
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the entry of DIR/SYS, to clear it.
5370
LD B,20H 06 20
Load Register B with 20H, the 32 bytes of the entry.
5372
LD (HL),00H 36 00
Store 00H at Register Pair HL, a byte of an empty directory entry.
5374
INC HL 23
Increment Register Pair HL to the next byte of the entry.
5375
Decrement Register B and jump back to 5372H until 4D00H-4D1FH are 00H: the buffer is an empty directory sector.
5377
LD B,07H 06 07
Load Register B with 07H, the seven other directory sectors, logical track 17 sectors 3-9.
5379
LD DE,1103H 11 03 11
Load Register Pair DE with 1103H, logical track 17 sector 3.
537C
Call 5949H to turn the logical track Register D and sector Register E into the cylinder and sector: Register Pair DE 0A0BH; from here the loop counts in cylinder and sector.
537F
Call 581AH to write the empty directory sector at 4D00H to cylinder Register D, sector Register E with the deleted data mark and read it back.
5382
INC E 1C
Increment Register E to the next sector of the cylinder.
5383
LD A,E 7B
Copy Register E, the sector, into Register A for the test.
5384
CP 12H FE 12
Compare Register A with 12H, 18, one past the last sector of a double density cylinder.
5386
If the C FLAG is set (sector 17 or lower), jump to 538BH.
5388
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the next cylinder.
538A
INC D 14
Increment Register D to the next cylinder (never needed: sectors 11-17 of cylinder 10 hold them all).
538B
Decrement Register B and jump back to 537FH until the seven sectors are written.
538D
LD HL,5A62H 21 62 5A
Load Register Pair HL with 5A62H, the text FORMAT COMPLETED.
5390
Jump to 521DH to show FORMAT COMPLETED, go back to double density and, when drive 0 was formatted, ask for the DBLDOS diskette.
5393H - DOUBLE BACKUP: Read the Drives and the Track Count
The form is DOUBLE BACKUP :s TO :d, then optionally Tnn, two digits, the cylinders of the destination (manual 3.3.2 and 3.3.2.2). The select bits of the source and the destination go to 549DH and 549EH; Tnn goes to 56BCH (00H without it). Every pass reads into a buffer from 5D00H up to the top of memory (4049H): its size in pages, 54A0H, must be at least 12H (18 sectors, one double density cylinder), else INSUFFICIENT MEMORY FOR 1 DRIVE BACKUP, a test made for two drives as well, which also read one cylinder a pass.
5393
LD DE,5A18H 11 18 5A
Load Register Pair DE with 5A18H, the word BACKUP ended by 00H, to compare with the command line.
5396
Call 5913H to compare the word at Register Pair DE (5A18H) with the line at Register Pair HL; a difference ends at COMMAND SYNTAX ERROR, a match leaves Register Pair HL past BACKUP.
5399
Call 561EH to read the source drive :s at Register Pair HL: its select bit goes to 4309H and Register A, a bad drive ends at INVALID DRIVE NUMBER.
539C
LD (549DH),A 32 9D 54
Store Register A, the select bit of the source drive, at 549DH.
539F
AND 01H E6 01
AND Register A, the select bit, with 01H: 01H when the source is drive 0.
53A1
LD (5239H),A 32 39 52
Store Register A at 5239H: bit 0 set when the source is drive 0 (5223H asks for the DBLDOS diskette at the end).
53A4
INC HL 23
Increment Register Pair HL past the drive digit, which 561EH leaves Register Pair HL on.
53A5
Call 563FH to pass over spaces at Register Pair HL: Register Pair HL stops on the next other character.
53A8
LD DE,5A1FH 11 1F 5A
Load Register Pair DE with 5A1FH, the word TO ended by 00H.
53AB
Call 5913H to compare the word TO at Register Pair DE (5A1FH) with the line at Register Pair HL; a difference ends at COMMAND SYNTAX ERROR.
53AE
Call 561EH to read the destination drive :d at Register Pair HL: its select bit goes to 4309H and Register A.
53B1
LD (549EH),A 32 9E 54
Store Register A, the select bit of the destination drive, at 549EH.
53B4
AND 01H E6 01
AND Register A, the select bit, with 01H: 01H when the destination is drive 0.
53B6
LD B,A 47
Copy Register A, the drive 0 bit of the destination, into Register B.
53B7
LD A,(5239H) 3A 39 52
Load Register A with the flag at 5239H, the drive 0 bit of the source.
53BA
OR B B0
OR Register A with Register B: bit 0 set when either drive is drive 0.
53BB
LD (5239H),A 32 39 52
Store Register A back at 5239H for the test at the end (5223H).
53BE
INC HL 23
Increment Register Pair HL past the digit of the destination drive.
53BF
Call 563FH to pass over spaces at Register Pair HL; Register A returns the next other character.
53C2
CP 54H FE 54
Compare Register A with 54H, the letter T of Tnn, the cylinders of the destination. The C FLAG is set for a character below T, such as the 0DH at the end of the line, and is carried to 53E4H.
53C4
LD A,00H 3E 00
Load Register A with 00H, no track count given; the flags of the compare stay.
53C6
If the NZ FLAG is set (no T), jump to 53DBH with Register A 00H.
53C8
Call 5647H to read the digit after the T at Register Pair HL plus one into Register A, the C FLAG when it is not a digit.
53CB
If the C FLAG is set (no digit after T), jump to 5214H, COMMAND SYNTAX ERROR.
53CE
RLCA 07
Rotate Register A, the tens digit, left by one bit: two times the digit.
53CF
LD C,A 4F
Copy Register A, two times the tens digit, into Register C.
53D0
RLCA 07
Rotate Register A left by one bit: four times the tens digit.
53D1
RLCA 07
Rotate Register A left by one bit: eight times the tens digit.
53D2
ADD A,C 81
Add Register C (two times) to Register A (eight times): ten times the tens digit.
53D3
LD C,A 4F
Copy Register A, ten times the tens digit, into Register C for the add at 53DAH.
53D4
Call 5647H to read the second digit at Register Pair HL plus one into Register A, the C FLAG when it is not a digit.
53D7
If the C FLAG is set (one digit only), jump to 5214H, COMMAND SYNTAX ERROR.
53DA
ADD A,C 81
Add Register C, the tens, to Register A: the number of cylinders of Tnn, 0-99, with the C FLAG clear.
53DB
LD (56BCH),A 32 BC 56
Store Register A, the cylinders of Tnn (00H without it), at 56BCH.
53DE
LD HL,(4049H) 2A 49 40
Load Register Pair HL with the word at 4049H, the top of memory found by SYS0/SYS at start-up.
53E1
LD DE,5D00H 11 00 5D
Load Register Pair DE with 5D00H, the start of the buffer of the backup passes and of the track images of 5650H (5C65H in 4.23).
53E4
SBC HL,DE ED 52
Subtract Register Pair DE (5D00H) and the C FLAG from Register Pair HL. The C FLAG can still be set from 53C2H (no T); with a top of memory ending in FFH, as SYS0/SYS finds it, Register H is the same either way.
53E6
LD A,H 7C
Copy Register H, the whole pages from 5D00H to the top of memory, into Register A.
53E7
LD (54A0H),A 32 A0 54
Store Register A at 54A0H, the number of sectors a pass of a backup with one drive may hold.
53EA
CP 12H FE 12
Compare Register A with 12H, the eighteen sectors of one double density cylinder.
53EC
If the NC FLAG is set (enough memory), jump to 53F4H.
53EE
LD HL,5BC2H 21 C2 5B
Load Register Pair HL with 5BC2H, a line feed and INSUFFICIENT MEMORY FOR 1 DRIVE BACKUP.
53F1
Jump to 5217H to show the text at Register Pair HL and DOUBLE DENSITY UTILITY ABORTED.
53F4H - DOUBLE BACKUP: Read the Source GAT, Format the Destination, Copy Cylinder 0
The source GAT is read into 4D00H, where it stays as the GAT of the destination. The destination gets the source's number of cylinders (GAT byte CDH), or Tnn when that is larger (54A4H enlarges the GAT image for it), and today's date of DoubleDOS when one is set; the name stays. Every cylinder of the destination is formatted, then cylinder 0 is copied in single density, ten sectors in one pass. The prompts for the source and the destination before the format are shown even with two drives; 549FH is set only after them.
53F4
Call 54D0H to select the source drive and, with 549FH still 00H, ask for the SOURCE diskette and wait for ENTER.
53F7
Call 58FBH to switch the Doubler to double density (command FFH, then D0H) for the source GAT.
53FA
Call 577BH to give the Restore command 03H and wait: the head of the source goes to cylinder 0.
53FD
LD DE,1100H 11 00 11
Load Register Pair DE with 1100H, logical track 17 sector 0, the GAT.
5400
Call 5949H to turn the logical track Register D and sector Register E into the cylinder and sector: Register Pair DE 0A08H, cylinder 10 sector 8.
5403
LD BC,4D00H 01 00 4D
Load Register Pair BC with 4D00H, the buffer of the GAT image.
5406
Call 57CBH to read cylinder Register D, sector Register E into the buffer at Register Pair BC (4D00H), with up to four tries; the NZ FLAG when it fails.
5409
If the NZ FLAG is set (the source GAT cannot be read), jump to 56B6H to show UNEXPECTED DISK I/O ERROR and abort.
540C
LD A,(56BCH) 3A BC 56
Load Register A with the byte at 56BCH, the cylinders of Tnn (00H without it).
540F
LD C,A 4F
Copy Register A, the cylinders of Tnn, into Register C for the compare.
5410
LD A,(4DCDH) 3A CD 4D
Load Register A with the byte at 4DCDH, GAT byte CDH of the source, its number of cylinders.
5413
LD (54A3H),A 32 A3 54
Store Register A, the cylinders of the source, at 54A3H: every pass of the copy ends at that cylinder.
5416
CP C B9
Compare Register A, the cylinders of the source, with Register C, those of Tnn: the C FLAG is set when Tnn is larger.
5417
If the C FLAG is set (Tnn larger), call 54A4H to enlarge the GAT image for Tnn cylinders (at most 80); Register A returns that number. A smaller Tnn is not used (the manual: the destination cannot be smaller).
541A
LD (56BCH),A 32 BC 56
Store Register A, the cylinders the destination gets, at 56BCH for the format of 5650H.
541D
LD HL,4DD8H 21 D8 4D
Load Register Pair HL with 4DD8H, the creation date in the GAT image.
5420
LD A,(4045H) 3A 45 40
Load Register A with the byte at 4045H, the day of the date of DoubleDOS (00H when no DATE has been given).
5423
OR A B7
Set the flags from Register A, the day: the NZ FLAG is set when a date is set.
5424
If the NZ FLAG is set (a date is set), call 4470H to write the date of DoubleDOS at Register Pair HL (4DD8H) as MM/DD/YY: the copy gets today's date.
5427
Call 54D8H to select the destination drive and, with 549FH still 00H, ask for the DESTINATION diskette and wait for ENTER.
542A
Call 5650H to format every cylinder of the destination (56BCH of them), cylinder 0 in single density; the sectors are not verified here.
542D
LD A,(549DH) 3A 9D 54
Load Register A with the select bit of the source drive at 549DH.
5430
LD B,A 47
Copy Register A, the select bit of the source, into Register B.
5431
LD A,(549EH) 3A 9E 54
Load Register A with the select bit of the destination drive at 549EH.
5434
XOR B A8
Exclusive OR Register A with Register B: 00H when the source and the destination are the same drive.
5435
LD (549FH),A 32 9F 54
Store Register A at 549FH: from now on 54DEH asks for a diskette only when there is one drive.
5438
Call 54D0H to select the source drive (and, with one drive, ask for the SOURCE diskette).
543B
Call 58F7H to switch the Doubler to single density (command FEH, then D0H) for cylinder 0.
543E
Call 577BH to give the Restore command 03H and wait: the head of the source goes to cylinder 0.
5441
LD A,0AH 3E 0A
Load Register A with 0AH, the ten sectors of the single density cylinder 0.
5443
LD (54A1H),A 32 A1 54
Store Register A (0AH) at 54A1H, the number of sectors of the pass.
5446
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, cylinder 0 sector 0, the first sector of the pass.
5449
Call 5532H to read the ten sectors of cylinder 0 from cylinder Register D, sector Register E into the buffer at 5D00H.
544C
Call 54D8H to select the destination drive (and, with one drive, ask for the DESTINATION diskette).
544F
Call 577BH to give the Restore command 03H and wait: the head of the destination goes to cylinder 0.
5452
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, cylinder 0 sector 0, for the write.
5455
Call 558DH to write the sectors of the pass from 5D00H to cylinder Register D, sector Register E on, the directory with its deleted data mark.
5458
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H, cylinder 0 sector 0, for the verify.
545B
Call 55BBH to read back each sector of the pass from cylinder Register D, sector Register E on; an error ends at VERIFY ERROR.
545E
Call 58FBH to switch the Doubler to double density (command FFH, then D0H) for cylinders 1 to the last.
5461H - DOUBLE BACKUP: Copy Cylinders 1 to the Last
Each pass reads a number of sectors from the source into 5D00H, writes them to the destination and reads them back: eighteen (one cylinder) with two drives, else as many as memory holds (54A0H), with the diskettes changed in between. 5C65H (new in 4.24) makes the passes stop at the source's last cylinder; 5C75H then verifies the destination's extra cylinders of Tnn. Last, the GAT image is written as the GAT of the destination.
5461
LD DE,0100H 11 00 01
Load Register Pair DE with 0100H, cylinder 1 sector 0, the first double density sector.
5464
LD A,(549FH) 3A 9F 54
Load Register A with the flag at 549FH: not 00H when the source and the destination are two drives.
5467
OR A B7
Set the flags from Register A, the flag of two drives.
5468
LD A,12H 3E 12
Load Register A with 12H, the eighteen sectors of one cylinder, the pass with two drives; the flags stay.
546A
If the NZ FLAG is set (two drives), jump to 546FH with Register A 12H.
546C
LD A,(54A0H) 3A A0 54
Load Register A with the number of sectors memory holds at 54A0H, the pass with one drive.
546F
Call 5C65H to store Register A, the sectors of a pass, at 54A1H and to make the passes end at the source's last cylinder (4.23 had LD (54A1H),A here).
5472
PUSH DE D5
Save Register Pair DE, the cylinder and sector of the pass, on the stack for the write.
5473
Call 54D0H to select the source drive (and, with one drive, ask for the SOURCE diskette).
5476
Call 5532H to read the pass from cylinder Register D, sector Register E into 5D00H on; Register Pair DE returns past the last sector read.
5479
POP DE D1
Restore Register Pair DE, the first cylinder and sector of the pass, from the stack.
547A
PUSH DE D5
Save Register Pair DE on the stack again for the verify.
547B
Call 54D8H to select the destination drive (and, with one drive, ask for the DESTINATION diskette).
547E
Call 558DH to write the pass from 5D00H to cylinder Register D, sector Register E on.
5481
POP DE D1
Restore Register Pair DE, the first cylinder and sector of the pass, from the stack.
5482
Call 55BBH to read back the sectors of the pass from cylinder Register D, sector Register E on; Register Pair DE returns past the last sector.
5485
LD A,(54A3H) 3A A3 54
Load Register A with the number of cylinders of the source at 54A3H.
5488
CP D BA
Compare Register A with Register D, the cylinder after the pass: the Z FLAG is set when the source's last cylinder is done.
5489
If the NZ FLAG is set (cylinders left), jump back to 5472H for the next pass.
548B
Call 5C75H to verify the destination's cylinders beyond the source's (Tnn), locking out flawed granules, and to Restore the head (4.23 called 577BH, the Restore alone).
548E
LD DE,1100H 11 00 11
Load Register Pair DE with 1100H, logical track 17 sector 0, the GAT.
5491
Call 5949H to turn the logical track Register D and sector Register E into the cylinder and sector: Register Pair DE 0A08H.
5494
Call 581AH to write the GAT image at 4D00H (the source's, with the new date, size and flaws) to the destination with the deleted data mark and read it back.
5497
LD HL,5A73H 21 73 5A
Load Register Pair HL with 5A73H, two line feeds and BACKUP COMPLETED.
549A
Jump to 521DH to show BACKUP COMPLETED, go back to double density and, when drive 0 took part, ask for the DBLDOS diskette.
549D
DEFB 00H 00
The select bit of the source drive at 549DH (01H, 02H, 04H or 08H), stored by 539CH; 54D0H selects it.
549E
DEFB 00H 00
The select bit of the destination drive at 549EH, stored by 53B1H; 54D8H selects it.
549F
DEFB 00H 00
The flag at 549FH: 00H while 54DEH must ask for each diskette (one drive, the first two prompts, and the DBLDOS prompt of 522BH), else the exclusive OR of the two select bits (5435H).
54A0
DEFB 00H 00
The number at 54A0H of whole pages from 5D00H to the top of memory (53E7H): the sectors of a pass with one drive.
54A1
DEFB 00H 00
The number of sectors of a pass at 54A1H: 0AH for cylinder 0 (5443H), then 12H or the count of 54A0H (5C65H).
54A2
DEFB 00H 00
The count at 54A2H of the sectors still to do in the pass, set from 54A1H by 5537H, 5592H and 55C0H and counted down by 55F1H.
54A3
DEFB 00H 00
The number of cylinders of the source at 54A3H, GAT byte CDH (5413H): the passes end there (5488H, 5C6EH).
54A4H - Enlarge the GAT Image for Tnn
Called from 5417H when Tnn is larger than the source. Tnn is held to 80 cylinders at most; the logical tracks the extra cylinders add are made free (FCH) after the source's last one, and GAT bytes CCH and CDH get the new counts. The manual: the destination is formatted for the larger size and the GAT enlarged by the extra granules (3.3.2.2).
54A4
LD A,(56BCH) 3A BC 56
Load Register A with the byte at 56BCH, the cylinders of Tnn.
54A7
CP 50H FE 50
Compare Register A with 50H, 80 cylinders, the most DoubleDOS takes.
54A9
If the C FLAG is set (fewer than 80), jump to 54B0H.
54AB
LD A,50H 3E 50
Load Register A with 50H, 80 cylinders, in place of a larger Tnn.
54AD
LD (56BCH),A 32 BC 56
Store Register A (50H) at 56BCH, the cylinders of the destination.
54B0
LD D,A 57
Copy Register A, the cylinders of the destination, into Register D for the conversion.
54B1
LD E,00H 1E 00
Load Register E with 00H, sector 0: Register Pair DE is the first sector after the last cylinder.
54B3
Call 592DH to turn cylinder Register D, sector Register E into the logical track: Register D returns the whole logical tracks of the destination.
54B6
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the GAT image.
54B9
LD A,(4DCCH) 3A CC 4D
Load Register A with the byte at 4DCCH, GAT byte CCH, the logical tracks of the source.
54BC
LD L,A 6F
Copy Register A into Register L: Register Pair HL is the GAT byte of the first logical track the source does not have.
54BD
LD A,D 7A
Copy Register D, the logical tracks of the destination, into Register A.
54BE
SUB L 95
Subtract Register L, the logical tracks of the source, from Register A: the logical tracks added.
54BF
LD B,A 47
Copy Register A, the logical tracks added, into Register B, the count of the loop (at least 1: one more cylinder adds 18 sectors).
54C0
LD (HL),FCH 36 FC
Store FCH at Register Pair HL: both granules of the added logical track free.
54C2
INC HL 23
Increment Register Pair HL to the next GAT byte.
54C3
Decrement Register B and jump back to 54C0H until every added logical track is free.
54C5
LD A,D 7A
Copy Register D, the logical tracks of the destination, into Register A.
54C6
LD (4DCCH),A 32 CC 4D
Store Register A at 4DCCH, GAT byte CCH, the new number of logical tracks.
54C9
LD A,(56BCH) 3A BC 56
Load Register A with the cylinders of the destination at 56BCH.
54CC
LD (4DCDH),A 32 CD 4D
Store Register A at 4DCDH, GAT byte CDH, the new number of cylinders; Register A returns it to 541AH.
54CF
RET C9
Return to 541AH with Register A the cylinders of the destination.
54D0H - Select the Source or the Destination and Ask for Its Diskette
54D0H takes the source (549DH), 54D8H the destination (549EH), 54DEH any drive whose select bit is in Register A, with Register Pair HL the word to show. The track register of the controller belongs to the drive in use, so the head position of the old drive is kept in its byte of 4300H-4303H (the table of SYS0/SYS) and that of the new drive put in its place; 4308H and 4309H get the drive and its select bit. When 549FH is 00H the text MOUNT word DISK IN DRIVE n AND PUSH "ENTER" is shown and a key awaited.
54D0
LD HL,5B7EH 21 7E 5B
Load Register Pair HL with 5B7EH, the word SOURCE ended by 03H, for the prompt.
54D3
LD A,(549DH) 3A 9D 54
Load Register A with the select bit of the source drive at 549DH.
54D6
Jump to 54DEH to select the drive of Register A and ask for its diskette.
54D8
LD HL,5B85H 21 85 5B
Load Register Pair HL with 5B85H, the word DESTINATION ended by 03H, for the prompt.
54DB
LD A,(549EH) 3A 9E 54
Load Register A with the select bit of the destination drive at 549EH.
54DE
PUSH DE D5
Save Register Pair DE on the stack: the cylinder and sector of the pass are kept.
54DF
PUSH HL E5
Save Register Pair HL, the word of the prompt, on the stack.
54E0
PUSH AF F5
Save Register Pair AF, the select bit of the new drive in Register A, on the stack.
54E1
LD A,(4309H) 3A 09 43
Load Register A with the select bit at 4309H of the drive used last.
54E4
Call 5527H to find the byte of the drive of Register A in the table 4300H-4303H: Register Pair HL returns it.
54E7
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the head position of the drive used last.
54EA
LD (HL),A 77
Store Register A at Register Pair HL, the old drive's byte of 4300H-4303H.
54EB
POP AF F1
Restore Register Pair AF from the stack: Register A is the select bit of the new drive.
54EC
LD (4309H),A 32 09 43
Store Register A, the select bit of the new drive, at 4309H, which 57B7H writes to the drive latch 37E1H.
54EF
Call 5527H to find the byte of the new drive of Register A in the table 4300H-4303H: Register Pair HL, and Register D its number 0-3.
54F2
LD A,(HL) 7E
Load Register A with the head position of the new drive at Register Pair HL.
54F3
LD (37EDH),A 32 ED 37
Store Register A at 37EDH, the track register: the controller now knows where the new drive's head is.
54F6
LD A,D 7A
Copy Register D, the number of the new drive, into Register A.
54F7
LD (4308H),A 32 08 43
Store Register A at 4308H, the drive in use, as SYS0/SYS keeps it.
54FA
LD A,(549FH) 3A 9F 54
Load Register A with the flag at 549FH: 00H when a diskette must be asked for.
54FD
OR A B7
Set the flags from Register A, the flag of two drives.
54FE
If the NZ FLAG is set (two drives, the diskettes stay), jump to 5524H to return.
5500
LD HL,5B98H 21 98 5B
Load Register Pair HL with 5B98H, a line feed and MOUNT and a space, ended by 03H.
5503
Call 4467H to show the text at Register Pair HL (5B98H) up to its 03H.
5506
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer: Register Pair HL is the word of the prompt (SOURCE, DESTINATION or DBLDOS), and 5B98H takes its place on the stack.
5507
Call 4467H to show the word at Register Pair HL up to its 03H.
550A
LD HL,5BAFH 21 AF 5B
Load Register Pair HL with 5BAFH, the drive digit in the text DISK IN DRIVE 0.
550D
LD (HL),2FH 36 2F
Store 2FH at Register Pair HL (5BAFH), one less than the digit 0: the loop counts the digit up from there.
550F
LD A,(4309H) 3A 09 43
Load Register A with the select bit of the new drive at 4309H.
5512
INC (HL) 34
Increment the digit at Register Pair HL (5BAFH): 0 the first time.
5513
RRA 1F
Rotate Register A right through the C FLAG: the C FLAG is set when the bit of this drive number is reached.
5514
If the NC FLAG is set (not yet the select bit), jump back to 5512H: the digit at 5BAFH ends as the drive number.
5516
LD HL,5BA0H 21 A0 5B
Load Register Pair HL with 5BA0H, the text DISK IN DRIVE n AND PUSH "ENTER" ended by 03H.
5519
Call 4467H to show the text at Register Pair HL (5BA0H) up to its 03H.
551C
LD HL,5983H 21 83 59
Load Register Pair HL with 5983H, the start of the banner, as a buffer for the key: the banner is not shown again.
551F
LD B,01H 06 01
Load Register B with 01H, one character at most.
5521
Call 0040H, the line input of the ROM, to wait for ENTER (one character may be typed first) into the buffer at Register Pair HL (5983H).
5524
POP HL E1
Restore Register Pair HL from the stack: the word of the prompt, or 5B98H when the prompt was shown; no caller uses it.
5525
POP DE D1
Restore Register Pair DE, the cylinder and sector of the pass, from the stack.
5526
RET C9
Return to the caller with the new drive selected and its head position in the track register.
5527H - Find the Byte of a Drive in 4300H-4303H
Called with a select bit in Register A (01H, 02H, 04H or 08H). Returns Register Pair HL 4300H plus the drive number and Register D the drive number.
5527
LD HL,42FFH 21 FF 42
Load Register Pair HL with 42FFH, one before the table of head positions 4300H-4303H.
552A
LD D,FFH 16 FF
Load Register D with FFH, one before drive 0.
552C
INC HL 23
Increment Register Pair HL to the byte of the next drive in 4300H-4303H.
552D
INC D 14
Increment Register D to the next drive number.
552E
RRA 1F
Rotate Register A right through the C FLAG: bit 0 goes into the C FLAG.
552F
If the NC FLAG is set (not the select bit yet), jump back to 552CH for the next drive.
5531
RET C9
Return with Register Pair HL the drive's byte of 4300H-4303H and Register D its number.
5532H - Read a Pass from the Source
Reads 54A1H sectors from cylinder Register D, sector Register E on into the buffer at 5D00H, each with up to four tries (57CBH), showing READING TRACK nn SECTOR nn in place. A sector that cannot be read shows - SOURCE READ ERROR; when it is in the flaw table of the GAT image (4DC0H-4DC9H) the pass goes on, else the user is asked (C)ONTINUE, (R)ETRY, OR (A)BORT?. On (C)ONTINUE, and for a sector of the flaw table, the buffer place of the bad sector is not passed over: the next sector is read into it, so the rest of the pass is written one sector early (a bug: the Bugs part of the introduction). Returns Register Pair DE past the last sector.
5532
PUSH HL E5
Save Register Pair HL on the stack for the caller.
5533
PUSH BC C5
Save Register Pair BC on the stack for the caller.
5534
LD BC,5D00H 01 00 5D
Load Register Pair BC with 5D00H, the start of the buffer of the pass; 57CBH moves it on by 256 for each sector read.
5537
LD A,(54A1H) 3A A1 54
Load Register A with the number of sectors of the pass at 54A1H.
553A
LD (54A2H),A 32 A2 54
Store Register A at 54A2H, the count of the sectors still to read.
553D
LD HL,5B4BH 21 4B 5B
Load Register Pair HL with 5B4BH, the six characters two spaces and READ, the first word of the progress text.
5540
Call 55F9H to show READING TRACK nn SECTOR nn with the word at Register Pair HL and cylinder Register D, sector Register E.
5543
Call 57CBH to read cylinder Register D, sector Register E into the buffer at Register Pair BC with up to four tries; the Z FLAG and Register Pair BC 256 higher when it is read.
5546
If the Z FLAG is set (the sector was read), jump to 5585H for the next sector.
5548
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack while the text is shown.
5549
LD HL,5BEAH 21 EA 5B
Load Register Pair HL with 5BEAH, the text - SOURCE READ ERROR and a carriage return, which ends the progress line.
554C
Call 4467H to show the text at Register Pair HL (5BEAH) up to its carriage return.
554F
POP DE D1
Restore Register Pair DE, the cylinder and sector of the bad sector, from the stack.
5550
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
5551
PUSH BC C5
Save Register Pair BC, the buffer place of the bad sector (not moved on), on the stack.
5552
LD HL,4DC0H 21 C0 4D
Load Register Pair HL with 4DC0H, the flaw table in the GAT image of the source: five entries of a cylinder and a sector.
5555
LD B,05H 06 05
Load Register B with 05H, the five entries of the flaw table.
5557
LD A,(HL) 7E
Load Register A with the cylinder of the entry at Register Pair HL (FFH for an empty entry).
5558
CP D BA
Compare Register A, the cylinder of the entry, with Register D, the cylinder of the bad sector.
5559
If the NZ FLAG is set (another cylinder), jump to 5563H for the next entry.
555B
INC HL 23
Increment Register Pair HL to the sector of the entry.
555C
LD A,(HL) 7E
Load Register A with the sector of the entry at Register Pair HL.
555D
DEC HL 2B
Decrement Register Pair HL back to the cylinder of the entry.
555E
CP E BB
Compare Register A, the sector of the entry, with Register E, the sector of the bad sector.
555F
LD A,43H 3E 43
Load Register A with 43H, the letter C of (C)ONTINUE; the flags stay.
5561
If the Z FLAG is set (the sector is in the flaw table), jump to 5576H to go on as for C.
5563
INC HL 23
Increment Register Pair HL past the cylinder of the entry.
5564
INC HL 23
Increment Register Pair HL past the sector: the next entry.
5565
Decrement Register B and jump back to 5557H until the five entries have been compared.
5567
LD HL,5BFFH 21 FF 5B
Load Register Pair HL with 5BFFH, a line feed and (C)ONTINUE, (R)ETRY, OR (A)BORT? ended by 03H.
556A
Call 4467H to show the question at Register Pair HL (5BFFH) up to its 03H.
556D
LD HL,5983H 21 83 59
Load Register Pair HL with 5983H, the start of the banner, as the buffer of the answer.
5570
LD B,01H 06 01
Load Register B with 01H, one character at most for the answer to the question.
5572
Call 0040H, the line input of the ROM: one character into the buffer at Register Pair HL (5983H), which it returns.
5575
LD A,(HL) 7E
Load Register A with the character typed at Register Pair HL (0DH when only ENTER was pressed).
5576
POP BC C1
Restore Register Pair BC, the buffer place of the bad sector, from the stack.
5577
POP DE D1
Restore Register Pair DE, the cylinder and sector of the bad sector, from the stack.
5578
CP 41H FE 41
Compare Register A, the answer, with 41H, the letter A of (A)BORT.
557A
If the Z FLAG is set (A), jump to 521AH to show DOUBLE DENSITY UTILITY ABORTED and end.
557D
CP 52H FE 52
Compare Register A, the answer, with 52H, the letter R of (R)ETRY.
557F
If the Z FLAG is set (R), jump back to 553DH to read the same sector again into the same place.
5581
CP 43H FE 43
Compare Register A, the answer, with 43H, the letter C of (C)ONTINUE.
5583
If the NZ FLAG is set (another key), jump back to 5550H to search the flaw table and ask again.
5585
Call 55E3H to move cylinder Register D, sector Register E to the next sector and count the pass down; the Z FLAG at its end. After a sector that was not read Register Pair BC still points at its place in the buffer, so the next sector goes there (a bug: the Bugs part of the introduction).
5588
If the NZ FLAG is set (sectors left in the pass), jump back to 553DH for the next sector.
558A
POP BC C1
Restore Register Pair BC from the stack for the caller.
558B
POP HL E1
Restore Register Pair HL from the stack for the caller.
558C
RET C9
Return with Register Pair DE past the last sector of the pass.
558DH - Write a Pass to the Destination
Writes 54A1H sectors from 5D00H to cylinder Register D, sector Register E on, showing WRITING TRACK nn SECTOR nn. Sectors of logical track 17, the directory, get the deleted data mark (Write Sector A9H), every other sector the ordinary mark (A8H). The sectors are read back afterwards by 55BBH; a write error ends at 56A8H.
558D
PUSH HL E5
Save Register Pair HL on the stack for the caller.
558E
PUSH BC C5
Save Register Pair BC on the stack for the caller.
558F
LD BC,5D00H 01 00 5D
Load Register Pair BC with 5D00H, the start of the buffer of the pass; 583FH moves it on by 256 for each sector written.
5592
LD A,(54A1H) 3A A1 54
Load Register A with the number of sectors of the pass at 54A1H.
5595
LD (54A2H),A 32 A2 54
Store Register A at 54A2H, the count of the sectors still to write.
5598
LD HL,5B51H 21 51 5B
Load Register Pair HL with 5B51H, the six characters two spaces and WRIT, the first word of the progress text.
559B
Call 55F9H to show WRITING TRACK nn SECTOR nn with the word at Register Pair HL and cylinder Register D, sector Register E.
559E
Call 57BEH to put the head on cylinder Register D (Seek 13H when it is elsewhere) and sector Register E in the sector register 37EEH.
55A1
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack during the conversion.
55A2
Call 592DH to turn cylinder Register D, sector Register E into the logical track in Register D and the sector of it in Register E.
55A5
LD A,D 7A
Copy Register D, the logical track, into Register A.
55A6
CP 11H FE 11
Compare Register A with 11H, logical track 17, the directory: the Z FLAG for cylinder 10 sectors 8-17.
55A8
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack; the flags stay.
55A9
LD A,A8H 3E A8
Load Register A with A8H, the Write Sector command with the ordinary data mark; the flags stay.
55AB
If the NZ FLAG is set (not the directory), jump to 55AEH with Register A A8H.
55AD
INC A 3C
Increment Register A to A9H, the Write Sector command with the deleted data mark of the directory.
55AE
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
55AF
Call 583FH to give the write command in Register A and send 256 bytes from Register Pair BC to the data register; a write error ends at 56A8H.
55B2
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
55B3
Call 55E3H to move cylinder Register D, sector Register E to the next sector and count the pass down; the Z FLAG at its end.
55B6
If the NZ FLAG is set (sectors left), jump back to 5598H for the next sector.
55B8
POP BC C1
Restore Register Pair BC from the stack for the caller.
55B9
POP HL E1
Restore Register Pair HL from the stack for the caller.
55BA
RET C9
Return to the caller with the pass written to the destination.
55BBH - Verify a Pass on the Destination
Reads back the 54A1H sectors written from cylinder Register D, sector Register E on with the Read Sector command 88H and no data taken, showing VERIFYING TRACK nn SECTOR nn. The controller ends each command with LOST DATA, which the mask 98H leaves out: NOT READY, RECORD NOT FOUND and a CRC error end the backup at VERIFY ERROR, as the manual says of any error on the destination (3.3.1). Returns Register Pair DE past the last sector.
55BB
PUSH HL E5
Save Register Pair HL on the stack for the caller.
55BC
PUSH BC C5
Save Register Pair BC on the stack for the caller.
55BD
LD BC,5D00H 01 00 5D
Load Register Pair BC with 5D00H, the start of the buffer, which the verify does not use.
55C0
LD A,(54A1H) 3A A1 54
Load Register A with the number of sectors of the pass at 54A1H.
55C3
LD (54A2H),A 32 A2 54
Store Register A at 54A2H, the count of the sectors still to verify.
55C6
LD HL,5B57H 21 57 5B
Load Register Pair HL with 5B57H, the six characters VERIFY, the first word of the progress text.
55C9
Call 55F9H to show VERIFYING TRACK nn SECTOR nn with the word at Register Pair HL and cylinder Register D, sector Register E.
55CC
Call 57BEH to put the head on cylinder Register D (Seek 13H when needed) and sector Register E in the sector register 37EEH.
55CF
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
55D0
LD A,88H 3E 88
Load Register A with 88H, the Read Sector command; its data bytes are not taken.
55D2
Call 577DH to give the command in Register A (88H) and wait until the controller is done; Register A returns the status.
55D5
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
55D6
AND 98H E6 98
AND Register A, the status, with 98H: NOT READY (bit 7), RECORD NOT FOUND (bit 4) and CRC ERROR (bit 3).
55D8
If the NZ FLAG is set (the sector does not read back), jump to 5839H to show VERIFY ERROR and abort.
55DB
Call 55E3H to move cylinder Register D, sector Register E to the next sector and count the pass down; the Z FLAG at its end.
55DE
If the NZ FLAG is set (sectors left), jump back to 55C6H for the next sector.
55E0
POP BC C1
Restore Register Pair BC from the stack for the caller.
55E1
POP HL E1
Restore Register Pair HL from the stack for the caller.
55E2
RET C9
Return with Register Pair DE past the last sector of the pass.
55E3H - Next Sector of a Pass
Moves cylinder Register D, sector Register E to the next of the eighteen sectors of a cylinder and counts 54A2H down. Returns the Z FLAG when the count reaches 0, or when the next cylinder is 56BCH, the end (from 4.24 the source's number of cylinders while copying, 5C71H).
55E3
INC E 1C
Increment Register E, the sector, to the next sector of the cylinder.
55E4
LD A,E 7B
Copy Register E, the sector, into Register A for the test.
55E5
CP 12H FE 12
Compare Register A with 12H, one past the last sector of a double density cylinder.
55E7
If the C FLAG is set (still on the cylinder), jump to 55F1H to count the pass down.
55E9
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the next cylinder.
55EB
INC D 14
Increment Register D, the cylinder, to the next cylinder of the diskette.
55EC
LD A,(56BCH) 3A BC 56
Load Register A with the number of cylinders at 56BCH, the end of the copy.
55EF
CP D BA
Compare Register A with Register D, the next cylinder: the Z FLAG when the last cylinder is done.
55F0
RET Z C8
Return with the Z FLAG set when Register D has reached the end: the pass ends early.
55F1
LD A,(54A2H) 3A A2 54
Load Register A with the count of sectors left at 54A2H.
55F4
DEC A 3D
Decrement Register A, the count: the Z FLAG when it reaches 0.
55F5
LD (54A2H),A 32 A2 54
Store Register A, the new count, back at 54A2H.
55F8
RET C9
Return with the Z FLAG set when the pass is complete.
55F9H - Show the Progress of a Pass
Copies the six characters at Register Pair HL (two spaces and READ, two spaces and WRIT, or VERIFY) over the start of VERIFYING at 5B2EH and puts the two digits of cylinder Register D at 5B3EH and of sector Register E at 5B48H, then shows the line from 5B2DH, which starts with 1DH (the cursor to the start of the line), so that each sector's line is written over the last.
55F9
PUSH BC C5
Save Register Pair BC, the buffer place of the pass, on the stack.
55FA
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
55FB
LD DE,5B2EH 11 2E 5B
Load Register Pair DE with 5B2EH, the first six characters of the progress text, VERIFY at first.
55FE
LD BC,0006H 01 06 00
Load Register Pair BC with 0006H, the six characters of the word.
5601
LDIR ED B0
Copy Register Pair BC (0006H) bytes from Register Pair HL, the word, to Register Pair DE (5B2EH): READING, WRITING or VERIFYING.
5603
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
5604
PUSH DE D5
Save Register Pair DE on the stack again for the return.
5605
LD A,D 7A
Copy Register D, the cylinder, into Register A.
5606
Call 591EH to turn Register A (0-99) into two digits: Register C the tens, Register B the units.
5609
LD (5B3EH),BC ED 43 3E 5B
Store Register Pair BC at 5B3EH: Register C (the tens) at 5B3EH and Register B (the units) at 5B3FH, the track number of the text.
560D
LD A,E 7B
Copy Register E, the sector, into Register A.
560E
Call 591EH to turn Register A into two digits: Register C the tens, Register B the units.
5611
LD (5B48H),BC ED 43 48 5B
Store Register Pair BC at 5B48H: the tens at 5B48H and the units at 5B49H, the sector number of the text.
5615
LD HL,5B2DH 21 2D 5B
Load Register Pair HL with 5B2DH, the progress text with its leading 1DH.
5618
Call 4467H to show the text at Register Pair HL (5B2DH) up to its 03H, the cursor staying on the line.
561B
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
561C
POP BC C1
Restore Register Pair BC, the buffer place, from the stack.
561D
RET C9
Return to the pass with the progress line on the screen.
561EH - Read :n, the Drive Number
Called with Register Pair HL on the command line. Spaces are passed over; a colon and a digit 0-3 must follow. The select bit of the drive (01H, 02H, 04H or 08H) is stored at 4309H and returned in Register A, with Register Pair HL on the digit. Anything else ends at INVALID DRIVE NUMBER.
561E
Call 563FH to pass over spaces at Register Pair HL; Register A returns the next other character.
5621
CP 3AH FE 3A
Compare Register A with 3AH, the colon in front of a drive number.
5623
If the NZ FLAG is set (no colon), jump to 5639H to show INVALID DRIVE NUMBER.
5625
Call 5647H to read the character after the colon at Register Pair HL plus one: Register A its value, the C FLAG when it is not a digit.
5628
If the C FLAG is set (not a digit), jump to 5639H to show INVALID DRIVE NUMBER.
562A
CP 04H FE 04
Compare Register A, the drive number, with 04H: the NC FLAG for 4 and above.
562C
If the NC FLAG is set (drive 4-9), jump to 5639H to show INVALID DRIVE NUMBER.
562E
LD B,A 47
Copy Register A, the drive number, into Register B, the count of the shift loop.
562F
XOR A AF
Clear Register A to 00H, the start of the select bit built by the loop.
5630
SCF 37
Set the C FLAG, the bit that the first RLA brings into bit 0 of Register A.
5631
INC B 04
Increment Register B: the loop shifts drive number plus one times.
5632
RLA 17
Rotate Register A left through the C FLAG: 01H the first time, then 02H, 04H, 08H.
5633
Decrement Register B and jump back to 5632H until Register A is the select bit of the drive.
5635
LD (4309H),A 32 09 43
Store Register A, the select bit, at 4309H, which 57B7H writes to the drive latch 37E1H.
5638
RET C9
Return with Register A the select bit and Register Pair HL on the drive digit.
5639
LD HL,5A86H 21 86 5A
Load Register Pair HL with 5A86H, the text INVALID DRIVE NUMBER.
563C
Jump to 5217H to show the text at Register Pair HL and DOUBLE DENSITY UTILITY ABORTED.
563FH - Pass Over Spaces
Called with Register Pair HL on the text. Returns Register Pair HL on the first character that is not a space, with that character in Register A.
563F
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5640
INC HL 23
Increment Register Pair HL to the next character.
5641
CP 20H FE 20
Compare Register A, the character, with 20H, a space: the Z FLAG for a space.
5643
If the Z FLAG is set (a space), jump back to 563FH for the next character.
5645
DEC HL 2B
Decrement Register Pair HL back to the character that is not a space.
5646
RET C9
Return with Register A the character and Register Pair HL on it.
5647H - Read a Digit
Called with Register Pair HL one before the character. Moves Register Pair HL on to it and returns its value 0-9 in Register A with the NC FLAG, or the C FLAG when it is not a digit.
5647
INC HL 23
Increment Register Pair HL to the character to read.
5648
LD A,(HL) 7E
Load Register A with the character at Register Pair HL.
5649
SUB 30H D6 30
Subtract 30H, the digit 0, from Register A: the C FLAG for a character below 0.
564B
RET C D8
Return with the C FLAG set when the character is below 30H: not a digit.
564C
CP 0AH FE 0A
Compare Register A with 0AH: the C FLAG is set for a value 0-9.
564E
CCF 3F
Complement the C FLAG: set when Register A is 0AH or more, not a digit.
564F
RET C9
Return with Register A the value and the NC FLAG for a digit.
5650H - Format the Diskette
Formats 56BCH cylinders of the selected drive: cylinder 0 in single density with ten sectors (the table at 56BDH), then each of cylinders 1 to the last in double density with eighteen sectors (56CEH), stepping in by one each time. After each double density cylinder the sector order at 56E9H-56FAH is turned by four places, so that sector 0 of the next cylinder comes four places later. A drive not ready or write protected at the first Restore ends the job at 56A8H.
5650
PUSH HL E5
Save Register Pair HL on the stack for the caller.
5651
PUSH DE D5
Save Register Pair DE on the stack for the caller.
5652
PUSH BC C5
Save Register Pair BC on the stack for the caller.
5653
Call 58F7H to switch the Doubler to single density (command FEH, then D0H) for cylinder 0.
5656
Call 577BH to give the Restore command 03H and wait: the head goes to cylinder 0; Register A returns the status.
5659
AND C0H E6 C0
AND Register A, the status, with C0H: NOT READY (bit 7) and WRITE PROTECT (bit 6).
565B
If the NZ FLAG is set (not ready or protected), jump to 56A8H to name the error and abort.
565D
LD HL,56BDH 21 BD 56
Load Register Pair HL with 56BDH, the format table of the single density cylinder 0.
5660
Call 56FBH to build the image of the cylinder from the table at Register Pair HL and write it with the Write Track command.
5663
If the NZ FLAG is set, jump to 56A8H. 56FBH returns only with the Z FLAG (583FH jumps to 56A8H itself on an error), so the jump is never taken (a bug: the Bugs part of the introduction).
5666
Call 58FBH to switch the Doubler to double density (command FFH, then D0H) for cylinders 1 to the last.
5669
Call 577BH to give the Restore command 03H and wait (the head is already on cylinder 0).
566C
LD A,(56BCH) 3A BC 56
Load Register A with the number of cylinders at 56BCH.
566F
LD B,A 47
Copy Register A, the number of cylinders, into Register B.
5670
DEC B 05
Decrement Register B: the count of the double density cylinders.
5671
LD HL,56CEH 21 CE 56
Load Register Pair HL with 56CEH, the format table of a double density cylinder.
5674
LD A,53H 3E 53
Load Register A with 53H, the Step In command with the track register updated, stepping rate 3.
5676
Call 577DH to give the command in Register A (53H) and wait: the head moves in to the next cylinder.
5679
Call 56FBH to build the image of the cylinder from the table at Register Pair HL (56CEH) and write it with Write Track.
567C
If the NZ FLAG is set, jump to 56A8H; as at 5663H, 56FBH always returns the Z FLAG and the jump is never taken.
567E
PUSH BC C5
Save Register Pair BC, the count of cylinders in Register B, on the stack.
567F
LD C,04H 0E 04
Load Register C with 04H, the four turns of the sector order between two cylinders.
5681
LD B,11H 06 11
Load Register B with 11H, the seventeen moves of one turn.
5683
LD IX,56FAH DD 21 FA 56
Load Index Register IX with 56FAH, the last byte of the double density sector order 56E9H-56FAH.
5687
LD A,(IX+00H) DD 7E 00
Load Register A with the last sector number of the order at Index Register IX+00H.
568A
EX AF,AF' 08
Exchange Register Pair AF with the alternate AF: the last sector number is kept in the alternate Register A.
568B
LD A,(IX-01H) DD 7E FF
Load Register A with the byte one place lower, at Index Register IX-01H.
568E
LD (IX+00H),A DD 77 00
Store Register A at Index Register IX+00H: the sector number moves up one place.
5691
DEC IX DD 2B
Decrement Index Register IX to the next lower place of the order.
5693
Decrement Register B and jump back to 568BH until seventeen numbers have moved up one place.
5695
EX AF,AF' 08
Exchange Register Pair AF with the alternate AF: Register A is the sector number that was last.
5696
LD (IX+00H),A DD 77 00
Store Register A at Index Register IX+00H (56E9H): the last number of the order becomes the first.
5699
DEC C 0D
Decrement Register C, the turns still to make.
569A
If the NZ FLAG is set (turns left), jump back to 5681H for the next turn.
569C
POP BC C1
Restore Register Pair BC, the count of cylinders, from the stack.
569D
Decrement Register B and jump back to 5674H until every double density cylinder is formatted.
569F
LD A,0DH 3E 0D
Load Register A with 0DH, a carriage return, to end the line of FORMATTING TRACK nn.
56A1
Call 0033H, the ROM's display of the character in Register A: the FORMATTING TRACK line is ended.
56A4
POP BC C1
Restore Register Pair BC from the stack for the caller.
56A5
POP DE D1
Restore Register Pair DE from the stack for the caller.
56A6
POP HL E1
Restore Register Pair HL from the stack for the caller.
56A7
RET C9
Return to the caller with every cylinder of the diskette formatted.
56A8H - Name a Disk Error and Abort
Reached with the status of the controller in Register A. Bit 7 (NOT READY) gives DRIVE INOPERATIVE OR DOOR OPEN, bit 6 (WRITE PROTECT) DISK IS WRITE PROTECTED, anything else UNEXPECTED DISK I/O ERROR (56B6H, also reached from 5409H when the source GAT cannot be read). Each ends at 5217H, DOUBLE DENSITY UTILITY ABORTED.
56A8
LD HL,5A9BH 21 9B 5A
Load Register Pair HL with 5A9BH, the text DRIVE INOPERATIVE OR DOOR OPEN.
56AB
RLA 17
Rotate Register A, the status, left: bit 7, NOT READY, goes into the C FLAG.
56AC
If the C FLAG is set (not ready), jump to 5217H to show the text at Register Pair HL and abort.
56AF
LD HL,5ABAH 21 BA 5A
Load Register Pair HL with 5ABAH, the text DISK IS WRITE PROTECTED.
56B2
RLA 17
Rotate Register A left again: bit 6 of the status, WRITE PROTECT, goes into the C FLAG.
56B3
If the C FLAG is set (write protected), jump to 5217H to show the text at Register Pair HL and abort.
56B6
LD HL,5AD2H 21 D2 5A
Load Register Pair HL with 5AD2H, a line feed and UNEXPECTED DISK I/O ERROR.
56B9
Jump to 5217H to show the text at Register Pair HL and DOUBLE DENSITY UTILITY ABORTED.
56BCH - The Format Tables
56BCH holds the number of cylinders. Then the table of a single density cylinder (56BDH) and of a double density cylinder (56CEH), each a sector count, the address of its sector order, and pairs of a count and a byte that 56FBH writes into the track image: one pair before the first sector, then six pairs for each sector around its ID field and its data. The single density sector order (56DFH) is 0 5 1 6 2 7 3 8 4 9; the double density one (56E9H) starts 0 6 12 1 7 13, as found on the 4.24 diskette, and is turned by 5683H after each cylinder. Two counts of the double density table differ in 4.23: 3EH at 56D1H and 16H at 56DDH.
56BC
DEFB 00H 00
The number of cylinders at 56BCH: typed for FORMAT (52D1H), Tnn or the source's for BACKUP (53DBH, 541AH), and the source's while the passes run (5C71H).
56BD-56BF
DEFB 0AH / DEFW 56DFH 0A DF 56
The single density table at 56BDH: ten sectors (0AH), and the address 56DFH of their order on the track.
56C0-56C1
DEFB 1FH,FFH 1F FF
The pair at 56C0H written once before the first single density sector: 31 bytes FFH, the gap after the index hole; its FFH also fills the end of the track (575DH).
56C2-56C3
DEFB 03H,00H 03 00
The first pair of each single density sector at 56C2H: three bytes 00H before the ID field (576FH keeps this address).
56C4-56C5
DEFB 03H,00H 03 00
The second pair of each single density sector at 56C4H: three more bytes 00H, six in all, before the ID address mark FEH.
56C6-56C7
DEFB 0BH,FFH 0B FF
The third pair of each single density sector at 56C6H: eleven bytes FFH after the ID field and its CRC.
56C8-56C9
DEFB 03H,00H 03 00
The fourth pair of each single density sector at 56C8H: three bytes 00H before the data field.
56CA-56CB
DEFB 03H,00H 03 00
The fifth pair of each single density sector at 56CAH: three more bytes 00H, six in all, before the data address mark FBH.
56CC-56CD
DEFB 0BH,FFH 0B FF
The sixth pair of each single density sector at 56CCH: eleven bytes FFH after the data and its CRC, before the next sector.
56CE-56D0
DEFB 12H / DEFW 56E9H 12 E9 56
The double density table at 56CEH: eighteen sectors (12H), and the address 56E9H of their order on the track.
56D1-56D2
DEFB 64H,4EH 64 4E
The pair at 56D1H written once before the first double density sector: 100 bytes 4EH after the index hole (62 in 4.23, whose byte here is 3EH); its 4EH also fills the end of the track.
56D3-56D4
DEFB 0CH,00H 0C 00
The first pair of each double density sector at 56D3H: twelve bytes 00H before the ID field.
56D5-56D6
DEFB 03H,F5H 03 F5
The second pair of each double density sector at 56D5H: three bytes F5H, which the controller writes as the A1H marks of double density, before the ID address mark FEH.
56D7-56D8
DEFB 16H,4EH 16 4E
The third pair of each double density sector at 56D7H: twenty-two bytes 4EH after the ID field and its CRC.
56D9-56DA
DEFB 0CH,00H 0C 00
The fourth pair of each double density sector at 56D9H: twelve bytes 00H before the data field.
56DB-56DC
DEFB 03H,F5H 03 F5
The fifth pair of each double density sector at 56DBH: three bytes F5H, the A1H marks, before the data address mark FBH.
56DD-56DE
DEFB 14H,4EH 14 4E
The sixth pair of each double density sector at 56DDH: twenty bytes 4EH after the data and its CRC (twenty-two in 4.23, whose byte here is 16H).
56DF-56E8
DEFB 00H,05H,01H,06H,02H,07H,03H,08H,04H,09H 00 05 01 06 02 07 03 08 04 09
The order of the ten single density sectors on cylinder 0 at 56DFH: 0 5 1 6 2 7 3 8 4 9, every other place.
56E9-56FA
DEFB 00H,06H,0CH,01H,07H,0DH,02H,08H,0EH,03H,09H,0FH,04H,0AH,10H,05H,0BH,11H 00 06 0C 01 07 0D 02 08 0E 03 09 0F 04 0A 10 05 0B 11
The order of the eighteen double density sectors at 56E9H, as written on cylinder 1: 0 6 12 1 7 13 2 8 14 3 9 15 4 10 16 5 11 17, every third place. 5683H moves every number up one place four times after each cylinder.
56FBH - Build and Write the Image of a Cylinder
Called with Register Pair HL a format table (56BDH or 56CEH) and the head on the cylinder. FORMATTING TRACK nn is shown; the image is built at 5D00H (5C65H in 4.23): the first pair, then for each sector two pairs, the ID field (FEH, the cylinder, side 00H, the sector from the order, size 01H for 256 bytes, F7H for the CRC), three pairs, the data mark FBH, 256 bytes of data, F7H and the last pair; then 256 bytes of the gap byte. The Write Track command F4H writes it. The caller's registers are kept in the alternate set.
56FB
PUSH HL E5
Save Register Pair HL, the format table, on the stack across the exchange.
56FC
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: the caller's count of cylinders and table address are kept there.
56FD
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder the head is on.
5700
Call 591EH to turn Register A, the cylinder, into two digits: Register C the tens, Register B the units.
5703
LD (5B29H),BC ED 43 29 5B
Store Register Pair BC at 5B29H: the tens at 5B29H and the units at 5B2AH, the number in FORMATTING TRACK 00.
5707
LD HL,5B18H 21 18 5B
Load Register Pair HL with 5B18H, the text FORMATTING TRACK nn, 1DH and 03H: the cursor goes back to the start of the line.
570A
Call 4467H to show the text at Register Pair HL (5B18H) up to its 03H.
570D
POP HL E1
Restore Register Pair HL, the format table, from the stack.
570E
LD C,(HL) 4E
Load Register C with the number of sectors of the cylinder at Register Pair HL.
570F
INC HL 23
Increment Register Pair HL to the address of the sector order.
5710
LD E,(HL) 5E
Load Register E with the low byte of the address of the sector order at Register Pair HL.
5711
INC HL 23
Increment Register Pair HL to the high byte of the address.
5712
LD D,(HL) 56
Load Register D with the high byte at Register Pair HL: Register Pair DE is the sector order (56DFH or 56E9H).
5713
INC HL 23
Increment Register Pair HL to the first pair of the table.
5714
PUSH DE D5
Save Register Pair DE, the place in the sector order, on the stack: 5731H takes the sector numbers from there.
5715
LD DE,5D00H 11 00 5D
Load Register Pair DE with 5D00H, the buffer of the image of the cylinder.
5718
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL is the image at 5D00H, Register Pair DE the pairs of the table.
5719
Call 5771H to write the first pair at Register Pair DE into the image at Register Pair HL: the gap after the index hole.
571C
LD (576FH),DE ED 53 6F 57
Store Register Pair DE, the first pair of a sector, at 576FH, to start each sector from it.
5720
Call 5771H to write the next pair at Register Pair DE into the image at Register Pair HL: the bytes 00H before the ID field.
5723
Call 5771H to write the next pair at Register Pair DE into the image at Register Pair HL: F5H in double density, more 00H in single density.
5726
LD (HL),FEH 36 FE
Store FEH at Register Pair HL, the ID address mark.
5728
INC HL 23
Increment Register Pair HL to the next byte of the image.
5729
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder number of the ID field.
572C
LD (HL),A 77
Store Register A, the cylinder number, at Register Pair HL in the ID field.
572D
INC HL 23
Increment Register Pair HL to the next byte of the image.
572E
LD (HL),00H 36 00
Store 00H at Register Pair HL, the side number of the ID field.
5730
INC HL 23
Increment Register Pair HL to the next byte of the image.
5731
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer: Register Pair HL is the place in the sector order.
5732
LD A,(HL) 7E
Load Register A with the next sector number of the order at Register Pair HL.
5733
INC HL 23
Increment Register Pair HL to the next place of the order.
5734
EX (SP),HL E3
Exchange Register Pair HL with the word at the Stack Pointer again: the place in the order goes back on the stack and Register Pair HL is the image.
5735
LD (HL),A 77
Store Register A, the sector number, at Register Pair HL in the ID field.
5736
INC HL 23
Increment Register Pair HL to the next byte of the image.
5737
LD (HL),01H 36 01
Store 01H at Register Pair HL, the size code of the ID field: 256 bytes.
5739
INC HL 23
Increment Register Pair HL to the next byte of the image.
573A
LD (HL),F7H 36 F7
Store F7H at Register Pair HL: the controller writes the two CRC bytes of the ID field.
573C
INC HL 23
Increment Register Pair HL to the next byte of the image.
573D
Call 5771H to write the next pair at Register Pair DE into the image at Register Pair HL: the gap after the ID field.
5740
Call 5771H to write the next pair at Register Pair DE into the image at Register Pair HL: the bytes 00H before the data field.
5743
Call 5771H to write the next pair at Register Pair DE into the image at Register Pair HL: F5H in double density, more 00H in single density.
5746
LD (HL),FBH 36 FB
Store FBH at Register Pair HL, the data address mark.
5748
INC HL 23
Increment Register Pair HL to the next byte of the image.
5749
LD A,E5H 3E E5
Load Register A with E5H, the data byte that 4.23 wrote 256 times here; 5C89H, new in 4.24, does not use Register A.
574B
Call 5C89H to write the 256 data bytes of the sector at Register Pair HL as 6DH B6H (4.23 called 5776H, which wrote Register A E5H).
574E
LD (HL),F7H 36 F7
Store F7H at Register Pair HL: the controller writes the two CRC bytes of the data field.
5750
INC HL 23
Increment Register Pair HL to the next byte of the image.
5751
Call 5771H to write the last pair of the sector at Register Pair DE into the image at Register Pair HL: the gap before the next sector.
5754
LD DE,(576FH) ED 5B 6F 57
Load Register Pair DE with the word at 576FH, the first pair of a sector, for the next sector.
5758
DEC C 0D
Decrement Register C, the sectors still to build.
5759
If the NZ FLAG is set (sectors left), jump back to 5720H for the next sector.
575B
INC SP 33
Increment the Stack Pointer, the first of two: the place in the sector order is dropped.
575C
INC SP 33
Increment the Stack Pointer, the second: the stack is as it was at 5714H.
575D
DEC DE 1B
Decrement Register Pair DE to the byte of the first pair of the table: FFH or 4EH, the gap byte.
575E
LD A,(DE) 1A
Load Register A with the gap byte at Register Pair DE.
575F
Call 5776H to write Register A Register B times at Register Pair HL; Register B is 00H after the last DJNZ, so 256 bytes fill the end of the track.
5762
LD BC,5D00H 01 00 5D
Load Register Pair BC with 5D00H, the image of the cylinder (5C65H in 4.23).
5765
LD A,F4H 3E F4
Load Register A with F4H, the Write Track command.
5767
Call 583FH to give the command in Register A (F4H) and send the image at Register Pair BC to the data register until the controller has written the track.
576A
If the NZ FLAG is set, jump to 56A8H; 583FH returns only with the Z FLAG (it jumps to 56A8H itself on an error), so the jump is never taken (a bug: the Bugs part of the introduction).
576D
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: the caller's registers are back.
576E
RET C9
Return with the Z FLAG set, the cylinder written.
576F-5770
DEFW 0000H 00 00
The word at 576FH: the address in the format table of the first pair of a sector, stored by 571CH and loaded for each sector at 5754H.
5771H - Write a Pair of the Format Table
5771H takes a count and a byte from Register Pair DE and writes the byte count times at Register Pair HL; 5776H writes Register A Register B times. Register Pair HL returns past the bytes written and Register B 00H.
5771
LD A,(DE) 1A
Load Register A with the count of the pair at Register Pair DE.
5772
LD B,A 47
Copy Register A, the count of the pair, into Register B for the DJNZ loop at 5778H.
5773
INC DE 13
Increment Register Pair DE to the byte of the pair.
5774
LD A,(DE) 1A
Load Register A with the byte of the pair at Register Pair DE.
5775
INC DE 13
Increment Register Pair DE to the next pair of the table.
5776
LD (HL),A 77
Store Register A, the byte, at Register Pair HL in the image.
5777
INC HL 23
Increment Register Pair HL to the next byte of the image.
5778
Decrement Register B and jump back to 5776H until the byte has been written the count of times.
577A
RET C9
Return with Register Pair HL past the bytes and Register B 00H.
577BH - Give a Command to the Controller and Wait
577BH gives the Restore command 03H; 577DH gives the command in Register A. The controller is waited for until it is no longer busy, the drive being selected again on each turn so that its motor runs; when it stays busy for 65536 turns bit 7 (NOT READY) is set in the status returned in Register A.
577B
LD A,03H 3E 03
Load Register A with 03H, the Restore command, stepping rate 3: the head goes to cylinder 0.
577D
Call 5797H to give the command in Register A to the command register at 37ECH, after making sure the drive's motor runs.
5780
PUSH BC C5
Save Register Pair BC on the stack for the caller.
5781
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, a count of 65536 turns of the wait.
5784
LD A,(37ECH) 3A EC 37
Load Register A with the status register at 37ECH.
5787
BIT 0,A CB 47
Test bit 0 of Register A, BUSY: the Z FLAG is set when the command is done.
5789
If the Z FLAG is set (not busy), jump to 5795H to return the status in Register A.
578B
Call 57A4H to select the drive again (and wait for its motor when it was not ready).
578E
DEC C 0D
Decrement Register C, the low count of the wait.
578F
If the NZ FLAG is set, jump back to 5784H to read the status again.
5791
Decrement Register B, the high count, and jump back to 5784H until 65536 turns have passed.
5793
OR 80H F6 80
OR Register A, the last status, with 80H: the command did not end, reported as NOT READY.
5795
POP BC C1
Restore Register Pair BC from the stack for the caller.
5796
RET C9
Return with Register A the status of the controller.
5797H - Give a Command
Called with the command in Register A. The drive's motor is made to run (57A4H), the command goes to 37ECH, and two pushes and pops give the controller time to set BUSY before its status is read.
5797
PUSH AF F5
Save Register Pair AF, the command in Register A, on the stack.
5798
Call 57A4H to select the drive and, when it was not ready, wait for its motor.
579B
POP AF F1
Restore Register Pair AF from the stack: Register A is the command again.
579C
LD (37ECH),A 32 EC 37
Store Register A, the command, at 37ECH, the command register of the controller.
579F
PUSH AF F5
Save Register Pair AF on the stack: with the pop after it, a short wait for the controller.
57A0
POP AF F1
Restore Register Pair AF from the stack, the end of the first wait.
57A1
PUSH AF F5
Save Register Pair AF on the stack again for a second short wait.
57A2
POP AF F1
Restore Register Pair AF from the stack, the end of the second wait.
57A3
RET C9
Return to the caller with the command started in the controller.
57A4H - Select the Drive and Wait for Its Motor
When the status at 37ECH has bit 7 (NOT READY) clear, the drive is only selected again. Else the drive is selected, a loop of 65536 turns gives the motor time to reach speed, and the drive is selected once more.
57A4
LD A,(37ECH) 3A EC 37
Load Register A with the status register at 37ECH.
57A7
RLA 17
Rotate Register A left through the C FLAG: bit 7, NOT READY, goes into the C FLAG.
57A8
If the NC FLAG is set (the drive is ready), jump to 57B7H to select it again and return.
57AA
Call 57B7H to select the drive, which starts its motor.
57AD
PUSH BC C5
Save Register Pair BC on the stack for the delay loop.
57AE
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H, a count of 65536 turns.
57B1
DEC C 0D
Decrement Register C, the low count of the delay.
57B2
If the NZ FLAG is set (Register C not yet 00H), jump back to 57B1H.
57B4
Decrement Register B, the high count, and jump back to 57B1H until 65536 turns have passed.
57B6
POP BC C1
Restore Register Pair BC from the stack for the caller.
57B7
LD A,(4309H) 3A 09 43
Load Register A with the select bit of the drive at 4309H.
57BA
LD (37E1H),A 32 E1 37
Store Register A at 37E1H, the drive select latch: the drive is selected and its motor timer started again.
57BD
RET C9
Return to the caller with the drive selected and its motor running.
57BEH - Put the Head on a Cylinder
Called with Register D the cylinder and Register E the sector. Both go to the controller (Register E to the sector register 37EEH, Register D to the data register 37EFH); when the track register 37EDH is already Register D nothing more is done, else the Seek command 13H moves the head.
57BE
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder the head is on.
57C1
CP D BA
Compare Register A with Register D, the cylinder wanted: the Z FLAG when the head is there.
57C2
LD (37EEH),DE ED 53 EE 37
Store Register Pair DE at 37EEH: Register E, the sector, in the sector register 37EEH and Register D, the cylinder, in the data register 37EFH for a Seek; the flags stay.
57C6
RET Z C8
Return with the Z FLAG set when the head is already on the cylinder.
57C7
LD A,13H 3E 13
Load Register A with 13H, the Seek command, stepping rate 3, to the cylinder in the data register.
57C9
Jump to 577DH to give the command in Register A (13H) and wait until it is done.
57CBH - Read a Sector with Retries
Reads cylinder Register D, sector Register E into the buffer at Register Pair BC: two tries, then the head is stepped in and out by one cylinder without changing the track register (43H, 63H) and a third try, then a Restore and a fourth try (57E1H falls into 57E4H). Returns the Z FLAG and Register Pair BC 256 higher, or the NZ FLAG and Register Pair BC unchanged.
57CB
Call 57E4H to read cylinder Register D, sector Register E into Register Pair BC: the first try.
57CE
RET Z C8
Return with the Z FLAG when the first try read the sector.
57CF
Call 57E4H to read cylinder Register D, sector Register E into Register Pair BC: the second try.
57D2
RET Z C8
Return with the Z FLAG when the second try read the sector.
57D3
LD A,43H 3E 43
Load Register A with 43H, the Step In command without the track register updated, stepping rate 3.
57D5
Call 577DH to give the command in Register A (43H) and wait: the head moves in one cylinder.
57D8
LD A,63H 3E 63
Load Register A with 63H, the Step Out command without the track register updated, stepping rate 3.
57DA
Call 577DH to give the command in Register A (63H) and wait: the head moves back out to the cylinder.
57DD
Call 57E4H to read cylinder Register D, sector Register E into Register Pair BC: the third try.
57E0
RET Z C8
Return with the Z FLAG when the third try read the sector.
57E1
Call 577BH to give the Restore command 03H; the fourth try that follows seeks the cylinder again from cylinder 0.
57E4H - Read a Sector
Reads cylinder Register D, sector Register E into the buffer at Register Pair BC with the Read Sector command 88H. The data register is read whenever DATA REQUEST is set, testing it three times for each test of BUSY so that a double density byte is not lost. The status is masked with 9CH (NOT READY, RECORD NOT FOUND, CRC ERROR, LOST DATA); the data mark (bit 5) is not tested, so the deleted mark of the directory reads as any other.
57E4
PUSH HL E5
Save Register Pair HL on the stack for the caller.
57E5
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
57E6
PUSH BC C5
Save Register Pair BC, the buffer, on the stack: it is popped back unchanged and moved on by 256 only when the read is good.
57E7
Call 57BEH to put the head on cylinder Register D (Seek 13H when needed) and sector Register E in the sector register.
57EA
LD DE,37EFH 11 EF 37
Load Register Pair DE with 37EFH, the data register of the controller.
57ED
LD HL,37ECH 21 EC 37
Load Register Pair HL with 37ECH, the command and status register of the controller.
57F0
LD A,88H 3E 88
Load Register A with 88H, the Read Sector command.
57F2
Call 5797H to give the command in Register A (88H) to the controller.
57F5
LD A,(HL) 7E
Load Register A with the status at Register Pair HL (37ECH).
57F6
AND 03H E6 03
AND Register A with 03H, BUSY (bit 0) and DATA REQUEST (bit 1).
57F8
If the PO FLAG is set (one of the two bits: busy and no data yet), jump back to 57F5H; both set, the first byte is ready, both clear, the command has ended.
57FB
LD A,(DE) 1A
Load Register A with the data byte at Register Pair DE (37EFH).
57FC
LD (BC),A 02
Store Register A, the byte read, at Register Pair BC in the buffer.
57FD
INC BC 03
Increment Register Pair BC to the next place of the buffer.
57FE
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST: the NZ FLAG when the next byte is ready.
5800
If the NZ FLAG is set (a byte ready), jump back to 57FBH to take it.
5802
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, a second time.
5804
If the NZ FLAG is set (a byte ready), jump back to 57FBH to take it.
5806
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, a third time.
5808
If the NZ FLAG is set (a byte ready), jump back to 57FBH to take it.
580A
BIT 0,(HL) CB 46
Test bit 0 of the status at Register Pair HL (37ECH), BUSY: the NZ FLAG while the command runs.
580C
If the NZ FLAG is set (still busy), jump back to 57FEH to wait for the next byte.
580E
LD A,(HL) 7E
Load Register A with the final status at Register Pair HL (37ECH).
580F
LD (HL),D0H 36 D0
Store D0H at Register Pair HL (37ECH), the Force Interrupt command, which clears the controller's interrupt.
5811
AND 9CH E6 9C
AND Register A, the status, with 9CH: NOT READY, RECORD NOT FOUND, CRC ERROR and LOST DATA.
5813
POP BC C1
Restore Register Pair BC, the buffer as it was at the call, from the stack.
5814
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
5815
POP HL E1
Restore Register Pair HL from the stack for the caller.
5816
RET NZ C0
Return with the NZ FLAG and the error bits in Register A when the read failed; Register Pair BC is unchanged.
5817
INC B 04
Increment Register B: Register Pair BC moves on by 256 to the next place of the buffer.
5818
OR A B7
Set the flags from Register A, which is 00H: the Z FLAG, the read was good.
5819
RET C9
Return with the Z FLAG and Register Pair BC past the sector read.
581AH - Write a Sector and Read It Back
581AH writes the 256 bytes at 4D00H with the deleted data mark (Write Sector A9H), for the directory; 5825H writes the bytes at Register Pair BC with the ordinary mark (A8H). Register D is the cylinder and Register E the sector. The sector is then read with 88H and no data taken; NOT READY, RECORD NOT FOUND or a CRC error ends at VERIFY ERROR.
581A
LD A,A9H 3E A9
Load Register A with A9H, the Write Sector command with the deleted data mark of the directory.
581C
PUSH BC C5
Save Register Pair BC on the stack for the caller.
581D
LD BC,4D00H 01 00 4D
Load Register Pair BC with 4D00H, the buffer of the GAT, the HIT and the directory sectors.
5820
Call 5827H to write the 256 bytes at Register Pair BC (4D00H) to cylinder Register D, sector Register E with the command in Register A and read them back.
5823
POP BC C1
Restore Register Pair BC from the stack for the caller.
5824
RET C9
Return with the sector written and read back.
5825
LD A,A8H 3E A8
Load Register A with A8H, the Write Sector command with the ordinary data mark.
5827
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
5828
PUSH AF F5
Save Register Pair AF, the write command in Register A, on the stack.
5829
Call 57BEH to put the head on cylinder Register D (Seek 13H when needed) and sector Register E in the sector register.
582C
POP AF F1
Restore Register Pair AF from the stack: Register A is the write command again.
582D
Call 583FH to give the command in Register A and send 256 bytes from Register Pair BC to the data register; a write error ends at 56A8H.
5830
LD A,88H 3E 88
Load Register A with 88H, the Read Sector command; its data bytes are not taken.
5832
Call 577DH to give the command in Register A (88H) and wait until it is done; Register A returns the status.
5835
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
5836
AND 98H E6 98
AND Register A, the status, with 98H: NOT READY, RECORD NOT FOUND and CRC ERROR; LOST DATA (bit 2), which this read always gives, is left out.
5838
RET Z C8
Return with the Z FLAG when the sector reads back.
5839
LD HL,5AEDH 21 ED 5A
Load Register Pair HL with 5AEDH, a line feed and VERIFY ERROR.
583C
Jump to 5217H to show the text at Register Pair HL and DOUBLE DENSITY UTILITY ABORTED.
583FH - Write to the Controller
Gives the write command in Register A (Write Sector A8H or A9H, Write Track F4H) and sends bytes from Register Pair BC to the data register 37EFH whenever DATA REQUEST is set, testing it six times for each test of BUSY, until the controller ends the command; Register Pair BC returns past the bytes sent. The wait for the second byte (5854H) has no test of BUSY. An error bit in the final status (mask FCH) ends at 56A8H; the return is always with the Z FLAG.
583F
LD DE,37EFH 11 EF 37
Load Register Pair DE with 37EFH, the data register of the controller.
5842
LD HL,37ECH 21 EC 37
Load Register Pair HL with 37ECH, the command and status register of the controller.
5845
Call 5797H to give the command in Register A to the controller.
5848
LD A,(BC) 0A
Load Register A with the first byte to send at Register Pair BC.
5849
BIT 0,(HL) CB 46
Test bit 0 of the status at Register Pair HL (37ECH), BUSY: the Z FLAG when the command has ended.
584B
If the Z FLAG is set (ended at once, as for a write protected diskette), jump to 5878H to read the status.
584D
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST.
584F
If the Z FLAG is set (no request yet), jump back to 5849H.
5851
LD (DE),A 12
Store Register A, the first byte, at Register Pair DE (37EFH), the data register.
5852
INC BC 03
Increment Register Pair BC to the next byte to send.
5853
LD A,(BC) 0A
Load Register A with the next byte at Register Pair BC.
5854
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST.
5856
If the Z FLAG is set (no request yet), jump back to 5854H to test again: this wait alone does not test BUSY.
5859
LD (DE),A 12
Store Register A, the byte, at Register Pair DE (37EFH), the data register.
585A
INC BC 03
Increment Register Pair BC to the next byte to send.
585B
LD A,(BC) 0A
Load Register A with the next byte at Register Pair BC, ready for the next request.
585C
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST: the first of six tests.
585E
If the NZ FLAG is set (a request), jump back to 5859H to send the byte in Register A.
5860
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, the second time.
5862
If the NZ FLAG is set (a request), jump back to 5859H to send the byte in Register A.
5864
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, the third time.
5866
If the NZ FLAG is set (a request), jump back to 5859H to send the byte in Register A.
5868
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, the fourth time.
586A
If the NZ FLAG is set (a request), jump back to 5859H to send the byte in Register A.
586C
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, the fifth time.
586E
If the NZ FLAG is set (a request), jump back to 5859H to send the byte in Register A.
5870
BIT 1,(HL) CB 4E
Test bit 1 of the status at Register Pair HL (37ECH), DATA REQUEST, the sixth time.
5872
If the NZ FLAG is set (a request), jump back to 5859H to send the byte in Register A.
5874
BIT 0,(HL) CB 46
Test bit 0 of the status at Register Pair HL (37ECH), BUSY: the NZ FLAG while the command runs.
5876
If the NZ FLAG is set (still busy), jump back to 585CH to wait for the next request.
5878
LD A,(HL) 7E
Load Register A with the final status at Register Pair HL (37ECH).
5879
LD (HL),D0H 36 D0
Store D0H at Register Pair HL (37ECH), the Force Interrupt command, which clears the controller's interrupt.
587B
AND FCH E6 FC
AND Register A, the status, with FCH: every bit but BUSY and DATA REQUEST.
587D
If the NZ FLAG is set (an error), jump to 56A8H to name it (not ready, write protected, or unexpected) and abort.
5880
RET C9
Return with the Z FLAG set: the bytes were written.
5881H - Verify a Cylinder and Lock Out Its Flaws
Reads every sector of the cylinder the head is on (ten on cylinder 0, else eighteen) with Read Sector 88H and no data taken, showing VERIFYING TRACK nn SECTOR nn. For a sector that does not read back (NOT READY, RECORD NOT FOUND, CRC ERROR) the bit of its granule is set in the GAT image at 4D00H (the five sectors 0-4 of a logical track are granule 0, bit 0; sectors 5-9 granule 1, bit 1) and its cylinder and sector go into the first free entry of the flaw table 4DC0H-4DC9H, with - ERROR, GRANULE LOCKED OUT; a sixth flaw ends at TOO MANY FLAWS - USE ANOTHER DISK!. Cylinder 0 has no logical tracks: the conversion makes it logical track CBH, so a flaw in sectors 5-9 of cylinder 0 sets bit 1 of GAT byte CBH (a bug: the Bugs part of the introduction).
5881
PUSH BC C5
Save Register Pair BC, the caller's count of cylinders, on the stack.
5882
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder the head is on.
5885
OR A B7
Set the flags from Register A, the cylinder: the Z FLAG for cylinder 0.
5886
LD C,0AH 0E 0A
Load Register C with 0AH, the ten sectors of the single density cylinder 0; the flags stay.
5888
If the Z FLAG is set (cylinder 0), jump to 588CH with Register C 0AH.
588A
LD C,12H 0E 12
Load Register C with 12H, the eighteen sectors of a double density cylinder.
588C
PUSH BC C5
Save Register Pair BC, the number of sectors in Register C, on the stack.
588D
Call 591EH to turn Register A, the cylinder, into two digits: Register C the tens, Register B the units.
5890
LD (5B3EH),BC ED 43 3E 5B
Store Register Pair BC at 5B3EH: the tens at 5B3EH and the units at 5B3FH, the track number of the progress text.
5894
POP BC C1
Restore Register Pair BC, the number of sectors in Register C, from the stack.
5895
XOR A AF
Clear Register A to 00H, sector 0, the first sector verified on the cylinder.
5896
LD (37EEH),A 32 EE 37
Store Register A, the sector, at 37EEH, the sector register of the controller.
5899
PUSH BC C5
Save Register Pair BC, the number of sectors, on the stack.
589A
Call 591EH to turn Register A, the sector, into two digits: Register C the tens, Register B the units.
589D
LD (5B48H),BC ED 43 48 5B
Store Register Pair BC at 5B48H: the tens at 5B48H and the units at 5B49H, the sector number of the progress text.
58A1
LD HL,5B2DH 21 2D 5B
Load Register Pair HL with 5B2DH, the progress text VERIFYING TRACK nn SECTOR nn with its leading 1DH.
58A4
Call 4467H to show the text at Register Pair HL (5B2DH) up to its 03H.
58A7
POP BC C1
Restore Register Pair BC, the number of sectors, from the stack.
58A8
LD A,88H 3E 88
Load Register A with 88H, the Read Sector command; its data bytes are not taken.
58AA
Call 577DH to give the command in Register A (88H) and wait until it is done; Register A returns the status.
58AD
AND 98H E6 98
AND Register A, the status, with 98H: NOT READY, RECORD NOT FOUND and CRC ERROR, LOST DATA left out.
58AF
If the Z FLAG is set (the sector is good), jump to 58EEH for the next sector.
58B1
PUSH DE D5
Save Register Pair DE on the stack for the caller.
58B2
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder of the flawed sector.
58B5
LD D,A 57
Copy Register A, the cylinder, into Register D.
58B6
LD A,(37EEH) 3A EE 37
Load Register A with the sector register at 37EEH, the flawed sector.
58B9
LD E,A 5F
Copy Register A, the sector, into Register E.
58BA
Call 592DH to turn cylinder Register D, sector Register E into the logical track in Register D and its sector 0-9 in Register E. For cylinder 0 the cylinder less one is FFH and the result is logical track CBH, sectors 0-9 (a bug: the Bugs part of the introduction).
58BD
LD HL,4D00H 21 00 4D
Load Register Pair HL with 4D00H, the GAT image.
58C0
LD L,D 6A
Copy Register D, the logical track, into Register L: Register Pair HL is its byte of the GAT image.
58C1
LD A,E 7B
Copy Register E, the sector of the logical track, into Register A.
58C2
CP 05H FE 05
Compare Register A with 05H: the C FLAG for sectors 0-4, the first granule.
58C4
LD A,01H 3E 01
Load Register A with 01H, the bit of the first granule; the flags stay.
58C6
If the C FLAG is set (sectors 0-4), jump to 58C9H with Register A 01H.
58C8
RLA 17
Rotate Register A left through the C FLAG, which is clear: 02H, the bit of the second granule.
58C9
OR (HL) B6
OR Register A, the bit of the granule, with the GAT byte at Register Pair HL.
58CA
LD (HL),A 77
Store Register A at Register Pair HL: the granule is in use and will never be given to a file.
58CB
LD HL,4DC0H 21 C0 4D
Load Register Pair HL with 4DC0H, the flaw table in the GAT image.
58CE
LD B,05H 06 05
Load Register B with 05H, the five entries of the flaw table.
58D0
LD A,(HL) 7E
Load Register A with the cylinder byte of the entry at Register Pair HL.
58D1
INC A 3C
Increment Register A: the Z FLAG when it was FFH, a free entry.
58D2
If the Z FLAG is set (a free entry), jump to 58DEH to fill it.
58D4
INC HL 23
Increment Register Pair HL past the cylinder of the entry.
58D5
INC HL 23
Increment Register Pair HL past the sector: the next entry.
58D6
Decrement Register B and jump back to 58D0H until the five entries have been looked at.
58D8
LD HL,5C21H 21 21 5C
Load Register Pair HL with 5C21H, a line feed and TOO MANY FLAWS - USE ANOTHER DISK!.
58DB
Jump to 5217H to show the text at Register Pair HL and DOUBLE DENSITY UTILITY ABORTED.
58DE
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder of the flaw.
58E1
LD (HL),A 77
Store Register A, the cylinder, at Register Pair HL in the free entry of the flaw table.
58E2
INC HL 23
Increment Register Pair HL to the sector byte of the entry.
58E3
LD A,(37EEH) 3A EE 37
Load Register A with the sector register at 37EEH, the sector of the flaw.
58E6
LD (HL),A 77
Store Register A, the sector, at Register Pair HL: the entry is filled.
58E7
LD HL,5AFBH 21 FB 5A
Load Register Pair HL with 5AFBH, the text - ERROR, GRANULE LOCKED OUT and a carriage return, which keeps the progress line on the screen.
58EA
Call 4467H to show the text at Register Pair HL (5AFBH) up to its carriage return.
58ED
POP DE D1
Restore Register Pair DE from the stack for the caller.
58EE
LD A,(37EEH) 3A EE 37
Load Register A with the sector register at 37EEH, the sector just verified.
58F1
INC A 3C
Increment Register A, the sector, to the next sector of the cylinder.
58F2
CP C B9
Compare Register A with Register C, the number of sectors of the cylinder.
58F3
If the NZ FLAG is set (sectors left), jump back to 5896H to verify the next sector.
58F5
POP BC C1
Restore Register Pair BC, the caller's count of cylinders, from the stack.
58F6
RET C9
Return to the caller with every sector of the cylinder verified.
58F7H - Switch the Doubler to Single or Double Density
58F7H gives the Doubler's command FEH (single density), 58FBH its command FFH (double density), each followed by the Force Interrupt D0H. The track register 37EDH is read before and written back after.
58F7
LD A,FEH 3E FE
Load Register A with FEH, the Doubler's command for single density.
58F9
Jump to 58FDH to give the command in Register A.
58FB
LD A,FFH 3E FF
Load Register A with FFH, the Doubler's command for double density.
58FD
EX AF,AF' 08
Exchange Register Pair AF with the alternate AF: the density command is kept in the alternate Register A.
58FE
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder the head is on.
5901
EX AF,AF' 08
Exchange Register Pair AF with the alternate AF: Register A is the density command, the cylinder kept in the alternate Register A.
5902
LD (37ECH),A 32 EC 37
Store Register A, FEH or FFH, at 37ECH, the command register: the Doubler takes it as the density.
5905
LD A,D0H 3E D0
Load Register A with D0H, the Force Interrupt command.
5907
LD (37ECH),A 32 EC 37
Store Register A (D0H) at 37ECH, the command register, after the density command.
590A
PUSH AF F5
Save Register Pair AF on the stack: with the pop after it, a short wait for the controller.
590B
POP AF F1
Restore Register Pair AF from the stack, the end of the wait.
590C
EX AF,AF' 08
Exchange Register Pair AF with the alternate AF: Register A is the cylinder read at 58FEH.
590D
LD (37EDH),A 32 ED 37
Store Register A, the cylinder, back at 37EDH, the track register.
5910
PUSH AF F5
Save Register Pair AF on the stack: with the pop after it, a short wait for the controller.
5911
POP AF F1
Restore Register Pair AF from the stack, the end of the wait.
5912
RET C9
Return with the Doubler in the density asked for.
5913H - Compare a Word
Called with Register Pair DE a word ended by 00H (FORMAT, BACKUP or TO) and Register Pair HL the command line. Every character must be the same; then Register Pair HL is past the word. A difference ends at COMMAND SYNTAX ERROR. What follows the word is not tested here, so FORMATX passes as FORMAT.
5913
LD A,(DE) 1A
Load Register A with the next character of the word at Register Pair DE.
5914
OR A B7
Set the flags from Register A: the Z FLAG for the 00H that ends the word.
5915
RET Z C8
Return with the Z FLAG set when the whole word matched.
5916
INC DE 13
Increment Register Pair DE to the next character of the word.
5917
CP (HL) BE
Compare Register A, the character of the word, with the character of the line at Register Pair HL.
5918
INC HL 23
Increment Register Pair HL to the next character of the line; the flags stay.
5919
If the Z FLAG is set (the same character), jump back to 5913H for the next one.
591B
Jump to 5214H, COMMAND SYNTAX ERROR: the line does not have the word.
591EH - Turn a Number into Two Digits
Called with Register A 0-99. Returns Register C the tens digit and Register B the units digit as ASCII characters, so that LD (nnnnH),BC stores them in reading order.
591E
LD BC,3030H 01 30 30
Load Register Pair BC with 3030H: Register B and Register C both the digit 0.
5921
CP 0AH FE 0A
Compare Register A with 0AH: the C FLAG when less than ten is left.
5923
If the C FLAG is set (less than ten), jump to 592AH for the units.
5925
INC C 0C
Increment Register C, the tens digit, for each ten taken from Register A.
5926
SUB 0AH D6 0A
Subtract 0AH, ten, from Register A, the rest of the number still to count.
5928
Jump back to 5921H to test the rest in Register A.
592A
ADD A,B 80
Add Register B, the digit 0 (30H), to Register A, the units: the units digit.
592B
LD B,A 47
Copy Register A, the units digit, into Register B.
592C
RET C9
Return with Register C the tens digit and Register B the units digit.
592DH - Cylinder and Sector to Logical Track and Sector
Called with Register D a cylinder and Register E a sector of it. The sectors from cylinder 1, sector 0 are counted, (cylinder - 1) x 18 + sector, and divided by ten: Register D returns the logical track and Register E the sector of it, 0-9. Register Pairs BC and HL are kept. Multiplies and divides with 4B6AH and 4B84H of SYS0/SYS.
592D
PUSH BC C5
Save Register Pair BC on the stack for the caller.
592E
PUSH HL E5
Save Register Pair HL on the stack for the caller.
592F
LD L,D 6A
Copy Register D, the cylinder, into Register L.
5930
DEC L 2D
Decrement Register L: the cylinders counted from cylinder 1 (FFH for cylinder 0).
5931
LD H,00H 26 00
Load Register H with 00H: Register Pair HL is the cylinder less one.
5933
LD A,12H 3E 12
Load Register A with 12H, the eighteen sectors of a double density cylinder, the multiplier.
5935
PUSH DE D5
Save Register Pair DE, the cylinder and sector, on the stack.
5936
Call 4B6AH, the multiply of SYS0/SYS: Register Pair HL times Register A, the low byte of the product in Register A and the upper bits in Register Pair HL.
5939
POP DE D1
Restore Register Pair DE, the cylinder and sector, from the stack.
593A
LD H,L 65
Copy Register L, the middle byte of the product, into Register H.
593B
LD L,A 6F
Copy Register A, the low byte of the product, into Register L: Register Pair HL is (cylinder - 1) x 18.
593C
LD D,00H 16 00
Load Register D with 00H: Register Pair DE is the sector.
593E
ADD HL,DE 19
Add Register Pair DE, the sector, to Register Pair HL: the sector counted from cylinder 1, sector 0.
593F
LD A,0AH 3E 0A
Load Register A with 0AH, the ten sectors of a logical track, the divisor.
5941
Call 4B84H, the divide of SYS0/SYS: Register Pair HL by Register A, the quotient in Register Pair HL and the rest in Register A.
5944
LD D,L 55
Copy Register L, the quotient, into Register D: the logical track.
5945
LD E,A 5F
Copy Register A, the rest, into Register E: the sector of the logical track.
5946
POP HL E1
Restore Register Pair HL from the stack for the caller.
5947
POP BC C1
Restore Register Pair BC from the stack for the caller.
5948
RET C9
Return with Register D the logical track and Register E its sector.
5949H - Logical Track and Sector to Cylinder and Sector
Called with Register D a logical track and Register E a sector of it (0-9). The sector counted from cylinder 1, sector 0 is Register D x 10 + Register E; divided by 18 it gives Register D the cylinder (quotient plus one) and Register E the sector. Register Pairs BC and HL are kept.
5949
PUSH BC C5
Save Register Pair BC on the stack for the caller.
594A
PUSH HL E5
Save Register Pair HL on the stack for the caller.
594B
LD L,D 6A
Copy Register D, the logical track, into Register L.
594C
LD H,00H 26 00
Load Register H with 00H: Register Pair HL is the logical track.
594E
LD A,0AH 3E 0A
Load Register A with 0AH, the ten sectors of a logical track, the multiplier.
5950
PUSH DE D5
Save Register Pair DE, the logical track and sector, on the stack.
5951
Call 4B6AH, the multiply of SYS0/SYS: Register Pair HL times Register A, the low byte of the product in Register A and the upper bits in Register Pair HL.
5954
POP DE D1
Restore Register Pair DE, the logical track and sector, from the stack.
5955
LD H,L 65
Copy Register L, the middle byte of the product, into Register H.
5956
LD L,A 6F
Copy Register A, the low byte of the product, into Register L: Register Pair HL is the logical track times ten.
5957
LD D,00H 16 00
Load Register D with 00H: Register Pair DE is the sector of the logical track.
5959
ADD HL,DE 19
Add Register Pair DE to Register Pair HL: the sector counted from cylinder 1, sector 0.
595A
LD A,12H 3E 12
Load Register A with 12H, the eighteen sectors of a double density cylinder, the divisor.
595C
Call 4B84H, the divide of SYS0/SYS: Register Pair HL by Register A, the quotient in Register Pair HL and the rest in Register A.
595F
LD D,L 55
Copy Register L, the quotient, into Register D: the cylinders after cylinder 0.
5960
LD E,A 5F
Copy Register A, the rest, into Register E: the sector of the cylinder.
5961
INC D 14
Increment Register D: the cylinder, counted from cylinder 0.
5962
POP HL E1
Restore Register Pair HL from the stack for the caller.
5963
POP BC C1
Restore Register Pair BC from the stack for the caller.
5964
RET C9
Return with Register D the cylinder and Register E the sector.
5965H - The Boot Sector of a Diskette Without a System
256 bytes from 5965H to 5A64H are written by FORMAT to cylinder 0, sector 0 (532DH). The ROM loads them at 4200H and runs them: the text at 4210H (clear the screen, 32 characters a line, 40 spaces, NO SYSTEM) is shown, a line is awaited, and the processor halts until RESET. Only the first 30 bytes are used; the rest of the sector is the banner and the texts that follow in DOUBLE/CMD (5983H-5A64H), never run.
5965-5967
DEFB 21H,10H,42H 21 10 42
At 4200H on the diskette, LD HL,4210H: Register Pair HL is the text NO SYSTEM, at 5975H here.
5968
DEFB 7EH 7E
At 4203H, LD A,(HL): Register A is the next character of the text.
5969-596B
DEFB CDH,33H,00H CD 33 00
At 4204H, CALL 0033H: the ROM shows the character in Register A.
596C
DEFB 23H 23
At 4207H, INC HL: Register Pair HL moves on to the next character.
596D-596E
DEFB FEH,0DH FE 0D
At 4208H, CP 0DH: the Z FLAG for the carriage return that ends the text.
596F-5970
DEFB 20H,F7H 20 F7
At 420AH, JR NZ,4203H: back for the next character until the carriage return has been shown.
5971-5973
DEFB CDH,40H,00H CD 40 00
At 420CH, CALL 0040H: the ROM's line input waits for ENTER.
5974
DEFB 76H 76
At 420FH, HALT: the processor stops until RESET is pressed.
5975-5982
DEFB 1CH,1FH,17H,E8H / DEFM "NO SYSTEM" / DEFB 0DH 1C 1F 17 E8 4E 4F 20 53 59 53 54 45 4D 0D
The text at 4210H on the diskette: 1CH (cursor home), 1FH (clear to the end of the screen), 17H (32 characters a line), E8H (40 spaces), NO SYSTEM and a carriage return.
5983H - The Texts
The banner, the messages and prompts, the words compared with the command line and the progress texts. 03H ends a text that leaves the cursor on its line; 1DH puts the cursor back at the start of the line, so that the progress texts write over themselves; 0AH is a line feed. 5983H-59DCH also serve as the buffer of a single key (5521H, 5572H) once the banner has been shown.
5983-59B3
DEFB 1CH,1FH / DEFM "PERCOM DBLDOS FORMAT/BACKUP UTILITY VERSION 1.2" 1C 1F 50 45 52 43 4F 4D 20 44 42 4C 44 4F 53 20 46 4F 52 4D 41 54 2F 42 41 43 4B 55 50 20 55 54 49 4C 49 54 59 20 56 45 52 53 49 4F 4E 20 31 2E 32
The banner at 5983H shown by 5202H: 1CH (cursor home), 1FH (clear the screen), and PERCOM DBLDOS FORMAT/BACKUP UTILITY VERSION 1.2, the last digit at 59B4H.
59B4
DEFM "1" 31
The last digit of the version 1.21 at 59B4H; DOUBLE/CMD of 4.20 and 4.23 has 0 here, version 1.20.
59B5-59DC
DEFB 0AH / DEFM "COPYRIGHT (C) 1980 BY PERCOM DATA CO." / DEFB 0AH,0DH 0A 43 4F 50 59 52 49 47 48 54 20 28 43 29 20 31 39 38 30 20 42 59 20 50 45 52 43 4F 4D 20 44 41 54 41 20 43 4F 2E 0A 0D
The rest of the banner at 59B5H: a line feed, COPYRIGHT (C) 1980 BY PERCOM DATA CO., a line feed and the carriage return that ends it.
59DD-59F1
DEFM "COMMAND SYNTAX ERROR" / DEFB 0DH 43 4F 4D 4D 41 4E 44 20 53 59 4E 54 41 58 20 45 52 52 4F 52 0D
The text at 59DDH shown by 5214H when the line is not DOUBLE FORMAT :n or DOUBLE BACKUP :s TO :d.
59F2-5A10
DEFM "DOUBLE DENSITY UTILITY ABORTED" / DEFB 0DH 44 4F 55 42 4C 45 20 44 45 4E 53 49 54 59 20 55 54 49 4C 49 54 59 20 41 42 4F 52 54 45 44 0D
The text at 59F2H shown by 521AH after every error and after the answer A to (C)ONTINUE, (R)ETRY, OR (A)BORT?.
5A11-5A17
DEFM "FORMAT" / DEFB 00H 46 4F 52 4D 41 54 00
The word FORMAT at 5A11H, ended by 00H, which 523AH compares with the command line.
5A18-5A1E
DEFM "BACKUP" / DEFB 00H 42 41 43 4B 55 50 00
The word BACKUP at 5A18H, ended by 00H, which 5393H compares with the command line.
5A1F-5A21
DEFM "TO" / DEFB 00H 54 4F 00
The word TO at 5A1FH, ended by 00H, which 53A8H compares with the command line between the two drives.
5A22-5A31
DEFM "DISKETTE NAME? " / DEFB 03H 44 49 53 4B 45 54 54 45 20 4E 41 4D 45 3F 20 03
The prompt at 5A22H shown by 5252H, DISKETTE NAME? and a space (the manual says DISK NAME?), ended by 03H.
5A32-5A41
DEFM "CREATION DATE? " / DEFB 03H 43 52 45 41 54 49 4F 4E 20 44 41 54 45 3F 20 03
The prompt at 5A32H shown by 527AH when no date of DoubleDOS is set: CREATION DATE? and a space, ended by 03H.
5A42-5A61
DEFM "NUMBER OF TRACKS (DEFAULT 40)? " / DEFB 03H 4E 55 4D 42 45 52 20 4F 46 20 54 52 41 43 4B 53 20 28 44 45 46 41 55 4C 54 20 34 30 29 3F 20 03
The prompt at 5A42H shown by 529BH: NUMBER OF TRACKS (DEFAULT 40)? and a space (the manual says HOW MANY TRACKS?), ended by 03H.
5A62-5A72
DEFM "FORMAT COMPLETED" / DEFB 0DH 46 4F 52 4D 41 54 20 43 4F 4D 50 4C 45 54 45 44 0D
The text at 5A62H shown by 538DH and 521DH at the end of DOUBLE FORMAT. The boot sector written from 5965H ends inside it, at 5A64H.
5A73-5A85
DEFB 0AH,0AH / DEFM "BACKUP COMPLETED" / DEFB 0DH 0A 0A 42 41 43 4B 55 50 20 43 4F 4D 50 4C 45 54 45 44 0D
The text at 5A73H shown by 5497H and 521DH at the end of DOUBLE BACKUP: two line feeds, BACKUP COMPLETED and a carriage return.
5A86-5A9A
DEFM "INVALID DRIVE NUMBER" / DEFB 0DH 49 4E 56 41 4C 49 44 20 44 52 49 56 45 20 4E 55 4D 42 45 52 0D
The text at 5A86H shown by 5639H when :n is missing or n is not 0-3.
5A9B-5AB9
DEFM "DRIVE INOPERATIVE OR DOOR OPEN" / DEFB 0DH 44 52 49 56 45 20 49 4E 4F 50 45 52 41 54 49 56 45 20 4F 52 20 44 4F 4F 52 20 4F 50 45 4E 0D
The text at 5A9BH shown by 56A8H for an error status with bit 7, NOT READY.
5ABA-5AD1
DEFM "DISK IS WRITE PROTECTED" / DEFB 0DH 44 49 53 4B 20 49 53 20 57 52 49 54 45 20 50 52 4F 54 45 43 54 45 44 0D
The text at 5ABAH shown by 56AFH for an error status with bit 6, WRITE PROTECT.
5AD2-5AEC
DEFB 0AH / DEFM "UNEXPECTED DISK I/O ERROR" / DEFB 0DH 0A 55 4E 45 58 50 45 43 54 45 44 20 44 49 53 4B 20 49 2F 4F 20 45 52 52 4F 52 0D
The text at 5AD2H shown by 56B6H for any other error, and when the GAT of the source cannot be read (5409H).
5AED-5AFA
DEFB 0AH / DEFM "VERIFY ERROR" / DEFB 0DH 0A 56 45 52 49 46 59 20 45 52 52 4F 52 0D
The text at 5AEDH shown by 5839H when a sector written does not read back.
5AFB-5B17
DEFM " - ERROR, GRANULE LOCKED OUT" / DEFB 0DH 20 2D 20 45 52 52 4F 52 2C 20 47 52 41 4E 55 4C 45 20 4C 4F 43 4B 45 44 20 4F 55 54 0D
The text at 5AFBH shown by 58E7H after the progress line of a flawed sector, which then stays on the screen.
5B18-5B28
DEFM "FORMATTING TRACK " 46 4F 52 4D 41 54 54 49 4E 47 20 54 52 41 43 4B 20
The text at 5B18H shown by 5707H for each cylinder formatted: FORMATTING TRACK and a space, then the number at 5B29H.
5B29-5B2A
DEFM "00" 30 30
The two digits at 5B29H-5B2AH of the cylinder being formatted, stored by 5703H.
5B2B-5B2C
DEFB 1DH,03H 1D 03
The end at 5B2BH of the text FORMATTING TRACK nn: 1DH, the cursor back to the start of the line, and 03H.
5B2D
DEFB 1DH 1D
The start at 5B2DH of the progress text of the passes and the verify: 1DH, the cursor to the start of the line, so that each line is written over the last.
5B2E-5B33
DEFM "VERIFY" 56 45 52 49 46 59
The first six characters of the progress text at 5B2EH, replaced by 55F9H with two spaces and READ, two spaces and WRIT, or VERIFY.
5B34-5B3D
DEFM "ING TRACK " 49 4E 47 20 54 52 41 43 4B 20
The progress text at 5B34H goes on: ING TRACK and a space, then the number of the cylinder at 5B3EH.
5B3E-5B3F
DEFM "00" 30 30
The two digits at 5B3EH-5B3FH of the cylinder of the progress text, stored by 5609H and 5890H.
5B40-5B47
DEFM " SECTOR " 20 53 45 43 54 4F 52 20
The progress text at 5B40H goes on: SECTOR between two spaces, then the number of the sector at 5B48H.
5B48-5B49
DEFM "00" 30 30
The two digits at 5B48H-5B49H of the sector of the progress text, stored by 5611H and 589DH.
5B4A
DEFB 03H 03
The 03H at 5B4AH that ends the progress text with the cursor on its line.
5B4B-5B50
DEFM " READ" 20 20 52 45 41 44
The six characters at 5B4BH, two spaces and READ, copied to 5B2EH for a read of the source: READING TRACK nn SECTOR nn.
5B51-5B56
DEFM " WRIT" 20 20 57 52 49 54
The six characters at 5B51H, two spaces and WRIT, copied to 5B2EH for a write of the destination: WRITING TRACK nn SECTOR nn.
5B57-5B5C
DEFM "VERIFY" 56 45 52 49 46 59
The six characters at 5B57H, VERIFY, copied to 5B2EH for the read back of the destination: VERIFYING TRACK nn SECTOR nn.
5B5D-5B7D
DEFB 0AH / DEFM "INITIALIZING SYSTEM INFORMATION" / DEFB 0DH 0A 49 4E 49 54 49 41 4C 49 5A 49 4E 47 20 53 59 53 54 45 4D 20 49 4E 46 4F 52 4D 41 54 49 4F 4E 0D
The text at 5B5DH shown by 531EH before FORMAT writes the boot sector, the GAT, the HIT and the directory.
5B7E-5B84
DEFM "SOURCE" / DEFB 03H 53 4F 55 52 43 45 03
The word SOURCE at 5B7EH, ended by 03H, for the prompt of 54D0H.
5B85-5B90
DEFM "DESTINATION" / DEFB 03H 44 45 53 54 49 4E 41 54 49 4F 4E 03
The word DESTINATION at 5B85H, ended by 03H, for the prompt of 54D8H.
5B91-5B97
DEFM "DBLDOS" / DEFB 03H 44 42 4C 44 4F 53 03
The word DBLDOS at 5B91H, ended by 03H, for the prompt of 522EH at the end of a job that used drive 0.
5B98-5B9F
DEFB 0AH / DEFM "MOUNT " / DEFB 03H 0A 4D 4F 55 4E 54 20 03
The text at 5B98H shown by 5500H: a line feed and MOUNT and a space, ended by 03H, before the word of the prompt.
5BA0-5BAE
DEFM " DISK IN DRIVE " 20 44 49 53 4B 20 49 4E 20 44 52 49 56 45 20
The text at 5BA0H shown by 5516H after the word of the prompt: DISK IN DRIVE between spaces, then the drive digit at 5BAFH.
5BAF
DEFM "0" 30
The drive digit at 5BAFH of the prompt, counted up from 2FH by 550DH-5514H to the number of the drive.
5BB0-5BC1
DEFM " AND PUSH ",22H,"ENTER",22H / DEFB 03H 20 41 4E 44 20 50 55 53 48 20 22 45 4E 54 45 52 22 03
The end of the prompt at 5BB0H: AND PUSH "ENTER" with the quotes, ended by 03H, the cursor staying on the line for the key.
5BC2-5BE9
DEFB 0AH / DEFM "INSUFFICIENT MEMORY FOR 1 DRIVE BACKUP" / DEFB 0DH 0A 49 4E 53 55 46 46 49 43 49 45 4E 54 20 4D 45 4D 4F 52 59 20 46 4F 52 20 31 20 44 52 49 56 45 20 42 41 43 4B 55 50 0D
The text at 5BC2H shown by 53EEH when fewer than 18 pages lie between 5D00H and the top of memory, whether one or two drives are used.
5BEA-5BFE
DEFM " - SOURCE READ ERROR" / DEFB 0DH 20 2D 20 53 4F 55 52 43 45 20 52 45 41 44 20 45 52 52 4F 52 0D
The text at 5BEAH shown by 5549H after the progress line of a sector of the source that cannot be read.
5BFF-5C20
DEFB 0AH / DEFM "(C)ONTINUE, (R)ETRY, OR (A)BORT?" / DEFB 03H 0A 28 43 29 4F 4E 54 49 4E 55 45 2C 20 28 52 29 45 54 52 59 2C 20 4F 52 20 28 41 29 42 4F 52 54 3F 03
The question at 5BFFH shown by 5567H for a source sector that is not in the flaw table, ended by 03H for the answer.
5C21-5C44
DEFB 0AH / DEFM "TOO MANY FLAWS - USE ANOTHER DISK!" / DEFB 0DH 0A 54 4F 4F 20 4D 41 4E 59 20 46 4C 41 57 53 20 2D 20 55 53 45 20 41 4E 4F 54 48 45 52 20 44 49 53 4B 21 0D
The text at 5C21H shown by 58D8H for a sixth flawed sector (the manual writes TOO MANY FLAWS, USE ANOTHER DISK!).
5C45H - The Directory Entry of DIR/SYS
The 32 bytes that FORMAT copies to the first entry of the first directory sector (5359H), directory record 00H: the same as the entry of DIR/SYS on the 4.24 system diskette.
5C45
DEFB 5DH 5D
Entry byte +00H at 5C45H, the attributes 5DH of DIR/SYS: a system file (bit 6), in use (bit 4), invisible (bit 3), protection level 5 (bits 2-0).
5C46-5C49
DEFB 00H,00H,00H,00H 00 00 00 00
Entry bytes +01H-+04H at 5C46H: 00H, and the end of file byte (+03H) and the record length (+04H, 256) 00H.
5C4A-5C51
DEFM "DIR " 44 49 52 20 20 20 20 20
Entry bytes +05H-+0CH at 5C4AH: the name DIR and five spaces.
5C52-5C54
DEFM "SYS" 53 59 53
Entry bytes +0DH-+0FH at 5C52H: the extension SYS.
5C55-5C56
DEFB A7H,1DH A7 1D
Entry bytes +10H-+11H at 5C55H: A7H 1DH, the hash of the update password.
5C57-5C58
DEFB F9H,E5H F9 E5
Entry bytes +12H-+13H at 5C57H: F9H E5H, the hash of the access password.
5C59-5C5A
DEFW 000AH 0A 00
Entry bytes +14H-+15H at 5C59H: 000AH, the ten sectors of logical track 17.
5C5B-5C5C
DEFB 11H,01H 11 01
Entry bytes +16H-+17H at 5C5BH, the first extent: logical track 11H (17), granule bits 01H, both granules of the track from granule 0.
5C5D-5C64
DEFB FFH,FFH,FFH,FFH,FFH,FFH,FFH,FFH FF FF FF FF FF FF FF FF
Entry bytes +18H-+1FH at 5C5DH: FFH, no further extent.
5C65H - New in 4.24: Copy Only the Source's Cylinders
Called from 546FH with Register A the sectors of a pass. Besides the store at 54A1H that 4.23 made at 546FH, the number of cylinders of the destination (56BCH) is put into the operand of LD C at 5C75H and 56BCH is set to the source's number (54A3H), so that 55E3H ends the passes at the source's last cylinder. In 4.23, with Tnn larger than the source, 56BCH stayed at the destination's number: a pass with one drive that did not end exactly at the source's last cylinder went on reading cylinders the source does not have, and the test at 5488H then never found the end.
5C65
LD (54A1H),A 32 A1 54
Store Register A, the sectors of a pass (12H or the count of 54A0H), at 54A1H.
5C68
LD A,(56BCH) 3A BC 56
Load Register A with the number of cylinders of the destination at 56BCH.
5C6B
LD (5C76H),A 32 76 5C
Store Register A at 5C76H, the operand of LD C,00H at 5C75H: 5C75H later verifies the destination's cylinders up to this number.
5C6E
LD A,(54A3H) 3A A3 54
Load Register A with the number of cylinders of the source at 54A3H.
5C71
LD (56BCH),A 32 BC 56
Store Register A at 56BCH: while the passes run, 55E3H ends them at the source's last cylinder.
5C74
RET C9
Return to 5472H, the first pass of the copy of cylinders 1 to the last.
5C75H - New in 4.24: Verify the Destination's Extra Cylinders
Called from 548BH after the last pass, with the head of the destination on the source's last cylinder. While the head is not on the destination's last cylinder it steps in by one and 5881H verifies that cylinder, locking out the granules of its flawed sectors in the GAT image and the flaw table, which 5494H then writes to the destination. Last, the head is restored to cylinder 0 (as 4.23 did at 548BH). Without Tnn, or with a Tnn not larger than the source, the head is already on the last cylinder and only the Restore is made.
5C75
LD C,00H 0E 00
Load Register C with the number of cylinders of the destination, stored in this operand at 5C76H by 5C6BH (00H in the file).
5C77
DEC C 0D
Decrement Register C: the destination's last cylinder.
5C78
LD A,(37EDH) 3A ED 37
Load Register A with the track register at 37EDH, the cylinder the head of the destination is on.
5C7B
CP C B9
Compare Register A with Register C, the destination's last cylinder: the Z FLAG when the head has reached it.
5C7C
If the Z FLAG is set (the last cylinder), jump to 577BH to give the Restore command 03H; its RET returns to 548EH.
5C7F
LD A,53H 3E 53
Load Register A with 53H, the Step In command with the track register updated, stepping rate 3.
5C81
Call 577DH to give the command in Register A (53H) and wait: the head moves in to the next cylinder.
5C84
Call 5881H to verify the eighteen sectors of the cylinder, locking out the granule of each flawed sector.
5C87
Jump back to 5C78H to test the cylinder in the track register again.
5C89H - New in 4.24: The Data of a Formatted Sector
Called from 574BH with Register Pair HL the data field in the image of the cylinder. Writes 128 times the two bytes 6DH B6H, 256 bytes in all; 4.23 wrote 256 bytes E5H through 5776H. The pattern stays in every sector that is not written later, so a diskette formatted by 4.24 has 6DH B6H in its unused sectors (the DOS identification page uses it to tell 4.24).
5C89
LD B,80H 06 80
Load Register B with 80H, the 128 pairs of bytes of a 256 byte sector.
5C8B
LD (HL),6DH 36 6D
Store 6DH at Register Pair HL, the first byte of the pair.
5C8D
INC HL 23
Increment Register Pair HL to the next byte of the data field.
5C8E
LD (HL),B6H 36 B6
Store B6H at Register Pair HL, the second byte of the pair.
5C90
INC HL 23
Increment Register Pair HL to the next byte of the data field.
5C91
Decrement Register B and jump back to 5C8BH until the 128 pairs are written.
5C93
RET C9
Return with Register Pair HL past the data field.