TRS-80 DOS - LDOS 5.3.1 for the Model I - FORMAT/CMD Disassembled

Page Customization

Introduction/Summary

LDOS 5.3.1 FORMAT/CMD Disassembly - The Diskette Formatter (Model I)

FORMAT writes the tracks of a diskette, checks every sector, and writes the system information: the two boot sectors and the system information sector on cylinder 0, a copy of the allocation table, and a directory with the records of BOOT/SYS and DIR/SYS on a cylinder near the middle. The command is FORMAT :d (NAME="name",MPW="password",SDEN,DDEN,SIDES=n,CYL=n,STEP=n,ABS,QUERY=N,SYSTEM,WAIT=n,DIR=n); whatever is not given is asked for or taken as a default.

The file is a load module of 4989 bytes: a copyright record, 23 load blocks with 4842 bytes in 6000H-7673H (with gaps that are not in the file), and the transfer address 6E00H. The program has two parts. The front end (6E00H-7264H) reads the parameters and the replies, copies the target drive's drive code table to 6564H and changes the copy, checks the diskette and jumps to the engine (71EBH). The engine (6000H-6563H) builds each track from a template into the memory from 6E00H up, over the front end, which has finished; it reaches the drive's driver itself, through the JP at the start of the working copy (6460H), so the system's own drive code table is never changed.

The Parameters

@PARAM reads the parameters only when the command line starts with :d; without it the drive is asked for and the rest of the line is not read (6E3EH). Each parameter's value goes into the operand of the instruction that reads it (the table at 72A8H).

ParameterWhat the Code Does
NAME="name" (N)The diskette name, at most 8 characters, put in upper case into the allocation table (+D0H). NAME alone asks Diskette name ?; without NAME the QUERY setting decides: ask, or take LDOSDISK (6EDBH).
MPW="password" (M)The master password, the same way, default PASSWORD. It must start with a letter and hold only letters and digits; its hash (SYS2/SYS) goes to +CEH-+CFH (7201H).
SDEN, DDENSingle or double density. Without them the density is double when the drive's controller can do it (bit 6 of +04H), else single (6F6EH).
SIDES=nSIDES=2 formats both sides (bit 5 of +04H); anything else one side.
CYL=n (C)The cylinders of a 5 inch floppy, below 96; 96 or more gives Parameter error. Without it the drive's cylinders from the system information sector (SYSTEM (DRIVE=d,CYL=n)). An 8 inch diskette always gets 77.
STEP=nThe bootstrap step rate, 0-3, written into both boot sectors. Without it the rate of drive 0's table in the system information sector (SYSTEM (BSTEP=n), 6E17H).
ABS (A)A diskette that holds data is formatted without the question Are you sure you want to format it ? (71C3H).
QUERY=N (Q)No question: NAME and MPW take their defaults and the format the defaults of the drive. Any of SDEN, DDEN, SIDES, CYL or STEP also stops every question about the format.
SYSTEMOn a 5 inch double density floppy: after the format, cylinder 0 is written again in single density, so the ROM can boot from it (bit 4 of the configuration byte). On a drive whose table has bit 4 of +04H set: only the system information is written. Any other format refuses it with Can only SYSTEM a 5" DDEN floppy! (70BCH).
WAIT=n (W)A wait of n counts of the ROM's delay (0060H) after each Step In of the format, and before each cylinder of the verify (6125H).
DIR=n (D)The cylinder of the directory, when it is below the highest cylinder; else the middle cylinder. A locked out cylinder moves it to the nearest good one (6241H).

The Questions

In this order: Which drive is to be used ? (without :d), Diskette name ?, Master password ?, Single or Double density <S,D> ? (only when the controller can do double density), Enter number of sides <1,2> ?, Number of cylinders ? (5 inch floppies only), and the bootstrap step rate in milliseconds: 6, 12, 20, 30 or 40 for a 5 inch drive, 3, 6, 10, 15 or 20 for an 8 inch drive. ENTER takes the default. For drive 0 Load destination diskette and hit <ENTER> follows, and at the end Load SYSTEM diskette and hit <ENTER>. A JCL job, which cannot answer, ends at Load destination diskette and at Are you sure you want to format it ?; the question for the system diskette waits for ENTER.

Before the format the drive must be ready, the head on track 0 after a Restore, a diskette turning (the index hole passes within half a second, 723EH), not write protected, and HIGH$ must leave room for the track above 6E00H. When cylinder 0, sector 0 can be read in the new format, the diskette is shown as Disk contains data -- with its name and date, or Non-standard format, Unreadable directory or Non-initialized directory (7167H).

The Track Templates

Four descriptors (6571H) give for each size and density the template, the values of +07H and +08H, and the memory the track takes. A template holds the sectors on a track, the skew, the order of the sectors on the track and a stream of codes that 6013H expands: 01H-F0H (and F6H-FFH; 00H means 256) put the next byte that many times, F1H-F2H enclose the part repeated for every sector, F3H marks an ID field, F5H repeats a pair of bytes, F4H ends the stream; the list of the sectors in the order of the verify follows.

TemplateFormatSectorsInterleave, SkewTrack
6589H5 inch, single density102, 73105 bytes; 2 granules of 5 sectors on a track; data E5H.
65C9H5 inch, double density183, 136334 bytes; 3 granules of 6 sectors; data 6DH B6H. Its memory size (196AH) is 84 bytes less than the 6590 bytes 6013H writes.
6623H8 inch, single density163, 25176 bytes; 2 granules of 8 sectors; data E5H.
6668H8 inch, double density305, 310357 bytes; 3 granules of 10 sectors; data 6DH B6H.

What FORMAT Writes

Every track of every cylinder (both sides with SIDES=2), from cylinder 0 up, the head moved only by Restore and Step In; then every sector is verified, and a cylinder with a sector not found or a CRC error is shown with an asterisk and locked out (FFH in the allocation table and the lock out table). The directory goes on the middle cylinder or the nearest good one.

Cylinder, SectorContents
0, 0Boot sector 0 from 6B00H, with the directory cylinder and the step rate: the sector the ROM boots from (the BOOT/SYS page shows it as it is on the system diskette).
0, 1Boot sector 1 from 6C00H, for a boot through a disk driver.
0, 2The system information sector: 53H and 255 bytes of 00H.
0, 3A copy of the allocation table.
Directory, 0The allocation table (6A00H-6AFFH): a byte for each cylinder, a bit set for each granule not free; the lock out table at +60H; +CCH the cylinders less 35; +CDH the configuration byte; +CEH the hash of the master password; +D0H the name; +D8H the date; +E0H no AUTO command.
Directory, 1The hash index table: A2H (BOOT/SYS) and C4H (DIR/SYS).
Directory, 2 and 3The records of BOOT/SYS (6524H) and DIR/SYS (6544H).
Directory, 4 onEmpty sectors of 00H.

Every sector of the directory cylinder is written with the deleted data mark and read back: only the error 06H of that mark is accepted (6497H). The other sectors are written with the normal mark and verified.

Drives Without Track Writing

A drive whose table has bit 4 of +04H set gets no questions about the format (density, sides, cylinders, step rate) and no check of the controller's status or of the memory, but the name, the password and the test for data on the diskette as any other; the engine writes no tracks (61FCH). A hard disk (bit 3 of +03H) is formatted only when the operator answers Y to The target drive is a hard disk!. Without SYSTEM the drive's driver gets function 0CH, with SYSTEM nothing is done to the surface. Then the system information is written. On this path nothing has stored a table at 6000H-6009H, so the copy at 62FFH puts FORMAT's own first nine bytes into the working table, and the next call through it runs those bytes as code.

About This Page

Every byte of the file has its row; the rows of the two boot sector images (6B00H-6CFFH) show their code as it runs at 4200H, and their branches link to the rows of the image. Further points read from the code: when no cylinder can take the directory, the JP 6434H at 6281H displays Format aborted! and not the text at 6715H; Number of cylinders ? takes at most 95; the default name is LDOSDISK; the question Special non-standard format desired ? (7416H) is not used; the bootstrap step rate stays 03H on a drive with bit 4 of +04H set; after the clock interrupt was shut out (6007H) FORMAT ends with Note: Realtime clock no longer accurate.

Memory Map

Load Blocks in File Order

The file starts with a copyright record (type 1FH, 49 bytes: Copyright 1991 MISOSYS, Inc., All rights reserved), then 23 load blocks with 4842 bytes in the order LDOS loads them (the two boot sector images come last), then the transfer address 6E00H. 6564H-656DH, 656FH-6570H, 685BH-68FFH, 6904H-6ACAH, 6D00H-6DFFH and 7265H-7276H are not in the file.

AddressContents
6000H-60FFH256 bytes
6100H-61FFH256 bytes
6200H-62FFH256 bytes
6300H-63FFH256 bytes
6400H-64FFH256 bytes
6500H-6563H100 bytes
656EH-656EH1 bytes
6571H-6670H256 bytes
6671H-6770H256 bytes
6771H-685AH234 bytes
6900H-6903H4 bytes
6ACBH-6AFFH53 bytes
6E00H-6EFFH256 bytes
6F00H-6FFFH256 bytes
7000H-70FFH256 bytes
7100H-71FFH256 bytes
7200H-7264H101 bytes
7277H-7376H256 bytes
7377H-7476H256 bytes
7477H-7576H256 bytes
7577H-7673H253 bytes
6B00H-6BFFH256 bytes
6C00H-6CFFH256 bytes

The Parts of the File

AddressContents
6000H-6523HThe engine: the track expander (6013H), the format of every cylinder (6095H), the verify (612EH), the directory cylinder (6241H), the system information (629EH-6418H), the end (641AH), the calls to the driver (6460H) and its helpers.
6524H-66D1HThe records of BOOT/SYS and DIR/SYS, the working drive code table (not in the file), the four track descriptors and templates.
66D2H-6AFFHThe engine's texts, a Restore (6763H), the pointers 6900H and the allocation table image (6A00H-6AFFH).
6B00H-6CFFHThe images of boot sectors 0 and 1 (run at 4200H).
6D00H-6DFFHNot in the file: the table of the ID fields of the track, then the buffer of the replies and of the sectors written.
6E00H-7264HThe front end; from 6000H on the engine builds the tracks here, up to 6E00H plus the memory size of the descriptor.
7265H-7673HThe saved table and the cylinders of the drives (not in the file), the two supervisor requests, the master password, the table of the parameters and the front end's texts.

Sections of the Disassembly

AddressContents
6000HThe Format Engine: Entry
6013HExpand the Track Template
6095HFormat Every Cylinder
60D6HWrite the Track, the Second Side, Step In
612EHVerify Every Cylinder
61E3HA Sector Failed the Verify
61FCHA Drive Without Track Writing: the Hard Disk Question
6241HChoose the Directory Cylinder
629EHThe Boot Sectors: Cylinder 0, Sectors 0 and 1
62FFHThe Allocation Table: Cylinder 0, Sectors 2 and 3
6364HThe Directory Cylinder
641AHThe End: Formatting Complete
642FHA Period, the Abort, and Putting Back the Interrupt Vector
6460HCalls to the Drive's Driver
6497HVerify a Directory Sector, the Error Exits, Small Helpers
6524HThe Directory Records of BOOT/SYS and DIR/SYS
6564HThe Working Drive Code Table and the Counts
6571HThe Four Track Descriptors
6589HTemplate: 5 Inch, Single Density
65C9HTemplate: 5 Inch, Double Density
6623HTemplate: 8 Inch, Single Density
6668HTemplate: 8 Inch, Double Density
66D2HThe Engine's Texts (1)
6763HRestore and Side 0
676FHThe Engine's Texts (2)
685BHMemory Not in the File, the Boot Sector Pointers, the Allocation Table Image
6B00HImage of Boot Sector 0 (Runs at 4200H)
6B2EHImage of Boot Sector 0: Locate SYS0/SYS (Runs at 422EH)
6B42HImage of Boot Sector 0: Load SYS0/SYS Record by Record (Runs at 4242H)
6B79HImage of Boot Sector 0: Fetch the Next Byte (Runs at 4279H)
6B94HImage of Boot Sector 0: Display an Error and Stop (Runs at 4294H)
6B9EHImage of Boot Sector 0: Display a Text (Runs at 429EH)
6BACHImage of Boot Sector 0: Read a Sector, Two Tries (Runs at 42ACH)
6BE4HImage of Boot Sector 0: Texts (42E4H-42FFH)
6C00HImage of Boot Sector 1 (Runs at 4200H)
6C4CHImage of Boot Sector 1: Locate SYS0/SYS (Runs at 424CH)
6C66HImage of Boot Sector 1: Load SYS0/SYS Record by Record (Runs at 4266H)
6C9DHImage of Boot Sector 1: Fetch the Next Byte (Runs at 429DH)
6CB3HImage of Boot Sector 1: Display an Error and Stop (Runs at 42B3H)
6CBDHImage of Boot Sector 1: Display a Text (Runs at 42BDH)
6CC9HImage of Boot Sector 1: Read a Sector Through the Driver (Runs at 42C9H)
6CD7HImage of Boot Sector 1: Multiply Two Bytes (Runs at 42D7H)
6CE6HImage of Boot Sector 1: Texts (42E6H-42FFH)
6D00HThe Buffer at 6D00H (Not in the File)
6E00HThe Front End: the Banner, the System Information Sector
6E3EHThe Drive and the Parameters
6E9BHNAME and MPW Follow QUERY, the Drive's Table
6EDBHThe Diskette Name, the Date, the Master Password
6F6EHThe Density
6FF3HThe Sides and the Cylinders
704BHThe Bootstrap Step Rate, SYSTEM
70CFHThe Allocation Table Image, the Target Diskette
711AHCheck the Target Diskette
71EEHA Number From Digits
7201HCheck and Hash the Master Password
723EHDoes a Diskette Turn?
7265HNot in the File: the Saved Table and the Cylinders of the Drives
7277HTwo Supervisor Requests
727DHThe Master Password, a Text
72A8HThe Table of the Parameters
7341HThe Front End's Texts

Memory FORMAT Uses

AddressContents
0033H, 0040H, 0049H, 0060HROM: display the character in Register A; the line input (Register Pair HL the buffer, Register B the length, the CARRY FLAG for BREAK; it ends the reply with 0DH); wait for a key; the delay, Register Pair BC counted down.
4012HThe interrupt vector (ROM 0038H jumps here): C3H, the JP to 4518H. FORMAT stores C9H (RET) here while it writes the tracks (6010H) and puts the byte back (6446H).
402DH, 4030H, 4409H@EXIT (the end, Register Pair HL = 0000H), @ABORT and @ERROR (a disk error or error 2CH, bit 6 set for the short message).
4040HTIMER$, the tick counter (40 a second): the half second of the test whether a diskette turns.
4049H-404AHHIGH$: the track must end below it (715BH).
4200H-42FFHThe system's sector buffer: the system information sector of drive 0 is read here (6E11H); its drive tables at 4220H (after a boot through a disk driver) or 4270H give the default step rate (+03H of drive 0) and each drive's highest cylinder (+06H).
430FHSFLAG$: bit 5 a JCL job runs (no question can be answered).
442FHMFLAG$: bit 0 the system was booted through a disk driver.
4467H, 447BH, 4470H, 4476H@DSPLY, @LOGOT, @DATE (the date as MM/DD/YY into the allocation table) and @PARAM.
4700H-474FHDCT$: the target drive's table is copied from here (47A5H, 6EC6H); FORMAT never writes it.
4777HRDSECT: the read of the system information sector.
47A5HThe address of drive Register C's table: Register Pair HL = 4700H + the drive x 10.
4B6CHMULTEA: Register A = Register A x Register E (8 bits).
RST 28H, 84H and E4HSYS2/SYS: 84H loads it, E4H the hash of the master password (its 4E27H).
45FBHSYS0/SYS's floppy disk driver, called through the working table (functions 00H, 01H, 04H, 05H, 07H, 09H, 0AH, 0CH, 0DH, 0EH, 0FH).

Variables

The entry points of FORMAT, then the data of the file, the operands it changes, and the memory outside the file that it uses, by address.

Entry Points

AddressContents
6E00HThe start of FORMAT, the transfer address of the file: the front end.
6000HThe engine, entered from 71EBH with Index Register IY = 6564H.
6013HBuild the track from the template (the SYSTEM pass enters here again).
6095HFormat every cylinder.
612EHVerify every cylinder.
6241HChoose the directory cylinder (624AH after the verify).
629EHWrite the boot sectors, the allocation table, the system information sector and the directory.
641AHThe end through @EXIT.
6434HFormat aborted! (6437H another text) and @ABORT.
6440HPut back the interrupt vector, ask for the system diskette, Restore.
6460HThe calls to the driver: 6460H function 00H, 6463H 01H, 6467H 04H, 646BH 05H, 646FH 07H, 6473H 0FH, 6477H 0CH, 647BH 0DH, 647FH 0EH, 6483H 09H, 6487H 0AH; 6489H the common part.
6497HVerify a sector with the deleted data mark.
64A7HReport a disk error and end; 64B1H error 2CH.
64B5HTwo digits of a number (Register C, Register B).
64C2HDisplay a question and read up to 3 characters; 64C9H up to 8; 64CEH into the buffer at Register Pair HL.
64E9HWrite two digits over the last two on the screen.
64FBHPut a track descriptor into effect with the default cylinders; 650AH without them.
71EEHA number from digits.
7201HCheck and hash the master password.
723EHDoes a diskette turn?
7277HThe requests 84H (7277H) and E4H (727AH).

Data in the File

Address
Size
Contents
6524H
1 byte
DEFB 5EH
6524H, BOOT/SYS +00H, the attribute: 5EH, bit 6 a system file, bit 4 in use, bit 3 invisible, bits 2-0 access level 6 (execute only without the password).
6525H
1 byte
DEFB 00H
6525H, BOOT/SYS +01H: 00H, no flags and no month (the record is not dated).
6526H
1 byte
DEFB 00H
6526H, BOOT/SYS +02H: 00H, the day and the year of the date, none.
6527H
1 byte
DEFB 00H
6527H, BOOT/SYS +03H: 00H, the end of file byte: the last sector is full.
6528H
1 byte
DEFB 00H
6528H, BOOT/SYS +04H: 00H, the record length: 256 bytes.
6529H-6530H
8 bytes
DEFM "BOOT "
6529H-6530H, BOOT/SYS +05H-+0CH: the name BOOT, padded with spaces to 8 bytes.
6531H-6533H
3 bytes
DEFM "SYS"
6531H-6533H, BOOT/SYS +0DH-+0FH: the extension SYS.
6534H-6535H
2 bytes
DEFW 01AEH
6534H-6535H, BOOT/SYS +10H-+11H: 01AEH, the hash of the file's password (4296H would be no password); SYS2/SYS's @OPEN compares it.
6536H-6537H
2 bytes
DEFW 0000H
6536H-6537H, BOOT/SYS +12H-+13H: 0000H, the time and the year of the date stamp, none.
6538H-6539H
2 bytes
DEFW 0005H
6538H-6539H, BOOT/SYS +14H-+15H: 0005H, the ending record number: 5 sectors, cylinder 0 sectors 0-4.
653AH
1 byte
DEFB 00H
653AH, BOOT/SYS +16H: 00H, the cylinder of the first extent: cylinder 0.
653BH
1 byte
DEFB 00H
653BH, BOOT/SYS +17H: 00H, the first extent's first granule (bits 7-5: granule 0) and its granules less one (bits 4-0: one granule).
653CH-6541H
6 bytes
DEFB FFH x 6
653CH-6541H, BOOT/SYS +18H-+1DH: the three other extents, FFH (no extent).
6542H
1 byte
DEFB FFH
6542H, BOOT/SYS +1EH: FFH, no link to an extension record.
6543H
1 byte
DEFB FFH
6543H, BOOT/SYS +1FH: FFH, the number of an extension record, none.
6544H
1 byte
DEFB 5DH
6544H, DIR/SYS +00H, the attribute: 5DH, bit 6 a system file, bit 4 in use, bit 3 invisible, bits 2-0 access level 5 (read only without the password).
6545H
1 byte
DEFB 00H
6545H, DIR/SYS +01H: 00H, no flags and no month.
6546H
1 byte
DEFB 00H
6546H, DIR/SYS +02H: 00H, the day and the year of the date, none.
6547H
1 byte
DEFB 00H
6547H, DIR/SYS +03H: 00H, the end of file byte: the last sector is full.
6548H
1 byte
DEFB 00H
6548H, DIR/SYS +04H: 00H, the record length: 256 bytes.
6549H-6550H
8 bytes
DEFM "DIR "
6549H-6550H, DIR/SYS +05H-+0CH: the name DIR, padded with spaces to 8 bytes.
6551H-6553H
3 bytes
DEFM "SYS"
6551H-6553H, DIR/SYS +0DH-+0FH: the extension SYS.
6554H-6555H
2 bytes
DEFW 01AEH
6554H-6555H, DIR/SYS +10H-+11H: 01AEH, the hash of the file's password, the same as BOOT/SYS.
6556H-6557H
2 bytes
DEFW 4296H
6556H-6557H, DIR/SYS +12H-+13H: 4296H, the hash of eight spaces. DATECONV/CMD treats a record with 4296H here as one without a date stamp.
6558H-6559H
2 bytes
DEFW 000AH
6558H-6559H, DIR/SYS +14H-+15H: the ending record number, 000AH in the file; 63BEH stores the sectors of the directory cylinder (at most 34) in the low byte.
655AH
1 byte
DEFB 11H
655AH, DIR/SYS +16H: the cylinder of the first extent, 11H (17) in the file; 62A8H and 63D1H store the directory cylinder.
655BH
1 byte
DEFB 01H
655BH, DIR/SYS +17H: the first extent's first granule (bits 7-5) and granules less one (bits 4-0), 01H in the file; 63CBH stores granule 0 and the granules of the cylinder less one.
655CH-6561H
6 bytes
DEFB FFH x 6
655CH-6561H, DIR/SYS +18H-+1DH: the three other extents, FFH (no extent).
6562H
1 byte
DEFB FFH
6562H, DIR/SYS +1EH: FFH, no link to an extension record.
6563H
1 byte
DEFB FFH
6563H, DIR/SYS +1FH: FFH, the number of an extension record, none.
6564H-656DH
10 bytes
DEFS 10
6564H-656DH: not in the file. The working copy of the target drive's drive code table: the front end copies the drive's table here (6EC9H) and changes it for the format chosen; the engine reaches the driver through it (6495H).
656EH
1 byte
DEFB 03H
656EH: the bootstrap step rate, 0-3: 03H in the file, the value the front end chooses stored by 70B9H; 62B4H and 62E1H put it into the two boot sectors.
656FH-6570H
2 bytes
DEFS 2
656FH-6570H: not in the file. 656FH the sectors on a cylinder (6023H, 6238H), 6570H the sectors on a track (6018H); 61BBH-61C7H keep both across the second pass over cylinder 0.
6571H-6576H
6 bytes
DEFW 6589H, 2409H, 0D35H
6571H-6576H: 5 inch single density. Template 6589H; +07H 09H (10 sectors on a track, one head), +08H 24H (2 granules on a track, 5 sectors to a granule); 0D35H (3381) bytes of memory, 20 more than the 3105 bytes of the track and the 256 bytes of FFH after it.
6577H-657CH
6 bytes
DEFW 65C9H, 4511H, 196AH
6577H-657CH: 5 inch double density. Template 65C9H; +07H 11H (18 sectors on a track), +08H 45H (3 granules on a track, 6 sectors to a granule); 196AH (6506) bytes of memory, 84 fewer than the 6334 bytes of the track and the 256 bytes of FFH after it (19BEH) that 6013H writes.
657DH-6582H
6 bytes
DEFW 6623H, 270FH, 1558H
657DH-6582H: 8 inch single density. Template 6623H; +07H 0FH (16 sectors on a track), +08H 27H (2 granules on a track, 8 sectors to a granule); 1558H (5464) bytes of memory, 32 more than the 5176 bytes of the track and the 256 bytes of FFH.
6583H-6588H
6 bytes
DEFW 6668H, 491DH, 29B1H
6583H-6588H: 8 inch double density. Template 6668H; +07H 1DH (30 sectors on a track), +08H 49H (3 granules on a track, 10 sectors to a granule); 29B1H (10673) bytes of memory, 60 more than the 10357 bytes of the track and the 256 bytes of FFH.
6589H
1 byte
DEFB 0AH
6589H, template +00H: 0AH, 10 sectors on a track (6016H).
658AH
1 byte
DEFB 07H
658AH, template +01H: 07H, the skew: each cylinder starts the order of the sectors 7 places further on (6026H).
658BH-6594H
10 bytes
DEFB 00H, 05H, 01H, 06H, 02H, 07H, 03H, 08H, 04H, 09H
658BH-6594H: the order of the sectors on the track, with an interleave of 2: each sector number lies two places after the one before.
6595H-659CH
8 bytes
DEFB F6H x 8
6595H-659CH: F6H (minus 10) eight times, the skew plus 1: a pointer that runs past the last sector number moves back 10 places (60C2H-60CBH).
659DH-659EH
2 bytes
DEFB 0EH, FFH
659DH-659EH: 14 bytes of FFH, the gap at the start of the track after the index pulse.
659FH
1 byte
DEFB F1H
659FH: F1H, the start of the part built once for each of the 10 sectors.
65A0H-65A1H
2 bytes
DEFB 06H, 00H
65A0H-65A1H: 6 bytes of 00H before the ID field.
65A2H-65A3H
2 bytes
DEFB 01H, FEH
65A2H-65A3H: 1 byte FEH, the ID address mark.
65A4H
1 byte
DEFB F3H
65A4H: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
65A5H-65A6H
2 bytes
DEFB 03H, 00H
65A5H-65A6H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
65A7H-65A8H
2 bytes
DEFB 01H, 01H
65A7H-65A8H: 1 byte 01H, the size code of the ID field: 256 bytes.
65A9H-65AAH
2 bytes
DEFB 01H, F7H
65A9H-65AAH: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
65ABH-65ACH
2 bytes
DEFB 01H, FFH
65ABH-65ACH: 1 byte FFH, the start of the gap after the ID field.
65ADH-65AEH
2 bytes
DEFB 0BH, FFH
65ADH-65AEH: 11 bytes of FFH, the rest of the gap after the ID field.
65AFH-65B0H
2 bytes
DEFB 06H, 00H
65AFH-65B0H: 6 bytes of 00H before the data field.
65B1H-65B2H
2 bytes
DEFB 01H, FBH
65B1H-65B2H: 1 byte FBH, the data address mark.
65B3H-65B4H
2 bytes
DEFB 00H, E5H
65B3H-65B4H: 256 bytes of E5H (a count of 00H), the data of the sector.
65B5H-65B6H
2 bytes
DEFB 01H, F7H
65B5H-65B6H: 1 byte F7H: the controller writes the two CRC bytes of the data field.
65B7H-65B8H
2 bytes
DEFB 01H, FFH
65B7H-65B8H: 1 byte FFH, the start of the gap after the data field.
65B9H-65BAH
2 bytes
DEFB 0DH, FFH
65B9H-65BAH: 13 bytes of FFH, the rest of the gap after the data field.
65BBH
1 byte
DEFB F2H
65BBH: F2H, the end of the part built for each sector.
65BCH-65BDH
2 bytes
DEFB 47H, FFH
65BCH-65BDH: 71 bytes of FFH, the gap at the end of the track.
65BEH
1 byte
DEFB F4H
65BEH: F4H, the end of the template; 6085H finishes the track there.
65BFH-65C8H
10 bytes
DEFB 00H, 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H
65BFH-65C8H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.
65C9H
1 byte
DEFB 12H
65C9H, template +00H: 12H, 18 sectors on a track (6016H).
65CAH
1 byte
DEFB 0DH
65CAH, template +01H: 0DH, the skew: each cylinder starts the order of the sectors 13 places further on (6026H).
65CBH-65DCH
18 bytes
DEFB 00H, 06H, 0CH, 01H, 07H, 0DH, 02H, 08H, 0EH, 03H, 09H, 0FH, 04H, 0AH, 10H, 05H, 0BH, 11H
65CBH-65DCH: the order of the 18 sectors on the track (an interleave of 3).
65DDH-65EAH
14 bytes
DEFB EEH x 14
65DDH-65EAH: EEH (minus 18) fourteen times, the skew plus 1: a pointer that runs past the last sector number moves back 18 places (60C2H-60CBH).
65EBH-65ECH
2 bytes
DEFB 20H, 4EH
65EBH-65ECH: 32 bytes of 4EH, the gap at the start of the track.
65EDH
1 byte
DEFB F1H
65EDH: F1H, the start of the part built once for each of the 18 sectors.
65EEH-65EFH
2 bytes
DEFB 0CH, 00H
65EEH-65EFH: 12 bytes of 00H before the ID field.
65F0H-65F1H
2 bytes
DEFB 03H, F5H
65F0H-65F1H: 3 bytes F5H: the controller writes the sync byte A1H with a missing clock bit before the address mark.
65F2H-65F3H
2 bytes
DEFB 01H, FEH
65F2H-65F3H: 1 byte FEH, the ID address mark.
65F4H
1 byte
DEFB F3H
65F4H: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
65F5H-65F6H
2 bytes
DEFB 03H, 00H
65F5H-65F6H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
65F7H-65F8H
2 bytes
DEFB 01H, 01H
65F7H-65F8H: 1 byte 01H, the size code of the ID field: 256 bytes.
65F9H-65FAH
2 bytes
DEFB 01H, F7H
65F9H-65FAH: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
65FBH-65FCH
2 bytes
DEFB 16H, 4EH
65FBH-65FCH: 22 bytes of 4EH, the gap after the ID field.
65FDH-65FEH
2 bytes
DEFB 0CH, 00H
65FDH-65FEH: 12 bytes of 00H before the data field.
65FFH-6600H
2 bytes
DEFB 03H, F5H
65FFH-6600H: 3 bytes F5H, the sync bytes A1H before the data address mark.
6601H-6602H
2 bytes
DEFB 01H, FBH
6601H-6602H: 1 byte FBH, the data address mark.
6603H-6606H
4 bytes
DEFB F5H, 80H, 6DH, B6H
6603H-6606H: F5H: the pair after the count is put that many times, 80H (128) pairs 6DH B6H, the 256 bytes of the sector's data.
6607H-6608H
2 bytes
DEFB 01H, F7H
6607H-6608H: 1 byte F7H: the controller writes the two CRC bytes of the data field.
6609H-660AH
2 bytes
DEFB 01H, 4EH
6609H-660AH: 1 byte 4EH, the start of the gap after the data field.
660BH-660CH
2 bytes
DEFB 17H, 4EH
660BH-660CH: 23 bytes of 4EH, the rest of the gap after the data field.
660DH
1 byte
DEFB F2H
660DH: F2H, the end of the part built for each sector.
660EH-660FH
2 bytes
DEFB B6H, 4EH
660EH-660FH: 182 bytes of 4EH, the gap at the end of the track.
6610H
1 byte
DEFB F4H
6610H: F4H, the end of the template; 6085H finishes the track there.
6611H-6622H
18 bytes
DEFB 00H, 0CH, 07H, 02H, 0EH, 09H, 04H, 10H, 0BH, 06H, 01H, 0DH, 08H, 03H, 0FH, 0AH, 05H, 11H
6611H-6622H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.
6623H
1 byte
DEFB 10H
6623H, template +00H: 10H, 16 sectors on a track (6016H).
6624H
1 byte
DEFB 02H
6624H, template +01H: 02H, the skew: each cylinder starts the order of the sectors 2 places further on (6026H).
6625H-6634H
16 bytes
DEFB 0AH, 05H, 00H, 0BH, 06H, 01H, 0CH, 07H, 02H, 0DH, 08H, 03H, 0EH, 09H, 04H, 0FH
6625H-6634H: the order of the 16 sectors on the track (an interleave of 3).
6635H-6637H
3 bytes
DEFB F0H x 3
6635H-6637H: F0H (minus 16) three times, the skew plus 1: a pointer that runs past the last sector number moves back 16 places (60C2H-60CBH).
6638H-6639H
2 bytes
DEFB 28H, FFH
6638H-6639H: 40 bytes of FFH, the gap at the start of the track.
663AH
1 byte
DEFB F1H
663AH: F1H, the start of the part built once for each of the 16 sectors.
663BH-663CH
2 bytes
DEFB 06H, 00H
663BH-663CH: 6 bytes of 00H before the ID field.
663DH-663EH
2 bytes
DEFB 01H, FEH
663DH-663EH: 1 byte FEH, the ID address mark.
663FH
1 byte
DEFB F3H
663FH: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
6640H-6641H
2 bytes
DEFB 03H, 00H
6640H-6641H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
6642H-6643H
2 bytes
DEFB 01H, 01H
6642H-6643H: 1 byte 01H, the size code of the ID field: 256 bytes.
6644H-6645H
2 bytes
DEFB 01H, F7H
6644H-6645H: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
6646H-6647H
2 bytes
DEFB 0BH, FFH
6646H-6647H: 11 bytes of FFH, the gap after the ID field.
6648H-6649H
2 bytes
DEFB 06H, 00H
6648H-6649H: 6 bytes of 00H before the data field.
664AH-664BH
2 bytes
DEFB 01H, FBH
664AH-664BH: 1 byte FBH, the data address mark.
664CH-664DH
2 bytes
DEFB 00H, E5H
664CH-664DH: 256 bytes of E5H (a count of 00H), the data of the sector.
664EH-664FH
2 bytes
DEFB 01H, F7H
664EH-664FH: 1 byte F7H: the controller writes the two CRC bytes of the data field.
6650H-6651H
2 bytes
DEFB 01H, FFH
6650H-6651H: 1 byte FFH, the start of the gap after the data field.
6652H-6653H
2 bytes
DEFB 14H, FFH
6652H-6653H: 20 bytes of FFH, the rest of the gap after the data field.
6654H
1 byte
DEFB F2H
6654H: F2H, the end of the part built for each sector.
6655H-6656H
2 bytes
DEFB D0H, FFH
6655H-6656H: 208 bytes of FFH, the gap at the end of the track.
6657H
1 byte
DEFB F4H
6657H: F4H, the end of the template; 6085H finishes the track there.
6658H-6667H
16 bytes
DEFB 0AH, 00H, 06H, 0CH, 02H, 08H, 0EH, 04H, 05H, 0BH, 01H, 07H, 0DH, 03H, 09H, 0FH
6658H-6667H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.
6668H
1 byte
DEFB 1EH
6668H, template +00H: 1EH, 30 sectors on a track (6016H).
6669H
1 byte
DEFB 03H
6669H, template +01H: 03H, the skew: each cylinder starts the order of the sectors 3 places further on (6026H).
666AH-6687H
30 bytes
DEFB 00H, 06H, 0CH, 12H, 18H, 01H, 07H, 0DH, 13H, 19H, 02H, 08H, 0EH, 14H, 1AH, 03H, 09H, 0FH, 15H, 1BH, 04H, 0AH, 10H, 16H, 1CH, 05H, 0BH, 11H, 17H, 1DH
666AH-6687H: the order of the 30 sectors on the track (an interleave of 5).
6688H-668BH
4 bytes
DEFB E2H x 4
6688H-668BH: E2H (minus 30) four times, the skew plus 1: a pointer that runs past the last sector number moves back 30 places (60C2H-60CBH).
668CH-668DH
2 bytes
DEFB 14H, 4EH
668CH-668DH: 20 bytes of 4EH, the gap at the start of the track.
668EH
1 byte
DEFB F1H
668EH: F1H, the start of the part built once for each of the 30 sectors.
668FH-6690H
2 bytes
DEFB 0CH, 00H
668FH-6690H: 12 bytes of 00H before the ID field.
6691H-6692H
2 bytes
DEFB 03H, F5H
6691H-6692H: 3 bytes F5H: the controller writes the sync byte A1H with a missing clock bit before the address mark.
6693H-6694H
2 bytes
DEFB 01H, FEH
6693H-6694H: 1 byte FEH, the ID address mark.
6695H
1 byte
DEFB F3H
6695H: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
6696H-6697H
2 bytes
DEFB 03H, 00H
6696H-6697H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
6698H-6699H
2 bytes
DEFB 01H, 01H
6698H-6699H: 1 byte 01H, the size code of the ID field: 256 bytes.
669AH-669BH
2 bytes
DEFB 01H, F7H
669AH-669BH: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
669CH-669DH
2 bytes
DEFB 16H, 4EH
669CH-669DH: 22 bytes of 4EH, the gap after the ID field.
669EH-669FH
2 bytes
DEFB 0CH, 00H
669EH-669FH: 12 bytes of 00H before the data field.
66A0H-66A1H
2 bytes
DEFB 03H, F5H
66A0H-66A1H: 3 bytes F5H, the sync bytes A1H before the data address mark.
66A2H-66A3H
2 bytes
DEFB 01H, FBH
66A2H-66A3H: 1 byte FBH, the data address mark.
66A4H-66A7H
4 bytes
DEFB F5H, 80H, 6DH, B6H
66A4H-66A7H: F5H: the pair after the count is put that many times, 80H (128) pairs 6DH B6H, the 256 bytes of the sector's data.
66A8H-66A9H
2 bytes
DEFB 01H, F7H
66A8H-66A9H: 1 byte F7H: the controller writes the two CRC bytes of the data field.
66AAH-66ABH
2 bytes
DEFB 01H, FFH
66AAH-66ABH: 1 byte FFH after the data field's CRC (the other templates of double density put 4EH here).
66ACH-66ADH
2 bytes
DEFB 11H, 4EH
66ACH-66ADH: 17 bytes of 4EH, the gap after the data field.
66AEH
1 byte
DEFB F2H
66AEH: F2H, the end of the part built for each sector.
66AFH-66B0H
2 bytes
DEFB 00H, 4EH
66AFH-66B0H: 256 bytes of 4EH (a count of 00H), the first part of the gap at the end of the track.
66B1H-66B2H
2 bytes
DEFB 3DH, 4EH
66B1H-66B2H: 61 bytes of 4EH, the rest of the gap at the end of the track.
66B3H
1 byte
DEFB F4H
66B3H: F4H, the end of the template; 6085H finishes the track there.
66B4H-66D1H
30 bytes
DEFB 00H, 0CH, 18H, 07H, 13H, 02H, 0EH, 1AH, 09H, 15H, 04H, 10H, 1CH, 0BH, 17H, 06H, 12H, 01H, 0DH, 19H, 08H, 14H, 03H, 0FH, 1BH, 0AH, 16H, 05H, 11H, 1DH
66B4H-66D1H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.
66D2H
1 byte
DEFB 1DH
66D2H: 1DH, the cursor to the start of its line: the start of the text of 6095H.
66D3H-66E8H
22 bytes
DEFM "Formatting cylinder "
66D3H-66E8H: Formatting cylinder and three spaces; 64E9H writes the cylinder number over the last two.
66E9H
1 byte
DEFB 03H
66E9H: 03H, the end of the text: the cursor stays after the spaces.
66EAH
1 byte
DEFB 1DH
66EAH: 1DH, the cursor to the start of its line: the start of the text of 6136H.
66EBH-6700H
22 bytes
DEFM "Verifying cylinder "
66EBH-6700H: Verifying, two spaces, cylinder and three spaces, as long as the text above; 64E9H writes the cylinder number over the last two.
6701H
1 byte
DEFB 03H
6701H: 03H, the end of the text: the cursor stays after the spaces.
6702H-6705H
4 bytes
DEFM "* "
6702H-6705H: an asterisk and three spaces, displayed after the number of a cylinder that failed the verify (61EDH).
6706H
1 byte
DEFB 03H
6706H: 03H, the end of the text: the next cylinder number goes two places before its end.
6707H-6713H
13 bytes
DEFM "Formatting..."
6707H-6713H: Formatting..., displayed before the driver's function 0CH (6215H).
6714H
1 byte
DEFB 0DH
6714H: 0DH, the end of the line and of the text.
6715H-6739H
37 bytes
DEFM "No cylinders available for directory!"
6715H-6739H: the text 627EH points to when no cylinder can take the directory; the JP 6434H after it displays Format aborted! instead.
673AH
1 byte
DEFB 0DH
673AH: 0DH, the end of the line and of the text.
673BH-675FH
37 bytes
DEFM "Directory will be placed on cylinder "
673BH-675FH: Directory will be placed on cylinder and a space, displayed by 6292H.
6760H-6761H
2 bytes
DEFM "00"
6760H-6761H: two digits, 00 in the file: 628EH stores the directory cylinder here.
6762H
1 byte
DEFB 0DH
6762H: 0DH, the end of the line and of the text.
676FH
1 byte
DEFB 0AH
676FH: 0AH, a new line: the start of the text of 6197H.
6770H-6784H
21 bytes
DEFM " Re-format track 0..."
6770H-6784H: a space and Re-format track 0..., displayed before the second pass over cylinder 0 in single density.
6785H
1 byte
DEFB 0DH
6785H: 0DH, the end of the line and of the text.
6786H
1 byte
DEFB 0AH
6786H: 0AH, a new line: the start of the text of 6298H.
6787H-67A6H
32 bytes
DEFM "Initializing SYSTEM information "
6787H-67A6H: Initializing SYSTEM information and a space; the periods and plus signs of the sectors written follow on the line.
67A7H
1 byte
DEFB 03H
67A7H: 03H, the end of the text: the cursor stays at its end.
67A8H
1 byte
DEFB 0AH
67A8H: 0AH, a new line: the start of the text of 6451H.
67A9H-67CCH
36 bytes
DEFM "Load SYSTEM diskette and hit <ENTER>"
67A9H-67CCH: Load SYSTEM diskette and hit &lt;ENTER&gt;, displayed after a format of drive 0.
67CDH
1 byte
DEFB 0DH
67CDH: 0DH, the end of the line and of the text.
67CEH
1 byte
DEFB 0AH
67CEH: 0AH, a new line: the start of the text of 641DH.
67CFH-67E1H
19 bytes
DEFM "Formatting complete"
67CFH-67E1H: Formatting complete, displayed and written to the job log by @LOGOT at the end.
67E2H
1 byte
DEFB 0DH
67E2H: 0DH, the end of the line and of the text.
67E3H
1 byte
DEFB 0AH
67E3H: 0AH, a new line: the start of the text of 6423H.
67E4H-680AH
39 bytes
DEFM "Note: Realtime clock no longer accurate"
67E4H-680AH: Note: Realtime clock no longer accurate, since the clock interrupt was shut out while the tracks were written.
680BH
1 byte
DEFB 0DH
680BH: 0DH, the end of the line and of the text.
680CH-681AH
15 bytes
DEFM "Format aborted!"
680CH-681AH: Format aborted!, the text of 6434H, displayed and written to the job log.
681BH
1 byte
DEFB 0DH
681BH: 0DH, the end of the line and of the text.
681CH-6839H
30 bytes
DEFM "Can't, Diskette not formatted!"
681CH-6839H: the text of 62C6H, for a diskette whose cylinder 0, sector 0 cannot be read when only the system information is to be written.
683AH
1 byte
DEFB 0DH
683AH: 0DH, the end of the line and of the text.
683BH-685AH
32 bytes
DEFB 00H x 32
683BH-685AH: 32 bytes of 00H at the end of the block. No code addresses them.
685BH-68FFH
165 bytes
DEFS 165
685BH-68FFH: not in the file, and no code of FORMAT uses it.
6900H-6901H
2 bytes
DEFW 6BBCH
6900H-6901H: 6BBCH, the Seek command byte of boot sector 0's image (42BCH when it runs), read by 62B8H.
6902H-6903H
2 bytes
DEFW 6C10H
6902H-6903H: 6C10H, the step rate byte of boot sector 1's image (4210H when it runs), read by 62E5H.
6904H-69FFH
252 bytes
DEFS 252
6904H-69FFH: not in the file, and no code of FORMAT uses it.
6A00H-6ACAH
203 bytes
DEFS 203
6A00H-6ACAH: not in the file. The allocation table image, +00H-+CAH: 6A00H-6A5FH one byte for each cylinder, a bit set for each granule not free (the front end fills it, 70E6H; the verify sets FFH for a bad cylinder, 61F7H); 6A60H-6ABFH the lock out table (61DAH copies the allocation bytes there); 6AC0H-6ACAH what memory holds.
6ACBH
1 byte
DEFB 53H
6ACBH, the allocation table +CBH: 53H, written to the diskette as it is.
6ACCH
1 byte
DEFB 00H
6ACCH, +CCH: the number of cylinders less 35, 00H in the file, stored by 6315H.
6ACDH
1 byte
DEFB 00H
6ACDH, +CDH: the configuration byte, 00H in the file, stored by 6335H (bit 7 and bit 3 always, bit 6 double density, bit 5 two sides, bit 4 cylinder 0 single density, bits 2-0 the granules on a track less one).
6ACEH-6ACFH
2 bytes
DEFW 0000H
6ACEH-6ACFH, +CEH-+CFH: the hash of the master password, 0000H in the file, stored by the front end (6F6CH).
6AD0H-6AD7H
8 bytes
DEFM " "
6AD0H-6AD7H, +D0H-+D7H: the diskette name, eight spaces in the file, stored by the front end (6EEAH, 6F14H).
6AD8H-6ADFH
8 bytes
DEFM "MM/DD/YY"
6AD8H-6ADFH, +D8H-+DFH: the date the diskette is formatted, MM/DD/YY in the file, stored by the front end (6F19H).
6AE0H
1 byte
DEFB 0DH
6AE0H, +E0H: 0DH, the AUTO command of the diskette: none.
6AE1H-6AFFH
31 bytes
DEFM " "
6AE1H-6AFFH, +E1H-+FFH: 31 spaces, the rest of the AUTO command field.
6BE4H-6BE6H
3 bytes
DEFB 1CH, 1FH, 03H
The text displayed by 420EH at the start: 1CH moves the cursor to the top left, 1FH clears to the end of the screen, 03H ends the text.
6BE7H-6BE8H
2 bytes
DEFB 17H, E8H
Start of the No System text (422CH): 17H switches the screen to 32 characters per line, E8H displays 40 spaces (E8H less C0H), which puts the message on the second line, 8 columns in.
6BE9H-6BF1H
9 bytes
DEFM "No System"
The message displayed when the directory record of SYS0/SYS is not in use (4224H-422CH).
6BF2H
1 byte
DEFB 03H
End of the No System text: 429EH stops at this byte and does not display it.
6BF3H-6BF4H
2 bytes
DEFB 17H, E8H
Start of the Disk Error text (4294H): 17H switches the screen to 32 characters per line, E8H displays 40 spaces, which puts the message on the second line, 8 columns in.
6BF5H-6BFEH
10 bytes
DEFM "Disk Error"
The message displayed when a sector cannot be read in two tries (4222H, 4286H).
6BFFH
1 byte
DEFB 03H
End of the Disk Error text, and the last byte of sector 0.
6CE6H-6CE7H
2 bytes
DEFB 17H, E8H
Start of the No System text (424AH): 17H switches the screen to 32 characters per line, E8H displays 40 spaces (E8H less C0H), which puts the message on the second line, 8 columns in.
6CE8H-6CF0H
9 bytes
DEFM "No System"
The message displayed when the directory record of SYS0/SYS is not in use (4245H-424AH).
6CF1H
1 byte
DEFB 03H
End of the No System text: 42BDH stops at this byte and does not display it.
6CF2H-6CF3H
2 bytes
DEFB 17H, E8H
Start of the Disk Error text (42B3H): 32 characters per line, then 40 spaces.
6CF4H-6CFDH
10 bytes
DEFM "Disk Error"
The message displayed when the driver cannot read a sector of SYS0/SYS (42A5H).
6CFEH
1 byte
DEFB 03H
End of the Disk Error text: 42BDH stops at this byte and does not display it.
6CFFH
1 byte
DEFB FFH
The last byte of sector 1, FFH. No code of this sector uses it.
6D00H-6DFFH
256 bytes
DEFS 256
6D00H-6DFFH: not in the file. While a track is built, the address of each sector's ID field in the track (6039H, 607DH), ended by 0000H; the replies to the questions (64CBH, 6E82H); the sector read from the target diskette (716FH-71BBH); then the sectors FORMAT writes: the system information sector, the hash index table, the directory records and the empty directory sectors (634BH-6418H).
7265H-726EH
10 bytes
DEFS 10
7265H-726EH: not in the file. The copy of the working drive code table taken at 7123H and put back at 71E6H.
726FH-7276H
8 bytes
DEFS 8
726FH-7276H: not in the file. The highest cylinder of drives 0-7 from the system information sector (6E35H); 6EC1H takes the target drive's.
727DH-7284H
8 bytes
DEFM " "
727DH-7284H: the master password, eight spaces in the file: filled from the command line, the reply or PASSWORD (6F2CH-6F63H), then checked and hashed (7201H).
7285H
1 byte
DEFB 20H
7285H: a space after the buffer. The ROM's line input puts its 0DH here after a reply of 8 characters (6F4EH).
7286H-72A6H
33 bytes
DEFM "Can only SYSTEM a 5" / DEFB 22H / DEFM " DDEN floppy!"
7286H-72A6H: the text of 722CH, for SYSTEM with a format other than 5 inch double density.
72A7H
1 byte
DEFB 0DH
72A7H: 0DH, the end of the line and of the text.
72A8H-72AFH
8 bytes
DEFM "NAME " / DEFW 6EDCH
72A8H-72AFH: NAME, the diskette name: the operand of LD HL,0000H at 6EDBH.
72B0H-72B7H
8 bytes
DEFM "N " / DEFW 6EDCH
72B0H-72B7H: N, the short form of NAME: 6EDCH.
72B8H-72BFH
8 bytes
DEFM "MPW " / DEFW 6F1FH
72B8H-72BFH: MPW, the master password: the operand of LD HL,0000H at 6F1EH.
72C0H-72C7H
8 bytes
DEFM "M " / DEFW 6F1FH
72C0H-72C7H: M, the short form of MPW: 6F1FH.
72C8H-72CFH
8 bytes
DEFM "SDEN " / DEFW 6E5FH
72C8H-72CFH: SDEN, single density: the operand of LD DE,0000H at 6E5EH.
72D0H-72D7H
8 bytes
DEFM "DDEN " / DEFW 6E64H
72D0H-72D7H: DDEN, double density: the operand of LD DE,0000H at 6E63H.
72D8H-72DFH
8 bytes
DEFM "SIDES " / DEFW 6E69H
72D8H-72DFH: SIDES=n, the sides: the operand of LD DE,0000H at 6E68H.
72E0H-72E7H
8 bytes
DEFM "CYL " / DEFW 6E6EH
72E0H-72E7H: CYL=n, the cylinders: the operand of LD DE,0000H at 6E6DH.
72E8H-72EFH
8 bytes
DEFM "C " / DEFW 6E6EH
72E8H-72EFH: C, the short form of CYL: 6E6EH.
72F0H-72F7H
8 bytes
DEFM "STEP " / DEFW 6E73H
72F0H-72F7H: STEP=n, the bootstrap step rate: the operand of LD DE,FF00H at 6E72H.
72F8H-72FFH
8 bytes
DEFM "ABS " / DEFW 71C4H
72F8H-72FFH: ABS, no question for a diskette that holds data: the operand of LD DE,0000H at 71C3H.
7300H-7307H
8 bytes
DEFM "A " / DEFW 71C4H
7300H-7307H: A, the short form of ABS: 71C4H.
7308H-730FH
8 bytes
DEFM "QUERY " / DEFW 6FACH
7308H-730FH: QUERY, ask the questions (FFFFH) or not (0000H): the operand of LD DE,FFFFH at 6FABH.
7310H-7317H
8 bytes
DEFM "Q " / DEFW 6FACH
7310H-7317H: Q, the short form of QUERY: 6FACH.
7318H-731FH
8 bytes
DEFM "SYSTEM" / DEFW 620FH
7318H-731FH: SYSTEM, cylinder 0 in single density on a double density diskette, or only the system information: the operand of LD HL,0000H at 620EH.
7320H-7327H
8 bytes
DEFM "WAIT " / DEFW 6126H
7320H-7327H: WAIT=n, a wait after each step: the operand of LD BC,0000H at 6125H.
7328H-732FH
8 bytes
DEFM "W " / DEFW 6126H
7328H-732FH: W, the short form of WAIT: 6126H.
7330H-7337H
8 bytes
DEFM "DIR " / DEFW 6256H
7330H-7337H: DIR=n, the cylinder of the directory: the operand of LD BC,0000H at 6255H.
7338H-733FH
8 bytes
DEFM "D " / DEFW 6256H
7338H-733FH: D, the short form of DIR: 6256H.
7340H
1 byte
DEFB 00H
7340H: 00H, the end of the table: @PARAM stops here.
7341H-7342H
2 bytes
DEFB 1CH, 1FH
7341H-7342H: 1CH, the cursor to the top left, and 1FH, clear to the end of the screen: the start of the banner (6E01H).
7343H-7376H
52 bytes
DEFM "FORMAT - LDOS Disk Formatter Program - Version 5.3.1"
7343H-7376H: the name and the version of the program.
7377H
1 byte
DEFB 0AH
7377H: 0AH, a new line: the copyright goes on the next line.
7378H-73A8H
49 bytes
DEFM "Copyright 1991 MISOSYS, Inc., All rights reserved"
7378H-73A8H: the copyright line of the program, Copyright 1991 MISOSYS, Inc.
73A9H-73AAH
2 bytes
DEFB 0AH, 0DH
73A9H-73AAH: 0AH, a new line, and 0DH, the end of the banner.
73ABH-73D3H
41 bytes
DEFM "Insufficient memory for specified format!"
73ABH-73D3H: the text of 7161H, when HIGH$ leaves no room for the track.
73D4H
1 byte
DEFB 0DH
73D4H: 0DH, the end of the line and of the text.
73D5H-73F0H
28 bytes
DEFM "Which drive is to be used ? "
73D5H-73F0H: the question of 6E7CH, when no :d is on the command line.
73F1H
1 byte
DEFB 03H
73F1H: 03H, the end of the question: the cursor stays for the reply.
73F2H-7401H
16 bytes
DEFM "Diskette name ? "
73F2H-7401H: the question of 6F05H, for the diskette name.
7402H
1 byte
DEFB 03H
7402H: 03H, the end of the question: the cursor stays for the reply.
7403H-7414H
18 bytes
DEFM "Master password ? "
7403H-7414H: the question of 6F43H, for the master password.
7415H
1 byte
DEFB 03H
7415H: 03H, the end of the question: the cursor stays for the reply.
7416H-743BH
38 bytes
DEFM "Special non-standard format desired ? "
7416H-743BH: a question that no code of the file displays.
743CH
1 byte
DEFB 03H
743CH: 03H, the end of the question that no code displays.
743DH-7452H
22 bytes
DEFM "Number of cylinders ? "
743DH-7452H: the question of 7024H, for a 5 inch floppy.
7453H
1 byte
DEFB 03H
7453H: 03H, the end of the question: the cursor stays for the reply.
7454H-7487H
52 bytes
DEFM "Boot strap stepping rate <6, 12, 20, 30/40 msecs> ? "
7454H-7487H: the question of 705DH, for a 5 inch drive.
7488H
1 byte
DEFB 03H
7488H: 03H, the end of the question: the cursor stays for the reply.
7489H-74BAH
50 bytes
DEFM "Bootstrap stepping rate <3, 6, 10, 15/20 msecs> ? "
7489H-74BAH: the question of 7087H, for an 8 inch drive.
74BBH
1 byte
DEFB 03H
74BBH: 03H, the end of the question: the cursor stays for the reply.
74BCH-74D9H
30 bytes
DEFM "Enter number of sides <1,2> ? "
74BCH-74D9H: the question of 6FF9H, for the number of sides.
74DAH
1 byte
DEFB 03H
74DAH: 03H, the end of the question: the cursor stays for the reply.
74DBH-74FBH
33 bytes
DEFM "Single or Double density <S,D> ? "
74DBH-74FBH: the question of 6FBFH, for the density.
74FCH
1 byte
DEFB 03H
74FCH: 03H, the end of the question: the cursor stays for the reply.
74FDH-750CH
16 bytes
DEFM "Drive not ready!"
74FDH-750CH: the text of 7131H, when the controller's status shows NOT READY.
750DH
1 byte
DEFB 0DH
750DH: 0DH, the end of the line and of the text.
750EH-7522H
21 bytes
DEFM "Write protected disk!"
750EH-7522H: the text of 7146H, for a write protected diskette or drive.
7523H
1 byte
DEFB 0DH
7523H: 0DH, the end of the line and of the text.
7524H-7537H
20 bytes
DEFM "Drive not in system!"
7524H-7537H: the text of 7139H, when the head is not on track 0 after a Restore.
7538H
1 byte
DEFB 0DH
7538H: 0DH, the end of the line and of the text.
7539H-7561H
41 bytes
DEFM "Load destination diskette and hit <ENTER>"
7539H-7561H: the text of 7100H, for drive 0 and when no diskette turns.
7562H
1 byte
DEFB 0DH
7562H: 0DH, the end of the line and of the text.
7563H
1 byte
DEFB 0AH
7563H: 0AH, a new line: the start of the text of 7235H.
7564H-757BH
24 bytes
DEFM "Invalid Master Password!"
7564H-757BH: the text of 7235H, for a password with other characters than letters and digits.
757CH-757DH
2 bytes
DEFB 0AH, 0DH
757CH-757DH: 0AH, a new line, and 0DH, the end of the text.
757EH-7593H
22 bytes
DEFM "Disk contains data -- "
757EH-7593H: the text of 717BH, followed on the line by one of the four texts below.
7594H
1 byte
DEFB 03H
7594H: 03H, the end of the text: the cursor stays at its end.
7595H-75A7H
19 bytes
DEFM "Non-standard format"
7595H-75A7H: the text of 7181H, for a diskette whose directory cylinder is not below the highest cylinder.
75A8H
1 byte
DEFB 0DH
75A8H: 0DH, the end of the line and of the text.
75A9H-75BCH
20 bytes
DEFM "Unreadable directory"
75A9H-75BCH: the text of 719BH, for a directory sector 0 without the deleted data mark.
75BDH
1 byte
DEFB 0DH
75BDH: 0DH, the end of the line and of the text.
75BEH-75D6H
25 bytes
DEFM "Non-initialized directory"
75BEH-75D6H: the text of 71A0H, for a directory whose date has no slash.
75D7H
1 byte
DEFB 0DH
75D7H: 0DH, the end of the line and of the text.
75D8H-75DCH
5 bytes
DEFM "Name="
75D8H-75DCH: Name=, the start of the text of 71BDH.
75DDH-75E4H
8 bytes
DEFM "XXXXXXXX"
75DDH-75E4H: eight X in the file; 71B3H copies the diskette's name here.
75E5H-75EBH
7 bytes
DEFM " Date="
75E5H-75EBH: two spaces and Date=, between the name and the date.
75ECH-75F3H
8 bytes
DEFM "MM/DD/YY"
75ECH-75F3H: MM/DD/YY in the file; 71BBH copies the diskette's date here.
75F4H
1 byte
DEFB 0DH
75F4H: 0DH, the end of the line and of the text.
75F5H-761CH
40 bytes
DEFM "*** The target drive is a hard disk! ***"
75F5H-761CH: the first line of the text of 61FCH.
761DH
1 byte
DEFB 0AH
761DH: 0AH, a new line between the two lines of the text.
761EH-7642H
37 bytes
DEFM "Are you sure you want to format it ? "
761EH-7642H: the question of 61FCH and, on its own, of 71D1H.
7643H
1 byte
DEFB 03H
7643H: 03H, the end of the question: the cursor stays for the reply.
7644H-764BH
8 bytes
DEFM "LDOSDISK"
7644H-764BH: LDOSDISK, the default diskette name (6EE6H). The 1992 manual (M-40-060) gives DOSDISK.
764CH-7653H
8 bytes
DEFM "PASSWORD"
764CH-7653H: PASSWORD, the default master password (6F29H).
7654H-7673H
32 bytes
DEFB 00H x 32
7654H-7673H: 32 bytes of 00H at the end of the file. No code addresses them.

Operands Changed While It Runs

Address
Size
Contents
6014H-6015H
2 bytes
The operand of LD DE,0000H at 6013H: the address of the template (650EH).
60A5H-60A6H
2 bytes
The operand of LD BC,0000H at 60A4H: the place in the order of the sectors where the next cylinder starts (602BH, 60D2H, 6103H).
60FDH
1 byte
The operand of LD A,00H at 60FCH: the skew (6028H).
610DH
1 byte
The opcode of JR Z,612EH: 18H (JR) for the second pass over cylinder 0 (61B1H).
6126H-6127H
2 bytes
The operand of LD BC,0000H at 6125H: WAIT=n, stored by @PARAM.
6156H-6157H
2 bytes
The operand of LD BC,0000H at 6155H: the list of the sectors in the order of the verify (6085H).
615AH
1 byte
The operand of ADD A,00H at 6159H: 00H for side 0, the sectors on a track for side 1 (6152H, 6176H).
6164H
1 byte
The operand of LD A,00H at 6163H: the sectors of the cylinder verified (614FH, 6166H).
6184H-6185H
2 bytes
JR NZ,611EH; 18H 3EH (JR 61C4H) for the second pass over cylinder 0 (61B8H).
61C5H-61C6H
2 bytes
The operand of LD HL,0000H at 61C4H: the sectors on a cylinder and on a track of the main format (61BEH).
620FH-6210H
2 bytes
The operand of LD HL,0000H at 620EH: SYSTEM, FFFFH when given.
6256H-6257H
2 bytes
The operand of LD BC,0000H at 6255H: DIR=n.
6334H
1 byte
The operand of OR 00H at 6333H: 10H (cylinder 0 single density) after the SYSTEM pass (61ACH).
63C2H
1 byte
The operand of LD A,00H at 63C1H: the granules on a track less one (632DH).
6441H
1 byte
The operand of LD A,00H at 6440H: the byte of 4012H (600BH), 00H until the engine runs.
648CH
1 byte
The operand of LD C,FFH at 648BH: the target drive (6E51H, 6E98H), FFH until it is known.
6558H, 655AH, 655BH
1 byte each
The ending record number (63BEH), the cylinder (62A8H, 63D1H) and the granules (63CBH) of DIR/SYS's record.
6760H-6761H
2 bytes
The two digits of the directory cylinder in the text at 673BH (628EH).
6B02H, 6BBCH
1 byte each
Boot sector 0: the directory cylinder (62B1H) and the Seek command with the step rate (62BFH).
6C02H, 6C10H
1 byte each
Boot sector 1: the directory cylinder (62DEH) and the step rate (62ECH).
6E5FH-6E60H, 6E64H-6E65H
2 bytes each
The operands of LD DE,0000H at 6E5EH and 6E63H: SDEN and DDEN, FFFFH when given.
6E69H-6E6AH, 6E6EH-6E6FH
2 bytes each
The operands of LD DE,0000H at 6E68H and 6E6DH: SIDES=n and CYL=n.
6E73H-6E74H
2 bytes
The operand of LD DE,FF00H at 6E72H: STEP=n; 6E73H the default rate (6E29H), 6E74H FFH until STEP is given.
6EDCH-6EDDH
2 bytes
The operand of LD HL,0000H at 6EDBH: NAME (@PARAM, or the QUERY value from 6EA6H).
6F1FH-6F20H
2 bytes
The operand of LD HL,0000H at 6F1EH: MPW (@PARAM, or the QUERY value from 6EB1H).
6FA7H
1 byte
The operand of LD A,00H at 6FA6H: not 0 when SDEN, DDEN, SIDES, CYL or STEP was given (6E77H).
6FACH-6FADH
2 bytes
The operand of LD DE,FFFFH at 6FABH: QUERY, 0000H for Q=N.
6FDAH-6FDBH, 6FEAH-6FEBH
2 bytes each
The operands of LD HL,0000H at 6FD9H and 6FE9H: the double and the single density descriptor of the drive's size (6F88H, 6F83H).
7031H
1 byte
The operand of LD A,00H at 7030H: the default cylinders of the drive (6EC3H).
7156H-7157H
2 bytes
The operand of LD DE,0000H at 7155H: the memory the track takes (651FH).
71C4H-71C5H
2 bytes
The operand of LD DE,0000H at 71C3H: ABS, FFFFH when given.
75DDH-75E4H, 75ECH-75F3H
8 bytes each
The name and the date of a diskette that holds data, in the text at 75D8H (71B3H, 71BBH).

Memory Outside the File That FORMAT Uses

Address
Size
Contents
6000H-6009H
10 bytes
After the format the first bytes of the engine hold a copy of the working table (618FH), with the directory cylinder at 6009H (6288H); 6302H copies it back.
6564H-656DH
10 bytes
The working drive code table, Index Register IY: +00H-+02H the JP to the driver, +03H the flags (bits 1-0 step rate, bit 3 hard disk, bit 4 side 1, bit 5 8 inch, bit 6 double density, bit 7 write protect), +04H (bits 3-0 the select lines, bit 4 no track writing, bit 5 two sides, bit 6 the controller can do double density), +05H the cylinder the head is on, +06H the highest cylinder, +07H the highest sector and the heads less one, +08H the granules and the sectors of a granule less one, +09H the directory cylinder.
656FH-6570H
2 bytes
The sectors on a cylinder and on a track of the format.
6A00H-6ACAH
203 bytes
The allocation table image: 6A00H-6A5FH a byte for each cylinder (70E6H), FFH after the last; 6A60H-6ABFH the lock out table; 6AC0H-6ACAH FFH.
6D00H-6DFFH
256 bytes
The address of each sector's ID field in the track (6039H), ended by 0000H; afterwards the buffer of the replies and of the sectors written (634BH-6418H) and read (7167H-71BBH).
6E00H-
up to 10673 bytes
The track built by 6013H, over the front end, and 256 bytes of FFH after it.
7265H-726EH
10 bytes
The working table saved during the checks of the diskette (7123H, 71E6H).
726FH-7276H
8 bytes
The highest cylinder of drives 0-7 from the system information sector (6E35H).

Disassembly

6000H - The Format Engine: Entry

The front end ends with JP 6000H (71EBH) after it has put the drive code table of the target drive, with every choice made, into the working copy at 6564H-656DH and pointed Index Register IY at it. A drive whose table has bit 4 of +04H set gets no tracks written (61FCH). For every other drive the clock interrupt is shut out: the byte at 4012H, the JP of the interrupt vector, becomes a RET until 6440H puts it back.

6000
BIT 4,(IY+04H) FD CB 04 66
Test bit 4 of +04H of the working drive code table at Index Register IY (6568H): set for a drive whose driver FORMAT does not lay tracks on (SYS2/SYS's @CKDRV skips its index pulse test for such a drive too).
6004
If the NZ FLAG is set (bit 4 of +04H is set), JUMP to 61FCH: no track is written; only the system information goes onto the drive.
6007
DI F3
Disable interrupts: the clock interrupt must not take the processor away while a track is written byte by byte.
6008
LD A,(4012H) 3A 12 40
Fetch the byte at 4012H into Register A: C3H, the JP of the interrupt vector (ROM 0038H jumps to 4012H, which jumps to the interrupt service routine at 4518H).
600B
LD (6441H),A 32 41 64
Store Register A (the byte from 4012H) at 6441H, the operand of LD A,00H at 6440H, so that 6440H can put it back at the end.
600E
LD A,C9H 3E C9
Load Register A with C9H, the opcode of RET, for the interrupt vector at 4012H.
6010
LD (4012H),A 32 12 40
Store Register A (C9H, RET) at 4012H. The driver's read and write engine enables interrupts after each transfer (46D7H); an interrupt taken then runs this RET instead of the service routine, and interrupts stay off until the next EI. The clock does not count meanwhile.

6013H - Expand the Track Template

The template (one of four, 6589H-66D2H, chosen by 650AH) is a byte stream that describes one track: byte 0 the sectors on a track, byte 1 the skew from one cylinder to the next, then the table of the order of the sectors on the track (the skew plus 1 plus the sectors on a track bytes), then the codes that build the track. 01H-F0H (and F6H-FFH, 00H = 256) put the next byte that many times into the track; F1H starts the part repeated once for every sector, F2H ends it; F3H notes where the next sector's ID field is (cylinder, side, sector); F5H puts a pair of bytes the count after it times; F4H ends the template. The track is built from 6E00H up, over the front end, which has finished; the address of every ID field goes into the table at 6D00H. The SYSTEM parameter comes back here (61C1H) for cylinder 0.

6013
LD DE,0000H 11 00 00
Load Register Pair DE with the address of the template: the operand 6014H-6015H, 0000H in the file, stored by 650EH from the first word of the track descriptor (6589H, 65C9H, 6623H or 6668H).
6016
LD A,(DE) 1A
Fetch byte 0 of the template at Register Pair DE into Register A: the sectors on a track (10, 18, 16 or 30).
6017
INC DE 13
INCrement Register Pair DE to byte 1 of the template.
6018
LD (6570H),A 32 70 65
Store Register A (the sectors on a track) at 6570H, where 606CH takes it as the count of the repeated part and the verify pass at 6170H reads it.
601B
LD B,A 47
Copy Register A (the sectors on a track) into Register B, for working out where the table of the sector order ends.
601C
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of +04H of the working drive code table at Index Register IY (6568H): set for a drive with two sides.
6020
If the Z FLAG is set (one side), JUMP to 6023H with Register A = the sectors on a track.
6022
ADD A,A 87
Double Register A (ADD A,A): a cylinder of two sides has the sectors on a track twice.
6023
LD (656FH),A 32 6F 65
Store Register A (the sectors on a cylinder) at 656FH, read by the verify pass (616AH), the directory sizing (63B2H) and the loop that writes the directory sectors (6414H).
6026
LD A,(DE) 1A
Fetch byte 1 of the template at Register Pair DE into Register A: the skew, the number of places the order of the sectors moves on from one cylinder to the next (7, 13, 2 or 3).
6027
INC DE 13
INCrement Register Pair DE to byte 2 of the template, the first byte of the table of the sector order.
6028
LD (60FDH),A 32 FD 60
Store Register A (the skew) at 60FDH, the operand of LD A,00H at 60FCH, which moves the pointer into the table on after every cylinder.
602B
LD (60A5H),DE ED 53 A5 60
Store Register Pair DE (the address of the table of the sector order) at 60A5H-60A6H, the operand of LD BC,0000H at 60A4H: the first cylinder starts at the head of the table.
602F
INC A 3C
INCrement Register A (the skew): the skew plus 1.
6030
ADD A,B 80
ADD Register B (the sectors on a track) to Register A: the length of the table of the sector order, the skew plus 1 plus the sectors on a track.
6031
ADD A,E 83
ADD Register E (the low byte of the address of the table) to Register A: the low byte of the address after the table; the CARRY FLAG is the carry into the high byte.
6032
LD E,A 5F
Copy Register A (the low byte of the address after the table) into Register E.
6033
ADC A,D 8A
ADD Register D (the high byte of the address of the table) and the CARRY FLAG to Register A.
6034
SUB E 93
SUBtract Register E from Register A: Register A = Register D plus the carry, the high byte of the address after the table.
6035
LD D,A 57
Copy Register A (the high byte) into Register D. Register Pair DE now points to the first code of the stream that builds the track.
6036
LD HL,6E00H 21 00 6E
Point Register Pair HL to 6E00H, where the track is built: the front end's code, which has finished.
6039
LD BC,6D00H 01 00 6D
Point Register Pair BC to 6D00H, the table that gets the address of every sector's ID field in the track.
603C
LD A,(DE) 1A
Fetch the next code of the stream at Register Pair DE into Register A.
603D
INC DE 13
INCrement Register Pair DE past the code, to the byte after it in the template.
603E
CP F1H FE F1
Compare Register A (the code) against F1H, the start of the part repeated for every sector.
6040
If the Z FLAG is set (F1H), JUMP to 606CH to start the repeated part.
6042
CP F2H FE F2
Compare Register A (the code) against F2H, the end of the repeated part.
6044
If the Z FLAG is set (F2H), JUMP to 6073H to count one sector and go round again.
6046
CP F3H FE F3
Compare Register A (the code) against F3H: the next three bytes of the track are an ID field's cylinder, side and sector.
6048
If the Z FLAG is set (F3H), JUMP to 607DH to note the address of the ID field.
604A
CP F4H FE F4
Compare Register A (the code) against F4H, the end of the template.
604C
If the Z FLAG is set (F4H), JUMP to 6085H to finish the track.
604E
CP F5H FE F5
Compare Register A (the code) against F5H, a pair of bytes to put into the track a number of times. The flags stay as this CP leaves them through the PUSH below.
6050
PUSH BC C5
Save Register Pair BC (the pointer into the table at 6D00H) to the stack: both loops below count in Register B.
6051
If the NZ FLAG is set (any other code: a count of bytes), JUMP to 6062H to put one byte that many times.
6053
LD A,(DE) 1A
Fetch the count after F5H at Register Pair DE into Register A.
6054
INC DE 13
INCrement Register Pair DE to the first byte of the pair.
6055
LD B,A 47
Copy Register A (the count of pairs) into Register B for the DJNZ below: 00H counts 256.
6056
LD A,(DE) 1A
Fetch the first byte of the pair at Register Pair DE into Register A.
6057
INC DE 13
INCrement Register Pair DE to the second byte of the pair.
6058
LD C,A 4F
Copy Register A (the first byte of the pair) into Register C.
6059
LD A,(DE) 1A
Fetch the second byte of the pair at Register Pair DE into Register A. Register Pair DE stays on it: 6069H moves it on.
605A
LD (HL),C 71
Store Register C (the first byte of the pair) into the track at Register Pair HL.
605B
INC HL 23
INCrement Register Pair HL to the next byte of the track.
605C
LD (HL),A 77
Store Register A (the second byte of the pair) into the track at Register Pair HL.
605D
INC HL 23
INCrement Register Pair HL to the next byte of the track.
605E
DECrement Register B (the pairs left) and LOOP BACK to 605AH until it reaches 0.
6060
JUMP to 6068H to take back the pointer into the table at 6D00H and move Register Pair DE past the pair.
6062
LD B,A 47
Copy Register A (the code: the count of bytes) into Register B for the DJNZ below: 00H counts 256 (the 256 bytes of a sector's data field take two bytes of the template).
6063
LD A,(DE) 1A
Fetch the byte to put into the track at Register Pair DE into Register A. Register Pair DE stays on it: 6069H moves it on.
6064
LD (HL),A 77
Store Register A (the byte) into the track at Register Pair HL.
6065
INC HL 23
INCrement Register Pair HL to the next byte of the track.
6066
DECrement Register B (the bytes left) and LOOP BACK to 6064H until it reaches 0.
6068
POP BC C1
Restore Register Pair BC (the pointer into the table at 6D00H) from the stack.
6069
INC DE 13
INCrement Register Pair DE past the last byte of the item, to the next code of the stream.
606A
LOOP BACK to 603CH for the next code of the template, with Register Pair DE on it.
606C
LD A,(6570H) 3A 70 65
Fetch the sectors on a track from 6570H (stored at 6018H) into Register A: the number of times the repeated part is put into the track.
606F
PUSH DE D5
Save Register Pair DE (the address of the code after F1H, the start of the repeated part) to the stack.
6070
PUSH AF F5
Save Register Pair AF (Register A = the times the part is still to be put) to the stack above it.
6071
JUMP to 603CH to build the repeated part once.
6073
POP AF F1
Restore Register Pair AF from the stack: Register A = the times the repeated part was still to be put.
6074
DEC A 3D
DECrement Register A, the times the repeated part is still to be put: one sector is built.
6075
If the Z FLAG is set (every sector of the track is built), JUMP to 607AH to drop the start address of the part.
6077
POP DE D1
Restore Register Pair DE from the stack: the start of the repeated part, to build it again.
6078
LOOP BACK to 606FH to save the start and the new count again and build the next sector.
607A
POP AF F1
Restore Register Pair AF from the stack: this only drops the start address of the repeated part saved at 606FH.
607B
JUMP to 603CH for the code after F2H, the rest of the template after the repeated part.
607D
LD A,L 7D
Copy Register L (the low byte of the address in the track at Register Pair HL, where the ID field's cylinder byte goes next) into Register A.
607E
LD (BC),A 02
Store Register A (the low byte) into the table at Register Pair BC.
607F
INC BC 03
INCrement Register Pair BC to the next byte of the table.
6080
LD A,H 7C
Copy Register H (the high byte of the address in the track) into Register A.
6081
LD (BC),A 02
Store Register A (the high byte) into the table at Register Pair BC: one word, the address of this sector's ID field.
6082
INC BC 03
INCrement Register Pair BC to the next word of the table.
6083
JUMP to 603CH for the next code: the template goes on with three bytes for the cylinder, side and sector, which 60B2H-60CDH fill in for each cylinder.
6085
LD (6156H),DE ED 53 56 61
Store Register Pair DE (the address after the F4H code: the list of the sectors in the order the verify pass reads them) at 6156H-6157H, the operand of LD BC,0000H at 6155H.
6089
XOR A AF
Set Register A to 00H (XOR A), for the word 0000H that ends the table at 6D00H.
608A
LD (BC),A 02
Store Register A (00H) into the table at Register Pair BC: the low byte of the word 0000H that ends the table.
608B
INC BC 03
INCrement Register Pair BC to the high byte of the word that ends the table.
608C
LD (BC),A 02
Store Register A (00H) into the table at Register Pair BC: the table ends with 0000H, which 60AFH tests.
608D
LD B,00H 06 00
Load Register B with 00H: the DJNZ below counts 256.
608F
LD A,FFH 3E FF
Load Register A with FFH, the byte put after the track.
6091
LD (HL),A 77
Store Register A (FFH) into the track at Register Pair HL.
6092
INC HL 23
INCrement Register Pair HL to the next byte after the track in the buffer.
6093
DECrement Register B and LOOP BACK to 6091H until 256 bytes of FFH follow the track: the Write Track command takes bytes until the index pulse, so a track that turns longer than the template still gets FFH bytes.

6095H - Format Every Cylinder

The track in the buffer at 6E00H is complete except for the cylinder, side and sector bytes of each ID field. For each cylinder, from the one the head is on (cylinder 0 after the Restore at 71E8H) to the highest (+06H of the table), and for each side, the ID fields are filled in, the track is written, and the head steps in one cylinder. The order of the sectors comes from the table of the template; Register Pair BC moves on through it from side to side and cylinder to cylinder, so each cylinder starts its order further on by the skew, and by one place more on a drive with two sides.

6095
LD HL,66D2H 21 D2 66
Point Register Pair HL to 66D2H, the text 1DH (the cursor to the start of its line), Formatting cylinder and three spaces, ended by 03H so the cursor stays at its end.
6098
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (66D2H). The cylinder number is written over its last two spaces for each cylinder.
609B
LD A,(IY+05H) FD 7E 05
Fetch +05H of the working drive code table at Index Register IY (6569H) into Register A: the cylinder the head is on, kept by the driver (0 after a Restore, plus 1 for each Step In). 6124H returns here for every cylinder.
609E
GOSUB to 64B5H to turn Register A (the cylinder) into two digits: Register C = the tens digit, Register B = the units digit.
60A1
GOSUB to 64E9H to go back two places on the screen and display Register C and Register B, the cylinder number, over the last two characters of the line.
60A4
LD BC,0000H 01 00 00
Load Register Pair BC with the pointer into the table of the sector order: the operand 60A5H-60A6H, 0000H in the file, stored by 602BH (the head of the table) and after every side and cylinder (60D2H, 6103H).
60A7
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the table of the addresses of the ID fields in the track. Side 1 comes back here (60F6H).
60AA
LD E,(HL) 5E
Fetch the low byte of the next address of the table at Register Pair HL into Register E.
60AB
INC HL 23
INCrement Register Pair HL to the high byte of the address.
60AC
LD D,(HL) 56
Fetch the high byte of the address at Register Pair HL into Register D: Register Pair DE = the address of an ID field's cylinder byte in the track.
60AD
INC HL 23
INCrement Register Pair HL to the next word of the table at 6D00H.
60AE
LD A,D 7A
Copy Register D (the high byte of the address) into Register A.
60AF
OR E B3
OR Register E (the low byte) into Register A: the Z FLAG is set by the word 0000H that ends the table (608AH).
60B0
If the Z FLAG is set (every ID field of the track is filled in), JUMP to 60D2H to keep the pointer and write the track.
60B2
LD A,(IY+05H) FD 7E 05
Fetch +05H of the working drive code table at Index Register IY (6569H) into Register A: the cylinder the head is on.
60B5
LD (DE),A 12
Store Register A (the cylinder) into the ID field at Register Pair DE: its cylinder byte.
60B6
INC DE 13
INCrement Register Pair DE to the ID field's side byte.
60B7
LD A,(IY+03H) FD 7E 03
Fetch +03H of the working drive code table at Index Register IY (6567H) into Register A: the drive's flags, bit 4 the side the next write goes to.
60BA
AND 10H E6 10
Mask Register A to bit 4 (AND 10H), the side bit: 00H for side 0, 10H for side 1.
60BC
RRCA 0F
Rotate Register A (the side bit) right one place, from bit 4 to bit 3.
60BD
RRCA 0F
Rotate Register A (the side bit) right one place, from bit 3 to bit 2.
60BE
RRCA 0F
Rotate Register A (the side bit) right one place, from bit 2 to bit 1.
60BF
RRCA 0F
Rotate Register A (the side bit) right one place, from bit 1 to bit 0: Register A = 00H for side 0 or 01H for side 1.
60C0
LD (DE),A 12
Store Register A (the side, 00H or 01H) into the ID field at Register Pair DE: its side byte.
60C1
INC DE 13
INCrement Register Pair DE to the ID field's sector byte.
60C2
LD A,(BC) 0A
Fetch the entry of the table of the sector order at Register Pair BC into Register A: a sector number (bit 7 clear), or the negative number of the sectors on a track (bit 7 set) after the last sector number.
60C3
OR A B7
Set the flags from Register A (OR A): the S FLAG is bit 7 of the entry.
60C4
If the P FLAG is set (bit 7 clear: a sector number), JUMP to 60CCH to use it.
60C7
ADD A,C 81
ADD Register C (the low byte of the pointer) to Register A (the negative count, for example F6H, minus 10): the low byte of the pointer moved back by the sectors on a track. The CARRY FLAG is set when the high byte stays.
60C8
LD C,A 4F
Copy Register A (the new low byte) into Register C.
60C9
If the CARRY FLAG is set (no borrow from the high byte), JUMP to 60CCH: Register Pair BC is moved back.
60CB
DEC B 05
DECrement Register B, the high byte of the pointer, for the borrow: Register Pair BC is moved back by the sectors on a track.
60CC
LD A,(BC) 0A
Fetch the entry at Register Pair BC into Register A: the sector number for this ID field.
60CD
LD (DE),A 12
Store Register A (the sector number) into the ID field at Register Pair DE: its sector byte.
60CE
INC DE 13
INCrement Register Pair DE past the ID field. Register Pair DE is loaded again from the table for the next one.
60CF
INC BC 03
INCrement Register Pair BC, the pointer into the table of the sector order, to the next sector.
60D0
LOOP BACK to 60AAH for the next ID field, with Register Pair HL on the next word of the table at 6D00H.
60D2
LD (60A5H),BC ED 43 A5 60
Store Register Pair BC (the pointer into the table of the sector order after this side) at 60A5H-60A6H, the operand of LD BC,0000H at 60A4H.

60D6H - Write the Track, the Second Side, Step In

The track goes to the drive through the driver's Write Track (function 0FH). On a drive with two sides the same buffer is written again on side 1, its ID fields filled in again: the side byte 01H, and the sector numbers from one place further on in the order table (60F5H). Then the pointer into the table of the sector order moves on by the skew, and, until the highest cylinder is written, the head steps in one cylinder and the loop goes round again at 609BH through the wait at 611EH.

60D6
LD D,(IY+05H) FD 56 05
Fetch +05H of the working drive code table at Index Register IY (6569H) into Register D: the cylinder the head is on. The driver writes Register D to the controller's track register before the command (46BAH).
60D9
GOSUB to 6463H, the driver's function 01H, to select the drive with the side in bit 4 of +03H (the side select line of the latch at 37E1H).
60DC
LD HL,6E00H 21 00 6E
Point Register Pair HL to 6E00H, the track built by 6013H, the buffer of the Write Track.
60DF
GOSUB to 6473H, the driver's function 0FH, Write Track: the command F4H, the bytes from Register Pair HL until the next index pulse. The Z FLAG on success, else Register A = the error number.
60E2
If the NZ FLAG is set (the write failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A through @ERROR.
60E5
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of +04H of the working drive code table at Index Register IY (6568H): set for a drive with two sides.
60E9
If the Z FLAG is set (one side), JUMP to 60F8H: the cylinder is done.
60EB
BIT 4,(IY+03H) FD CB 03 66
Test bit 4 of +03H of the working drive code table at Index Register IY (6567H): set while side 1 is written.
60EF
If the NZ FLAG is set (side 1 was just written), JUMP to 60F8H: both sides are done.
60F1
SET 4,(IY+03H) FD CB 03 E6
Set bit 4 of +03H of the working drive code table at Index Register IY (6567H): the next select and the side bytes of the ID fields are for side 1.
60F5
INC BC 03
INCrement Register Pair BC, the pointer into the table of the sector order: side 1 starts its order one place further on than where side 0 ended.
60F6
LOOP BACK to 60A7H to fill in the ID fields for side 1 and write the track again.
60F8
RES 4,(IY+03H) FD CB 03 A6
Reset bit 4 of +03H of the working drive code table at Index Register IY (6567H): side 0 for the next cylinder.
60FC
LD A,00H 3E 00
Load Register A with the skew: the operand 60FDH, 00H in the file, stored by 6028H from byte 1 of the template.
60FE
ADD A,C 81
ADD Register C (the low byte of the pointer into the table of the sector order) to Register A (the skew); the CARRY FLAG is the carry into the high byte.
60FF
LD C,A 4F
Copy Register A (the new low byte) into Register C.
6100
ADC A,B 88
ADD Register B (the high byte of the pointer) and the CARRY FLAG to Register A.
6101
SUB C 91
SUBtract Register C from Register A: Register A = Register B plus the carry, the new high byte.
6102
LD B,A 47
Copy Register A (the new high byte) into Register B: Register Pair BC has moved on by the skew.
6103
LD (60A5H),BC ED 43 A5 60
Store Register Pair BC (the pointer, moved on by the skew) at 60A5H-60A6H, the operand of LD BC,0000H at 60A4H, for the next cylinder.
6107
LD A,(IY+05H) FD 7E 05
Fetch +05H of the working drive code table at Index Register IY (6569H) into Register A: the cylinder just written.
610A
CP (IY+06H) FD BE 06
Compare Register A (the cylinder just written) against +06H of the working drive code table at Index Register IY (656AH), the highest cylinder.
610D
If the Z FLAG is set (the highest cylinder is written), JUMP to 612EH to verify. 61B1H changes the opcode at 610DH to 18H (JR) for the second pass over cylinder 0 that SYSTEM asks for, so that pass always ends after one cylinder.
610F
LD BC,0090H 01 90 00
Load Register Pair BC with 0090H (144), the count of the wait below.
6112
GOSUB to 0060H, the ROM's delay, to count Register Pair BC (144) down to 0 before the head steps.
6115
GOSUB to 646BH, the driver's function 05H, Step In: +05H (6569H) goes up by 1 and the command 58H steps the head in at the drive's rate.
6118
If the NZ FLAG is set (the driver gave an error), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
611B
LD BC,609BH 01 9B 60
Load Register Pair BC with 609BH, the start of the loop over the cylinders, the address the tail below returns to. The verify pass comes to 611EH with 613EH in Register Pair BC (6181H).
611E
GOSUB to 646FH, the driver's function 07H: wait until the controller is not busy (the Step In or the Restore is finished).
6121
If the NZ FLAG is set (the driver gave an error), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
6124
PUSH BC C5
Save Register Pair BC (609BH, or 613EH for the verify pass) to the stack: the RET below, or the RET of the ROM's delay, goes there.
6125
LD BC,0000H 01 00 00
Load Register Pair BC with the WAIT parameter: the operand 6126H-6127H, 0000H in the file, stored by @PARAM for WAIT=n (the table entries WAIT and W at 72A8H).
6128
LD A,B 78
Copy Register B (the high byte of the WAIT count) into Register A.
6129
OR C B1
OR Register C (the low byte) into Register A: the Z FLAG is set when no WAIT was given.
612A
RET Z C8
If the Z FLAG is set (no WAIT), RETurn to the address saved at 6124H (609BH or 613EH).
612B
JUMP to 0060H, the ROM's delay: Register Pair BC (the WAIT count) is counted down to 0 and its RET goes to the address saved at 6124H.

612EH - Verify Every Cylinder

Every sector of every cylinder is read back with the driver's Verify (function 0AH), in the order of the list after the template's F4H code (6085H): every second sector around the track, so that each read has the time of one sector before the next comes under the head. Register D is the cylinder; the driver seeks it for each sector. A cylinder with a sector that is not found or fails its CRC is marked with an asterisk on the screen and gets FFH in its byte of the allocation table at 6A00H (no granule free); any other error ends the format.

612E
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, to end the line of the cylinder numbers.
6130
GOSUB to 0033H, the ROM's routine that displays the character in Register A (0DH): the next text starts on a new line.
6133
GOSUB to 6467H, the driver's function 04H, Restore: +05H (6569H) = 0 and the head goes back to cylinder 0.
6136
LD HL,66EAH 21 EA 66
Point Register Pair HL to 66EAH, the text 1DH (the cursor to the start of its line), Verifying, two spaces, cylinder and three spaces, ended by 03H.
6139
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (66EAH). The cylinder number is written over its last two spaces.
613C
LD D,00H 16 00
Load Register D with 00H: the verify starts at cylinder 0.
613E
LD L,D 6A
Copy Register D (the cylinder to verify) into Register L. The tail at 6124H returns here for every cylinder (6181H).
613F
LD H,6AH 26 6A
Load Register H with 6AH: Register Pair HL = 6A00H + the cylinder, its byte in the allocation table being built.
6141
LD A,(HL) 7E
Fetch the cylinder's byte of the allocation table at Register Pair HL into Register A: a bit set for each granule not free.
6142
INC A 3C
INCrement Register A: the Z FLAG is set when the byte was FFH, no granule of the cylinder free.
6143
If the Z FLAG is set (the byte is FFH), JUMP to 617CH: the cylinder is not read.
6145
LD A,D 7A
Copy Register D (the cylinder) into Register A, for the display.
6146
GOSUB to 64B5H to turn Register A (the cylinder) into two digits: Register C = the tens digit, Register B = the units digit.
6149
PUSH DE D5
Save Register Pair DE (Register D = the cylinder) to the stack across the display.
614A
GOSUB to 64E9H to go back two places on the screen and display Register C and Register B, the cylinder number.
614D
POP DE D1
Restore Register Pair DE from the stack: Register D = the cylinder.
614E
XOR A AF
Set Register A to 00H (XOR A), for the two operands below.
614F
LD (6164H),A 32 64 61
Store Register A (00H) at 6164H, the operand of LD A,00H at 6163H: no sector of this cylinder verified yet.
6152
LD (615AH),A 32 5A 61
Store Register A (00H) at 615AH, the operand of ADD A,00H at 6159H: the sector numbers of side 0 are used as they are.
6155
LD BC,0000H 01 00 00
Point Register Pair BC to the list of the sectors in the order they are verified: the operand 6156H-6157H, 0000H in the file, stored by 6085H (the bytes after the template's F4H code).
6158
LD A,(BC) 0A
Fetch the next sector number of the list at Register Pair BC into Register A.
6159
ADD A,00H C6 00
ADD the side offset to Register A (the sector number): the operand 615AH, 00H for side 0, the sectors on a track for side 1 (6176H). The driver takes a sector number at or above the sectors on a track as one on side 1.
615B
LD E,A 5F
Copy Register A (the sector number) into Register E, the sector for the driver.
615C
GOSUB to 6487H, the driver's function 0AH, Verify: seek cylinder Register D, read sector Register E without storing its bytes. The Z FLAG on success, else Register A = the error number.
615F
If the NZ FLAG is set (the sector failed), JUMP to 61E3H to lock the cylinder out or report the error in Register A.
6162
INC BC 03
INCrement Register Pair BC to the next sector number of the list.
6163
LD A,00H 3E 00
Load Register A with the count of sectors verified on this cylinder: the operand 6164H, set to 00H at 614FH.
6165
INC A 3C
INCrement Register A, the count of sectors verified on this cylinder.
6166
LD (6164H),A 32 64 61
Store Register A (the count) back at 6164H, the operand of LD A,00H at 6163H.
6169
LD E,A 5F
Copy Register A (the count of sectors verified) into Register E.
616A
LD A,(656FH) 3A 6F 65
Fetch the sectors on a cylinder from 656FH (6023H) into Register A.
616D
CP E BB
Compare Register A (the sectors on a cylinder) against Register E (the count verified).
616E
If the Z FLAG is set (every sector of the cylinder is verified), JUMP to 617CH for the next cylinder.
6170
LD A,(6570H) 3A 70 65
Fetch the sectors on a track from 6570H (6018H) into Register A.
6173
CP E BB
Compare Register A (the sectors on a track) against Register E (the count verified): equal when side 0 of a drive with two sides is done.
6174
If the NZ FLAG is set (sectors of this side are left), LOOP BACK to 6158H for the next sector of the list.
6176
LD (615AH),A 32 5A 61
Store Register A (the sectors on a track) at 615AH, the operand of ADD A,00H at 6159H: the sector numbers now count from the first sector of side 1.
6179
INC BC 03
INCrement Register Pair BC. Without effect: 6155H loads Register Pair BC again.
617A
LOOP BACK to 6155H to go through the list again for side 1.
617C
LD A,D 7A
Copy Register D (the cylinder just verified or passed over) into Register A.
617D
INC D 14
INCrement Register D to the next cylinder, which the next Verify seeks.
617E
CP (IY+06H) FD BE 06
Compare Register A (the cylinder just done) against +06H of the working drive code table at Index Register IY (656AH), the highest cylinder.
6181
LD BC,613EH 01 3E 61
Load Register Pair BC with 613EH, the start of the loop over the cylinders, for the tail at 611EH to return to. LD does not change the flags.
6184
If the NZ FLAG is set (cylinders are left), JUMP to 611EH to wait until the controller is not busy, wait the WAIT count and go on at 613EH. 61B8H rewrites the two bytes 6184H-6185H to JR 61C4H for the second pass over cylinder 0 that SYSTEM asks for.
6186
LD HL,6564H 21 64 65
Point Register Pair HL to 6564H, the working drive code table, the source of the copy below.
6189
LD DE,6000H 11 00 60
Point Register Pair DE to 6000H, the destination: the first ten bytes of the engine, which have run and are not run again.
618C
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of a drive code table.
618F
LDIR ED B0
Copy the ten bytes from Register Pair HL (6564H) to Register Pair DE (6000H-6009H), Register Pair BC the count (LDIR): the table as the format left it, for 6302H to put back after the changes below.
6191
LD A,(620FH) 3A 0F 62
Fetch the low byte of the SYSTEM parameter, the operand 620FH of LD HL,0000H at 620EH, into Register A: FFH when SYSTEM was given (the table entry SYSTEM at 72A8H).
6194
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when SYSTEM was not given.
6195
If the Z FLAG is set (no SYSTEM), JUMP to 61CFH to copy the allocation table to the lock out table.
6197
LD HL,676FH 21 6F 67
Point Register Pair HL to 676FH, the text 0AH (a new line), Re-format track 0... and 0DH.
619A
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (676FH).
619D
LD HL,6571H 21 71 65
Point Register Pair HL to 6571H, the track descriptor of a 5 inch single density track (template 6589H, 10 sectors).
61A0
GOSUB to 650AH to put the template address of the descriptor at Register Pair HL into 6014H, its +07H and +08H into the working drive code table and its memory size into 7156H. The highest cylinder (+06H) is not changed.
61A3
GOSUB to 6763H: the driver's Restore (the head to cylinder 0, +05H = 0) and side 0 (bit 4 of +03H reset).
61A6
RES 6,(IY+03H) FD CB 03 B6
Reset bit 6 of +03H of the working drive code table at Index Register IY (6567H): single density for the writes and reads that follow.
61AA
LD A,10H 3E 10
Load Register A with 10H, bit 4 of the configuration byte of the allocation table: cylinder 0 is single density while the rest is double density.
61AC
LD (6334H),A 32 34 63
Store Register A (10H) at 6334H, the operand of OR 00H at 6333H, where the configuration byte (allocation table +CDH) is built.
61AF
LD A,18H 3E 18
Load Register A with 18H, the opcode of JR, for the format loop's test.
61B1
LD (610DH),A 32 0D 61
Store Register A (18H) at 610DH: JR Z,612EH becomes JR 612EH, so the format loop ends after cylinder 0.
61B4
LD L,18H 2E 18
Load Register L with 18H, the opcode of JR, for the verify loop's test.
61B6
LD H,3EH 26 3E
Load Register H with 3EH, the displacement from 6186H to 61C4H.
61B8
LD (6184H),HL 22 84 61
Store Register Pair HL (18H 3EH) at 6184H-6185H: JR NZ,611EH becomes JR 61C4H, so the verify ends after cylinder 0 and comes back below.
61BB
LD HL,(656FH) 2A 6F 65
Fetch the word at 656FH-6570H into Register Pair HL: Register L = the sectors on a cylinder, Register H = the sectors on a track, of the format just done.
61BE
LD (61C5H),HL 22 C5 61
Store Register Pair HL (the two counts) at 61C5H-61C6H, the operand of LD HL,0000H at 61C4H, to put them back after the pass.
61C1
JUMP to 6013H to build the single density track and format and verify cylinder 0; the changed JRs bring the run to 61C4H.
61C4
LD HL,0000H 21 00 00
Load Register Pair HL with the two counts saved at 61BEH: the operand 61C5H-61C6H, 0000H in the file. 6184H (changed to JR 61C4H) comes here after the second pass.
61C7
LD (656FH),HL 22 6F 65
Store Register Pair HL at 656FH-6570H: the sectors on a cylinder and on a track of the main format again.
61CA
LD HL,6A00H 21 00 6A
Point Register Pair HL to 6A00H, cylinder 0's byte of the allocation table.
61CD
LD (HL),FCH 36 FC
Store FCH at Register Pair HL (6A00H): granules 0 and 1 of cylinder 0 free (bits 1-0 clear), the two granules of a single density track. A failure of the verify of the pass (FFH from 61F7H) is overwritten.
61CF
LD HL,6A00H 21 00 6A
Point Register Pair HL to 6A00H, the allocation table, the source of the copy below.
61D2
LD DE,6A60H 11 60 6A
Point Register Pair DE to 6A60H, the lock out table (allocation table +60H), the destination.
61D5
LD B,L 45
Copy Register L (00H, the low byte of 6A00H) into Register B, the high byte of the count.
61D6
LD C,(IY+06H) FD 4E 06
Fetch +06H of the working drive code table at Index Register IY (656AH) into Register C: the highest cylinder.
61D9
INC C 0C
INCrement Register C: Register Pair BC = the number of cylinders.
61DA
LDIR ED B0
Copy one byte for each cylinder from Register Pair HL (6A00H) to Register Pair DE (6A60H), Register Pair BC the count (LDIR): the lock out table starts the same as the allocation table, with FFH for each cylinder that failed.
61DC
LD A,0DH 3E 0D
Load Register A with 0DH, the end of a line, to end the line of the verify.
61DE
GOSUB to 0033H, the ROM's routine that displays the character in Register A (0DH).
61E1
JUMP to 624AH to choose the directory cylinder and write the system information.

61E3H - A Sector Failed the Verify

Register A holds the driver's error number for the read (0AH Verify): 05H, the sector's ID field was not found, and 04H, a CRC error, mean the surface is bad and the cylinder is locked out; any other error number ends the format through @ERROR.

61E3
CP 05H FE 05
Compare Register A (the error number) against 05H, not found.
61E5
If the Z FLAG is set (05H, not found), JUMP to 61ECH to lock the cylinder out.
61E7
CP 04H FE 04
Compare Register A (the error number) against 04H, a CRC error.
61E9
If the NZ FLAG is set (another error), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
61EC
PUSH DE D5
Save Register Pair DE (Register D = the cylinder) to the stack across the display.
61ED
LD HL,6702H 21 02 67
Point Register Pair HL to 6702H, the text an asterisk and three spaces, ended by 03H: the number of the cylinder stays on the screen with the asterisk after it, and the next number goes two places on.
61F0
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (6702H).
61F3
POP DE D1
Restore Register Pair DE from the stack: Register D = the cylinder.
61F4
LD L,D 6A
Copy Register D (the cylinder) into Register L.
61F5
LD H,6AH 26 6A
Load Register H with 6AH: Register Pair HL = 6A00H + the cylinder, its byte of the allocation table.
61F7
LD (HL),FFH 36 FF
Store FFH at Register Pair HL: no granule of the cylinder is free. 61DAH copies it into the lock out table too.
61F9
JUMP to 617CH for the next cylinder: the rest of this one is not read.

61FCH - A Drive Without Track Writing: the Hard Disk Question

The entry at 6004H comes here when bit 4 of +04H of the drive's table is set. A drive with bit 3 of +03H set (a hard disk) is formatted only when the operator answers Y. Without SYSTEM the drive's driver gets function 0CH; with SYSTEM nothing is done to the surface. Then the sectors on a cylinder are worked out from the table, and the run joins the choice of the directory cylinder: at 6241H for a hard disk, through the lock out table copy at 61CFH for any other drive.

61FC
LD HL,75F5H 21 F5 75
Point Register Pair HL to 75F5H, the text The target drive is a hard disk! between three asterisks on each side, a new line and Are you sure you want to format it ? ended by 03H.
61FF
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of +03H of the working drive code table at Index Register IY (6567H): set for a hard disk.
6203
If the Z FLAG is set (not a hard disk), JUMP to 620EH: no question.
6205
GOSUB to 64C2H to display the text at Register Pair HL (75F5H) and read up to 3 characters into 6D00H, in upper case; Register Pair HL comes back pointing to 6D00H. BREAK ends the program at 6434H.
6208
LD A,(HL) 7E
Fetch the first character of the reply at Register Pair HL (6D00H) into Register A (0DH when only ENTER was pressed).
6209
CP 59H FE 59
Compare Register A (the first character) against 59H, Y.
620B
If the NZ FLAG is set (not Y), JUMP to 6434H to display Format aborted! and end at @ABORT.
620E
LD HL,0000H 21 00 00
Load Register Pair HL with the SYSTEM parameter: the operand 620FH-6210H, 0000H in the file, FFFFH when @PARAM found SYSTEM (the table entry SYSTEM at 72A8H).
6211
LD A,H 7C
Copy Register H (the high byte of the SYSTEM parameter) into Register A.
6212
OR L B5
OR Register L (the low byte) into Register A: the Z FLAG is set when SYSTEM was not given.
6213
If the NZ FLAG is set (SYSTEM given), JUMP to 6221H: only the system information is written.
6215
LD HL,6707H 21 07 67
Point Register Pair HL to 6707H, the text Formatting... ended by 0DH.
6218
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (6707H); Register Pair HL comes back unchanged.
621B
GOSUB to 6477H, the driver's function 0CH, the only use of it in the file: the drive's own driver formats its surface. SYS0/SYS's floppy driver would take 0CH as a sector write (0BH-0DH); FORMAT gives it only to a drive with bit 4 of +04H set.
621E
If the NZ FLAG is set (the driver gave an error), JUMP to 64A7H to give back the interrupt vector (unchanged on this path) and report the error in Register A.
6221
LD A,(IY+07H) FD 7E 07
Fetch +07H of the working drive code table at Index Register IY (656BH) into Register A: bits 4-0 the highest sector on a track, bits 7-5 the heads less one.
6224
LD D,A 57
Copy Register A (+07H) into Register D, to take the two fields apart.
6225
AND 1FH E6 1F
Mask Register A to bits 4-0 (AND 1FH): the highest sector on a track.
6227
LD E,A 5F
Copy Register A (the highest sector) into Register E.
6228
INC E 1C
INCrement Register E: the sectors on a track (sectors are numbered from 0).
6229
XOR D AA
Exclusive OR Register D (+07H) into Register A (bits 4-0 of it): Register A = bits 7-5 of +07H only, the heads less one.
622A
RLCA 07
Rotate Register A left one place (RLCA): bit 7 goes round to bit 0.
622B
RLCA 07
Rotate Register A left one place (RLCA): bits 7-6 of +07H are now bits 1-0.
622C
RLCA 07
Rotate Register A left one place (RLCA): Register A = bits 7-5 of +07H as a number 0-7, the heads less one.
622D
INC A 3C
INCrement Register A: the number of heads of the drive.
622E
GOSUB to 4B6CH, MULTEA, to multiply Register A (the heads) by Register E (the sectors on a track): Register A = the sectors on a cylinder.
6231
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of +04H of the working drive code table at Index Register IY (6568H): set for a drive with two sides.
6235
If the Z FLAG is set (one side), JUMP to 6238H with Register A unchanged.
6237
ADD A,A 87
Double Register A (ADD A,A), the sectors on a cylinder of a drive with two sides.
6238
LD (656FH),A 32 6F 65
Store Register A (the sectors on a cylinder) at 656FH, which the directory sizing (63B2H) and the directory loop (6414H) read.
623B
BIT 3,(IY+03H) FD CB 03 5E
Test bit 3 of +03H of the working drive code table at Index Register IY (6567H): set for a hard disk.
623F
If the Z FLAG is set (not a hard disk), JUMP to 61CFH to copy the allocation table to the lock out table, then to 624AH.

6241H - Choose the Directory Cylinder

The directory goes on the cylinder given by DIR=n when it is below the highest cylinder, else on the middle cylinder; when that cylinder's byte of the allocation table is FFH (locked out), the cylinders on either side are tried in turn, one up, one down, two up, two down and so on. The search gives up when it reaches the highest cylinder or cylinder 0. The cylinder chosen goes into +09H of the working table and of the copy at 6000H, into the text 673BH and, at 629EH on, into the first extent of DIR/SYS and both boot sectors.

6241
LD A,(IY+06H) FD 7E 06
Fetch +06H of the working drive code table at Index Register IY (656AH) into Register A: the highest cylinder.
6244
LD L,A 6F
Copy Register A (the highest cylinder) into Register L.
6245
CP (IY+06H) FD BE 06
Compare Register A (the highest cylinder) against +06H of the working drive code table at Index Register IY (656AH), the same byte: never less, so the CARRY FLAG is clear.
6248
If the CARRY FLAG is set (never), JUMP to 624DH. The run always goes on at 624AH.
624A
LD L,(IY+06H) FD 6E 06
Fetch +06H of the working drive code table at Index Register IY (656AH) into Register L: the highest cylinder. 61E1H comes here after the verify.
624D
LD H,6AH 26 6A
Load Register H with 6AH: Register Pair HL = 6A00H + the highest cylinder.
624F
GOSUB to 6467H, the driver's function 04H, Restore: the head goes back to cylinder 0 and +05H = 0.
6252
If the NZ FLAG is set (the driver gave an error), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
6255
LD BC,0000H 01 00 00
Load Register Pair BC with the DIR parameter: the operand 6256H-6257H, 0000H in the file, stored by @PARAM for DIR=n (the table entries DIR and D at 72A8H).
6258
LD A,C 79
Copy Register C (the low byte of the DIR value) into Register A.
6259
OR B B0
OR Register B (the high byte) into Register A: the Z FLAG is set when DIR was not given.
625A
If the Z FLAG is set (no DIR), JUMP to 6262H to start at the middle cylinder.
625C
CP L BD
Compare Register A (the low byte of the DIR value, or of the OR with the high byte when that is not 0) against Register L (the highest cylinder).
625D
If the NO CARRY FLAG is set (the value is not below the highest cylinder), JUMP to 6262H: the value is ignored and the search starts at the middle cylinder.
625F
LD L,A 6F
Copy Register A (the DIR cylinder) into Register L: Register Pair HL = its byte of the allocation table.
6260
JUMP to 6265H to start the search at the DIR cylinder.
6262
INC L 2C
INCrement Register L (the highest cylinder): the number of cylinders.
6263
SRL L CB 3D
Shift Register L right one place (SRL): half the number of cylinders, the middle cylinder; Register Pair HL = its byte of the allocation table.
6265
LD C,00H 0E 00
Load Register C with 00H, the distance of the next try from the cylinder before it.
6267
LD A,(HL) 7E
Fetch the byte of the allocation table at Register Pair HL (the cylinder tried) into Register A.
6268
INC A 3C
INCrement Register A: the Z FLAG is set when the byte was FFH (the cylinder failed the verify).
6269
If the NZ FLAG is set (not FFH), JUMP to 6284H: the directory goes on cylinder Register L.
626B
INC C 0C
INCrement Register C, the distance of the next try.
626C
LD A,C 79
Copy Register C (the distance) into Register A.
626D
RRCA 0F
Rotate Register A right one place (RRCA): bit 0 of the distance goes into the CARRY FLAG, set for an odd distance.
626E
LD A,L 7D
Copy Register L (the cylinder tried) into Register A. LD does not change the flags.
626F
If the NO CARRY FLAG is set (an even distance), JUMP to 627AH to try a cylinder further down.
6271
ADD A,C 81
ADD Register C (the distance) to Register A (the cylinder tried): a cylinder further up.
6272
LD L,A 6F
Copy Register A (the new cylinder) into Register L: Register Pair HL = its byte of the allocation table.
6273
CP (IY+06H) FD BE 06
Compare Register A (the new cylinder) against +06H of the working drive code table at Index Register IY (656AH), the highest cylinder.
6276
If the NZ FLAG is set (not the highest cylinder), LOOP BACK to 6267H to test it.
6278
JUMP to 627EH: the search reached the highest cylinder, the directory has no place.
627A
SUB C 91
SUBtract Register C (the distance) from Register A (the cylinder tried): a cylinder further down.
627B
LD L,A 6F
Copy Register A (the new cylinder) into Register L: Register Pair HL = its byte of the allocation table. LD does not change the flags.
627C
If the NZ FLAG is set (not cylinder 0), LOOP BACK to 6267H to test it.
627E
LD HL,6715H 21 15 67
Point Register Pair HL to 6715H, the text No cylinders available for directory! ended by 0DH. The search reached cylinder 0 or the highest cylinder.
6281
JUMP to 6434H. 6434H loads Register Pair HL with 680CH, so the text at 6715H is not displayed: the operator sees Format aborted!, and the program ends at @ABORT.
6284
LD (IY+09H),L FD 75 09
Store Register L (the cylinder chosen) into +09H of the working drive code table at Index Register IY (656DH): the directory cylinder of every later directory read and write.
6287
LD A,L 7D
Copy Register L (the directory cylinder) into Register A.
6288
LD (6009H),A 32 09 60
Store Register A (the directory cylinder) at 6009H, +09H of the copy of the table at 6000H-6009H (618FH), so that 6302H puts it back with the rest.
628B
GOSUB to 64B5H to turn Register A (the directory cylinder) into two digits: Register C = the tens digit, Register B = the units digit.
628E
LD (6760H),BC ED 43 60 67
Store Register Pair BC at 6760H-6761H: Register C (the tens digit) at 6760H and Register B (the units digit) at 6761H, the 00 at the end of the text at 673BH.
6292
LD HL,673BH 21 3B 67
Point Register Pair HL to 673BH, the text Directory will be placed on cylinder nn ended by 0DH.
6295
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (673BH).
6298
LD HL,6786H 21 86 67
Point Register Pair HL to 6786H, the text 0AH (a new line), Initializing SYSTEM information and a space, ended by 03H: the progress marks follow on the same line.
629B
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (6786H).

629EH - The Boot Sectors: Cylinder 0, Sectors 0 and 1

Granule 0 of cylinder 0 (the boot sectors and the system information) and the whole directory cylinder are marked used in the allocation table. Each boot sector image gets the directory cylinder at its +02H (4202H, the operand of CP at 4201H) and the bootstrap step rate (656EH): sector 0 in bits 1-0 of its Seek command (6BBCH, the 1BH of LD (HL),1BH at 42BBH), sector 1 at 6C10H (the operand of OR 03H at 420FH, 4210H). Sector 0 is verified before anything is written: a drive that was never formatted (the paths that write no tracks) ends here.

629E
LD HL,6A00H 21 00 6A
Point Register Pair HL to 6A00H, cylinder 0's byte of the allocation table.
62A1
LD A,(HL) 7E
Fetch the byte at Register Pair HL (6A00H) into Register A: a bit set for each granule of cylinder 0 not free.
62A2
OR 01H F6 01
Set bit 0 in Register A (OR 01H): granule 0 of cylinder 0, the boot sectors, the system information sector and the copy of the allocation table, is used.
62A4
LD (HL),A 77
Store Register A (cylinder 0's byte) back at Register Pair HL (6A00H).
62A5
LD A,(IY+09H) FD 7E 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register A: the directory cylinder.
62A8
LD (655AH),A 32 5A 65
Store Register A (the directory cylinder) at 655AH, +16H of the record of DIR/SYS (6544H): the cylinder of its first extent.
62AB
LD L,A 6F
Copy Register A (the directory cylinder) into Register L: Register Pair HL = 6A00H + the directory cylinder, its byte of the allocation table.
62AC
LD (HL),FFH 36 FF
Store FFH at Register Pair HL: every granule of the directory cylinder is used.
62AE
LD A,(IY+09H) FD 7E 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register A: the directory cylinder.
62B1
LD (6B02H),A 32 02 6B
Store Register A (the directory cylinder) at 6B02H, +02H of the image of boot sector 0: the operand of CP 11H at 4201H when the sector runs at 4200H.
62B4
LD A,(656EH) 3A 6E 65
Fetch the bootstrap step rate from 656EH into Register A: 0-3 (03H in the file; the front end stores the value chosen, 70B9H).
62B7
LD B,A 47
Copy Register A (the step rate) into Register B.
62B8
LD HL,(6900H) 2A 00 69
Fetch the word at 6900H into Register Pair HL: 6BBCH, the operand of LD (HL),1BH at 6BBBH (42BBH when the sector runs), the Seek command of boot sector 0.
62BB
LD A,(HL) 7E
Fetch the Seek command at Register Pair HL (6BBCH) into Register A: 1BH in the file.
62BC
AND FCH E6 FC
Mask Register A (the Seek command) to bits 7-2 (AND FCH): the step rate bits 1-0 cleared.
62BE
OR B B0
OR Register B (the step rate) into Register A: the Seek command with the step rate chosen.
62BF
LD (HL),A 77
Store Register A (the Seek command) back at Register Pair HL (6BBCH).
62C0
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H: Register D = cylinder 0, Register E = sector 0.
62C3
GOSUB to 6487H, the driver's function 0AH, Verify: read cylinder Register D (0), sector Register E (0). The Z FLAG when the sector can be read.
62C6
LD HL,681CH 21 1C 68
Point Register Pair HL to 681CH, the text Can't, Diskette not formatted! ended by 0DH. LD does not change the flags.
62C9
If the NZ FLAG is set (cylinder 0, sector 0 cannot be read), JUMP to 6437H to display the text at Register Pair HL (681CH), give back the interrupt vector and end at @ABORT.
62CC
LD HL,6B00H 21 00 6B
Point Register Pair HL to 6B00H, the image of boot sector 0 (the sector the ROM reads and runs at 4200H).
62CF
GOSUB to 647BH, the driver's function 0DH, Write Sector: Register Pair HL (6B00H) to cylinder Register D (0), sector Register E (0).
62D2
If the Z FLAG is set (written), GOSUB to 6487H, the driver's function 0AH, to verify cylinder 0, sector 0.
62D5
If the NZ FLAG is set (the write or the verify failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
62D8
GOSUB to 642FH to display a period after Initializing SYSTEM information: one sector written.
62DB
LD A,(IY+09H) FD 7E 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register A: the directory cylinder.
62DE
LD (6C02H),A 32 02 6C
Store Register A (the directory cylinder) at 6C02H, +02H of the image of boot sector 1: the operand of CP 11H at 4201H when it runs.
62E1
LD A,(656EH) 3A 6E 65
Fetch the bootstrap step rate from 656EH into Register A.
62E4
LD B,A 47
Copy Register A (the step rate) into Register B.
62E5
LD HL,(6902H) 2A 02 69
Fetch the word at 6902H into Register Pair HL: 6C10H, the operand of OR 03H at 6C0FH (420FH when the sector runs), the step rate boot sector 1 puts into +03H of its drive's table.
62E8
LD A,(HL) 7E
Fetch the byte at Register Pair HL (6C10H) into Register A: 03H in the file.
62E9
AND FCH E6 FC
Mask Register A to bits 7-2 (AND FCH): bits 1-0 cleared.
62EB
OR B B0
OR Register B (the step rate) into Register A.
62EC
LD (HL),A 77
Store Register A (the step rate) back at Register Pair HL (6C10H).
62ED
LD DE,0001H 11 01 00
Load Register Pair DE with 0001H: Register D = cylinder 0, Register E = sector 1.
62F0
LD HL,6C00H 21 00 6C
Point Register Pair HL to 6C00H, the image of boot sector 1 (the sector a boot through a disk driver runs).
62F3
GOSUB to 647BH, the driver's function 0DH, Write Sector: Register Pair HL (6C00H) to cylinder Register D (0), sector Register E (1).
62F6
If the Z FLAG is set (written), GOSUB to 6487H, the driver's function 0AH, to verify cylinder 0, sector 1.
62F9
If the NZ FLAG is set (the write or the verify failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
62FC
GOSUB to 642FH to display a period: two sectors written.

62FFH - The Allocation Table: Cylinder 0, Sectors 2 and 3

The table saved at 6000H-6009H by 618FH is put back into the working copy (the second pass over cylinder 0 changed its density and geometry), keeping the cylinder the head is on. On the path from 6004H nothing was saved there: the LDIR then copies the engine's own first nine bytes (FDH CBH 04H 66H C2H FCH 61H F3H 3AH) and the directory cylinder (6009H), and the next call through JP (IY) at 6495H runs those bytes as code. Then +CCH and +CDH of the allocation table image at 6A00H are built from the table, the image is written to cylinder 0, sector 3, and a system information sector of 53H and 255 bytes of 00H to sector 2.

62FF
LD A,(IY+05H) FD 7E 05
Fetch +05H of the working drive code table at Index Register IY (6569H) into Register A: the cylinder the head is on, kept across the copy below.
6302
LD HL,6000H 21 00 60
Point Register Pair HL to 6000H, the copy of the working table made by 618FH (with the directory cylinder at 6009H, 6288H), the source of the copy below.
6305
LD DE,6564H 11 64 65
Point Register Pair DE to 6564H, the working drive code table, the destination.
6308
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of a drive code table.
630B
LDIR ED B0
Copy the ten bytes from Register Pair HL (6000H) to Register Pair DE (6564H), Register Pair BC the count (LDIR): the density, the geometry and the side of the main format are back.
630D
LD (IY+05H),A FD 77 05
Store Register A (the cylinder the head is on) into +05H of the working drive code table at Index Register IY (6569H).
6310
LD A,(IY+06H) FD 7E 06
Fetch +06H of the working drive code table at Index Register IY (656AH) into Register A: the highest cylinder.
6313
SUB 22H D6 22
SUBtract 22H (34) from Register A: the number of cylinders less 35.
6315
LD (6ACCH),A 32 CC 6A
Store Register A (the cylinders less 35) at 6ACCH, +CCH of the allocation table image. @CKDRV (SYS2/SYS) puts 22H plus this byte into +06H of a drive's table.
6318
LD A,(IY+04H) FD 7E 04
Fetch +04H of the working drive code table at Index Register IY (6568H) into Register A.
631B
AND 20H E6 20
Mask Register A to bit 5 (AND 20H): set for a drive with two sides; it becomes bit 5 of the configuration byte.
631D
LD B,A 47
Copy Register A (the two sides bit) into Register B.
631E
LD A,(IY+03H) FD 7E 03
Fetch +03H of the working drive code table at Index Register IY (6567H) into Register A.
6321
AND 40H E6 40
Mask Register A to bit 6 (AND 40H): set for double density; it becomes bit 6 of the configuration byte.
6323
OR B B0
OR Register B (the two sides bit) into Register A.
6324
LD B,A 47
Copy Register A (bits 6 and 5 of the configuration byte) into Register B.
6325
LD A,(IY+08H) FD 7E 08
Fetch +08H of the working drive code table at Index Register IY (656CH) into Register A: bits 7-5 the granules on a track less one, bits 4-0 the sectors in a granule less one.
6328
RLCA 07
Rotate Register A left one place (RLCA): bit 7 goes round to bit 0.
6329
RLCA 07
Rotate Register A left one place (RLCA): bits 7-6 are now bits 1-0.
632A
RLCA 07
Rotate Register A left one place (RLCA): bits 7-5 of +08H are now bits 2-0.
632B
AND 07H E6 07
Mask Register A to bits 2-0 (AND 07H): the granules on a track less one.
632D
LD (63C2H),A 32 C2 63
Store Register A (the granules on a track less one) at 63C2H, the operand of LD A,00H at 63C1H, for the extent of DIR/SYS.
6330
OR B B0
OR Register B (bits 6 and 5) into Register A.
6331
OR 88H F6 88
Set bits 7 and 3 in Register A (OR 88H). Bit 3 marks a diskette whose directory records carry this release's date and time format (SYS2/SYS sets the drive's bit of 475DH from it).
6333
OR 00H F6 00
OR the operand 6334H into Register A: 00H in the file, 10H (bit 4: cylinder 0 single density, the rest double density) when SYSTEM made the second pass over cylinder 0 (61ACH).
6335
LD (6ACDH),A 32 CD 6A
Store Register A (the configuration byte) at 6ACDH, +CDH of the allocation table image.
6338
LD HL,6A00H 21 00 6A
Point Register Pair HL to 6A00H, the allocation table image, now complete.
633B
LD D,00H 16 00
Load Register D with 00H, cylinder 0, for the copy of the allocation table.
633D
LD E,03H 1E 03
Load Register E with 03H, sector 3: the copy of the allocation table on cylinder 0.
633F
GOSUB to 647BH, the driver's function 0DH, Write Sector: Register Pair HL (6A00H) to cylinder Register D (0), sector Register E (3).
6342
If the Z FLAG is set (written), GOSUB to 6487H, the driver's function 0AH, to verify cylinder 0, sector 3.
6345
If the NZ FLAG is set (the write or the verify failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
6348
GOSUB to 642FH to display a period: three sectors written.
634B
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer (the table of the ID fields while the tracks were written).
634E
LD (HL),00H 36 00
Store 00H at Register Pair HL, a byte of the sector buffer.
6350
INC L 2C
INCrement Register L to the next byte of the buffer: the Z FLAG is set when Register L wraps from FFH to 00H.
6351
If the NZ FLAG is set (Register L has not wrapped), LOOP BACK to 634EH: all 256 bytes of 6D00H-6DFFH become 00H.
6353
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the first byte of the cleared buffer.
6356
LD (HL),53H 36 53
Store 53H (S) at Register Pair HL (6D00H): byte 0 of the system information sector, the mark that DATECONV/CMD tests. The other 255 bytes stay 00H.
6358
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: Register D = cylinder 0, Register E = sector 2, the system information sector.
635B
GOSUB to 647BH, the driver's function 0DH, Write Sector: Register Pair HL (6D00H) to cylinder Register D (0), sector Register E (2).
635E
If the Z FLAG is set (written), GOSUB to 6487H, the driver's function 0AH, to verify cylinder 0, sector 2.
6361
If the Z FLAG is set (verified), GOSUB to 642FH to display a period: four sectors written. The CALL Z at 636CH tests the flags as this instruction leaves them.

6364H - The Directory Cylinder

Every sector of the directory cylinder is written with the deleted data mark (the driver's function 0EH) and read back by 6497H, which accepts only error 06H, the deleted data mark. Sector 0 gets the allocation table, sector 1 the hash index table with the bytes A2H (BOOT/SYS) and C4H (DIR/SYS), sector 2 the record of BOOT/SYS, sector 3 the record of DIR/SYS, every other sector 256 bytes of 00H. A plus sign is displayed for each of the first two sectors and a period for each sector after them.

6364
LD HL,6A00H 21 00 6A
Point Register Pair HL to 6A00H, the allocation table image.
6367
LD D,(IY+09H) FD 56 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register D: the directory cylinder.
636A
LD E,00H 1E 00
Load Register E with 00H, sector 0 of the directory cylinder: the allocation table.
636C
If the Z FLAG is set (the sectors of cylinder 0 were written and verified), GOSUB to 647FH, the driver's function 0EH, Write Sector with the deleted data mark: Register Pair HL (6A00H) to cylinder Register D, sector Register E (0).
636F
If the Z FLAG is set (written), GOSUB to 6497H to verify that the sector carries the deleted data mark.
6372
LD A,2BH 3E 2B
Load Register A with 2BH, a plus sign, the progress mark of a sector of the directory cylinder. LD does not change the flags.
6374
If the Z FLAG is set (all went well), GOSUB to 0033H, the ROM's routine that displays the character in Register A (+).
6377
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer: 53H and 255 bytes of 00H.
637A
LD (HL),A2H 36 A2
Store A2H at Register Pair HL (6D00H): byte 0 of the hash index table, the hash of the name BOOT/SYS for directory record 0.
637C
INC HL 23
INCrement Register Pair HL to 6D01H, byte 1 of the hash index table.
637D
LD (HL),C4H 36 C4
Store C4H at Register Pair HL (6D01H): byte 1 of the hash index table, the hash of the name DIR/SYS for directory record 1. Every other byte is 00H, a free record.
637F
DEC HL 2B
DECrement Register Pair HL back to 6D00H, the start of the buffer.
6380
LD D,(IY+09H) FD 56 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register D: the directory cylinder.
6383
LD E,01H 1E 01
Load Register E with 01H, sector 1 of the directory cylinder: the hash index table.
6385
If the Z FLAG is set (all went well), GOSUB to 647FH, the driver's function 0EH, Write Sector with the deleted data mark: Register Pair HL (6D00H) to cylinder Register D, sector Register E (1).
6388
If the Z FLAG is set (written), GOSUB to 6497H to verify that the sector carries the deleted data mark.
638B
If the NZ FLAG is set (a write or a verify since 6364H failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
638E
LD A,2BH 3E 2B
Load Register A with 2BH, a plus sign, the progress mark of a sector of the directory cylinder.
6390
GOSUB to 0033H, the ROM's routine that displays the character in Register A (+).
6393
LD DE,6D00H 11 00 6D
Point Register Pair DE to 6D00H, the sector buffer, the destination of the copy below.
6396
LD HL,6524H 21 24 65
Point Register Pair HL to 6524H, the record of BOOT/SYS, the source.
6399
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a directory record.
639C
LDIR ED B0
Copy the 32 bytes from Register Pair HL (6524H) to Register Pair DE (6D00H-6D1FH), Register Pair BC the count (LDIR): record 0 of the sector. The other 224 bytes of the buffer are 00H.
639E
LD D,(IY+09H) FD 56 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register D: the directory cylinder.
63A1
LD E,02H 1E 02
Load Register E with 02H, sector 2 of the directory cylinder: the first sector of directory records.
63A3
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer with the record of BOOT/SYS.
63A6
GOSUB to 647FH, the driver's function 0EH, Write Sector with the deleted data mark: Register Pair HL (6D00H) to cylinder Register D, sector Register E (2).
63A9
If the Z FLAG is set (written), GOSUB to 6497H to verify that the sector carries the deleted data mark.
63AC
If the NZ FLAG is set (the write or the verify failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
63AF
GOSUB to 642FH to display a period: one directory record sector written.
63B2
LD A,(656FH) 3A 6F 65
Fetch the sectors on a cylinder from 656FH into Register A: the size of the directory, a whole cylinder.
63B5
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set for 0, a count of sectors that did not fit in one byte.
63B6
If the Z FLAG is set (0), JUMP to 63BCH to use 34.
63B8
CP 22H FE 22
Compare Register A (the sectors on a cylinder) against 22H (34): the allocation table, the hash index table and the 32 sectors of 8 records whose 256 entries the hash index table can hold.
63BA
If the CARRY FLAG is set (fewer than 34 sectors), JUMP to 63BEH with Register A unchanged.
63BC
LD A,22H 3E 22
Load Register A with 22H (34), the most sectors the directory uses.
63BE
LD (6558H),A 32 58 65
Store Register A (the sectors of the directory) at 6558H, +14H of the record of DIR/SYS: the low byte of its ending record number.
63C1
LD A,00H 3E 00
Load Register A with the granules on a track less one: the operand 63C2H, 00H in the file, stored by 632DH from bits 7-5 of +08H.
63C3
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of +04H of the working drive code table at Index Register IY (6568H): set for a drive with two sides.
63C7
If the Z FLAG is set (one side), JUMP to 63CBH: Register A = the granules on the cylinder less one.
63C9
ADD A,A 87
Double Register A (ADD A,A): twice the granules on a track less one.
63CA
INC A 3C
INCrement Register A: twice the granules on a track, less one, the granules on a cylinder of two sides less one.
63CB
LD (655BH),A 32 5B 65
Store Register A (the granules on the cylinder less one; the first granule, bits 7-5, is 0) at 655BH, +17H of the record of DIR/SYS: its first extent is the whole cylinder.
63CE
LD A,(IY+09H) FD 7E 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register A: the directory cylinder.
63D1
LD (655AH),A 32 5A 65
Store Register A (the directory cylinder) at 655AH, +16H of the record of DIR/SYS: the cylinder of its first extent (62A8H stored it too).
63D4
LD HL,6544H 21 44 65
Point Register Pair HL to 6544H, the record of DIR/SYS, the source of the copy below.
63D7
LD DE,6D00H 11 00 6D
Point Register Pair DE to 6D00H, the sector buffer, the destination.
63DA
LD BC,0020H 01 20 00
Load Register Pair BC with 0020H, the 32 bytes of a directory record.
63DD
LDIR ED B0
Copy the 32 bytes from Register Pair HL (6544H) to Register Pair DE (6D00H-6D1FH), Register Pair BC the count (LDIR): record 0 of the sector, over the record of BOOT/SYS.
63DF
LD D,(IY+09H) FD 56 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register D: the directory cylinder.
63E2
LD E,03H 1E 03
Load Register E with 03H, sector 3 of the directory cylinder: the second sector of directory records.
63E4
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer with the record of DIR/SYS.
63E7
GOSUB to 647FH, the driver's function 0EH, Write Sector with the deleted data mark: Register Pair HL (6D00H) to cylinder Register D, sector Register E (3).
63EA
If the Z FLAG is set (written), GOSUB to 6497H to verify that the sector carries the deleted data mark.
63ED
If the NZ FLAG is set (the write or the verify failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
63F0
GOSUB to 642FH to display a period: two directory record sectors written.
63F3
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the record of DIR/SYS in the buffer.
63F6
LD B,20H 06 20
Load Register B with 20H (32), the bytes of the record to clear.
63F8
LD (HL),00H 36 00
Store 00H at Register Pair HL, a byte of the record in the buffer.
63FA
INC HL 23
INCrement Register Pair HL to the next byte of the record.
63FB
DECrement Register B and LOOP BACK to 63F8H until the 32 bytes are 00H: the whole buffer is now 256 bytes of 00H.
63FD
LD D,(IY+09H) FD 56 09
Fetch +09H of the working drive code table at Index Register IY (656DH) into Register D: the directory cylinder.
6400
LD E,04H 1E 04
Load Register E with 04H, the first sector of the directory cylinder without a record.
6402
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the buffer of 256 bytes of 00H, an empty sector of directory records.
6405
GOSUB to 647FH, the driver's function 0EH, Write Sector with the deleted data mark: Register Pair HL (6D00H) to cylinder Register D, sector Register E.
6408
If the Z FLAG is set (written), GOSUB to 6497H to verify that the sector carries the deleted data mark.
640B
If the NZ FLAG is set (the write or the verify failed), JUMP to 64A7H to give back the interrupt vector and report the error in Register A.
640E
PUSH DE D5
Save Register Pair DE (Register D = the directory cylinder, Register E = the sector) to the stack across the display.
640F
GOSUB to 642FH to display a period: one more directory sector written.
6412
POP DE D1
Restore Register Pair DE from the stack: Register D = the directory cylinder, Register E = the sector.
6413
INC E 1C
INCrement Register E to the next sector of the directory cylinder.
6414
LD A,(656FH) 3A 6F 65
Fetch the sectors on a cylinder from 656FH into Register A.
6417
CP E BB
Compare Register A (the sectors on a cylinder) against Register E (the next sector).
6418
If the NZ FLAG is set (sectors are left on the cylinder), LOOP BACK to 6402H to write the next empty sector.

641AH - The End: Formatting Complete

The interrupt vector is put back, the operator is asked for the system diskette when drive 0 was formatted, and the program returns to LDOS through @EXIT with Register Pair HL = 0000H.

641A
GOSUB to 6440H to put the byte back at 4012H, ask for the system diskette when drive 0 was formatted, and restore the head to cylinder 0.
641D
LD HL,67CEH 21 CE 67
Point Register Pair HL to 67CEH, the text 0AH (a new line), Formatting complete and 0DH.
6420
GOSUB to 447BH, @LOGOT, to display the text at Register Pair HL (67CEH) and write it to the job log.
6423
LD HL,67E3H 21 E3 67
Point Register Pair HL to 67E3H, the text 0AH (a new line), Note: Realtime clock no longer accurate and 0DH: the clock did not count while the interrupt vector held RET (6010H).
6426
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (67E3H).
6429
LD HL,0000H 21 00 00
Load Register Pair HL with 0000H, the return code of a program that ended without an error.
642C
JUMP to 402DH, @EXIT, to return to LDOS with Register Pair HL = 0000H.

642FH - A Period, the Abort, and Putting Back the Interrupt Vector

642FH displays a period. 6434H displays Format aborted! (6437H another text at Register Pair HL), writes it to the job log, puts back the interrupt vector and ends at @ABORT. 6440H puts back the byte at 4012H that 600BH saved, asks for the system diskette when drive 0 was the target, and restores the head of the target drive to cylinder 0.

642F
LD A,2EH 3E 2E
Load Register A with 2EH, a period, the progress mark of a sector written.
6431
JUMP to 0033H, the ROM's routine that displays the character in Register A (a period); its RET goes back to the caller of 642FH.
6434
LD HL,680CH 21 0C 68
Point Register Pair HL to 680CH, the text Format aborted! ended by 0DH.
6437
GOSUB to 447BH, @LOGOT, to display the text at Register Pair HL and write it to the job log.
643A
GOSUB to 6440H to put back the interrupt vector, ask for the system diskette when drive 0 was the target, and restore the head.
643D
JUMP to 4030H, @ABORT: the program ends with an error.
6440
LD A,00H 3E 00
Load Register A with the byte saved from 4012H: the operand 6441H, 00H in the file, C3H after 600BH.
6442
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when nothing was saved (the engine did not reach 600BH).
6443
If the Z FLAG is set (nothing saved), JUMP to 6449H.
6445
EI FB
Enable interrupts: the clock interrupt is served again from here on.
6446
LD (4012H),A 32 12 40
Store Register A (the saved byte, C3H) at 4012H: the interrupt vector jumps to the service routine again.
6449
LD A,(648CH) 3A 8C 64
Fetch the target drive from 648CH into Register A: the operand of LD C,FFH at 648BH, FFH in the file until the front end stores the drive.
644C
INC A 3C
INCrement Register A: the Z FLAG is set when the drive byte is still FFH.
644D
RET Z C8
If the Z FLAG is set (no drive chosen yet), RETurn to the caller.
644E
DEC A 3D
DECrement Register A back to the drive number: the Z FLAG is set for drive 0.
644F
If the NZ FLAG is set (not drive 0), JUMP to 645EH: the system diskette is still in drive 0.
6451
LD HL,67A8H 21 A8 67
Point Register Pair HL to 67A8H, the text 0AH (a new line), Load SYSTEM diskette and hit <ENTER> and 0DH.
6454
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (67A8H).
6457
GOSUB to 0049H, the ROM's routine that waits for a key and returns it in Register A.
645A
CP 0DH FE 0D
Compare Register A (the key) against 0DH, ENTER.
645C
If the NZ FLAG is set (not ENTER), LOOP BACK to 6457H to wait for the next key.
645E
JUMP to 6467H, the driver's function 04H, Restore: the head of the target drive goes back to cylinder 0, and its RET goes back to the caller of 6440H.

6460H - Calls to the Drive's Driver

FORMAT calls the driver of the target drive itself, through the working drive code table at Index Register IY (6564H), whose first three bytes are the JP to the driver (C3H and the driver address) or, for a drive that is not present, RET (C9H). Each entry loads a function number into Register A and goes to 6489H, which puts the function into Register B and the drive into Register C, as the driver wants them (SYS0/SYS's floppy driver, 45FBH). Register Pair BC is kept; Register D (the cylinder), Register E (the sector) and Register Pair HL (the buffer) go to the driver as they are. The driver returns the Z FLAG and Register A = 00H on success, else Register A = the error number.

6460
XOR A AF
Set Register A to 00H (XOR A), function 00H: SYS0/SYS's floppy driver returns at once with Register A = 00H and the Z FLAG. A drive that is not present returns NZ with Register A = 20H (6489H), so this is the test of whether the drive is there.
6461
JUMP to 6489H to call the driver with the function in Register A (00H).
6463
LD A,01H 3E 01
Load Register A with 01H, function 01H: select the drive and the side (bit 4 of +03H) at the latch 37E1H, waiting for the motor when it was off.
6465
JUMP to 6489H to call the driver with the function in Register A (01H).
6467
LD A,04H 3E 04
Load Register A with 04H, function 04H, Restore: +05H of the table = 00H and the controller's command 08H moves the head to cylinder 0.
6469
JUMP to 6489H to call the driver with the function in Register A (04H).
646B
LD A,05H 3E 05
Load Register A with 05H, function 05H, Step In: +05H of the table goes up by 1 and the command 58H steps the head in one cylinder.
646D
JUMP to 6489H to call the driver with the function in Register A (05H).
646F
LD A,07H 3E 07
Load Register A with 07H, function 07H: wait until the controller is not busy, keeping the drive selected.
6471
JUMP to 6489H to call the driver with the function in Register A (07H).
6473
LD A,0FH 3E 0F
Load Register A with 0FH, function 0FH, Write Track: the command F4H and the bytes from Register Pair HL, on the cylinder the head is on.
6475
JUMP to 6489H to call the driver with the function in Register A (0FH).
6477
LD A,0CH 3E 0C
Load Register A with 0CH, function 0CH (621BH, for a drive with bit 4 of +04H set). SYS0/SYS's floppy driver writes a sector for 0BH-0DH.
6479
JUMP to 6489H to call the driver with the function in Register A (0CH).
647B
LD A,0DH 3E 0D
Load Register A with 0DH, function 0DH, Write Sector: the command A8H, the 256 bytes at Register Pair HL to cylinder Register D, sector Register E.
647D
JUMP to 6489H to call the driver with the function in Register A (0DH).
647F
LD A,0EH 3E 0E
Load Register A with 0EH, function 0EH, Write Sector with the deleted data mark (the command ABH): the mark of a directory sector.
6481
JUMP to 6489H to call the driver with the function in Register A (0EH).
6483
LD A,09H 3E 09
Load Register A with 09H, function 09H, Read Sector: the 256 bytes of cylinder Register D, sector Register E into the buffer at Register Pair HL. The front end reads the target diskette with it (7175H, 7194H).
6485
JUMP to 6489H to call the driver with the function in Register A (09H).
6487
LD A,0AH 3E 0A
Load Register A with 0AH, function 0AH, Verify: read the sector at cylinder Register D, sector Register E without storing its bytes, and give its error number.
6489
PUSH BC C5
Save Register Pair BC to the stack: the callers keep pointers in it.
648A
LD B,A 47
Copy Register A (the function) into Register B, where the driver takes it.
648B
LD C,FFH 0E FF
Load Register C with the target drive: the operand 648CH, FFH in the file, stored by the front end when the drive is known.
648D
LD A,20H 3E 20
Load Register A with 20H, error 20H, Illegal drive number: what Register A holds when the call returns from a table that starts with RET.
648F
OR A B7
Set the flags from Register A (OR A): the NZ FLAG, which the RET of a drive that is not present returns with.
6490
GOSUB to 6495H to jump into the working drive code table: the driver's RET comes back here.
6493
POP BC C1
Restore Register Pair BC from the stack, as the caller had it.
6494
RET C9
RETurn to the caller with the driver's result: the Z FLAG on success, else Register A = the error number.
6495
JP (IY) FD E9
JUMP to Index Register IY (6564H), the working drive code table: its JP goes to the drive's driver, its RET (C9H) back to 6493H.

6497H - Verify a Directory Sector, the Error Exits, Small Helpers

6497H reads back a sector written with the deleted data mark: the read gives error 06H for that mark, which here is success; a read without an error means the mark is missing. 64A7H reports a disk error and ends the program; 64B1H gives error 2CH. 64B5H turns a number into two digits, 64C2H and 64C9H read a reply from the keyboard, 64E9H writes two digits over the last two on the screen, 64FBH and 650AH put a track descriptor into effect.

6497
GOSUB to 6487H, the driver's function 0AH, Verify, for the sector just written at cylinder Register D, sector Register E.
649A
If the Z FLAG is set (no error: the sector has the normal data mark), JUMP to 64A2H to give an error.
649C
SUB 06H D6 06
SUBtract 06H from Register A (the error number): 0 when the read found the deleted data mark (error 06H).
649E
RET Z C8
If the Z FLAG is set (error 06H), RETurn with the Z FLAG and Register A = 00H: the sector carries the deleted data mark.
649F
ADD A,06H C6 06
ADD 06H back to Register A: the driver's error number, with the NZ FLAG.
64A1
RET C9
RETurn with the NZ FLAG and Register A = the driver's error number.
64A2
OR 01H F6 01
OR 01H into Register A (00H): the NZ FLAG, a failure for the caller.
64A4
LD A,00H 3E 00
Load Register A with 00H, error 0. LD does not change the flags.
64A6
RET C9
RETurn with the NZ FLAG and Register A = 00H: the sector was read without the deleted data mark.
64A7
PUSH AF F5
Save Register Pair AF (Register A = the error number) to the stack.
64A8
GOSUB to 6440H to put back the interrupt vector, ask for the system diskette when drive 0 was the target, and restore the head.
64AB
POP AF F1
Restore Register Pair AF from the stack: Register A = the error number.
64AC
OR 40H F6 40
Set bit 6 in Register A (OR 40H): the short message; bit 7 clear means @ERROR does not return.
64AE
JUMP to 4409H, @ERROR, to display the message of the error in Register A and end the program at @ABORT.
64B1
LD A,2CH 3E 2C
Load Register A with 2CH, the error Parameter error, for a drive or a parameter value the front end cannot use.
64B3
JUMP to 64ACH to set bit 6 of Register A (2CH) and give the error through @ERROR.
64B5
LD C,30H 0E 30
Load Register C with 30H, the digit 0, the tens digit before counting.
64B7
SUB 0AH D6 0A
SUBtract 0AH (10) from Register A, the number: the CARRY FLAG is set when Register A was below 10.
64B9
If the CARRY FLAG is set (the tens are counted), JUMP to 64BEH to make the units digit.
64BB
INC C 0C
INCrement Register C, the tens digit: one more ten taken off.
64BC
LOOP BACK to 64B7H to take off another 10 from Register A.
64BE
ADD A,3AH C6 3A
ADD 3AH to Register A (the units less 10): plus 10 back, plus 30H, the units digit 0-9.
64C0
LD B,A 47
Copy Register A (the units digit) into Register B.
64C1
RET C9
RETurn with Register C = the tens digit and Register B = the units digit.
64C2
GOSUB to 4467H, @DSPLY, to display the question at Register Pair HL.
64C5
LD B,03H 06 03
Load Register B with 03H, the most characters of the reply: a number of up to three digits or a letter.
64C7
JUMP to 64CBH to read the reply into the buffer at 6D00H.
64C9
LD B,08H 06 08
Load Register B with 08H, the most characters of the reply: a diskette name or a password. The caller has displayed its question.
64CB
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the buffer of the reply.
64CE
GOSUB to 0040H, the ROM's line input: up to Register B characters into the buffer at Register Pair HL (6D00H), ended by 0DH; Register B comes back as the count typed, the CARRY FLAG set for BREAK.
64D1
If the CARRY FLAG is set (BREAK), JUMP to 6434H to display Format aborted! and end at @ABORT.
64D4
LD A,B 78
Copy Register B (the count of characters typed) into Register A.
64D5
OR A B7
Set the flags from Register A (OR A): the Z FLAG is set when only ENTER was pressed.
64D6
RET Z C8
If the Z FLAG is set (no reply), RETurn with the Z FLAG and Register Pair HL = 6D00H: the caller takes its default.
64D7
PUSH AF F5
Save Register Pair AF (the NZ FLAG) to the stack.
64D8
PUSH BC C5
Save Register Pair BC (Register B = the count) to the stack.
64D9
PUSH HL E5
Save Register Pair HL (6D00H, the reply) to the stack.
64DA
LD A,(HL) 7E
Fetch the next character of the reply at Register Pair HL into Register A.
64DB
CP 61H FE 61
Compare Register A (the character) against 61H, the letter a.
64DD
If the CARRY FLAG is set (below 61H), JUMP to 64E2H: the character stays as it is.
64DF
SUB 20H D6 20
SUBtract 20H from Register A: a lower case letter becomes upper case (every character from 61H up is changed).
64E1
LD (HL),A 77
Store Register A (the character) back into the buffer at Register Pair HL.
64E2
INC HL 23
INCrement Register Pair HL to the next character of the reply.
64E3
DECrement Register B (the characters left) and LOOP BACK to 64DAH until it reaches 0.
64E5
POP HL E1
Restore Register Pair HL from the stack: 6D00H, the reply.
64E6
POP BC C1
Restore Register Pair BC from the stack: Register B = the count of characters.
64E7
POP AF F1
Restore Register Pair AF from the stack: the NZ FLAG.
64E8
RET C9
RETurn with the NZ FLAG, Register Pair HL = 6D00H (the reply in upper case) and Register B = its length.
64E9
LD A,08H 3E 08
Load Register A with 08H, the backspace: the cursor goes back one place and the character there is erased.
64EB
GOSUB to 0033H, the ROM's routine that displays the character in Register A (08H).
64EE
LD A,08H 3E 08
Load Register A with 08H, the backspace, a second time.
64F0
GOSUB to 0033H, the ROM's routine that displays the character in Register A (08H): the cursor is on the first of the last two characters.
64F3
LD A,C 79
Copy Register C (the tens digit) into Register A.
64F4
GOSUB to 0033H, the ROM's routine that displays the character in Register A (the tens digit).
64F7
LD A,B 78
Copy Register B (the units digit) into Register A.
64F8
JUMP to 0033H, the ROM's routine that displays the character in Register A (the units digit); its RET goes back to the caller of 64E9H.
64FB
LD A,(7031H) 3A 31 70
Load Register A with the default number of cylinders of the target drive: the operand 7031H of LD A,00H at 7030H, stored by the front end from the system information sector (6EC1H).
64FE
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of +03H of the working drive code table at Index Register IY (6567H): set for an 8 inch drive.
6502
If the Z FLAG is set (a 5 inch drive), JUMP to 6506H with the default number of cylinders in Register A.
6504
LD A,4DH 3E 4D
Load Register A with 4DH (77), the cylinders of an 8 inch diskette.
6506
DEC A 3D
DECrement Register A: the highest cylinder (cylinders are numbered from 0).
6507
LD (IY+06H),A FD 77 06
Store Register A (the highest cylinder) into +06H of the working drive code table at Index Register IY (656AH).
650A
LD E,(HL) 5E
Fetch the low byte of the template address, the first word of the descriptor at Register Pair HL, into Register E. 61A0H calls this entry, which does not change +06H.
650B
INC HL 23
INCrement Register Pair HL to the high byte of the template address.
650C
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the template address.
650D
INC HL 23
INCrement Register Pair HL to the second word of the descriptor.
650E
LD (6014H),DE ED 53 14 60
Store Register Pair DE (the template address) at 6014H-6015H, the operand of LD DE,0000H at 6013H.
6512
LD E,(HL) 5E
Fetch the low byte of the second word at Register Pair HL into Register E: the value for +07H.
6513
INC HL 23
INCrement Register Pair HL to the high byte of the second word.
6514
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: the value for +08H.
6515
INC HL 23
INCrement Register Pair HL to the third word of the descriptor.
6516
LD (IY+07H),E FD 73 07
Store Register E into +07H of the working drive code table at Index Register IY (656BH): the highest sector on a track (bits 4-0), one head (bits 7-5 = 0).
6519
LD (IY+08H),D FD 72 08
Store Register D into +08H of the working drive code table at Index Register IY (656CH): the granules on a track less one (bits 7-5) and the sectors in a granule less one (bits 4-0).
651C
LD E,(HL) 5E
Fetch the low byte of the third word at Register Pair HL into Register E.
651D
INC HL 23
INCrement Register Pair HL to the high byte of the third word.
651E
LD D,(HL) 56
Fetch the high byte at Register Pair HL into Register D: Register Pair DE = the memory the track takes above 6E00H.
651F
LD (7156H),DE ED 53 56 71
Store Register Pair DE (the memory size) at 7156H-7157H, the operand of LD DE,0000H at 7155H, where the front end checks it against HIGH$.
6523
RET C9
RETurn to the caller with Register Pair HL past the descriptor.

6524H - The Directory Records of BOOT/SYS and DIR/SYS

The two 32 byte directory records FORMAT writes: BOOT/SYS as record 0 (directory sector 2, 6393H-63AFH) and DIR/SYS as record 1 (sector 3, 63D4H-63F0H). Their hash index table bytes are A2H and C4H (637AH-637DH). Before DIR/SYS is written, its ending record number (+14H) and its first extent (+16H-+17H) are filled in from the directory cylinder and the geometry (62A8H, 63BEH, 63CBH, 63D1H).

6524
DEFB 5EH 5E
6524H, BOOT/SYS +00H, the attribute: 5EH, bit 6 a system file, bit 4 in use, bit 3 invisible, bits 2-0 access level 6 (execute only without the password).
6525
DEFB 00H 00
6525H, BOOT/SYS +01H: 00H, no flags and no month (the record is not dated).
6526
DEFB 00H 00
6526H, BOOT/SYS +02H: 00H, the day and the year of the date, none.
6527
DEFB 00H 00
6527H, BOOT/SYS +03H: 00H, the end of file byte: the last sector is full.
6528
DEFB 00H 00
6528H, BOOT/SYS +04H: 00H, the record length: 256 bytes.
6529-6530
DEFM "BOOT " 42 4F 4F 54 20 20 20 20
6529H-6530H, BOOT/SYS +05H-+0CH: the name BOOT, padded with spaces to 8 bytes.
6531-6533
DEFM "SYS" 53 59 53
6531H-6533H, BOOT/SYS +0DH-+0FH: the extension SYS.
6534-6535
DEFW 01AEH AE 01
6534H-6535H, BOOT/SYS +10H-+11H: 01AEH, the hash of the file's password (4296H would be no password); SYS2/SYS's @OPEN compares it.
6536-6537
DEFW 0000H 00 00
6536H-6537H, BOOT/SYS +12H-+13H: 0000H, the time and the year of the date stamp, none.
6538-6539
DEFW 0005H 05 00
6538H-6539H, BOOT/SYS +14H-+15H: 0005H, the ending record number: 5 sectors, cylinder 0 sectors 0-4.
653A
DEFB 00H 00
653AH, BOOT/SYS +16H: 00H, the cylinder of the first extent: cylinder 0.
653B
DEFB 00H 00
653BH, BOOT/SYS +17H: 00H, the first extent's first granule (bits 7-5: granule 0) and its granules less one (bits 4-0: one granule).
653C-6541
DEFB FFH x 6 FF FF FF FF FF FF
653CH-6541H, BOOT/SYS +18H-+1DH: the three other extents, FFH (no extent).
6542
DEFB FFH FF
6542H, BOOT/SYS +1EH: FFH, no link to an extension record.
6543
DEFB FFH FF
6543H, BOOT/SYS +1FH: FFH, the number of an extension record, none.
6544
DEFB 5DH 5D
6544H, DIR/SYS +00H, the attribute: 5DH, bit 6 a system file, bit 4 in use, bit 3 invisible, bits 2-0 access level 5 (read only without the password).
6545
DEFB 00H 00
6545H, DIR/SYS +01H: 00H, no flags and no month.
6546
DEFB 00H 00
6546H, DIR/SYS +02H: 00H, the day and the year of the date, none.
6547
DEFB 00H 00
6547H, DIR/SYS +03H: 00H, the end of file byte: the last sector is full.
6548
DEFB 00H 00
6548H, DIR/SYS +04H: 00H, the record length: 256 bytes.
6549-6550
DEFM "DIR " 44 49 52 20 20 20 20 20
6549H-6550H, DIR/SYS +05H-+0CH: the name DIR, padded with spaces to 8 bytes.
6551-6553
DEFM "SYS" 53 59 53
6551H-6553H, DIR/SYS +0DH-+0FH: the extension SYS.
6554-6555
DEFW 01AEH AE 01
6554H-6555H, DIR/SYS +10H-+11H: 01AEH, the hash of the file's password, the same as BOOT/SYS.
6556-6557
DEFW 4296H 96 42
6556H-6557H, DIR/SYS +12H-+13H: 4296H, the hash of eight spaces. DATECONV/CMD treats a record with 4296H here as one without a date stamp.
6558-6559
DEFW 000AH 0A 00
6558H-6559H, DIR/SYS +14H-+15H: the ending record number, 000AH in the file; 63BEH stores the sectors of the directory cylinder (at most 34) in the low byte.
655A
DEFB 11H 11
655AH, DIR/SYS +16H: the cylinder of the first extent, 11H (17) in the file; 62A8H and 63D1H store the directory cylinder.
655B
DEFB 01H 01
655BH, DIR/SYS +17H: the first extent's first granule (bits 7-5) and granules less one (bits 4-0), 01H in the file; 63CBH stores granule 0 and the granules of the cylinder less one.
655C-6561
DEFB FFH x 6 FF FF FF FF FF FF
655CH-6561H, DIR/SYS +18H-+1DH: the three other extents, FFH (no extent).
6562
DEFB FFH FF
6562H, DIR/SYS +1EH: FFH, no link to an extension record.
6563
DEFB FFH FF
6563H, DIR/SYS +1FH: FFH, the number of an extension record, none.

6564H - The Working Drive Code Table and the Counts

6564H-656DH, not in the file, is the working copy of the target drive's drive code table (Index Register IY all through the engine); 656EH the bootstrap step rate; 656FH-6570H, not in the file, the sectors on a cylinder and on a track of the format.

6564-656D
DEFS 10
6564H-656DH: not in the file. The working copy of the target drive's drive code table: the front end copies the drive's table here (6EC9H) and changes it for the format chosen; the engine reaches the driver through it (6495H).
656E
DEFB 03H 03
656EH: the bootstrap step rate, 0-3: 03H in the file, the value the front end chooses stored by 70B9H; 62B4H and 62E1H put it into the two boot sectors.
656F-6570
DEFS 2
656FH-6570H: not in the file. 656FH the sectors on a cylinder (6023H, 6238H), 6570H the sectors on a track (6018H); 61BBH-61C7H keep both across the second pass over cylinder 0.

6571H - The Four Track Descriptors

Six bytes each: the address of the template, the values for +07H and +08H of the drive code table, and the bytes of memory the track takes above 6E00H. The front end picks the pair for the drive's size (6571H for 5 inch, 657DH for 8 inch), the first of a pair for single density and the second for double density; 64FBH or 650AH put it into effect.

6571-6576
DEFW 6589H, 2409H, 0D35H 89 65 09 24 35 0D
6571H-6576H: 5 inch single density. Template 6589H; +07H 09H (10 sectors on a track, one head), +08H 24H (2 granules on a track, 5 sectors to a granule); 0D35H (3381) bytes of memory, 20 more than the 3105 bytes of the track and the 256 bytes of FFH after it.
6577-657C
DEFW 65C9H, 4511H, 196AH C9 65 11 45 6A 19
6577H-657CH: 5 inch double density. Template 65C9H; +07H 11H (18 sectors on a track), +08H 45H (3 granules on a track, 6 sectors to a granule); 196AH (6506) bytes of memory, 84 fewer than the 6334 bytes of the track and the 256 bytes of FFH after it (19BEH) that 6013H writes.
657D-6582
DEFW 6623H, 270FH, 1558H 23 66 0F 27 58 15
657DH-6582H: 8 inch single density. Template 6623H; +07H 0FH (16 sectors on a track), +08H 27H (2 granules on a track, 8 sectors to a granule); 1558H (5464) bytes of memory, 32 more than the 5176 bytes of the track and the 256 bytes of FFH.
6583-6588
DEFW 6668H, 491DH, 29B1H 68 66 1D 49 B1 29
6583H-6588H: 8 inch double density. Template 6668H; +07H 1DH (30 sectors on a track), +08H 49H (3 granules on a track, 10 sectors to a granule); 29B1H (10673) bytes of memory, 60 more than the 10357 bytes of the track and the 256 bytes of FFH.

6589H - Template: 5 Inch, Single Density

10 sectors of 256 bytes, skew 7. The order of the sectors on the track, then the stream that 6013H expands: a gap of FFH bytes, then for each sector 6 bytes of 00H, the ID address mark FEH, the cylinder, side and sector (filled in by 60B2H), the size 01H (256 bytes), F7H (the controller writes the two CRC bytes), a gap, 6 bytes of 00H, the data address mark FBH, 256 bytes of E5H, F7H and a gap; then FFH to the end of the track. The track is 3105 bytes.

6589
DEFB 0AH 0A
6589H, template +00H: 0AH, 10 sectors on a track (6016H).
658A
DEFB 07H 07
658AH, template +01H: 07H, the skew: each cylinder starts the order of the sectors 7 places further on (6026H).
658B-6594
DEFB 00H, 05H, 01H, 06H, 02H, 07H, 03H, 08H, 04H, 09H 00 05 01 06 02 07 03 08 04 09
658BH-6594H: the order of the sectors on the track, with an interleave of 2: each sector number lies two places after the one before.
6595-659C
DEFB F6H x 8 F6 F6 F6 F6 F6 F6 F6 F6
6595H-659CH: F6H (minus 10) eight times, the skew plus 1: a pointer that runs past the last sector number moves back 10 places (60C2H-60CBH).
659D-659E
DEFB 0EH, FFH 0E FF
659DH-659EH: 14 bytes of FFH, the gap at the start of the track after the index pulse.
659F
DEFB F1H F1
659FH: F1H, the start of the part built once for each of the 10 sectors.
65A0-65A1
DEFB 06H, 00H 06 00
65A0H-65A1H: 6 bytes of 00H before the ID field.
65A2-65A3
DEFB 01H, FEH 01 FE
65A2H-65A3H: 1 byte FEH, the ID address mark.
65A4
DEFB F3H F3
65A4H: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
65A5-65A6
DEFB 03H, 00H 03 00
65A5H-65A6H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
65A7-65A8
DEFB 01H, 01H 01 01
65A7H-65A8H: 1 byte 01H, the size code of the ID field: 256 bytes.
65A9-65AA
DEFB 01H, F7H 01 F7
65A9H-65AAH: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
65AB-65AC
DEFB 01H, FFH 01 FF
65ABH-65ACH: 1 byte FFH, the start of the gap after the ID field.
65AD-65AE
DEFB 0BH, FFH 0B FF
65ADH-65AEH: 11 bytes of FFH, the rest of the gap after the ID field.
65AF-65B0
DEFB 06H, 00H 06 00
65AFH-65B0H: 6 bytes of 00H before the data field.
65B1-65B2
DEFB 01H, FBH 01 FB
65B1H-65B2H: 1 byte FBH, the data address mark.
65B3-65B4
DEFB 00H, E5H 00 E5
65B3H-65B4H: 256 bytes of E5H (a count of 00H), the data of the sector.
65B5-65B6
DEFB 01H, F7H 01 F7
65B5H-65B6H: 1 byte F7H: the controller writes the two CRC bytes of the data field.
65B7-65B8
DEFB 01H, FFH 01 FF
65B7H-65B8H: 1 byte FFH, the start of the gap after the data field.
65B9-65BA
DEFB 0DH, FFH 0D FF
65B9H-65BAH: 13 bytes of FFH, the rest of the gap after the data field.
65BB
DEFB F2H F2
65BBH: F2H, the end of the part built for each sector.
65BC-65BD
DEFB 47H, FFH 47 FF
65BCH-65BDH: 71 bytes of FFH, the gap at the end of the track.
65BE
DEFB F4H F4
65BEH: F4H, the end of the template; 6085H finishes the track there.
65BF-65C8
DEFB 00H, 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H 00 01 02 03 04 05 06 07 08 09
65BFH-65C8H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.

65C9H - Template: 5 Inch, Double Density

18 sectors of 256 bytes, skew 13. The stream: a gap of 4EH bytes, then for each sector 12 bytes of 00H, three F5H (the controller writes the sync byte A1H), the ID address mark FEH, the cylinder, side and sector, the size 01H, F7H (the two CRC bytes), a gap of 4EH, 12 bytes of 00H, three F5H, the data address mark FBH, 128 pairs 6DH B6H as the data, F7H and a gap; then 4EH to the end of the track. The track is 6334 bytes.

65C9
DEFB 12H 12
65C9H, template +00H: 12H, 18 sectors on a track (6016H).
65CA
DEFB 0DH 0D
65CAH, template +01H: 0DH, the skew: each cylinder starts the order of the sectors 13 places further on (6026H).
65CB-65DC
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
65CBH-65DCH: the order of the 18 sectors on the track (an interleave of 3).
65DD-65EA
DEFB EEH x 14 EE EE EE EE EE EE EE EE EE EE EE EE EE EE
65DDH-65EAH: EEH (minus 18) fourteen times, the skew plus 1: a pointer that runs past the last sector number moves back 18 places (60C2H-60CBH).
65EB-65EC
DEFB 20H, 4EH 20 4E
65EBH-65ECH: 32 bytes of 4EH, the gap at the start of the track.
65ED
DEFB F1H F1
65EDH: F1H, the start of the part built once for each of the 18 sectors.
65EE-65EF
DEFB 0CH, 00H 0C 00
65EEH-65EFH: 12 bytes of 00H before the ID field.
65F0-65F1
DEFB 03H, F5H 03 F5
65F0H-65F1H: 3 bytes F5H: the controller writes the sync byte A1H with a missing clock bit before the address mark.
65F2-65F3
DEFB 01H, FEH 01 FE
65F2H-65F3H: 1 byte FEH, the ID address mark.
65F4
DEFB F3H F3
65F4H: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
65F5-65F6
DEFB 03H, 00H 03 00
65F5H-65F6H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
65F7-65F8
DEFB 01H, 01H 01 01
65F7H-65F8H: 1 byte 01H, the size code of the ID field: 256 bytes.
65F9-65FA
DEFB 01H, F7H 01 F7
65F9H-65FAH: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
65FB-65FC
DEFB 16H, 4EH 16 4E
65FBH-65FCH: 22 bytes of 4EH, the gap after the ID field.
65FD-65FE
DEFB 0CH, 00H 0C 00
65FDH-65FEH: 12 bytes of 00H before the data field.
65FF-6600
DEFB 03H, F5H 03 F5
65FFH-6600H: 3 bytes F5H, the sync bytes A1H before the data address mark.
6601-6602
DEFB 01H, FBH 01 FB
6601H-6602H: 1 byte FBH, the data address mark.
6603-6606
DEFB F5H, 80H, 6DH, B6H F5 80 6D B6
6603H-6606H: F5H: the pair after the count is put that many times, 80H (128) pairs 6DH B6H, the 256 bytes of the sector's data.
6607-6608
DEFB 01H, F7H 01 F7
6607H-6608H: 1 byte F7H: the controller writes the two CRC bytes of the data field.
6609-660A
DEFB 01H, 4EH 01 4E
6609H-660AH: 1 byte 4EH, the start of the gap after the data field.
660B-660C
DEFB 17H, 4EH 17 4E
660BH-660CH: 23 bytes of 4EH, the rest of the gap after the data field.
660D
DEFB F2H F2
660DH: F2H, the end of the part built for each sector.
660E-660F
DEFB B6H, 4EH B6 4E
660EH-660FH: 182 bytes of 4EH, the gap at the end of the track.
6610
DEFB F4H F4
6610H: F4H, the end of the template; 6085H finishes the track there.
6611-6622
DEFB 00H, 0CH, 07H, 02H, 0EH, 09H, 04H, 10H, 0BH, 06H, 01H, 0DH, 08H, 03H, 0FH, 0AH, 05H, 11H 00 0C 07 02 0E 09 04 10 0B 06 01 0D 08 03 0F 0A 05 11
6611H-6622H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.

6623H - Template: 8 Inch, Single Density

16 sectors of 256 bytes, skew 2. The same fields as the 5 inch single density template (6589H) with longer gaps. The track is 5176 bytes.

6623
DEFB 10H 10
6623H, template +00H: 10H, 16 sectors on a track (6016H).
6624
DEFB 02H 02
6624H, template +01H: 02H, the skew: each cylinder starts the order of the sectors 2 places further on (6026H).
6625-6634
DEFB 0AH, 05H, 00H, 0BH, 06H, 01H, 0CH, 07H, 02H, 0DH, 08H, 03H, 0EH, 09H, 04H, 0FH 0A 05 00 0B 06 01 0C 07 02 0D 08 03 0E 09 04 0F
6625H-6634H: the order of the 16 sectors on the track (an interleave of 3).
6635-6637
DEFB F0H x 3 F0 F0 F0
6635H-6637H: F0H (minus 16) three times, the skew plus 1: a pointer that runs past the last sector number moves back 16 places (60C2H-60CBH).
6638-6639
DEFB 28H, FFH 28 FF
6638H-6639H: 40 bytes of FFH, the gap at the start of the track.
663A
DEFB F1H F1
663AH: F1H, the start of the part built once for each of the 16 sectors.
663B-663C
DEFB 06H, 00H 06 00
663BH-663CH: 6 bytes of 00H before the ID field.
663D-663E
DEFB 01H, FEH 01 FE
663DH-663EH: 1 byte FEH, the ID address mark.
663F
DEFB F3H F3
663FH: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
6640-6641
DEFB 03H, 00H 03 00
6640H-6641H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
6642-6643
DEFB 01H, 01H 01 01
6642H-6643H: 1 byte 01H, the size code of the ID field: 256 bytes.
6644-6645
DEFB 01H, F7H 01 F7
6644H-6645H: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
6646-6647
DEFB 0BH, FFH 0B FF
6646H-6647H: 11 bytes of FFH, the gap after the ID field.
6648-6649
DEFB 06H, 00H 06 00
6648H-6649H: 6 bytes of 00H before the data field.
664A-664B
DEFB 01H, FBH 01 FB
664AH-664BH: 1 byte FBH, the data address mark.
664C-664D
DEFB 00H, E5H 00 E5
664CH-664DH: 256 bytes of E5H (a count of 00H), the data of the sector.
664E-664F
DEFB 01H, F7H 01 F7
664EH-664FH: 1 byte F7H: the controller writes the two CRC bytes of the data field.
6650-6651
DEFB 01H, FFH 01 FF
6650H-6651H: 1 byte FFH, the start of the gap after the data field.
6652-6653
DEFB 14H, FFH 14 FF
6652H-6653H: 20 bytes of FFH, the rest of the gap after the data field.
6654
DEFB F2H F2
6654H: F2H, the end of the part built for each sector.
6655-6656
DEFB D0H, FFH D0 FF
6655H-6656H: 208 bytes of FFH, the gap at the end of the track.
6657
DEFB F4H F4
6657H: F4H, the end of the template; 6085H finishes the track there.
6658-6667
DEFB 0AH, 00H, 06H, 0CH, 02H, 08H, 0EH, 04H, 05H, 0BH, 01H, 07H, 0DH, 03H, 09H, 0FH 0A 00 06 0C 02 08 0E 04 05 0B 01 07 0D 03 09 0F
6658H-6667H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.

6668H - Template: 8 Inch, Double Density

30 sectors of 256 bytes, skew 3. The same fields as the 5 inch double density template (65C9H) with other gaps. The track is 10357 bytes.

6668
DEFB 1EH 1E
6668H, template +00H: 1EH, 30 sectors on a track (6016H).
6669
DEFB 03H 03
6669H, template +01H: 03H, the skew: each cylinder starts the order of the sectors 3 places further on (6026H).
666A-6687
DEFB 00H, 06H, 0CH, 12H, 18H, 01H, 07H, 0DH, 13H, 19H, 02H, 08H, 0EH, 14H, 1AH, 03H, 09H, 0FH, 15H, 1BH, 04H, 0AH, 10H, 16H, 1CH, 05H, 0BH, 11H, 17H, 1DH 00 06 0C 12 18 01 07 0D 13 19 02 08 0E 14 1A 03 09 0F 15 1B 04 0A 10 16 1C 05 0B 11 17 1D
666AH-6687H: the order of the 30 sectors on the track (an interleave of 5).
6688-668B
DEFB E2H x 4 E2 E2 E2 E2
6688H-668BH: E2H (minus 30) four times, the skew plus 1: a pointer that runs past the last sector number moves back 30 places (60C2H-60CBH).
668C-668D
DEFB 14H, 4EH 14 4E
668CH-668DH: 20 bytes of 4EH, the gap at the start of the track.
668E
DEFB F1H F1
668EH: F1H, the start of the part built once for each of the 30 sectors.
668F-6690
DEFB 0CH, 00H 0C 00
668FH-6690H: 12 bytes of 00H before the ID field.
6691-6692
DEFB 03H, F5H 03 F5
6691H-6692H: 3 bytes F5H: the controller writes the sync byte A1H with a missing clock bit before the address mark.
6693-6694
DEFB 01H, FEH 01 FE
6693H-6694H: 1 byte FEH, the ID address mark.
6695
DEFB F3H F3
6695H: F3H, the address of the next byte of the track goes into the table at 6D00H: the ID field's cylinder byte.
6696-6697
DEFB 03H, 00H 03 00
6696H-6697H: 3 bytes of 00H, the cylinder, side and sector of the ID field, filled in for each cylinder by 60B2H-60CDH.
6698-6699
DEFB 01H, 01H 01 01
6698H-6699H: 1 byte 01H, the size code of the ID field: 256 bytes.
669A-669B
DEFB 01H, F7H 01 F7
669AH-669BH: 1 byte F7H: the controller writes the two CRC bytes of the ID field.
669C-669D
DEFB 16H, 4EH 16 4E
669CH-669DH: 22 bytes of 4EH, the gap after the ID field.
669E-669F
DEFB 0CH, 00H 0C 00
669EH-669FH: 12 bytes of 00H before the data field.
66A0-66A1
DEFB 03H, F5H 03 F5
66A0H-66A1H: 3 bytes F5H, the sync bytes A1H before the data address mark.
66A2-66A3
DEFB 01H, FBH 01 FB
66A2H-66A3H: 1 byte FBH, the data address mark.
66A4-66A7
DEFB F5H, 80H, 6DH, B6H F5 80 6D B6
66A4H-66A7H: F5H: the pair after the count is put that many times, 80H (128) pairs 6DH B6H, the 256 bytes of the sector's data.
66A8-66A9
DEFB 01H, F7H 01 F7
66A8H-66A9H: 1 byte F7H: the controller writes the two CRC bytes of the data field.
66AA-66AB
DEFB 01H, FFH 01 FF
66AAH-66ABH: 1 byte FFH after the data field's CRC (the other templates of double density put 4EH here).
66AC-66AD
DEFB 11H, 4EH 11 4E
66ACH-66ADH: 17 bytes of 4EH, the gap after the data field.
66AE
DEFB F2H F2
66AEH: F2H, the end of the part built for each sector.
66AF-66B0
DEFB 00H, 4EH 00 4E
66AFH-66B0H: 256 bytes of 4EH (a count of 00H), the first part of the gap at the end of the track.
66B1-66B2
DEFB 3DH, 4EH 3D 4E
66B1H-66B2H: 61 bytes of 4EH, the rest of the gap at the end of the track.
66B3
DEFB F4H F4
66B3H: F4H, the end of the template; 6085H finishes the track there.
66B4-66D1
DEFB 00H, 0CH, 18H, 07H, 13H, 02H, 0EH, 1AH, 09H, 15H, 04H, 10H, 1CH, 0BH, 17H, 06H, 12H, 01H, 0DH, 19H, 08H, 14H, 03H, 0FH, 1BH, 0AH, 16H, 05H, 11H, 1DH 00 0C 18 07 13 02 0E 1A 09 15 04 10 1C 0B 17 06 12 01 0D 19 08 14 03 0F 1B 0A 16 05 11 1D
66B4H-66D1H: the sectors in the order the verify pass reads them (6155H): every second sector around the track, positions 0, 2, 4 and so on, then 1, 3, 5 and so on, so each read has the time of one sector before the next.

66D2H - The Engine's Texts (1)

The texts of the format, the verify and the directory. 03H ends a text with the cursor left at its end, 0DH ends the line, 0AH starts a new line, 1DH moves the cursor to the start of its line.

66D2
DEFB 1DH 1D
66D2H: 1DH, the cursor to the start of its line: the start of the text of 6095H.
66D3-66E8
DEFM "Formatting cylinder " 46 6F 72 6D 61 74 74 69 6E 67 20 63 79 6C 69 6E 64 65 72 20 20 20
66D3H-66E8H: Formatting cylinder and three spaces; 64E9H writes the cylinder number over the last two.
66E9
DEFB 03H 03
66E9H: 03H, the end of the text: the cursor stays after the spaces.
66EA
DEFB 1DH 1D
66EAH: 1DH, the cursor to the start of its line: the start of the text of 6136H.
66EB-6700
DEFM "Verifying cylinder " 56 65 72 69 66 79 69 6E 67 20 20 63 79 6C 69 6E 64 65 72 20 20 20
66EBH-6700H: Verifying, two spaces, cylinder and three spaces, as long as the text above; 64E9H writes the cylinder number over the last two.
6701
DEFB 03H 03
6701H: 03H, the end of the text: the cursor stays after the spaces.
6702-6705
DEFM "* " 2A 20 20 20
6702H-6705H: an asterisk and three spaces, displayed after the number of a cylinder that failed the verify (61EDH).
6706
DEFB 03H 03
6706H: 03H, the end of the text: the next cylinder number goes two places before its end.
6707-6713
DEFM "Formatting..." 46 6F 72 6D 61 74 74 69 6E 67 2E 2E 2E
6707H-6713H: Formatting..., displayed before the driver's function 0CH (6215H).
6714
DEFB 0DH 0D
6714H: 0DH, the end of the line and of the text.
6715-6739
DEFM "No cylinders available for directory!" 4E 6F 20 63 79 6C 69 6E 64 65 72 73 20 61 76 61 69 6C 61 62 6C 65 20 66 6F 72 20 64 69 72 65 63 74 6F 72 79 21
6715H-6739H: the text 627EH points to when no cylinder can take the directory; the JP 6434H after it displays Format aborted! instead.
673A
DEFB 0DH 0D
673AH: 0DH, the end of the line and of the text.
673B-675F
DEFM "Directory will be placed on cylinder " 44 69 72 65 63 74 6F 72 79 20 77 69 6C 6C 20 62 65 20 70 6C 61 63 65 64 20 6F 6E 20 63 79 6C 69 6E 64 65 72 20
673BH-675FH: Directory will be placed on cylinder and a space, displayed by 6292H.
6760-6761
DEFM "00" 30 30
6760H-6761H: two digits, 00 in the file: 628EH stores the directory cylinder here.
6762
DEFB 0DH 0D
6762H: 0DH, the end of the line and of the text.

6763H - Restore and Side 0

Called by 61A3H before the second pass over cylinder 0: the head goes back to cylinder 0 and side 0 is chosen. Four NOPs follow the RES.

6763
GOSUB to 6467H, the driver's function 04H, Restore: the head goes back to cylinder 0 and +05H of the working table becomes 00H.
6766
RES 4,(IY+03H) FD CB 03 A6
Reset bit 4 of +03H of the working drive code table at Index Register IY (6567H): side 0 for the next select and write.
676A
NOP 00
No operation: the first of four bytes of 00H between the RES and the RET.
676B
NOP 00
No operation: the second of the four bytes of 00H before the RET.
676C
NOP 00
No operation: the third of the four bytes of 00H before the RET.
676D
NOP 00
No operation: the last of the four bytes of 00H before the RET.
676E
RET C9
RETurn to 61A6H, the caller, with the head on cylinder 0 and side 0 chosen.

676FH - The Engine's Texts (2)

The texts of the second pass over cylinder 0, of the system information, of the end and of the errors, and 32 bytes of 00H that end the block.

676F
DEFB 0AH 0A
676FH: 0AH, a new line: the start of the text of 6197H.
6770-6784
DEFM " Re-format track 0..." 20 52 65 2D 66 6F 72 6D 61 74 20 74 72 61 63 6B 20 30 2E 2E 2E
6770H-6784H: a space and Re-format track 0..., displayed before the second pass over cylinder 0 in single density.
6785
DEFB 0DH 0D
6785H: 0DH, the end of the line and of the text.
6786
DEFB 0AH 0A
6786H: 0AH, a new line: the start of the text of 6298H.
6787-67A6
DEFM "Initializing SYSTEM information " 49 6E 69 74 69 61 6C 69 7A 69 6E 67 20 53 59 53 54 45 4D 20 69 6E 66 6F 72 6D 61 74 69 6F 6E 20
6787H-67A6H: Initializing SYSTEM information and a space; the periods and plus signs of the sectors written follow on the line.
67A7
DEFB 03H 03
67A7H: 03H, the end of the text: the cursor stays at its end.
67A8
DEFB 0AH 0A
67A8H: 0AH, a new line: the start of the text of 6451H.
67A9-67CC
DEFM "Load SYSTEM diskette and hit <ENTER>" 4C 6F 61 64 20 53 59 53 54 45 4D 20 64 69 73 6B 65 74 74 65 20 61 6E 64 20 68 69 74 20 3C 45 4E 54 45 52 3E
67A9H-67CCH: Load SYSTEM diskette and hit <ENTER>, displayed after a format of drive 0.
67CD
DEFB 0DH 0D
67CDH: 0DH, the end of the line and of the text.
67CE
DEFB 0AH 0A
67CEH: 0AH, a new line: the start of the text of 641DH.
67CF-67E1
DEFM "Formatting complete" 46 6F 72 6D 61 74 74 69 6E 67 20 63 6F 6D 70 6C 65 74 65
67CFH-67E1H: Formatting complete, displayed and written to the job log by @LOGOT at the end.
67E2
DEFB 0DH 0D
67E2H: 0DH, the end of the line and of the text.
67E3
DEFB 0AH 0A
67E3H: 0AH, a new line: the start of the text of 6423H.
67E4-680A
DEFM "Note: Realtime clock no longer accurate" 4E 6F 74 65 3A 20 52 65 61 6C 74 69 6D 65 20 63 6C 6F 63 6B 20 6E 6F 20 6C 6F 6E 67 65 72 20 61 63 63 75 72 61 74 65
67E4H-680AH: Note: Realtime clock no longer accurate, since the clock interrupt was shut out while the tracks were written.
680B
DEFB 0DH 0D
680BH: 0DH, the end of the line and of the text.
680C-681A
DEFM "Format aborted!" 46 6F 72 6D 61 74 20 61 62 6F 72 74 65 64 21
680CH-681AH: Format aborted!, the text of 6434H, displayed and written to the job log.
681B
DEFB 0DH 0D
681BH: 0DH, the end of the line and of the text.
681C-6839
DEFM "Can't, Diskette not formatted!" 43 61 6E 27 74 2C 20 44 69 73 6B 65 74 74 65 20 6E 6F 74 20 66 6F 72 6D 61 74 74 65 64 21
681CH-6839H: the text of 62C6H, for a diskette whose cylinder 0, sector 0 cannot be read when only the system information is to be written.
683A
DEFB 0DH 0D
683AH: 0DH, the end of the line and of the text.
683B-685A
DEFB 00H x 32 00 x 32
683BH-685AH: 32 bytes of 00H at the end of the block. No code addresses them.

685BH - Memory Not in the File, the Boot Sector Pointers, the Allocation Table Image

685BH-68FFH and 6904H-69FFH are not used. 6900H-6903H point to the step rate byte of each boot sector image. 6A00H-6AFFH is the image of the allocation table, with the offsets of the sector: 6A00H-6ACAH is built at run time and not in the file; 6ACBH-6AFFH holds the fields after it.

685B-68FF
DEFS 165
685BH-68FFH: not in the file, and no code of FORMAT uses it.
6900-6901
DEFW 6BBCH BC 6B
6900H-6901H: 6BBCH, the Seek command byte of boot sector 0's image (42BCH when it runs), read by 62B8H.
6902-6903
DEFW 6C10H 10 6C
6902H-6903H: 6C10H, the step rate byte of boot sector 1's image (4210H when it runs), read by 62E5H.
6904-69FF
DEFS 252
6904H-69FFH: not in the file, and no code of FORMAT uses it.
6A00-6ACA
DEFS 203
6A00H-6ACAH: not in the file. The allocation table image, +00H-+CAH: 6A00H-6A5FH one byte for each cylinder, a bit set for each granule not free (the front end fills it, 70E6H; the verify sets FFH for a bad cylinder, 61F7H); 6A60H-6ABFH the lock out table (61DAH copies the allocation bytes there); 6AC0H-6ACAH what memory holds.
6ACB
DEFB 53H 53
6ACBH, the allocation table +CBH: 53H, written to the diskette as it is.
6ACC
DEFB 00H 00
6ACCH, +CCH: the number of cylinders less 35, 00H in the file, stored by 6315H.
6ACD
DEFB 00H 00
6ACDH, +CDH: the configuration byte, 00H in the file, stored by 6335H (bit 7 and bit 3 always, bit 6 double density, bit 5 two sides, bit 4 cylinder 0 single density, bits 2-0 the granules on a track less one).
6ACE-6ACF
DEFW 0000H 00 00
6ACEH-6ACFH, +CEH-+CFH: the hash of the master password, 0000H in the file, stored by the front end (6F6CH).
6AD0-6AD7
DEFM " " 20 20 20 20 20 20 20 20
6AD0H-6AD7H, +D0H-+D7H: the diskette name, eight spaces in the file, stored by the front end (6EEAH, 6F14H).
6AD8-6ADF
DEFM "MM/DD/YY" 4D 4D 2F 44 44 2F 59 59
6AD8H-6ADFH, +D8H-+DFH: the date the diskette is formatted, MM/DD/YY in the file, stored by the front end (6F19H).
6AE0
DEFB 0DH 0D
6AE0H, +E0H: 0DH, the AUTO command of the diskette: none.
6AE1-6AFF
DEFM " " 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6AE1H-6AFFH, +E1H-+FFH: 31 spaces, the rest of the AUTO command field.

6B00H - Image of Boot Sector 0 (Runs at 4200H)

The 256 bytes 6B00H-6BFFH are the boot sector FORMAT writes to cylinder 0, sector 0 (62CCH-62D5H), with the directory cylinder stored at its +02H (6B02H, 62B1H) and the bootstrap step rate in bits 1-0 of its Seek command (6BBCH, 62B8H-62BFH). The rows show the code as it runs: the ROM reads the sector into 4200H-42FFH at a reset and jumps to 4200H, so every address in the comments is 2900H below the address of the row (4200H for 6B00H). It finds SYS0/SYS through its directory record (sector 4 of the directory cylinder), reads its first extent into 5100H-51FFH, copies each load block to its address and jumps to the transfer address, working the floppy disk controller through its registers at 37ECH-37EFH.

6B00
NOP 00
No operation. Byte 0 of the boot sector is 00H. Execution passes to 4201H.
6B01
CP 11H FE 11
Compare Register A against 11H. The flags are never tested: the instruction only steps over byte 2 of the sector (4202H, 6B02H in this image), which is data: 11H in the file, the directory cylinder, which FORMAT stores there for the new diskette (62B1H). The LD A,(4202H) at 4216H below reads it, and SYS0/SYS's reset (4E76H) copies it to 4709H, the directory cylinder byte (+09H) of drive 0's drive code table.
6B03
DI F3
Disable interrupts. No clock interrupt (through the RST 38H vector at 4012H) may run while SYS0/SYS loads over the ROM's vectors and work area in 4000H-41FFH; interrupts stay off until SYS0/SYS's reset turns them on (its 4E84H).
6B04
LD SP,41E0H 31 E0 41
Load the Stack Pointer with 41E0H. The stack holds return addresses and the pushes of Register Pairs BC, DE and HL of the routines below, at most 12 bytes (41D4H-41DFH) during a sector read from the byte fetch. SYS0/SYS's last load record puts 00H 00H at 41DEH-41DFH; the CALLs that follow store their return addresses over them, so at the jump to SYS0/SYS they hold 77H 42H, the return address 4277H of the CALL at 4274H.
6B07
LD IY,0000H FD 21 00 00
Load Index Register IY with 0000H. SYS0/SYS's reset (4E4FH-4E54H) tests IY: 0000H tells it that this sector, the boot sector the ROM runs, loaded it, so it takes the step rate from 42BCH below and does not set bit 0 of 442FH, the flag of a boot through a disk driver.
6B0B
LD HL,42E4H 21 E4 42
Point Register Pair HL to 42E4H, the text 1CH 1FH 03H: cursor to the top left, clear to the end of the screen, end of text.
6B0E
GOSUB to 429EH to display the text at Register Pair HL (42E4H) through the ROM: the screen is cleared.
6B11
LD A,01H 3E 01
Load Register A with 01H, the select bit of drive 0.
6B13
LD (37E1H),A 32 E1 37
Store Register A (01H) to the drive select latch at 37E1H: drive 0 is selected and its motor runs.
6B16
LD A,(4202H) 3A 02 42
Fetch the directory cylinder from 4202H (byte 2 of this sector, 6B02H in this image, stored by FORMAT at 62B1H) into Register A.
6B19
LD D,A 57
Copy Register A (the directory cylinder) into Register D, the cylinder for the sector read at 42ACH.
6B1A
LD E,04H 1E 04
Load Register E with 04H: sector 4 of the directory cylinder, whose first directory record (bytes 00H-1FH) is the record of SYS0/SYS. Sectors 0 and 1 of the directory cylinder hold the granule allocation table and the hash index table; the first records of sectors 2 and 3 are BOOT/SYS and DIR/SYS.
6B1C
LD BC,5100H 01 00 51
Point Register Pair BC to 5100H, the 256 byte buffer the sector is read into.
6B1F
GOSUB to 42ACH to read cylinder Register D, sector Register E into the buffer at Register Pair BC (5100H). On return the Z FLAG is set if the read succeeded (in one of two tries) and Register Pair HL holds 5100H.
6B22
If the NZ FLAG is set (the directory sector could not be read), JUMP to 4294H (6B94H in this image) to display Disk Error and stop.
6B24
LD A,(5100H) 3A 00 51
Fetch byte 00H of the directory record from 5100H into Register A: the attribute byte of SYS0/SYS's directory record.
6B27
AND 10H E6 10
Mask Register A to bit 4, the bit that marks a directory record in use. The Z FLAG is set when the record is free, that is when the diskette has no SYS0/SYS.
6B29
LD HL,42E7H 21 E7 42
Point Register Pair HL to 42E7H, the text No System, in case the record is free. LD does not change the flags of the AND above.
6B2C
If the Z FLAG is set (bit 4 of the attribute byte in Register A is 0: no SYS0/SYS on the diskette in drive 0), JUMP to 4297H (6B97H in this image) to display No System at Register Pair HL and stop.

6B2EH - Image of Boot Sector 0: Locate SYS0/SYS (Runs at 422EH)

Byte 16H of the directory record is the cylinder of the file's first extent and byte 17H holds its first granule (bits 7-5) and the number of granules less one (bits 4-0). This code works the first granule into a sector number, 5 sectors to a granule, and sets up the alternate register set, which does all the reading from here on: Register Pair DE' holds the cylinder and sector of the next sector to read and Register Pair BC' the pointer into the buffer. Only the first extent is used, read as consecutive sectors.

6B2E
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set. The values worked out below go into the alternate set, which only the byte fetch routine at 4279H uses.
6B2F
LD HL,(5116H) 2A 16 51
Fetch the first extent of SYS0/SYS from 5116H-5117H into Register Pair HL: Register L = byte 16H (the cylinder) and Register H = byte 17H (the first granule in bits 7-5, the number of granules less one in bits 4-0).
6B32
LD D,L 55
Copy Register L (the cylinder of the first extent) into Register D, the cylinder of the first sector to read.
6B33
LD A,H 7C
Copy Register H (byte 17H: first granule in bits 7-5) into Register A.
6B34
RLCA 07
Rotate Register A left one bit (bit 7 goes to bit 0): first of three rotations that bring the first granule from bits 7-5 down to bits 2-0.
6B35
RLCA 07
Rotate Register A left one bit again: second of three rotations that bring the first granule from bits 7-5 down to bits 2-0.
6B36
RLCA 07
Rotate Register A left one bit again: bits 7-5 of byte 17H are now bits 2-0 of Register A.
6B37
AND 07H E6 07
Mask Register A to bits 2-0: Register A now holds the number of the first granule on the cylinder (0 or 1 on a single density cylinder of 10 sectors).
6B39
LD H,A 67
Copy Register A (the granule number) into Register H, to be added once more below.
6B3A
RLCA 07
Rotate Register A left one bit: Register A = granule x 2 (bits 2-0 hold at most 7, so no bit is lost).
6B3B
RLCA 07
Rotate Register A left one bit again: Register A = granule x 4.
6B3C
ADD A,H 84
Add Register H (the granule number) to Register A: Register A = granule x 5, the first sector of the granule (5 sectors to a granule: sector 0 or 5).
6B3D
LD E,A 5F
Copy Register A (the first sector of the file) into Register E. Register Pair DE (alternate set) now holds the cylinder and sector where SYS0/SYS begins.
6B3E
LD BC,51FFH 01 FF 51
Load Register Pair BC with 51FFH, one byte before the buffer at 5100H. The byte fetch at 4279H increments only Register C, so its first call turns 51FFH into 5100H with the Z FLAG set, and that makes it read the first sector of SYS0/SYS before it takes a byte.
6B41
EXX D9
Exchange Register Pairs BC, DE and HL back with the alternate set. The alternate set now holds the read position (DE' cylinder and sector, BC' buffer pointer); the main set is free for the loader.

6B42H - Image of Boot Sector 0: Load SYS0/SYS Record by Record (Runs at 4242H)

SYS0/SYS is a load module: records of a type byte, a length byte and the data. Type 01H is a load block (two address bytes, then the length less 2 data bytes; a length of 02H gives 256), type 02H is the transfer address, and every other type is passed over by its length. The bytes come one at a time from the buffer through 4279H, which reads the next sector when the buffer is used up.

6B42
GOSUB to 4279H to fetch the next byte of SYS0/SYS into Register A: the record type.
6B45
DEC A 3D
DECrement Register A (the record type) by 1. The Z FLAG is set when the type was 01H, a load block.
6B46
If the NZ FLAG is set (the type in Register A was not 01H), JUMP to 425FH (6B5FH in this image) to check for the transfer address record or pass over the record.
6B48
GOSUB to 4279H to fetch the next byte into Register A: the record's length byte (the number of bytes after it).
6B4B
LD B,A 47
Copy Register A (the record length) into Register B, the count of bytes of this record still to be read.
6B4C
GOSUB to 4279H to fetch the next byte into Register A: the low byte of the load address.
6B4F
LD L,A 6F
Copy Register A (the low byte of the load address) into Register L.
6B50
DEC B 05
DECrement Register B (the bytes left in the record) by 1 for the low address byte just read.
6B51
GOSUB to 4279H to fetch the next byte into Register A: the high byte of the load address.
6B54
LD H,A 67
Copy Register A (the high byte of the load address) into Register H. Register Pair HL now holds the address where this block's data goes.
6B55
DEC B 05
DECrement Register B by 1 for the high address byte. Register B now holds the number of data bytes (a length byte of 02H gives 00H, which the DJNZ below counts as 256).
6B56
GOSUB to 4279H to fetch the next data byte of the block into Register A. 425BH loops back here.
6B59
LD (HL),A 77
Store Register A (the data byte) at the load address in Register Pair HL.
6B5A
INC HL 23
INCrement Register Pair HL, the load address, to the next byte.
6B5B
DECrement Register B (the data bytes left) and LOOP BACK to 4256H (6B56H in this image) until the block is copied.
6B5D
JUMP back to 4242H (6B42H in this image) for the next record: the load block in Register Pair HL's range is copied.
6B5F
DEC A 3D
DECrement Register A again: the type in Register A is now the record type less 2. The Z FLAG is set when the type was 02H, the transfer address.
6B60
If the Z FLAG is set (the type in Register A was 02H), JUMP to 426DH (6B6DH in this image) to take the transfer address and run SYS0/SYS.
6B62
Any other type (00H, 03H and up) is passed over. GOSUB to 4279H to fetch the record's length byte into Register A.
6B65
LD B,A 47
Copy Register A (the record length) into Register B, the number of bytes to pass over. A length of 00H passes over 256 bytes.
6B66
GOSUB to 4279H to fetch the next byte of the record into Register A, which is not used. 4269H loops back here.
6B69
DECrement Register B (the bytes left to pass over) and LOOP BACK to 4266H (6B66H in this image) until the record is passed over.
6B6B
JUMP back to 4242H (6B42H in this image) for the next record: the passed over record changed nothing in memory.
6B6D
Type 02H, the transfer address. GOSUB to 4279H to fetch the record's length byte into Register A (02H); it is not used.
6B70
GOSUB to 4279H to fetch the next byte into Register A: the low byte of the transfer address.
6B73
LD L,A 6F
Copy Register A (the low byte of the transfer address) into Register L.
6B74
GOSUB to 4279H to fetch the next byte into Register A: the high byte of the transfer address.
6B77
LD H,A 67
Copy Register A (the high byte of the transfer address) into Register H. Register Pair HL now holds the transfer address of SYS0/SYS (4E00H for LDOS 5.3.1).
6B78
JP (HL) E9
JUMP to the address in Register Pair HL: SYS0/SYS's reset code. Index Register IY still holds 0000H (4207H), interrupts are off and the Stack Pointer is 41E0H; SYS0/SYS sets its own stack at once.

6B79H - Image of Boot Sector 0: Fetch the Next Byte (Runs at 4279H)

Returns the next byte of the file in Register A. Works in the alternate register set: Register Pair BC' points into the buffer at 5100H and Register Pair DE' holds the cylinder and sector of the next sector to read. When Register C' wraps to 00H the buffer is used up and the next sector is read into it first. The main registers of the caller are not changed.

6B79
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: Register Pair BC now points into the buffer and Register Pair DE holds the next cylinder and sector.
6B7A
INC C 0C
INCrement Register C, the low byte of the buffer pointer in Register Pair BC. The Z FLAG is set when it wraps from FFH to 00H: the 256 bytes of the buffer have all been used (or this is the first call, with Register Pair BC = 51FFH).
6B7B
If the NZ FLAG is set (Register C did not wrap, so the buffer at Register Pair BC still holds unread bytes), JUMP to 4291H (6B91H in this image) to fetch the byte.
6B7D
PUSH BC C5
Save Register Pair BC (the buffer pointer, now 5100H) to the stack. The read below changes Register Pair BC.
6B7E
LD A,01H 3E 01
Load Register A with 01H, the select bit of drive 0.
6B80
LD (37E1H),A 32 E1 37
Store Register A (01H) to the drive select latch at 37E1H again before every sector: selecting the drive restarts its motor time-out, so the motor keeps running while SYS0/SYS loads.
6B83
GOSUB to 42ACH to read cylinder Register D, sector Register E into the buffer at Register Pair BC (5100H). The Z FLAG is set on return if the read succeeded.
6B86
If the NZ FLAG is set (the sector could not be read in two tries), JUMP to 4294H (6B94H in this image) to display Disk Error and stop.
6B88
POP BC C1
Restore Register Pair BC (the buffer pointer, 5100H) from the stack.
6B89
INC E 1C
INCrement Register E, the sector number, to the next sector.
6B8A
LD A,E 7B
Copy Register E (the next sector number) into Register A.
6B8B
SUB 0AH D6 0A
SUBtract 0AH (10, the number of sectors on a single density cylinder) from Register A (the next sector number). The Z FLAG is set when Register E has passed the last sector, 9.
6B8D
If the NZ FLAG is set (the next sector in Register E is still on this cylinder), JUMP to 4291H (6B91H in this image) to fetch the byte.
6B8F
LD E,A 5F
Copy Register A (00H) into Register E: sector 0 of the next cylinder.
6B90
INC D 14
INCrement Register D, the cylinder number, to the next cylinder.
6B91
LD A,(BC) 0A
Fetch the byte at Register Pair BC (the buffer pointer) into Register A: the next byte of SYS0/SYS.
6B92
EXX D9
Exchange Register Pairs BC, DE and HL back with the alternate set: the read position is kept in the alternate set and the caller's Register Pairs BC, DE and HL come back.
6B93
RET C9
RETurn to the caller with the byte in Register A.

6B94H - Image of Boot Sector 0: Display an Error and Stop (Runs at 4294H)

Disk Error is shown when a sector cannot be read, No System (entered at 4297H with Register Pair HL = 42E7H) when the directory record of SYS0/SYS is free. Both wait for a line from the keyboard and then stop the computer; only RESET restarts it.

6B94
LD HL,42F3H 21 F3 42
Point Register Pair HL to 42F3H, the text Disk Error.
6B97
GOSUB to 429EH to display the text at Register Pair HL (42F3H Disk Error, or 42E7H No System from 422CH). Register Pair HL comes back unchanged.
6B9A
GOSUB to the ROM's line input at 0040H. It waits for keys and stores them over the message text at Register Pair HL, at most Register B characters (51H or 52H, the high byte the sector read left in the buffer pointer), until ENTER or BREAK. Nothing uses the line: it only waits for the operator.
6B9D
HALT 76
Stop the processor. Interrupts are off (4203H), so only the RESET button (a non maskable interrupt) starts the computer again.

6B9EH - Image of Boot Sector 0: Display a Text (Runs at 429EH)

Displays the bytes at Register Pair HL through the ROM until the end byte 03H. Register Pair HL is kept.

6B9E
PUSH HL E5
Save Register Pair HL (the start of the text) to the stack, so the caller gets it back at 42AAH.
6B9F
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A. 42A8H loops back here.
6BA0
CP 03H FE 03
Compare Register A (the character) against 03H, the end of text byte. The Z FLAG is set at the end.
6BA2
If the Z FLAG is set (Register A holds 03H, the end of the text), JUMP to 42AAH (6BAAH in this image) to return.
6BA4
GOSUB to the ROM's display routine at 0033H to display the character in Register A. The ROM acts on the control codes: 1CH moves the cursor to the top left, 1FH clears to the end of the screen, 17H switches to 32 characters per line, and C0H-FFH display (code less C0H) spaces (E8H: 40 spaces).
6BA7
INC HL 23
INCrement Register Pair HL to the next character of the text.
6BA8
LOOP BACK to 429FH (6B9FH in this image) for the next character of the text at Register Pair HL.
6BAA
POP HL E1
Restore Register Pair HL (the start of the text) from the stack.
6BAB
RET C9
RETurn to the caller with Register Pair HL pointing at the start of the text again.

6BACH - Image of Boot Sector 0: Read a Sector, Two Tries (Runs at 42ACH)

Reads cylinder Register D, sector Register E of drive 0 into the buffer at Register Pair BC. The first try is the CALL 42B4H; when it fails, the code falls into 42B4H for a second try, which returns straight to the caller. On return the Z FLAG is set if the sector was read, and Register Pair HL holds the buffer address.

6BAC
PUSH BC C5
Save Register Pair BC (the buffer address) to the stack: the read at 42B4H advances Register Pair BC through the buffer.
6BAD
GOSUB to 42B4H for the first try at reading cylinder Register D, sector Register E into the buffer at Register Pair BC. The Z FLAG is set on return if it succeeded.
6BB0
POP HL E1
Restore the buffer address saved at 42ACH from the stack into Register Pair HL. POP does not change the flags.
6BB1
RET Z C8
If the Z FLAG is set (the first try read the sector), RETurn to the caller with Register Pair HL = the buffer address.
6BB2
LD B,H 44
Copy Register H (the high byte of the buffer address) into Register B for the second try.
6BB3
LD C,L 4D
Copy Register L (the low byte of the buffer address) into Register C. Register Pair BC again holds the buffer address, and the code falls into 42B4H for the second and last try, which returns to this routine's caller.
6BB4
LD (37EEH),DE ED 53 EE 37
Store Register Pair DE to 37EEH-37EFH: Register E (the sector) goes to the controller's sector register at 37EEH and Register D (the cylinder) to its data register at 37EFH, where the seek command takes the cylinder to move to. The track register (37EDH) is not written: it holds the cylinder the head is on (0 after the ROM's restore, then the last cylinder sought).
6BB8
LD HL,37ECH 21 EC 37
Point Register Pair HL to 37ECH, the controller's command register (written) and status register (read).
6BBB
LD (HL),1BH 36 1B
Store 1BH to the command register at Register Pair HL (37ECH): Seek to the cylinder in the data register. FORMAT writes the bootstrap step rate into bits 1-0 of this command byte (42BCH, 6BBCH in this image; 62B8H-62BFH through the pointer at 6900H), and SYS0/SYS's reset (4E66H-4E75H) copies those two bits into drive 0's drive code table at 4703H.
1771 FDC Command: 1BH (00011011)Function Description
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0Summary of Bits
00011011Command=Seek (bits 7-4 = 0001)
h = 1: head load and settle delay
V = 0: no verify
r1 r0 = 11: 40 ms stepping rate
6BBD
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (the Stack Pointer is not changed): first of four exchanges that only pass time (the four take 76 cycles) so the controller has set its busy bit before the status is read. Register Pair HL is unchanged after the even number of exchanges.
6BBE
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (the Stack Pointer is not changed) again: second of the four delay exchanges.
6BBF
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (the Stack Pointer is not changed) again: third of the four delay exchanges.
6BC0
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (the Stack Pointer is not changed) again: fourth delay exchange. Register Pair HL holds 37ECH again.
6BC1
LD A,(HL) 7E
Fetch the controller's status from 37ECH (Register Pair HL) into Register A. 42C3H loops back here.
6BC2
RRCA 0F
Rotate Register A right one bit: bit 0 of the status, BUSY, goes into the CARRY FLAG.
6BC3
If the CARRY FLAG is set (the controller is still busy with the seek), LOOP BACK to 42C1H (6BC1H in this image) to read the status again.
6BC5
LD (HL),88H 36 88
Store 88H to the command register at Register Pair HL (37ECH): Read Sector, the sector in the sector register on the cylinder just reached.
1771 FDC Command: 88H (10001000)Function Description
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0Summary of Bits
10001000Command=Read Sector (bits 7-5 = 100)
m = 0: one sector
b = 1: IBM sector length
E = 0: no head load delay
6BC7
PUSH DE D5
Save Register Pair DE (the cylinder and sector) to the stack, since Register Pair DE is needed for the data register address.
6BC8
LD DE,37EFH 11 EF 37
Point Register Pair DE to 37EFH, the controller's data register, where each byte of the sector arrives.
6BCB
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (the Stack Pointer is not changed): first of two exchanges that only pass time while the controller starts the read. Register Pair HL is unchanged after both.
6BCC
EX (SP),HL E3
Exchange Register Pair HL with the word at the top of the stack (the Stack Pointer is not changed) again: Register Pair HL holds 37ECH (the status register) again.
6BCD
JUMP to 42DAH (6BDAH in this image), which goes on to the status test at 42D2H.
6BCF
RRCA 0F
Rotate Register A (the status, with DATA REQUEST clear) right one bit: bit 0, BUSY, goes into the CARRY FLAG.
6BD0
If the NO CARRY FLAG is set (the controller is no longer busy: the sector is finished), JUMP to 42DCH (6BDCH in this image) to check the result.
6BD2
LD A,(HL) 7E
Fetch the controller's status from 37ECH (Register Pair HL) into Register A. 42DAH and 42D5H come back here.
6BD3
BIT 1,A CB 4F
Test bit 1 of Register A (the status): DATA REQUEST, a byte waiting in the data register. The Z FLAG is set when no byte is waiting.
6BD5
If the Z FLAG is set (no byte in the data register yet), JUMP to 42CFH (6BCFH in this image) to check whether the controller has finished.
6BD7
LD A,(DE) 1A
Fetch the byte from the controller's data register at Register Pair DE (37EFH) into Register A. Reading it clears DATA REQUEST.
6BD8
LD (BC),A 02
Store Register A (the byte of the sector) into the buffer at Register Pair BC.
6BD9
INC BC 03
INCrement Register Pair BC to the next byte of the buffer.
6BDA
JUMP to 42D2H (6BD2H in this image) to wait for the next byte or the end of the read.
6BDC
LD A,(HL) 7E
Fetch the controller's final status from 37ECH (Register Pair HL) into Register A.
6BDD
AND 1CH E6 1C
Mask Register A to bits 4-2 of the status: RECORD NOT FOUND (bit 4), CRC ERROR (bit 3) and LOST DATA (bit 2). The Z FLAG is set when none of them is on: the sector was read.
6BDF
POP DE D1
Restore Register Pair DE (the cylinder and sector) from the stack. POP does not change the flags.
6BE0
RET Z C8
If the Z FLAG is set (no error bit in Register A), RETurn: the sector is in the buffer.
6BE1
LD (HL),D0H 36 D0
Store D0H to the command register at Register Pair HL (37ECH): Force Interrupt ends whatever the controller is doing after the failed read. The NZ FLAG from the AND at 42DDH is still set for the caller.
1771 FDC Command: D0H (11010000)Function Description
Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0Summary of Bits
11010000Command=Force Interrupt (bits 7-4 = 1101)
I3-I0 = 0000: end the command, no interrupt
6BE3
RET C9
RETurn to the caller with the NZ FLAG set: the read failed.

6BE4H - Image of Boot Sector 0: Texts (42E4H-42FFH)

The three texts this sector displays through 429EH, each ended by 03H.

6BE4-6BE6
DEFB 1CH, 1FH, 03H 1C 1F 03
The text displayed by 420EH at the start: 1CH moves the cursor to the top left, 1FH clears to the end of the screen, 03H ends the text.
6BE7-6BE8
DEFB 17H, E8H 17 E8
Start of the No System text (422CH): 17H switches the screen to 32 characters per line, E8H displays 40 spaces (E8H less C0H), which puts the message on the second line, 8 columns in.
6BE9-6BF1
DEFM "No System" 4E 6F 20 53 79 73 74 65 6D
The message displayed when the directory record of SYS0/SYS is not in use (4224H-422CH).
6BF2
DEFB 03H 03
End of the No System text: 429EH stops at this byte and does not display it.
6BF3-6BF4
DEFB 17H, E8H 17 E8
Start of the Disk Error text (4294H): 17H switches the screen to 32 characters per line, E8H displays 40 spaces, which puts the message on the second line, 8 columns in.
6BF5-6BFE
DEFM "Disk Error" 44 69 73 6B 20 45 72 72 6F 72
The message displayed when a sector cannot be read in two tries (4222H, 4286H).
6BFF
DEFB 03H 03
End of the Disk Error text, and the last byte of sector 0.

6C00H - Image of Boot Sector 1 (Runs at 4200H)

The 256 bytes 6C00H-6CFFH are the boot sector FORMAT writes to cylinder 0, sector 1 (62F0H-62F9H), with the directory cylinder at its +02H (6C02H, 62DEH) and the bootstrap step rate at 6C10H (the operand of OR 03H at 420FH, 62E5H-62ECH). The rows show the code as it runs at 4200H-42FFH: every address in the comments is 2A00H below the address of the row. It is the boot sector for a computer whose own boot code reads the diskette through a disk driver and enters it with Index Register IY pointing at drive 0's drive code table, whose first three bytes are a JP to the driver; every read goes through that driver (JP (IY) at 42D5H) with function 09H. SYS0/SYS's reset (4E4FH-4E61H) sees that Index Register IY is not 0000H, copies the 10 bytes at IY to drive 0's table at 4700H and sets bit 0 of 442FH.

6C00
NOP 00
No operation. Byte 0 of the sector is 00H, as in sector 0. Execution passes to 4201H.
6C01
CP 11H FE 11
Compare Register A against 11H. The flags are never tested: the instruction only steps over byte 2 of the sector (4202H, 6C02H in this image), which is data: 11H in the file, the directory cylinder, which FORMAT stores there for the new diskette (62DEH). 4229H below reads it, and SYS0/SYS's reset (4E76H) copies it to 4709H, the directory cylinder byte of drive 0's drive code table.
6C03
LD SP,4160H 31 60 41
Load the Stack Pointer with 4160H. The stack holds the return addresses, the buffer address and the sectors per cylinder pushed below, and whatever the disk driver pushes, growing down from 4160H.
6C06
DI F3
Disable interrupts while SYS0/SYS loads over the vectors and work area in 4000H-41FFH. SYS0/SYS's reset turns them on (its 4E84H).
6C07
GOSUB to the ROM's clear screen routine at 01C9H: the screen is cleared and the cursor goes to the top left.
6C0A
LD A,(IY+03H) FD 7E 03
Fetch byte +03H of drive 0's drive code table at Index Register IY into Register A: the drive's flags, with the step rate in bits 1-0.
6C0D
AND FCH E6 FC
Mask Register A to bits 7-2 (AND FCH): the step rate bits 1-0 are cleared.
6C0F
OR 03H F6 03
OR Register A with the bootstrap step rate, the operand at 4210H (6C10H in this image): 03H in the file; FORMAT stores the rate chosen (0-3) there for the new diskette (62E5H-62ECH, through the pointer at 6902H). SYS0/SYS's reset (4E63H-4E75H) copies bits 1-0 of 4210H into drive 0's drive code table at 4703H.
6C11
LD (IY+03H),A FD 77 03
Store Register A (the flags with the bootstrap step rate) back into byte +03H of the drive code table at Index Register IY, so every seek of the boot uses that rate.
6C14
LD A,(IY+07H) FD 7E 07
Fetch byte +07H of the drive code table at Index Register IY into Register A: bits 4-0 hold the highest sector number on a track and bits 7-5 the number of heads less one.
6C17
LD D,A 57
Copy Register A (byte +07H) into Register D, kept for the head count below.
6C18
AND 1FH E6 1F
Mask Register A to bits 4-0: Register A now holds the highest sector number on a track.
6C1A
LD E,A 5F
Copy Register A (the highest sector number) into Register E.
6C1B
INC E 1C
INCrement Register E: Register E now holds the number of sectors on a track (sectors are numbered from 0).
6C1C
XOR D AA
Exclusive OR Register A (the highest sector number, bits 4-0 of byte +07H) with Register D (all of byte +07H): only bits 7-5 of byte +07H are left in Register A, the number of heads less one.
6C1D
RLCA 07
Rotate Register A left one bit: first of three rotations that bring bits 7-5 down to bits 2-0.
6C1E
RLCA 07
Rotate Register A left one bit again: second of three rotations.
6C1F
RLCA 07
Rotate Register A left one bit again: Register A now holds the number of heads less one in bits 2-0.
6C20
INC A 3C
INCrement Register A: Register A now holds the number of heads.
6C21
GOSUB to 42D7H to multiply Register A (the number of heads) by Register E (the sectors on a track). Register A comes back holding the number of sectors on a cylinder.
6C24
LD BC,5100H 01 00 51
Point Register Pair BC to 5100H, the 256 byte buffer for every sector read.
6C27
PUSH BC C5
Save Register Pair BC (the buffer address 5100H) to the stack, for the directory read at 423FH-4244H.
6C28
PUSH AF F5
Save Register Pair AF (Register A = the sectors on a cylinder) to the stack across the read below.
6C29
LD A,(4202H) 3A 02 42
Fetch the directory cylinder from 4202H (byte 2 of this sector) into Register A.
6C2C
LD D,A 57
Copy Register A (the directory cylinder) into Register D, the cylinder to read.
6C2D
LD E,C 59
Copy Register C (00H, the low byte of 5100H) into Register E: sector 0 of the directory cylinder, the granule allocation table.
6C2E
GOSUB to 42C9H to read cylinder Register D, sector Register E into the buffer at Register Pair BC (5100H) through the disk driver. The result is not tested: the allocation table is only used for one bit below.
6C31
POP AF F1
Restore Register Pair AF from the stack: Register A = the sectors on a cylinder again.
6C32
LD HL,51CDH 21 CD 51
Point Register Pair HL to 51CDH, byte CDH of the allocation table just read: the high byte of the diskette's configuration word.
6C35
BIT 5,(HL) CB 6E
Test bit 5 of the configuration byte at Register Pair HL (51CDH): set when the diskette was formatted with two sides (FORMAT/CMD takes it from bit 5 of byte +04H of the drive code table, its 6318H). The Z FLAG is set for one side.
6C37
If the Z FLAG is set (the diskette has one side), JUMP to 423AH (6C3AH in this image), keeping the sectors on a cylinder in Register A as they are.
6C39
ADD A,A 87
Double Register A (ADD A,A): a diskette with two sides has twice the sectors on a cylinder.
6C3A
LD (42ABH),A 32 AB 42
Store Register A (the sectors on a cylinder) into the operand byte 42ABH of the SUB at 42AAH, where the byte fetch decides when to move to the next cylinder.
6C3D
LD E,04H 1E 04
Load Register E with 04H: sector 4 of the directory cylinder, whose first record is the directory record of SYS0/SYS. Register D still holds the directory cylinder.
6C3F
POP BC C1
Restore Register Pair BC from the stack: the buffer address 5100H saved at 4227H.
6C40
PUSH BC C5
Save Register Pair BC (5100H) to the stack again, to come back as Register Pair HL at 4244H.
6C41
GOSUB to 42C9H to read the directory sector (cylinder Register D, sector Register E = 04H) into the buffer at Register Pair BC (5100H). The result is not tested; a sector that could not be read leaves the buffer as it was.
6C44
POP HL E1
Restore the buffer address from the stack into Register Pair HL: Register Pair HL = 5100H, byte 00H of SYS0/SYS's directory record.
6C45
BIT 4,(HL) CB 66
Test bit 4 of the attribute byte at Register Pair HL (5100H): set when the directory record is in use. The Z FLAG is set when the record is free, that is when the diskette has no SYS0/SYS.
6C47
LD HL,42E6H 21 E6 42
Point Register Pair HL to 42E6H, the text No System, in case the record is free. LD does not change the flags.
6C4A
If the Z FLAG is set (the record of SYS0/SYS is free), JUMP to 42B6H (6CB6H in this image) to display No System at Register Pair HL and stop.

6C4CH - Image of Boot Sector 1: Locate SYS0/SYS (Runs at 424CH)

The first extent of SYS0/SYS (bytes 16H-17H of its directory record) gives the cylinder and the first granule. Here the sectors per granule come from the drive code table (bits 4-0 of byte +08H, plus 1), and the granule number is multiplied by them through 42D7H. The read position is set up in the alternate register set, as in sector 0.

6C4C
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set. The values worked out below go into the alternate set, which only the byte fetch at 429DH uses.
6C4D
LD HL,(5116H) 2A 16 51
Fetch the first extent of SYS0/SYS from 5116H-5117H into Register Pair HL: Register L = byte 16H (the cylinder) and Register H = byte 17H (the first granule in bits 7-5, the number of granules less one in bits 4-0).
6C50
LD A,H 7C
Copy Register H (byte 17H of the directory record: first granule in bits 7-5) into Register A.
6C51
RLCA 07
Rotate Register A left one bit: first of three rotations that bring the first granule from bits 7-5 down to bits 2-0.
6C52
RLCA 07
Rotate Register A left one bit again: second of three rotations.
6C53
RLCA 07
Rotate Register A left one bit again: bits 7-5 of byte 17H are now bits 2-0 of Register A.
6C54
AND 07H E6 07
Mask Register A to bits 2-0: Register A now holds the number of the first granule on the cylinder.
6C56
LD E,A 5F
Copy Register A (the granule number) into Register E, the multiplier for 42D7H.
6C57
LD A,(IY+08H) FD 7E 08
Fetch byte +08H of the drive code table at Index Register IY into Register A: bits 4-0 hold the sectors in a granule less one.
6C5A
AND 1FH E6 1F
Mask Register A to bits 4-0: the sectors in a granule less one.
6C5C
INC A 3C
INCrement Register A: Register A now holds the number of sectors in a granule.
6C5D
GOSUB to 42D7H to multiply Register A (the sectors in a granule) by Register E (the granule number). Register A comes back holding the first sector of the file on its cylinder.
6C60
LD E,A 5F
Copy Register A (the first sector of SYS0/SYS) into Register E.
6C61
LD D,L 55
Copy Register L (the cylinder of the first extent) into Register D. Register Pair DE (alternate set) now holds the cylinder and sector where SYS0/SYS begins.
6C62
LD BC,51FFH 01 FF 51
Load Register Pair BC with 51FFH, one byte before the buffer at 5100H, so that the first call of the byte fetch (INC C at 429EH gives 00H) reads the first sector before it takes a byte.
6C65
EXX D9
Exchange Register Pairs BC, DE and HL back with the alternate set. The alternate set holds the read position; the main set is free for the loader.

6C66H - Image of Boot Sector 1: Load SYS0/SYS Record by Record (Runs at 4266H)

The same loader as sector 0 (4242H): type 01H records are copied to their load address, type 02H gives the transfer address, any other type is passed over by its length. The bytes come from 429DH.

6C66
GOSUB to 429DH to fetch the next byte of SYS0/SYS into Register A: the record type.
6C69
DEC A 3D
DECrement Register A (the record type) by 1. The Z FLAG is set when the type was 01H, a load block.
6C6A
If the NZ FLAG is set (the type in Register A was not 01H), JUMP to 4283H (6C83H in this image) to check for the transfer address record or pass over the record.
6C6C
GOSUB to 429DH to fetch the next byte into Register A: the record's length byte.
6C6F
LD B,A 47
Copy Register A (the record length) into Register B, the count of bytes of this record still to be read.
6C70
GOSUB to 429DH to fetch the next byte into Register A: the low byte of the load address.
6C73
LD L,A 6F
Copy Register A (the low byte of the load address) into Register L.
6C74
DEC B 05
DECrement Register B (the bytes left in the record) by 1 for the low address byte.
6C75
GOSUB to 429DH to fetch the next byte into Register A: the high byte of the load address.
6C78
LD H,A 67
Copy Register A (the high byte of the load address) into Register H. Register Pair HL now holds the address where this block's data goes.
6C79
DEC B 05
DECrement Register B by 1 for the high address byte. Register B now holds the number of data bytes (00H counts as 256 in the DJNZ below).
6C7A
GOSUB to 429DH to fetch the next data byte into Register A. 427FH loops back here.
6C7D
LD (HL),A 77
Store Register A (the data byte) at the load address in Register Pair HL.
6C7E
INC HL 23
INCrement Register Pair HL, the load address, to the next byte.
6C7F
DECrement Register B (the data bytes left) and LOOP BACK to 427AH (6C7AH in this image) until the block is copied.
6C81
JUMP back to 4266H (6C66H in this image) for the next record: the load block in Register Pair HL's range is copied.
6C83
DEC A 3D
DECrement Register A again: the type in Register A is now the record type less 2. The Z FLAG is set when the type was 02H, the transfer address.
6C84
If the Z FLAG is set (the type in Register A was 02H), JUMP to 4291H (6C91H in this image) to take the transfer address and run SYS0/SYS.
6C86
Any other type is passed over. GOSUB to 429DH to fetch the record's length byte into Register A.
6C89
LD B,A 47
Copy Register A (the record length) into Register B, the number of bytes to pass over (00H passes over 256).
6C8A
GOSUB to 429DH to fetch the next byte of the record into Register A, which is not used. 428DH loops back here.
6C8D
DECrement Register B (the bytes left to pass over) and LOOP BACK to 428AH (6C8AH in this image) until the record is passed over.
6C8F
JUMP back to 4266H (6C66H in this image) for the next record: the passed over record changed nothing in memory.
6C91
Type 02H. GOSUB to 429DH to fetch the record's length byte into Register A (02H); it is not used.
6C94
GOSUB to 429DH to fetch the next byte into Register A: the low byte of the transfer address.
6C97
LD L,A 6F
Copy Register A (the low byte of the transfer address) into Register L.
6C98
GOSUB to 429DH to fetch the next byte into Register A: the high byte of the transfer address.
6C9B
LD H,A 67
Copy Register A (the high byte of the transfer address) into Register H. Register Pair HL now holds the transfer address of SYS0/SYS (4E00H for LDOS 5.3.1).
6C9C
JP (HL) E9
JUMP to the address in Register Pair HL: SYS0/SYS's reset code, with Index Register IY still pointing at the drive code table the driver boot gave, which tells the reset that this sector loaded it.

6C9DH - Image of Boot Sector 1: Fetch the Next Byte (Runs at 429DH)

Returns the next byte of SYS0/SYS in Register A, working in the alternate register set (Register Pair BC' = buffer pointer, Register Pair DE' = next cylinder and sector). When Register C' wraps to 00H the next sector is read through the driver; the sector number wraps at the sectors per cylinder stored at 42ABH.

6C9D
EXX D9
Exchange Register Pairs BC, DE and HL with the alternate set: Register Pair BC now points into the buffer and Register Pair DE holds the next cylinder and sector.
6C9E
INC C 0C
INCrement Register C, the low byte of the buffer pointer in Register Pair BC. The Z FLAG is set when it wraps to 00H: the buffer at 5100H is used up (or this is the first call).
6C9F
If the NZ FLAG is set (Register C did not wrap, so unread bytes remain at Register Pair BC), JUMP to 42B0H (6CB0H in this image) to fetch the byte.
6CA1
PUSH BC C5
Save Register Pair BC (the buffer pointer, now 5100H) to the stack across the read.
6CA2
GOSUB to 42C9H to read cylinder Register D, sector Register E into the buffer at Register Pair BC (5100H) through the disk driver. The Z FLAG is set on return if the driver read it.
6CA5
If the NZ FLAG is set (the driver reported an error), JUMP to 42B3H (6CB3H in this image) to display Disk Error and stop.
6CA7
POP BC C1
Restore Register Pair BC (the buffer pointer, 5100H) from the stack.
6CA8
INC E 1C
INCrement Register E, the sector number, to the next sector.
6CA9
LD A,E 7B
Copy Register E (the next sector number) into Register A.
6CAA
SUB 00H D6 00
SUBtract the sectors per cylinder from Register A (the next sector number). The operand byte 42ABH is 00H in the file; 423AH stores the sectors per cylinder there before the first read. The Z FLAG is set when Register E has passed the last sector of the cylinder.
6CAC
If the NZ FLAG is set (the next sector in Register E is still on this cylinder), JUMP to 42B0H (6CB0H in this image) to fetch the byte.
6CAE
LD E,A 5F
Copy Register A (00H) into Register E: sector 0 of the next cylinder.
6CAF
INC D 14
INCrement Register D, the cylinder number, to the next cylinder.
6CB0
LD A,(BC) 0A
Fetch the byte at Register Pair BC (the buffer pointer) into Register A: the next byte of SYS0/SYS.
6CB1
EXX D9
Exchange Register Pairs BC, DE and HL back with the alternate set: the read position stays in the alternate set and the caller's registers come back.
6CB2
RET C9
RETurn to the caller with the byte in Register A.

6CB3H - Image of Boot Sector 1: Display an Error and Stop (Runs at 42B3H)

Disk Error when the driver cannot read a sector of SYS0/SYS; No System (entered at 42B6H with Register Pair HL = 42E6H) when its directory record is free. Then the computer waits for a line from the keyboard and stops.

6CB3
LD HL,42F2H 21 F2 42
Point Register Pair HL to 42F2H, the text Disk Error.
6CB6
GOSUB to 42BDH to display the text at Register Pair HL (42F2H Disk Error, or 42E6H No System from 424AH). Register Pair HL comes back pointing at the text's end byte 03H.
6CB9
GOSUB to the ROM's line input at 0040H: it waits for keys and stores them from Register Pair HL (the end of the message) on, at most Register B characters (the count the disk driver left in Register B), until ENTER or BREAK. Nothing uses the line.
6CBC
HALT 76
Stop the processor. Interrupts are off (4206H), so only RESET starts the computer again.

6CBDH - Image of Boot Sector 1: Display a Text (Runs at 42BDH)

Displays the bytes at Register Pair HL through the ROM until the end byte 03H; Register Pair HL is left pointing at the 03H.

6CBD
LD A,(HL) 7E
Fetch the next character of the text at Register Pair HL into Register A. 42C6H loops back here.
6CBE
CP 03H FE 03
Compare Register A (the character) against 03H, the end of text byte. The Z FLAG is set at the end.
6CC0
If the Z FLAG is set (Register A holds 03H), JUMP to 42C8H (6CC8H in this image) to return.
6CC2
GOSUB to the ROM's display routine at 0033H to display the character in Register A (17H switches to 32 characters per line, E8H displays 40 spaces).
6CC5
INC HL 23
INCrement Register Pair HL to the next character of the text.
6CC6
LOOP BACK to 42BDH (6CBDH in this image) for the next character of the text at Register Pair HL.
6CC8
RET C9
RETurn to the caller with Register Pair HL pointing at the end byte 03H.

6CC9H - Image of Boot Sector 1: Read a Sector Through the Driver (Runs at 42C9H)

Reads cylinder Register D, sector Register E of drive 0 into the buffer at Register Pair BC by calling the disk driver through the drive code table at Index Register IY with function 09H. The driver's Z FLAG (set = read) and Register A (the error) come back to the caller; Register Pair HL is kept.

6CC9
PUSH HL E5
Save Register Pair HL to the stack: the driver takes the buffer address in Register Pair HL.
6CCA
LD H,B 60
Copy Register B (the high byte of the buffer address) into Register H.
6CCB
LD L,C 69
Copy Register C (the low byte of the buffer address) into Register L. Register Pair HL now holds the buffer address for the driver.
6CCC
LD B,09H 06 09
Load Register B with 09H, the driver function: read a sector (the function SYS0/SYS's read primitive at 4777H passes).
6CCE
LD C,00H 0E 00
Load Register C with 00H, the drive number: drive 0.
6CD0
GOSUB to 42D5H, which jumps through the drive code table at Index Register IY into the disk driver. The driver returns here with the Z FLAG set if the sector was read.
6CD3
POP HL E1
Restore Register Pair HL from the stack. POP does not change the flags the driver returned.
6CD4
RET C9
RETurn to the caller with the driver's flags.
6CD5
JP (IY) FD E9
JUMP to the address in Index Register IY: byte +00H of the drive code table, which holds a JP to the disk driver (C3H and the driver's address). The driver's RET goes back to 42D3H.

6CD7H - Image of Boot Sector 1: Multiply Two Bytes (Runs at 42D7H)

Returns in Register A the low 8 bits of Register A times Register E, by shift and add. Register D is left holding the first factor and Register E is shifted to 00H; Register Pair BC is kept.

6CD7
PUSH BC C5
Save Register Pair BC to the stack: Register B is the bit counter below.
6CD8
LD D,A 57
Copy Register A (the first factor) into Register D, the value added for each set bit of Register E.
6CD9
XOR A AF
Set Register A to 00H (XOR A), the product so far.
6CDA
LD B,08H 06 08
Load Register B with 08H, one pass for each bit of Register E.
6CDC
ADD A,A 87
Double Register A (the product so far, ADD A,A). 42E2H loops back here.
6CDD
SLA E CB 23
Shift Register E (the second factor) left one bit: its bit 7 goes into the CARRY FLAG.
6CDF
If the NO CARRY FLAG is set (that bit of Register E was 0), JUMP to 42E2H (6CE2H in this image) without adding.
6CE1
ADD A,D 82
ADD Register D (the first factor) to Register A (the product so far).
6CE2
DECrement Register B (the bits left) and LOOP BACK to 42DCH (6CDCH in this image) until all 8 bits of Register E are done. Register A holds the product.
6CE4
POP BC C1
Restore Register Pair BC (saved at 42D7H; Register B was the bit counter) from the stack.
6CE5
RET C9
RETurn to the caller with the product in Register A.

6CE6H - Image of Boot Sector 1: Texts (42E6H-42FFH)

The two messages of this sector, each ended by 03H, and the last byte of the sector.

6CE6-6CE7
DEFB 17H, E8H 17 E8
Start of the No System text (424AH): 17H switches the screen to 32 characters per line, E8H displays 40 spaces (E8H less C0H), which puts the message on the second line, 8 columns in.
6CE8-6CF0
DEFM "No System" 4E 6F 20 53 79 73 74 65 6D
The message displayed when the directory record of SYS0/SYS is not in use (4245H-424AH).
6CF1
DEFB 03H 03
End of the No System text: 42BDH stops at this byte and does not display it.
6CF2-6CF3
DEFB 17H, E8H 17 E8
Start of the Disk Error text (42B3H): 32 characters per line, then 40 spaces.
6CF4-6CFD
DEFM "Disk Error" 44 69 73 6B 20 45 72 72 6F 72
The message displayed when the driver cannot read a sector of SYS0/SYS (42A5H).
6CFE
DEFB 03H 03
End of the Disk Error text: 42BDH stops at this byte and does not display it.
6CFF
DEFB FFH FF
The last byte of sector 1, FFH. No code of this sector uses it.

6D00H - The Buffer at 6D00H (Not in the File)

256 bytes the program uses for three things in turn.

6D00-6DFF
DEFS 256
6D00H-6DFFH: not in the file. While a track is built, the address of each sector's ID field in the track (6039H, 607DH), ended by 0000H; the replies to the questions (64CBH, 6E82H); the sector read from the target diskette (716FH-71BBH); then the sectors FORMAT writes: the system information sector, the hash index table, the directory records and the empty directory sectors (634BH-6418H).

6E00H - The Front End: the Banner, the System Information Sector

The transfer address. LDOS runs FORMAT with Register Pair HL pointing to the command line after the program name. The front end, 6E00H-7264H, asks for or reads every choice, puts the target drive's drive code table into 6564H and goes to the engine (71EBH); the engine then builds its tracks over the front end from 6E00H up. First the banner, a request that loads SYS2/SYS, and the system information sector of drive 0 (cylinder 0, sector 2) into 4200H: from its block of drive code tables (4220H after a boot through a disk driver, bit 0 of 442FH set, else 4270H) the default bootstrap step rate (drive 0's +03H, bits 1-0) and each drive's highest cylinder (+06H) are taken.

6E00
PUSH HL E5
Save Register Pair HL (the pointer to the command line) to the stack, for 6E3EH.
6E01
LD HL,7341H 21 41 73
Point Register Pair HL to 7341H, the banner: 1CH 1FH (the cursor to the top left, the screen cleared), the name and version of FORMAT, the copyright, ended by 0DH.
6E04
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (7341H).
6E07
GOSUB to 7277H, the request 84H: SYS2/SYS is loaded into the overlay area (its entry does nothing for function 00H), so the request E4H at 7220H finds it there.
6E0A
LD DE,0002H 11 02 00
Load Register Pair DE with 0002H: Register D = cylinder 0, Register E = sector 2, the system information sector.
6E0D
LD C,D 4A
Copy Register D (00H) into Register C: drive 0, the system drive.
6E0E
LD HL,4200H 21 00 42
Point Register Pair HL to 4200H, the system's sector buffer.
6E11
GOSUB to 4777H, RDSECT, to read drive Register C (0), cylinder Register D (0), sector Register E (2) into the buffer at Register Pair HL (4200H). Register Pairs BC, DE and HL come back unchanged; the Z FLAG on success.
6E14
If the NZ FLAG is set (the read failed), JUMP to 64A7H to report the error in Register A (no drive chosen yet, so 6440H does nothing).
6E17
LD L,26H 2E 26
Load Register L with 26H: Register Pair HL = 4226H, +06H of drive 0's table in the block at 4220H (the block for a boot through a disk driver).
6E19
LD A,(442FH) 3A 2F 44
Fetch MFLAG$ from 442FH into Register A: bit 0 set when the system was booted through a disk driver.
6E1C
RRCA 0F
Rotate Register A right one place (RRCA): bit 0 of 442FH goes into the CARRY FLAG.
6E1D
If the CARRY FLAG is set (a boot through a disk driver), JUMP to 6E21H with Register Pair HL = 4226H.
6E1F
LD L,76H 2E 76
Load Register L with 76H: Register Pair HL = 4276H, +06H of drive 0's table in the block at 4270H (the block for a boot by sector 0).
6E21
PUSH HL E5
Save Register Pair HL (4226H or 4276H) to the stack.
6E22
POP IY FD E1
Restore it into Index Register IY: Index Register IY = +06H of drive 0's table of the block.
6E24
LD A,(IY-03H) FD 7E FD
Fetch the byte 3 below Index Register IY (IY-03H: 4223H or 4273H, +03H of drive 0's table) into Register A: the flags with the bootstrap step rate in bits 1-0 (SYSTEM (BSTEP) sets it).
6E27
AND 03H E6 03
Mask Register A to bits 1-0 (AND 03H): the bootstrap step rate, 0-3.
6E29
LD (6E73H),A 32 73 6E
Store Register A (the default step rate) at 6E73H, the low byte of the STEP parameter (the operand of LD DE,FF00H at 6E72H); STEP=n on the command line replaces it.
6E2C
LD B,08H 06 08
Load Register B with 08H, one pass for each of the drives 0-7.
6E2E
LD IX,726FH DD 21 6F 72
Point Index Register IX to 726FH, the eight bytes of the highest cylinder of each drive (not in the file).
6E32
LD DE,000AH 11 0A 00
Load Register Pair DE with 000AH, the ten bytes from one drive's table to the next.
6E35
LD A,(HL) 7E
Fetch +06H of the drive's table at Register Pair HL into Register A: its highest cylinder (SYSTEM (DRIVE=d,CYL=n) sets it).
6E36
LD (IX+00H),A DD 77 00
Store Register A (the highest cylinder) at Index Register IX (IX+00H), the drive's byte of 726FH-7276H.
6E39
INC IX DD 23
INCrement Index Register IX to the next drive's byte.
6E3B
ADD HL,DE 19
ADD Register Pair DE (000AH) to Register Pair HL: +06H of the next drive's table.
6E3C
DECrement Register B (the drives left) and LOOP BACK to 6E35H until all eight drives are done.

6E3EH - The Drive and the Parameters

The command line may start with :d, the drive (0-7); then @PARAM reads the parameters (the table at 72A8H), which store their values into the operands of the instructions that read them. Without :d the drive is asked for and the parameters on the line are not read. The values of SDEN, DDEN, SIDES, CYL and STEP are ORed together into 6FA7H: not 0 when any of them was given, which means no question is asked.

6E3E
POP HL E1
Restore Register Pair HL from the stack: the pointer to the command line.
6E3F
LD A,(HL) 7E
Fetch the next character of the command line at Register Pair HL into Register A.
6E40
INC HL 23
INCrement Register Pair HL past the character.
6E41
CP 20H FE 20
Compare Register A (the character) against 20H, a space.
6E43
If the Z FLAG is set (a space), LOOP BACK to 6E3FH to skip it.
6E45
CP 3AH FE 3A
Compare Register A (the first character after the spaces) against 3AH, the colon that starts a drive.
6E47
If the NZ FLAG is set (no drive given), JUMP to 6E7CH to ask for the drive. The rest of the line is not read.
6E49
LD A,(HL) 7E
Fetch the character after the colon at Register Pair HL into Register A.
6E4A
SUB 30H D6 30
SUBtract 30H from Register A: the value of a digit (a character below 30H gives a borrow and a large value).
6E4C
CP 08H FE 08
Compare Register A (the drive) against 08H: the CARRY FLAG for drives 0-7.
6E4E
If the NO CARRY FLAG is set (not a digit 0-7), JUMP to 64B1H to give error 2CH, Parameter error.
6E51
LD (648CH),A 32 8C 64
Store Register A (the drive) at 648CH, the operand of LD C,FFH at 648BH: the drive of every call to the driver.
6E54
INC HL 23
INCrement Register Pair HL past the drive digit, to the parameters.
6E55
LD DE,72A8H 11 A8 72
Point Register Pair DE to 72A8H, the table of the parameters.
6E58
GOSUB to 4476H, @PARAM, to read the parameters at Register Pair HL against the table at Register Pair DE (72A8H): a parameter given alone stores FFFFH, a value stores the value, a quoted text stores the address of its first character. The Z FLAG on success.
6E5B
If the NZ FLAG is set (an unknown parameter or a bad value), JUMP to 64B1H to give error 2CH, Parameter error.
6E5E
LD DE,0000H 11 00 00
Load Register Pair DE with the SDEN parameter: the operand 6E5FH-6E60H, 0000H in the file, FFFFH when SDEN was given.
6E61
LD A,D 7A
Copy Register D (the high byte of SDEN) into Register A.
6E62
OR E B3
OR Register E (the low byte of SDEN) into Register A.
6E63
LD DE,0000H 11 00 00
Load Register Pair DE with the DDEN parameter: the operand 6E64H-6E65H, 0000H in the file, FFFFH when DDEN was given.
6E66
OR D B2
OR Register D (the high byte of DDEN) into Register A.
6E67
OR E B3
OR Register E (the low byte of DDEN) into Register A.
6E68
LD DE,0000H 11 00 00
Load Register Pair DE with the SIDES parameter: the operand 6E69H-6E6AH, 0000H in the file, the value of SIDES=n.
6E6B
OR D B2
OR Register D (the high byte of SIDES) into Register A.
6E6C
OR E B3
OR Register E (the low byte of SIDES) into Register A.
6E6D
LD DE,0000H 11 00 00
Load Register Pair DE with the CYL parameter: the operand 6E6EH-6E6FH, 0000H in the file, the value of CYL=n.
6E70
OR D B2
OR Register D (the high byte of CYL) into Register A.
6E71
OR E B3
OR Register E (the low byte of CYL) into Register A.
6E72
LD DE,FF00H 11 00 FF
Load Register Pair DE with the STEP parameter: the operand 6E73H-6E74H, FF00H in the file with the default rate at 6E73H (6E29H); STEP=n stores n, so the high byte 6E74H becomes 00H.
6E75
INC D 14
INCrement Register D (the high byte of STEP): 00H when STEP was not given (FFH), not 0 when it was.
6E76
OR D B2
OR Register D into Register A: Register A is not 0 when any of SDEN, DDEN, SIDES, CYL or STEP was given.
6E77
LD (6FA7H),A 32 A7 6F
Store Register A at 6FA7H, the operand of LD A,00H at 6FA6H: not 0 means the format is taken from the parameters and no question is asked.
6E7A
JUMP to 6E9BH, past the question for the drive.
6E7C
LD HL,73D5H 21 D5 73
Point Register Pair HL to 73D5H, the question Which drive is to be used ? ended by 03H.
6E7F
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (73D5H).
6E82
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the buffer of the reply.
6E85
LD B,01H 06 01
Load Register B with 01H, one character for the reply.
6E87
GOSUB to 0040H, the ROM's line input: up to Register B (1) characters into the buffer at Register Pair HL (6D00H), ended by 0DH; the CARRY FLAG for BREAK.
6E8A
If the CARRY FLAG is set (BREAK), JUMP to 6434H to display Format aborted! and end at @ABORT.
6E8D
LD A,(HL) 7E
Fetch the character typed at Register Pair HL (6D00H) into Register A (0DH when only ENTER was pressed).
6E8E
SUB 30H D6 30
SUBtract 30H from Register A: the value of a digit.
6E90
If the CARRY FLAG is set (a character below 30H, such as 0DH), JUMP to 6E7CH to ask again.
6E93
CP 08H FE 08
Compare Register A (the drive) against 08H: the CARRY FLAG for drives 0-7.
6E95
If the NO CARRY FLAG is set (8 or more), JUMP to 6E7CH to ask again.
6E98
LD (648CH),A 32 8C 64
Store Register A (the drive) at 648CH, the operand of LD C,FFH at 648BH: the drive of every call to the driver.

6E9BH - NAME and MPW Follow QUERY, the Drive's Table

When NAME or MPW was not given, its operand gets the QUERY value: FFFFH (the default, or Q=Y) means ask, 0000H (Q=N) means take the default. The drive's default cylinders go to 7031H; the drive's table is copied to the working table at 6564H, Index Register IY points to it, and the driver's function 00H tests that the drive is present.

6E9B
LD DE,(6FACH) ED 5B AC 6F
Fetch the QUERY parameter from 6FACH-6FADH (the operand of LD DE,FFFFH at 6FABH) into Register Pair DE: FFFFH in the file, 0000H for Q=N.
6E9F
LD HL,(6EDCH) 2A DC 6E
Fetch the NAME parameter from 6EDCH-6EDDH (the operand of LD HL,0000H at 6EDBH) into Register Pair HL.
6EA2
LD A,H 7C
Copy Register H (the high byte of NAME) into Register A.
6EA3
OR L B5
OR Register L (the low byte of NAME) into Register A: the Z FLAG when NAME was not given.
6EA4
If the NZ FLAG is set (NAME given), JUMP to 6EAAH.
6EA6
LD (6EDCH),DE ED 53 DC 6E
Store Register Pair DE (the QUERY value) at 6EDCH-6EDDH, the NAME parameter: FFFFH asks for the name, 0000H takes the default.
6EAA
LD HL,(6F1FH) 2A 1F 6F
Fetch the MPW parameter from 6F1FH-6F20H (the operand of LD HL,0000H at 6F1EH) into Register Pair HL.
6EAD
LD A,H 7C
Copy Register H (the high byte of MPW) into Register A.
6EAE
OR L B5
OR Register L (the low byte of MPW) into Register A: the Z FLAG when MPW was not given.
6EAF
If the NZ FLAG is set (MPW given), JUMP to 6EB5H.
6EB1
LD (6F1FH),DE ED 53 1F 6F
Store Register Pair DE (the QUERY value) at 6F1FH-6F20H, the MPW parameter.
6EB5
LD A,(648CH) 3A 8C 64
Fetch the target drive from 648CH into Register A.
6EB8
LD C,A 4F
Copy Register A (the drive) into Register C, for 47A5H below.
6EB9
LD HL,726FH 21 6F 72
Point Register Pair HL to 726FH, the highest cylinder of each drive (6E35H).
6EBC
ADD A,L 85
ADD Register L (6FH) to Register A (the drive): the low byte of the drive's entry; the CARRY FLAG is the carry into the high byte.
6EBD
LD L,A 6F
Copy Register A (the low byte) into Register L.
6EBE
ADC A,H 8C
ADD Register H (72H) and the CARRY FLAG to Register A.
6EBF
SUB L 95
SUBtract Register L from Register A: Register A = Register H plus the carry.
6EC0
LD H,A 67
Copy Register A into Register H: Register Pair HL = 726FH + the drive.
6EC1
LD A,(HL) 7E
Fetch the drive's highest cylinder at Register Pair HL into Register A.
6EC2
INC A 3C
INCrement Register A: the default number of cylinders of the drive.
6EC3
LD (7031H),A 32 31 70
Store Register A (the default cylinders) at 7031H, the operand of LD A,00H at 7030H, which 64FBH and the cylinder question use.
6EC6
GOSUB to 47A5H to point Register Pair HL to the drive code table of drive Register C (4700H + the drive x 10).
6EC9
LD DE,6564H 11 64 65
Point Register Pair DE to 6564H, the working drive code table.
6ECC
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of a drive code table.
6ECF
LDIR ED B0
Copy the drive's table from Register Pair HL to Register Pair DE (6564H), Register Pair BC the count (LDIR). FORMAT changes only this copy.
6ED1
LD IY,6564H FD 21 64 65
Point Index Register IY to 6564H, the working drive code table: every +nnH below is a byte of it, and 6495H calls the driver through it.
6ED5
GOSUB to 6460H, the driver's function 00H: the Z FLAG for a drive that is present; Register A = 20H and the NZ FLAG when the table starts with RET.
6ED8
If the NZ FLAG is set (no drive), JUMP to 64A7H to report error 20H, Illegal drive number, in Register A.

6EDBH - The Diskette Name, the Date, the Master Password

NAME: 0000H takes LDOSDISK (7644H), FFFFH asks (Diskette name ?), else the address of a text on the command line. The name goes into the allocation table image at 6AD0H (+D0H) in upper case, the date of today at 6AD8H (+D8H). MPW the same way: PASSWORD (764CH) or the question Master password ? or the text; it goes to 727DH, is checked (letters and digits, the first a letter) and its hash goes to 6ACEH (+CEH).

6EDB
LD HL,0000H 21 00 00
Load Register Pair HL with the NAME parameter: the operand 6EDCH-6EDDH, 0000H in the file.
6EDE
LD A,H 7C
Copy Register H (the high byte of NAME) into Register A.
6EDF
OR L B5
OR Register L (the low byte of NAME) into Register A.
6EE0
INC A 3C
INCrement Register A: the Z FLAG when the OR of the two bytes was FFH (FFFFH: ask).
6EE1
If the Z FLAG is set (ask), JUMP to 6F05H to ask for the name.
6EE3
DEC A 3D
DECrement Register A back to the OR of the two bytes: the Z FLAG for 0000H.
6EE4
If the NZ FLAG is set (the address of a text), JUMP to 6EE9H to copy the name from the command line at Register Pair HL.
6EE6
LD HL,7644H 21 44 76
Point Register Pair HL to 7644H, the default name LDOSDISK. 6F0EH comes here when only ENTER is pressed.
6EE9
LD DE,6AD0H 11 D0 6A
Point Register Pair DE to 6AD0H, +D0H of the allocation table image: the diskette name (eight spaces in the file).
6EEC
LD B,08H 06 08
Load Register B with 08H, the most characters of the name.
6EEE
LD A,(HL) 7E
Fetch the next character of the name at Register Pair HL into Register A.
6EEF
CP 22H FE 22
Compare Register A (the character) against 22H, the quote that ends a text on the command line.
6EF1
If the Z FLAG is set (the quote), JUMP to 6F18H: the rest of the name stays spaces.
6EF3
CP 20H FE 20
Compare Register A (the character) against 20H, a space.
6EF5
If the CARRY FLAG is set (a control character such as 0DH ends the text), JUMP to 6F18H.
6EF8
CP 61H FE 61
Compare Register A (the character) against 61H, the letter a.
6EFA
If the CARRY FLAG is set (below 61H), JUMP to 6EFEH: the character is stored as it is.
6EFC
XOR 20H EE 20
Exclusive OR 20H into Register A: a lower case letter becomes upper case.
6EFE
LD (DE),A 12
Store Register A (the character) into the name at Register Pair DE.
6EFF
INC HL 23
INCrement Register Pair HL to the next character of the text.
6F00
INC DE 13
INCrement Register Pair DE to the next byte of the name.
6F01
DECrement Register B (the characters left) and LOOP BACK to 6EEEH until eight are stored.
6F03
JUMP to 6F18H to store the date in the allocation table image.
6F05
LD HL,73F2H 21 F2 73
Point Register Pair HL to 73F2H, the question Diskette name ? ended by 03H.
6F08
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (73F2H).
6F0B
GOSUB to 64C9H to read up to 8 characters into 6D00H in upper case: Register Pair HL = 6D00H, Register B = the count, the Z FLAG when only ENTER was pressed.
6F0E
If the Z FLAG is set (no reply), JUMP to 6EE6H to take the default name LDOSDISK.
6F10
LD C,B 48
Copy Register B (the characters typed) into Register C.
6F11
LD B,00H 06 00
Load Register B with 00H: Register Pair BC = the characters typed.
6F13
LD DE,6AD0H 11 D0 6A
Point Register Pair DE to 6AD0H, the diskette name in the allocation table image.
6F16
LDIR ED B0
Copy the reply from Register Pair HL (6D00H) to Register Pair DE (6AD0H), Register Pair BC the count (LDIR); a name shorter than 8 keeps the spaces after it.
6F18
LD HL,6AD8H 21 D8 6A
Point Register Pair HL to 6AD8H, +D8H of the allocation table image: the date (MM/DD/YY in the file).
6F1B
GOSUB to 4470H, @DATE, to store the system date as MM/DD/YY (8 characters) at Register Pair HL (6AD8H).
6F1E
LD HL,0000H 21 00 00
Load Register Pair HL with the MPW parameter: the operand 6F1FH-6F20H, 0000H in the file.
6F21
LD A,H 7C
Copy Register H (the high byte of MPW) into Register A.
6F22
OR L B5
OR Register L (the low byte of MPW) into Register A.
6F23
INC A 3C
INCrement Register A: the Z FLAG when the OR of the two bytes was FFH (FFFFH: ask).
6F24
If the Z FLAG is set (ask), JUMP to 6F43H to ask for the master password.
6F26
DEC A 3D
DECrement Register A back to the OR of the two bytes: the Z FLAG for 0000H.
6F27
If the NZ FLAG is set (the address of a text), JUMP to 6F2CH to copy the password from the command line at Register Pair HL.
6F29
LD HL,764CH 21 4C 76
Point Register Pair HL to 764CH, the default master password PASSWORD. 6F51H comes here when only ENTER is pressed.
6F2C
LD DE,727DH 11 7D 72
Point Register Pair DE to 727DH, the buffer of the master password (spaces in the file).
6F2F
LD B,08H 06 08
Load Register B with 08H, the most characters of the password.
6F31
LD A,(HL) 7E
Fetch the next character of the password at Register Pair HL into Register A.
6F32
CP 30H FE 30
Compare Register A (the character) against 30H, the digit 0.
6F34
If the CARRY FLAG is set (below 30H: a quote, a space or 0DH ends the text), JUMP to 6F65H to check and hash the password.
6F36
CP 61H FE 61
Compare Register A (the character) against 61H, the letter a.
6F38
If the CARRY FLAG is set (below 61H), JUMP to 6F3CH: the character is stored as it is.
6F3A
XOR 20H EE 20
Exclusive OR 20H into Register A: a lower case letter becomes upper case.
6F3C
LD (DE),A 12
Store Register A (the character) into the buffer at Register Pair DE.
6F3D
INC DE 13
INCrement Register Pair DE to the next byte of the buffer.
6F3E
INC HL 23
INCrement Register Pair HL to the next character of the text.
6F3F
DECrement Register B (the characters left) and LOOP BACK to 6F31H until eight are stored.
6F41
JUMP to 6F65H to check and hash the password.
6F43
LD HL,7403H 21 03 74
Point Register Pair HL to 7403H, the question Master password ? ended by 03H.
6F46
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (7403H).
6F49
LD HL,727DH 21 7D 72
Point Register Pair HL to 727DH, the buffer of the master password: the reply is read straight into it.
6F4C
LD B,08H 06 08
Load Register B with 08H, the most characters of the reply.
6F4E
GOSUB to 64CEH, the line input of 64C2H without its buffer: up to Register B (8) characters into Register Pair HL (727DH), in upper case. The ROM ends the reply with 0DH, at 7285H after 8 characters. Register A comes back as the count, the Z FLAG when only ENTER was pressed.
6F51
If the Z FLAG is set (no reply), JUMP to 6F29H to take the default PASSWORD.
6F53
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair DE = 727DH, the buffer.
6F54
ADD A,E 83
ADD Register E (7DH) to Register A (the characters typed): the low byte of the address after the reply.
6F55
LD L,A 6F
Copy Register A (the low byte) into Register L.
6F56
LD A,D 7A
Copy Register D (72H, the high byte of 727DH) into Register A.
6F57
ADC A,00H CE 00
ADD 00H and the CARRY FLAG to Register A: the high byte.
6F59
LD H,A 67
Copy Register A (the high byte) into Register H: Register Pair HL = the byte after the reply (its 0DH).
6F5A
LD A,08H 3E 08
Load Register A with 08H, the length of the password.
6F5C
SUB B 90
SUBtract Register B (the characters typed) from Register A: the bytes left to fill.
6F5D
If the Z FLAG is set (8 characters typed), JUMP to 6F65H.
6F5F
LD B,A 47
Copy Register A (the bytes left) into Register B.
6F60
LD (HL),20H 36 20
Store 20H, a space, at Register Pair HL: the 0DH and the bytes after the reply become spaces.
6F62
INC HL 23
INCrement Register Pair HL to the next byte of the buffer.
6F63
DECrement Register B (the bytes left) and LOOP BACK to 6F60H until the password is 8 bytes.
6F65
LD DE,727DH 11 7D 72
Point Register Pair DE to 727DH, the master password of 8 characters.
6F68
GOSUB to 7201H to check the password at Register Pair DE and hash it: Register Pair HL = the hash. A password with other characters ends at 7235H.
6F6B
LD (6ACEH),HL 22 CE 6A
Store Register Pair HL (the hash of the master password) at 6ACEH-6ACFH, +CEH-+CFH of the allocation table image.

6F6EH - The Density

A drive with bit 4 of +04H set gets no questions (70CFH). For the others the track descriptors of the drive's size are chosen (6571H for 5 inch, 657DH for 8 inch, bit 5 of +03H). The default is single density, or double density when the drive's controller can do it (bit 6 of +04H); one side; the default cylinders. Without any of SDEN, DDEN, SIDES, CYL or STEP, and with QUERY not 0000H, the questions are asked; with Q=N none is, and the defaults are used. The density question is asked only when the controller can do double density.

6F6E
BIT 4,(IY+04H) FD CB 04 66
Test bit 4 of +04H of the working drive code table at Index Register IY (6568H): the drive FORMAT writes no tracks on.
6F72
If the NZ FLAG is set (bit 4 set), JUMP to 70CFH: no question about the format; the drive's own +06H, +07H and +08H are kept, and the bootstrap step rate stays the 03H of 656EH.
6F75
LD HL,6571H 21 71 65
Point Register Pair HL to 6571H, the first track descriptor (5 inch, single density).
6F78
LD DE,0006H 11 06 00
Load Register Pair DE with 0006H, the length of a descriptor.
6F7B
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of +03H of the working drive code table at Index Register IY (6567H): set for an 8 inch drive.
6F7F
If the Z FLAG is set (a 5 inch drive), JUMP to 6F83H with Register Pair HL = 6571H.
6F81
ADD HL,DE 19
ADD Register Pair DE (6) to Register Pair HL: 6577H.
6F82
ADD HL,DE 19
ADD Register Pair DE (6) to Register Pair HL again: 657DH, the 8 inch single density descriptor.
6F83
LD (6FEAH),HL 22 EA 6F
Store Register Pair HL (the single density descriptor of the drive's size) at 6FEAH-6FEBH, the operand of LD HL,0000H at 6FE9H.
6F86
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = 0006H, Register Pair DE = the single density descriptor.
6F87
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the double density descriptor of the drive's size (6577H or 6583H).
6F88
LD (6FDAH),HL 22 DA 6F
Store Register Pair HL (the double density descriptor) at 6FDAH-6FDBH, the operand of LD HL,0000H at 6FD9H.
6F8B
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the single density descriptor, Register Pair DE = the double density descriptor.
6F8C
RES 6,(IY+03H) FD CB 03 B6
Reset bit 6 of +03H of the working drive code table at Index Register IY (6567H): single density.
6F90
BIT 6,(IY+04H) FD CB 04 76
Test bit 6 of +04H of the working drive code table at Index Register IY (6568H): set when the drive's controller can do double density.
6F94
If the Z FLAG is set (single density only), JUMP to 6F9BH with Register Pair HL = the single density descriptor.
6F96
EX DE,HL EB
Exchange Register Pairs DE and HL: Register Pair HL = the double density descriptor.
6F97
SET 6,(IY+03H) FD CB 03 F6
Set bit 6 of +03H of the working drive code table at Index Register IY (6567H): double density, the default with such a controller.
6F9B
GOSUB to 64FBH to put the descriptor at Register Pair HL into effect: the default highest cylinder into +06H, the template, +07H, +08H and the memory size.
6F9E
RES 5,(IY+04H) FD CB 04 AE
Reset bit 5 of +04H of the working drive code table at Index Register IY (6568H): one side.
6FA2
RES 4,(IY+03H) FD CB 03 A6
Reset bit 4 of +03H of the working drive code table at Index Register IY (6567H): side 0.
6FA6
LD A,00H 3E 00
Load Register A with the value at 6FA7H, 00H in the file: not 0 when SDEN, DDEN, SIDES, CYL or STEP was given (6E77H).
6FA8
OR A B7
Set the flags from Register A (OR A): the Z FLAG when none of them was given.
6FA9
If the NZ FLAG is set (parameters given), JUMP to 6FB3H: the format comes from the parameters.
6FAB
LD DE,FFFFH 11 FF FF
Load Register Pair DE with the QUERY parameter: the operand 6FACH-6FADH, FFFFH in the file, 0000H for Q=N.
6FAE
LD A,D 7A
Copy Register D (the high byte of QUERY) into Register A.
6FAF
OR E B3
OR Register E (the low byte of QUERY) into Register A: the Z FLAG for Q=N.
6FB0
If the Z FLAG is set (Q=N), JUMP to 70B1H: no question, the defaults are used.
6FB3
BIT 6,(IY+04H) FD CB 04 76
Test bit 6 of +04H of the working drive code table at Index Register IY (6568H): set when the controller can do double density. 6FD0H comes back here.
6FB7
If the Z FLAG is set (single density only), JUMP to 6FF3H: no density question.
6FB9
LD A,(6FA7H) 3A A7 6F
Fetch the value at 6FA7H (6E77H) into Register A.
6FBC
OR A B7
Set the flags from Register A (OR A): the Z FLAG when no format parameter was given.
6FBD
If the NZ FLAG is set (parameters given), JUMP to 6FD2H to take the density from DDEN or SDEN.
6FBF
LD HL,74DBH 21 DB 74
Point Register Pair HL to 74DBH, the question Single or Double density <S,D> ? ended by 03H.
6FC2
GOSUB to 64C2H to display the question at Register Pair HL and read up to 3 characters into 6D00H in upper case; the Z FLAG when only ENTER was pressed.
6FC5
If the Z FLAG is set (no reply), JUMP to 6FF3H: the default density stays.
6FC7
LD A,(HL) 7E
Fetch the first character of the reply at Register Pair HL (6D00H) into Register A.
6FC8
CP 53H FE 53
Compare Register A (the character) against 53H, S.
6FCA
If the Z FLAG is set (S), JUMP to 6FE9H for single density.
6FCC
CP 44H FE 44
Compare Register A (the character) against 44H, D.
6FCE
If the Z FLAG is set (D), JUMP to 6FD9H for double density.
6FD0
LOOP BACK to 6FB3H to ask again: the reply was neither S nor D.
6FD2
LD A,(6E64H) 3A 64 6E
Fetch the low byte of the DDEN parameter from 6E64H into Register A: FFH when DDEN was given.
6FD5
XOR FFH EE FF
Exclusive OR FFH into Register A: the Z FLAG when DDEN was given.
6FD7
If the NZ FLAG is set (no DDEN), JUMP to 6FE2H to test SDEN.
6FD9
LD HL,0000H 21 00 00
Load Register Pair HL with the double density descriptor of the drive's size: the operand 6FDAH-6FDBH, 0000H in the file, stored by 6F88H.
6FDC
SET 6,(IY+03H) FD CB 03 F6
Set bit 6 of +03H of the working drive code table at Index Register IY (6567H): double density.
6FE0
JUMP to 6FF0H to put the descriptor into effect.
6FE2
LD A,(6E5FH) 3A 5F 6E
Fetch the low byte of the SDEN parameter from 6E5FH into Register A: FFH when SDEN was given.
6FE5
XOR FFH EE FF
Exclusive OR FFH into Register A: the Z FLAG when SDEN was given.
6FE7
If the NZ FLAG is set (neither DDEN nor SDEN), JUMP to 6FF3H: the default density stays.
6FE9
LD HL,0000H 21 00 00
Load Register Pair HL with the single density descriptor of the drive's size: the operand 6FEAH-6FEBH, 0000H in the file, stored by 6F83H.
6FEC
RES 6,(IY+03H) FD CB 03 B6
Reset bit 6 of +03H of the working drive code table at Index Register IY (6567H): single density.
6FF0
GOSUB to 64FBH to put the descriptor at Register Pair HL into effect: the default highest cylinder into +06H, the template, +07H, +08H and the memory size.

6FF3H - The Sides and the Cylinders

SIDES=2 (or the reply 2) sets bit 5 of +04H. The number of cylinders is asked for (or taken from CYL=n) only for a 5 inch floppy (bits 5 and 3 of +03H clear); a reply of 0 or ENTER takes the default, and 96 or more is refused: the question is asked again, and CYL=n of 96 or more gives error 2CH.

6FF3
LD A,(6FA7H) 3A A7 6F
Fetch the value at 6FA7H (6E77H) into Register A. 7008H comes back here.
6FF6
OR A B7
Set the flags from Register A (OR A): the Z FLAG when no format parameter was given.
6FF7
If the NZ FLAG is set (parameters given), JUMP to 700CH to take the sides from SIDES.
6FF9
LD HL,74BCH 21 BC 74
Point Register Pair HL to 74BCH, the question Enter number of sides <1,2> ? ended by 03H.
6FFC
GOSUB to 64C2H to display the question at Register Pair HL and read up to 3 characters into 6D00H; the Z FLAG when only ENTER was pressed.
6FFF
If the Z FLAG is set (no reply), JUMP to 7017H: one side.
7001
LD A,(HL) 7E
Fetch the first character of the reply at Register Pair HL (6D00H) into Register A.
7002
CP 31H FE 31
Compare Register A (the character) against 31H, the digit 1.
7004
If the Z FLAG is set (1), JUMP to 7017H: one side.
7006
CP 32H FE 32
Compare Register A (the character) against 32H, the digit 2.
7008
If the NZ FLAG is set (neither 1 nor 2), LOOP BACK to 6FF3H to ask again.
700A
JUMP to 7011H with the Z FLAG set (the reply 2): two sides.
700C
LD A,(6E69H) 3A 69 6E
Fetch the low byte of the SIDES parameter from 6E69H into Register A.
700F
CP 02H FE 02
Compare Register A (SIDES) against 02H: the Z FLAG for SIDES=2.
7011
If the NZ FLAG is set (not 2), JUMP to 7017H: one side.
7013
SET 5,(IY+04H) FD CB 04 EE
Set bit 5 of +04H of the working drive code table at Index Register IY (6568H): two sides.
7017
LD A,(IY+03H) FD 7E 03
Fetch +03H of the working drive code table at Index Register IY (6567H) into Register A.
701A
AND 28H E6 28
Mask Register A to bits 5 and 3 (AND 28H): an 8 inch drive or a hard disk.
701C
If the NZ FLAG is set (8 inch or a hard disk), JUMP to 704BH: the number of cylinders stays as 64FBH set it (77 for 8 inch).
701E
LD A,(6FA7H) 3A A7 6F
Fetch the value at 6FA7H (6E77H) into Register A. 7034H comes back here.
7021
OR A B7
Set the flags from Register A (OR A): the Z FLAG when no format parameter was given.
7022
If the NZ FLAG is set (parameters given), JUMP to 703CH to take the cylinders from CYL.
7024
LD HL,743DH 21 3D 74
Point Register Pair HL to 743DH, the question Number of cylinders ? ended by 03H.
7027
GOSUB to 64C2H to display the question at Register Pair HL and read up to 3 characters into 6D00H; Register Pair HL comes back as 6D00H.
702A
GOSUB to 71EEH to turn the digits at Register Pair HL into a number in Register A (0 when no digit comes first).
702D
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 0.
702E
If the NZ FLAG is set (a number), JUMP to 7032H to check it.
7030
LD A,00H 3E 00
Load Register A with the default number of cylinders of the drive: the operand 7031H, 00H in the file, stored by 6EC3H.
7032
CP 60H FE 60
Compare Register A (the number of cylinders) against 60H (96).
7034
If the NO CARRY FLAG is set (96 or more), LOOP BACK to 701EH to ask again. The 1992 manual (M-40-060) allows up to 96; the code takes at most 95.
7036
DEC A 3D
DECrement Register A: the highest cylinder (cylinders count from 0).
7037
LD (IY+06H),A FD 77 06
Store Register A (the highest cylinder) into +06H of the working drive code table at Index Register IY (656AH).
703A
JUMP to 704BH, to the question of the bootstrap step rate.
703C
LD A,(6E6EH) 3A 6E 6E
Fetch the low byte of the CYL parameter from 6E6EH into Register A.
703F
OR A B7
Set the flags from Register A (OR A): the Z FLAG when CYL was not given.
7040
If the Z FLAG is set (no CYL), JUMP to 704BH: the default stays.
7042
CP 60H FE 60
Compare Register A (the low byte of CYL) against 60H (96).
7044
If the NO CARRY FLAG is set (96 or more, or CYL given without a value: FFH), JUMP to 64B1H to give error 2CH, Parameter error.
7047
DEC A 3D
DECrement Register A: the highest cylinder (cylinders count from 0).
7048
LD (IY+06H),A FD 77 06
Store Register A (the highest cylinder) into +06H of the working drive code table at Index Register IY (656AH).

704BH - The Bootstrap Step Rate, SYSTEM

The step rate is asked for in milliseconds, with the values of a 5 inch drive (6, 12, 20, 30 or 40) or an 8 inch drive (3, 6, 10, 15 or 20), and turned into 0-3; ENTER, Q=N and the parameters take STEP or the default from the system information sector (6E29H). SYSTEM is refused unless the format is 5 inch double density.

704B
BIT 4,(IY+04H) FD CB 04 66
Test bit 4 of +04H of the working drive code table at Index Register IY (6568H). Never set here: 6F72H sends such a drive to 70CFH.
704F
If the NZ FLAG is set (never), JUMP to 6FF3H.
7051
LD A,(6FA7H) 3A A7 6F
Fetch the value at 6FA7H (6E77H) into Register A.
7054
OR A B7
Set the flags from Register A (OR A): the Z FLAG when no format parameter was given.
7055
If the NZ FLAG is set (parameters given), JUMP to 70B1H to take STEP or the default.
7057
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of +03H of the working drive code table at Index Register IY (6567H): set for an 8 inch drive.
705B
If the NZ FLAG is set (8 inch), JUMP to 7087H for the question with the 8 inch rates.
705D
LD HL,7454H 21 54 74
Point Register Pair HL to 7454H, the question Boot strap stepping rate <6, 12, 20, 30/40 msecs> ? ended by 03H. 7085H comes back here.
7060
GOSUB to 64C2H to display the question at Register Pair HL and read up to 3 characters into 6D00H; Register Pair HL comes back as 6D00H.
7063
GOSUB to 71EEH to turn the digits at Register Pair HL into a number in Register A.
7066
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 0 (no number).
7067
If the Z FLAG is set (no number), JUMP to 70B1H to take the default rate.
7069
LD B,00H 06 00
Load Register B with 00H, rate 0. LD does not change the flags.
706B
CP 06H FE 06
Compare Register A (the reply) against 06H (6 ms).
706D
If the Z FLAG is set (6), JUMP to 70B8H with rate 0 in Register B.
706F
LD B,01H 06 01
Load Register B with 01H, rate 1, for the next compare.
7071
CP 0CH FE 0C
Compare Register A (the reply) against 0CH (12 ms).
7073
If the Z FLAG is set (12), JUMP to 70B8H with rate 1 in Register B.
7075
LD B,02H 06 02
Load Register B with 02H, rate 2, for the next compare.
7077
CP 14H FE 14
Compare Register A (the reply) against 14H (20 ms).
7079
If the Z FLAG is set (20), JUMP to 70B8H with rate 2 in Register B.
707B
LD B,03H 06 03
Load Register B with 03H, rate 3, for the next two compares.
707D
CP 1EH FE 1E
Compare Register A (the reply) against 1EH (30 ms).
707F
If the Z FLAG is set (30), JUMP to 70B8H with rate 3 in Register B.
7081
CP 28H FE 28
Compare Register A (the reply) against 28H (40 ms), also rate 3.
7083
If the Z FLAG is set (40), JUMP to 70B8H with rate 3 in Register B.
7085
LOOP BACK to 705DH to ask again: the reply is none of the rates.
7087
LD HL,7489H 21 89 74
Point Register Pair HL to 7489H, the question Bootstrap stepping rate <3, 6, 10, 15/20 msecs> ? ended by 03H. 70AFH comes back here.
708A
GOSUB to 64C2H to display the question at Register Pair HL and read up to 3 characters into 6D00H; Register Pair HL comes back as 6D00H.
708D
GOSUB to 71EEH to turn the digits at Register Pair HL into a number in Register A.
7090
OR A B7
Set the flags from Register A (OR A): the Z FLAG for 0 (no number).
7091
If the Z FLAG is set (no number), JUMP to 70B1H to take the default rate.
7093
LD B,00H 06 00
Load Register B with 00H, rate 0. LD does not change the flags.
7095
CP 03H FE 03
Compare Register A (the reply) against 03H (3 ms).
7097
If the Z FLAG is set (3), JUMP to 70B8H with rate 0 in Register B.
7099
LD B,01H 06 01
Load Register B with 01H, rate 1, for the next compare.
709B
CP 06H FE 06
Compare Register A (the reply) against 06H (6 ms).
709D
If the Z FLAG is set (6), JUMP to 70B8H with rate 1 in Register B.
709F
LD B,02H 06 02
Load Register B with 02H, rate 2, for the next compare.
70A1
CP 0AH FE 0A
Compare Register A (the reply) against 0AH (10 ms).
70A3
If the Z FLAG is set (10), JUMP to 70B8H with rate 2 in Register B.
70A5
LD B,03H 06 03
Load Register B with 03H, rate 3, for the next two compares.
70A7
CP 0FH FE 0F
Compare Register A (the reply) against 0FH (15 ms).
70A9
If the Z FLAG is set (15), JUMP to 70B8H with rate 3 in Register B.
70AB
CP 14H FE 14
Compare Register A (the reply) against 14H (20 ms), also rate 3.
70AD
If the Z FLAG is set (20), JUMP to 70B8H with rate 3 in Register B.
70AF
LOOP BACK to 7087H to ask again: the reply is none of the rates.
70B1
LD A,(6E73H) 3A 73 6E
Fetch the low byte of the STEP parameter from 6E73H into Register A: STEP=n, or the default rate from the system information sector (6E29H).
70B4
AND 03H E6 03
Mask Register A to bits 1-0 (AND 03H): the rate, 0-3.
70B6
JUMP to 70B9H to store the rate in Register A at 656EH.
70B8
LD A,B 78
Copy Register B (the rate of the reply) into Register A.
70B9
LD (656EH),A 32 6E 65
Store Register A (the bootstrap step rate) at 656EH, for the two boot sectors (62B4H, 62E1H).
70BC
BIT 5,(IY+03H) FD CB 03 6E
Test bit 5 of +03H of the working drive code table at Index Register IY (6567H): set for an 8 inch drive.
70C0
If the NZ FLAG is set (8 inch), JUMP to 70C8H to refuse SYSTEM.
70C2
BIT 6,(IY+03H) FD CB 03 76
Test bit 6 of +03H of the working drive code table at Index Register IY (6567H): set for double density.
70C6
If the NZ FLAG is set (5 inch double density), JUMP to 70CFH: SYSTEM is allowed.
70C8
LD A,(620FH) 3A 0F 62
Fetch the low byte of the SYSTEM parameter from 620FH into Register A: FFH when SYSTEM was given.
70CB
INC A 3C
INCrement Register A: the Z FLAG when SYSTEM was given.
70CC
If the Z FLAG is set (SYSTEM for an 8 inch or single density format), JUMP to 722CH to display Can only SYSTEM a 5" DDEN floppy! and end at @ABORT.

70CFH - The Allocation Table Image, the Target Diskette

Each cylinder's byte of the allocation table image (6A00H up to the highest cylinder) gets a bit set for every granule the cylinder does not have: FFH shifted left once for each granule of a cylinder (the granules on a track, twice that with two sides). The bytes after it up to 6ACAH, the lock out table among them, get FFH. For drive 0 the operator is asked to put in the diskette to be formatted; a JCL job cannot answer, so it ends there.

70CF
LD A,(IY+08H) FD 7E 08
Fetch +08H of the working drive code table at Index Register IY (656CH) into Register A: bits 7-5 the granules on a track less one.
70D2
RLCA 07
Rotate Register A left one place (RLCA): bit 7 goes round to bit 0.
70D3
RLCA 07
Rotate Register A left one place (RLCA): bits 7-6 are now bits 1-0.
70D4
RLCA 07
Rotate Register A left one place (RLCA): bits 7-5 of +08H are now bits 2-0.
70D5
AND 07H E6 07
Mask Register A to bits 2-0 (AND 07H): the granules on a track less one.
70D7
INC A 3C
INCrement Register A: the granules on a track.
70D8
LD B,FFH 06 FF
Load Register B with FFH, every granule not free, before the shifts below free the cylinder's granules.
70DA
BIT 5,(IY+04H) FD CB 04 6E
Test bit 5 of +04H of the working drive code table at Index Register IY (6568H): set for two sides.
70DE
If the Z FLAG is set (one side), JUMP to 70E1H with Register A = the granules on a track.
70E0
ADD A,A 87
Double Register A (ADD A,A): the granules on a cylinder of two sides.
70E1
SLA B CB 20
Shift Register B left one place (SLA): one more granule bit, from bit 0 up, is clear (free). 70E4H loops back here.
70E3
DEC A 3D
DECrement Register A, the granules of the cylinder still to free.
70E4
If the NZ FLAG is set (granules left), LOOP BACK to 70E1H: Register B ends as FCH for 2 granules, F8H for 3, F0H for 4, C0H for 6.
70E6
LD HL,6A00H 21 00 6A
Point Register Pair HL to 6A00H, cylinder 0's byte of the allocation table image.
70E9
LD A,(IY+06H) FD 7E 06
Fetch +06H of the working drive code table at Index Register IY (656AH) into Register A: the highest cylinder.
70EC
LD (HL),B 70
Store Register B (the free granule pattern) at Register Pair HL, the byte of a cylinder.
70ED
INC L 2C
INCrement Register L to the next cylinder's byte.
70EE
CP L BD
Compare Register A (the highest cylinder) against Register L (the next cylinder): the CARRY FLAG once Register L is past it.
70EF
If the NO CARRY FLAG is set (Register L is not past the highest cylinder), LOOP BACK to 70ECH.
70F1
LD B,FFH 06 FF
Load Register B with FFH: no granule free, for the bytes after the last cylinder.
70F3
LD A,CBH 3E CB
Load Register A with CBH, the low byte of 6ACBH, where the loaded part of the image starts.
70F5
LD (HL),B 70
Store Register B (FFH) at Register Pair HL, a byte after the cylinders.
70F6
INC L 2C
INCrement Register L to the next byte of the image.
70F7
CP L BD
Compare Register A (CBH) against Register L, the low byte of the pointer.
70F8
If the NZ FLAG is set (6ACBH not reached), LOOP BACK to 70F5H: every byte up to 6ACAH is FFH, the lock out table (6A60H-6ABFH) and +C0H-+CAH included.
70FA
LD A,(648CH) 3A 8C 64
Fetch the target drive from 648CH into Register A.
70FD
OR A B7
Set the flags from Register A (OR A): the Z FLAG for drive 0.
70FE
If the NZ FLAG is set (not drive 0), JUMP to 711AH to check the target diskette.
7100
LD HL,7539H 21 39 75
Point Register Pair HL to 7539H, the text Load destination diskette and hit <ENTER> ended by 0DH. 7144H comes back here when no diskette turns in the drive.
7103
GOSUB to 4467H, @DSPLY, to display the text at Register Pair HL (7539H).
7106
LD A,(430FH) 3A 0F 43
Fetch SFLAG$ from 430FH into Register A: bit 5 is set while a JCL job runs.
7109
BIT 5,A CB 6F
Test bit 5 of Register A (SFLAG$): a JCL job.
710B
If the NZ FLAG is set (a job runs: no one can change the diskette), JUMP to 6434H to display Format aborted! and end at @ABORT.
710E
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, a buffer for the line input.
7111
LD BC,0000H 01 00 00
Load Register Pair BC with 0000H: Register B = 0, no character can be typed; only ENTER or BREAK end the input.
7114
GOSUB to 0040H, the ROM's line input, to wait for ENTER or BREAK with Register B (0) and Register Pair HL (6D00H); the CARRY FLAG for BREAK.
7117
If the CARRY FLAG is set (BREAK), JUMP to 6434H to display Format aborted! and end at @ABORT.

711AH - Check the Target Diskette

The working table is saved at 7265H, since the checks move the head and change +05H. After a Restore the controller's status must show the drive ready and the head on track 0, a diskette must turn (723EH) and must not be write protected, and HIGH$ must leave room for the track. A drive with bit 4 of +04H set skips these. Then, when cylinder 0, sector 0 can be read (in the density of the new format), the diskette's name and date are shown from its directory, and the operator must answer Y unless ABS was given; a JCL job ends there. The saved table is put back, the head restored, and the engine starts at 6000H.

711A
PUSH IY FD E5
Save Index Register IY (6564H, the working drive code table) to the stack.
711C
POP HL E1
Restore it into Register Pair HL: the source of the copy below.
711D
LD DE,7265H 11 65 72
Point Register Pair DE to 7265H, the save area (not in the file).
7120
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of a drive code table.
7123
LDIR ED B0
Copy the working table from Register Pair HL (6564H) to Register Pair DE (7265H), Register Pair BC the count (LDIR).
7125
GOSUB to 6467H, the driver's function 04H, Restore: the head goes to cylinder 0.
7128
GOSUB to 646FH, the driver's function 07H: wait until the Restore is finished; Register A = the controller's status.
712B
BIT 4,(IY+04H) FD CB 04 66
Test bit 4 of +04H of the working drive code table at Index Register IY (6568H): the drive FORMAT writes no tracks on.
712F
If the NZ FLAG is set (bit 4 set), JUMP to 7167H: no floppy status checks, no memory check.
7131
LD HL,74FDH 21 FD 74
Point Register Pair HL to 74FDH, the text Drive not ready! ended by 0DH.
7134
BIT 7,A CB 7F
Test bit 7 of Register A (the status): NOT READY.
7136
If the NZ FLAG is set (not ready), JUMP to 6437H to display the text at Register Pair HL (74FDH), put back the interrupt vector and end at @ABORT.
7139
LD HL,7524H 21 24 75
Point Register Pair HL to 7524H, the text Drive not in system! ended by 0DH.
713C
BIT 2,A CB 57
Test bit 2 of Register A (the status after the Restore): TRACK 0, the head is on cylinder 0.
713E
If the Z FLAG is set (the head is not on track 0 after the Restore), JUMP to 6437H to display the text at Register Pair HL (7524H) and end at @ABORT.
7141
GOSUB to 723EH to see whether a diskette turns: the Z FLAG when the index hole passed within 20 ticks; Register A = the last status.
7144
If the NZ FLAG is set (no diskette turns), LOOP BACK to 7100H to ask for the diskette and wait for ENTER.
7146
LD HL,750EH 21 0E 75
Point Register Pair HL to 750EH, the text Write protected disk! ended by 0DH.
7149
RLCA 07
Rotate Register A (the status) left one place (RLCA): bit 6, WRITE PROTECT (the notch is covered), goes to bit 7.
714A
OR (IY+03H) FD B6 03
OR +03H of the working drive code table at Index Register IY (6567H) into Register A: bit 7 of +03H is the software write protect.
714D
AND 80H E6 80
Mask Register A to bit 7 (AND 80H): set when the diskette or the drive is write protected.
714F
If the NZ FLAG is set (write protected), JUMP to 6437H to display the text at Register Pair HL (750EH) and end at @ABORT.
7152
LD HL,6E00H 21 00 6E
Point Register Pair HL to 6E00H, where the track will be built.
7155
LD DE,0000H 11 00 00
Load Register Pair DE with the memory the track takes: the operand 7156H-7157H, 0000H in the file, stored by 651FH from the descriptor.
7158
ADD HL,DE 19
ADD Register Pair DE to Register Pair HL: the address after the track's memory.
7159
LD D,H 54
Copy Register H (the high byte of the end of the track's memory) into Register D.
715A
LD E,L 5D
Copy Register L into Register E: Register Pair DE = the address after the track's memory.
715B
LD HL,(4049H) 2A 49 40
Fetch HIGH$ from 4049H into Register Pair HL: the highest address free for programs.
715E
XOR A AF
Set Register A to 00H (XOR A): the CARRY FLAG is clear for the SBC.
715F
SBC HL,DE ED 52
SUBtract Register Pair DE (the end of the track's memory) from Register Pair HL (HIGH$): the CARRY FLAG when HIGH$ is below it.
7161
LD HL,73ABH 21 AB 73
Point Register Pair HL to 73ABH, the text Insufficient memory for specified format! ended by 0DH. LD does not change the flags.
7164
If the CARRY FLAG is set (not enough memory), JUMP to 6437H to display the text at Register Pair HL (73ABH) and end at @ABORT.
7167
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H: Register D = cylinder 0, Register E = sector 0.
716A
GOSUB to 6487H, the driver's function 0AH, Verify: can cylinder Register D (0), sector Register E (0) be read in the format chosen?
716D
If the NZ FLAG is set (it cannot: a blank diskette or another format), JUMP to 71DDH to start the format.
716F
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer.
7172
LD DE,0000H 11 00 00
Load Register Pair DE with 0000H: Register D = cylinder 0, Register E = sector 0.
7175
GOSUB to 6483H, the driver's function 09H, Read Sector: cylinder Register D (0), sector Register E (0) into the buffer at Register Pair HL (6D00H).
7178
If the NZ FLAG is set (the read failed), JUMP to 64A7H to report the error in Register A.
717B
LD HL,757EH 21 7E 75
Point Register Pair HL to 757EH, the text Disk contains data -- ended by 03H.
717E
GOSUB to 447BH, @LOGOT, to display the text at Register Pair HL (757EH) and write it to the job log; the cursor stays at its end.
7181
LD HL,7595H 21 95 75
Point Register Pair HL to 7595H, the text Non-standard format ended by 0DH: shown unless the directory is found.
7184
LD A,(6D02H) 3A 02 6D
Fetch byte 2 of the boot sector just read, 6D02H, into Register A: the diskette's directory cylinder.
7187
CP (IY+06H) FD BE 06
Compare Register A (the directory cylinder) against +06H of the working drive code table at Index Register IY (656AH), the highest cylinder of the new format.
718A
If the NO CARRY FLAG is set (the directory cylinder is not below it), JUMP to 71C0H to display Non-standard format.
718C
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer.
718F
LD E,L 5D
Copy Register L (00H) into Register E: sector 0, the diskette's allocation table.
7190
LD D,A 57
Copy Register A (the directory cylinder) into Register D.
7191
LD HL,6D00H 21 00 6D
Point Register Pair HL to 6D00H, the sector buffer, again.
7194
GOSUB to 6483H, the driver's function 09H, Read Sector: cylinder Register D (the directory), sector Register E (0) into the buffer at Register Pair HL (6D00H).
7197
CP 06H FE 06
Compare Register A (the driver's result) against 06H, the error of a sector with the deleted data mark: the mark of a directory sector.
7199
If the Z FLAG is set (06H), JUMP to 71A0H: the directory was found.
719B
LD HL,75A9H 21 A9 75
Point Register Pair HL to 75A9H, the text Unreadable directory ended by 0DH: the sector failed, or carries the normal data mark.
719E
JUMP to 71C0H to display the text at Register Pair HL (75A9H).
71A0
LD HL,75BEH 21 BE 75
Point Register Pair HL to 75BEH, the text Non-initialized directory ended by 0DH: shown unless the date is found.
71A3
LD A,(6DDAH) 3A DA 6D
Fetch the allocation table's +DAH from 6DDAH into Register A: the third character of the date MM/DD/YY.
71A6
CP 2FH FE 2F
Compare Register A (the character) against 2FH, the slash of a date.
71A8
If the NZ FLAG is set (no date), JUMP to 71C0H to display Non-initialized directory.
71AA
LD HL,6DD0H 21 D0 6D
Point Register Pair HL to 6DD0H, the diskette name in the allocation table read (+D0H).
71AD
LD DE,75DDH 11 DD 75
Point Register Pair DE to 75DDH, the eight X of the text Name=XXXXXXXX at 75D8H.
71B0
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the length of the name.
71B3
LDIR ED B0
Copy the name from Register Pair HL (6DD0H) to Register Pair DE (75DDH), Register Pair BC the count (LDIR); Register Pair HL comes out at 6DD8H, the date.
71B5
LD DE,75ECH 11 EC 75
Point Register Pair DE to 75ECH, the MM/DD/YY of the text.
71B8
LD BC,0008H 01 08 00
Load Register Pair BC with 0008H, the length of the date.
71BB
LDIR ED B0
Copy the date from Register Pair HL (6DD8H) to Register Pair DE (75ECH), Register Pair BC the count (LDIR).
71BD
LD HL,75D8H 21 D8 75
Point Register Pair HL to 75D8H, the text Name=, the name, two spaces, Date= and the date, ended by 0DH.
71C0
GOSUB to 447BH, @LOGOT, to display the text at Register Pair HL (one of 7595H, 75A9H, 75BEH, 75D8H) and write it to the job log.
71C3
LD DE,0000H 11 00 00
Load Register Pair DE with the ABS parameter: the operand 71C4H-71C5H, 0000H in the file, FFFFH when ABS was given.
71C6
INC E 1C
INCrement Register E (the low byte of ABS): the Z FLAG when ABS was given.
71C7
If the Z FLAG is set (ABS), JUMP to 71DDH: no question.
71C9
LD HL,430FH 21 0F 43
Point Register Pair HL to 430FH, SFLAG$, the system flags.
71CC
BIT 5,(HL) CB 6E
Test bit 5 of the byte at Register Pair HL (SFLAG$): set while a JCL job runs.
71CE
If the NZ FLAG is set (a job runs: no one can answer), JUMP to 6434H to display Format aborted! and end at @ABORT.
71D1
LD HL,761EH 21 1E 76
Point Register Pair HL to 761EH, the question Are you sure you want to format it ? ended by 03H (the second line of the text at 75F5H).
71D4
GOSUB to 64C2H to display the question at Register Pair HL and read up to 3 characters into 6D00H in upper case.
71D7
LD A,(HL) 7E
Fetch the first character of the reply at Register Pair HL (6D00H) into Register A (0DH when only ENTER was pressed).
71D8
CP 59H FE 59
Compare Register A (the character) against 59H, Y.
71DA
If the NZ FLAG is set (not Y), JUMP to 6434H to display Format aborted! and end at @ABORT.
71DD
PUSH IY FD E5
Save Index Register IY (6564H, the working drive code table) to the stack.
71DF
POP DE D1
Restore it into Register Pair DE: the destination of the copy below.
71E0
LD HL,7265H 21 65 72
Point Register Pair HL to 7265H, the table saved at 7123H.
71E3
LD BC,000AH 01 0A 00
Load Register Pair BC with 000AH, the ten bytes of a drive code table.
71E6
LDIR ED B0
Copy the saved table from Register Pair HL (7265H) to Register Pair DE (6564H), Register Pair BC the count (LDIR): the working table as it was before the checks.
71E8
GOSUB to 6467H, the driver's function 04H, Restore: the head goes to cylinder 0, and +05H = 0.
71EB
JUMP to 6000H, the format engine, with Index Register IY at 6564H.

71EEH - A Number From Digits

Register Pair HL points to a reply; the decimal digits at its start are turned into a number in Register A (the low 8 bits), ending at the first character that is not a digit. Register Pair HL comes back past that character.

71EE
LD E,00H 1E 00
Load Register E with 00H, the number so far: no digit yet.
71F0
LD A,(HL) 7E
Fetch the next character at Register Pair HL into Register A. 71FFH loops back here.
71F1
INC HL 23
INCrement Register Pair HL past the character.
71F2
SUB 30H D6 30
SUBtract 30H from Register A: the value of a digit, 0-9.
71F4
LD B,A 47
Copy Register A (the value of the character) into Register B.
71F5
CP 0AH FE 0A
Compare Register A (the value) against 0AH: the CARRY FLAG for a digit.
71F7
LD A,E 7B
Copy Register E (the number so far) into Register A. LD does not change the flags.
71F8
RET NC D0
If the NO CARRY FLAG is set (not a digit), RETurn with the number in Register A.
71F9
ADD A,A 87
Double Register A (ADD A,A): the number so far x 2.
71FA
ADD A,A 87
Double Register A (ADD A,A): the number so far x 4.
71FB
ADD A,E 83
ADD Register E (the number) to Register A: the number x 5.
71FC
ADD A,A 87
Double Register A (ADD A,A): the number x 10.
71FD
ADD A,B 80
ADD Register B (the value of the digit) to Register A.
71FE
LD E,A 5F
Copy Register A (the new number) into Register E.
71FF
LOOP BACK to 71F0H for the next character at Register Pair HL.

7201H - Check and Hash the Master Password

Register Pair DE points to the 8 characters of the password. The first must be a letter A-Z, each of the others a letter or a digit 0-9, and once a space comes every character after it must be a space. A password that fails gives Invalid Master Password! and Format aborted!. A good one is hashed by SYS2/SYS (request E4H): Register Pair HL = the hash.

7201
LD B,08H 06 08
Load Register B with 08H, the characters of the password.
7203
PUSH DE D5
Save Register Pair DE (the address of the password) to the stack.
7204
POP HL E1
Restore it into Register Pair HL: Register Pair HL points to the first character.
7205
LD A,(HL) 7E
Fetch the first character at Register Pair HL into Register A.
7206
JUMP to 7216H: the first character must be a letter.
7208
INC HL 23
INCrement Register Pair HL to the next character. 721EH loops back here.
7209
LD A,(HL) 7E
Fetch the character at Register Pair HL into Register A.
720A
CP 20H FE 20
Compare Register A (the character) against 20H, a space.
720C
If the Z FLAG is set (a space), JUMP to 7228H: the rest must be spaces.
720E
CP 30H FE 30
Compare Register A (the character) against 30H, the digit 0.
7210
If the CARRY FLAG is set (below 30H), JUMP to 7235H: Invalid Master Password!.
7212
CP 3AH FE 3A
Compare Register A (the character) against 3AH, the character after the digit 9.
7214
If the CARRY FLAG is set (a digit 0-9), JUMP to 721EH: the character is good.
7216
CP 41H FE 41
Compare Register A (the character) against 41H, the letter A.
7218
If the CARRY FLAG is set (below 41H), JUMP to 7235H: Invalid Master Password!.
721A
CP 5BH FE 5B
Compare Register A (the character) against 5BH, the character after the letter Z.
721C
If the NO CARRY FLAG is set (above Z), JUMP to 7235H: Invalid Master Password!.
721E
DECrement Register B (the characters left) and LOOP BACK to 7208H until all 8 are checked.
7220
GOSUB to 727AH, the request E4H: SYS2/SYS hashes the 8 characters at Register Pair DE and returns the hash in Register Pair HL.
7223
RET C9
RETurn with the hash of the master password in Register Pair HL.
7224
INC HL 23
INCrement Register Pair HL to the next character after a space. 7228H loops back here.
7225
CP (HL) BE
Compare Register A (20H, a space) against the character at Register Pair HL.
7226
If the NZ FLAG is set (not a space), JUMP to 7235H: Invalid Master Password!.
7228
DECrement Register B (the characters left) and LOOP BACK to 7224H until the rest of the 8 are checked.
722A
JUMP to 7220H to hash the password, which has passed the checks.
722C
LD HL,7286H 21 86 72
Point Register Pair HL to 7286H, the text Can only SYSTEM a 5" DDEN floppy! ended by 0DH.
722F
GOSUB to 447BH, @LOGOT, to display the text at Register Pair HL (7286H) and write it to the job log.
7232
JUMP to 4030H, @ABORT: the program ends with an error; nothing has been written to the diskette.
7235
LD HL,7563H 21 63 75
Point Register Pair HL to 7563H, the text 0AH, Invalid Master Password!, 0AH and 0DH.
7238
GOSUB to 447BH, @LOGOT, to display the text at Register Pair HL (7563H) and write it to the job log.
723B
JUMP to 6434H to display Format aborted! and end at @ABORT.

723EH - Does a Diskette Turn?

The controller's status bit 1 (INDEX) is 1 while the index hole is under the sensor. The routine waits for it to be 0, then 1, then 0 again, each within the deadline of TIMER$ (4040H) plus 20 ticks (half a second). It returns the Z FLAG when the hole passed; at the deadline 7261H drops the return address of the poll and returns to the caller of 723EH with the NZ FLAG.

723E
LD A,(4040H) 3A 40 40
Fetch TIMER$ from 4040H into Register A: the tick count, 40 a second.
7241
ADD A,14H C6 14
ADD 14H (20) to Register A: the tick of the deadline, half a second on.
7243
LD D,A 57
Copy Register A (the deadline) into Register D.
7244
GOSUB to 7254H to read the status: the Z FLAG when the index hole is not under the sensor.
7247
If the NZ FLAG is set (the hole is under the sensor), LOOP BACK to 7244H until it is not.
7249
GOSUB to 7254H to read the status: the Z FLAG when the index hole is not under the sensor.
724C
If the Z FLAG is set (no hole), LOOP BACK to 7249H until the hole comes.
724E
GOSUB to 7254H to read the status: the Z FLAG when the index hole is not under the sensor.
7251
If the NZ FLAG is set (the hole is under the sensor), LOOP BACK to 724EH until it has passed.
7253
RET C9
RETurn with the Z FLAG: the diskette turns. Register A holds the last status.
7254
EI FB
Enable interrupts, so that TIMER$ (4040H) goes on counting.
7255
LD A,(4040H) 3A 40 40
Fetch TIMER$ from 4040H into Register A: the tick count now.
7258
CP D BA
Compare Register A (TIMER$) against Register D (the deadline).
7259
If the Z FLAG is set (the deadline), JUMP to 7261H to give up.
725B
GOSUB to 646FH, the driver's function 07H: Register A = the controller's status when it is not busy.
725E
BIT 1,A CB 4F
Test bit 1 of Register A (the status): INDEX, set while the index hole is under the sensor.
7260
RET C9
RETurn to the poll with the Z FLAG when the hole is not under the sensor.
7261
POP AF F1
Restore Register Pair AF from the stack: this drops the return address of the poll that called 7254H.
7262
OR 01H F6 01
OR 01H into Register A: the NZ FLAG, no diskette turns.
7264
RET C9
RETurn to the caller of 723EH with the NZ FLAG: no diskette turns.

7265H - Not in the File: the Saved Table and the Cylinders of the Drives

Two areas the front end fills.

7265-726E
DEFS 10
7265H-726EH: not in the file. The copy of the working drive code table taken at 7123H and put back at 71E6H.
726F-7276
DEFS 8
726FH-7276H: not in the file. The highest cylinder of drives 0-7 from the system information sector (6E35H); 6EC1H takes the target drive's.

7277H - Two Supervisor Requests

Each loads a request code into Register A and does RST 28H. The supervisor's dispatcher (4BCDH) drops the return address the RST pushed, so the RET at the end of the system file goes back to the caller of the CALL: neither needs a RET of its own. Both codes name SYS2/SYS (low four bits 4: file 2 plus 2).

7277
LD A,84H 3E 84
Load Register A with 84H, the request for SYS2/SYS function 00H (bits 6-4), which loads the file and does nothing else. 6E07H calls it.
7279
RST 28H EF
RST 28H with Register A = 84H: the supervisor's dispatcher loads SYS2/SYS into 4E00H when it is not there; its RET goes back to the caller of 7277H.
727A
LD A,E4H 3E E4
Load Register A with E4H, the request for SYS2/SYS function 60H: the hash of the 8 character password at Register Pair DE. 7220H calls it.
727C
RST 28H EF
RST 28H with Register A = E4H: SYS2/SYS (its 4E27H) returns the hash of the password at Register Pair DE in Register Pair HL, to the caller of 727AH.

727DH - The Master Password, a Text

The buffer of the master password and the text of 722CH.

727D-7284
DEFM " " 20 20 20 20 20 20 20 20
727DH-7284H: the master password, eight spaces in the file: filled from the command line, the reply or PASSWORD (6F2CH-6F63H), then checked and hashed (7201H).
7285
DEFB 20H 20
7285H: a space after the buffer. The ROM's line input puts its 0DH here after a reply of 8 characters (6F4EH).
7286-72A6
DEFM "Can only SYSTEM a 5" / DEFB 22H / DEFM " DDEN floppy!" 43 61 6E 20 6F 6E 6C 79 20 53 59 53 54 45 4D 20 61 20 35 22 20 44 44 45 4E 20 66 6C 6F 70 70 79 21
7286H-72A6H: the text of 722CH, for SYSTEM with a format other than 5 inch double density.
72A7
DEFB 0DH 0D
72A7H: 0DH, the end of the line and of the text.

72A8H - The Table of the Parameters

The table @PARAM reads (6E58H): for each parameter its name, 6 characters padded with spaces, and the address of the operand that takes its value; the short forms point to the same operands. 00H ends it. The operands: 0000H in the file (not given), FFFFH for a parameter given alone (or Y), 0000H for N, the number for =n, the address of the text for a quoted text.

72A8-72AF
DEFM "NAME " / DEFW 6EDCH 4E 41 4D 45 20 20 DC 6E
72A8H-72AFH: NAME, the diskette name: the operand of LD HL,0000H at 6EDBH.
72B0-72B7
DEFM "N " / DEFW 6EDCH 4E 20 20 20 20 20 DC 6E
72B0H-72B7H: N, the short form of NAME: 6EDCH.
72B8-72BF
DEFM "MPW " / DEFW 6F1FH 4D 50 57 20 20 20 1F 6F
72B8H-72BFH: MPW, the master password: the operand of LD HL,0000H at 6F1EH.
72C0-72C7
DEFM "M " / DEFW 6F1FH 4D 20 20 20 20 20 1F 6F
72C0H-72C7H: M, the short form of MPW: 6F1FH.
72C8-72CF
DEFM "SDEN " / DEFW 6E5FH 53 44 45 4E 20 20 5F 6E
72C8H-72CFH: SDEN, single density: the operand of LD DE,0000H at 6E5EH.
72D0-72D7
DEFM "DDEN " / DEFW 6E64H 44 44 45 4E 20 20 64 6E
72D0H-72D7H: DDEN, double density: the operand of LD DE,0000H at 6E63H.
72D8-72DF
DEFM "SIDES " / DEFW 6E69H 53 49 44 45 53 20 69 6E
72D8H-72DFH: SIDES=n, the sides: the operand of LD DE,0000H at 6E68H.
72E0-72E7
DEFM "CYL " / DEFW 6E6EH 43 59 4C 20 20 20 6E 6E
72E0H-72E7H: CYL=n, the cylinders: the operand of LD DE,0000H at 6E6DH.
72E8-72EF
DEFM "C " / DEFW 6E6EH 43 20 20 20 20 20 6E 6E
72E8H-72EFH: C, the short form of CYL: 6E6EH.
72F0-72F7
DEFM "STEP " / DEFW 6E73H 53 54 45 50 20 20 73 6E
72F0H-72F7H: STEP=n, the bootstrap step rate: the operand of LD DE,FF00H at 6E72H.
72F8-72FF
DEFM "ABS " / DEFW 71C4H 41 42 53 20 20 20 C4 71
72F8H-72FFH: ABS, no question for a diskette that holds data: the operand of LD DE,0000H at 71C3H.
7300-7307
DEFM "A " / DEFW 71C4H 41 20 20 20 20 20 C4 71
7300H-7307H: A, the short form of ABS: 71C4H.
7308-730F
DEFM "QUERY " / DEFW 6FACH 51 55 45 52 59 20 AC 6F
7308H-730FH: QUERY, ask the questions (FFFFH) or not (0000H): the operand of LD DE,FFFFH at 6FABH.
7310-7317
DEFM "Q " / DEFW 6FACH 51 20 20 20 20 20 AC 6F
7310H-7317H: Q, the short form of QUERY: 6FACH.
7318-731F
DEFM "SYSTEM" / DEFW 620FH 53 59 53 54 45 4D 0F 62
7318H-731FH: SYSTEM, cylinder 0 in single density on a double density diskette, or only the system information: the operand of LD HL,0000H at 620EH.
7320-7327
DEFM "WAIT " / DEFW 6126H 57 41 49 54 20 20 26 61
7320H-7327H: WAIT=n, a wait after each step: the operand of LD BC,0000H at 6125H.
7328-732F
DEFM "W " / DEFW 6126H 57 20 20 20 20 20 26 61
7328H-732FH: W, the short form of WAIT: 6126H.
7330-7337
DEFM "DIR " / DEFW 6256H 44 49 52 20 20 20 56 62
7330H-7337H: DIR=n, the cylinder of the directory: the operand of LD BC,0000H at 6255H.
7338-733F
DEFM "D " / DEFW 6256H 44 20 20 20 20 20 56 62
7338H-733FH: D, the short form of DIR: 6256H.
7340
DEFB 00H 00
7340H: 00H, the end of the table: @PARAM stops here.

7341H - The Front End's Texts

The banner, the questions (ended by 03H: the cursor stays for the reply), the error texts (ended by 0DH), the defaults LDOSDISK and PASSWORD, and 32 bytes of 00H.

7341-7342
DEFB 1CH, 1FH 1C 1F
7341H-7342H: 1CH, the cursor to the top left, and 1FH, clear to the end of the screen: the start of the banner (6E01H).
7343-7376
DEFM "FORMAT - LDOS Disk Formatter Program - Version 5.3.1" 46 4F 52 4D 41 54 20 2D 20 4C 44 4F 53 20 44 69 73 6B 20 46 6F 72 6D 61 74 74 65 72 20 50 72 6F 67 72 61 6D 20 2D 20 56 65 72 73 69 6F 6E 20 35 2E 33 2E 31
7343H-7376H: the name and the version of the program.
7377
DEFB 0AH 0A
7377H: 0AH, a new line: the copyright goes on the next line.
7378-73A8
DEFM "Copyright 1991 MISOSYS, Inc., All rights reserved" 43 6F 70 79 72 69 67 68 74 20 31 39 39 31 20 4D 49 53 4F 53 59 53 2C 20 49 6E 63 2E 2C 20 41 6C 6C 20 72 69 67 68 74 73 20 72 65 73 65 72 76 65 64
7378H-73A8H: the copyright line of the program, Copyright 1991 MISOSYS, Inc.
73A9-73AA
DEFB 0AH, 0DH 0A 0D
73A9H-73AAH: 0AH, a new line, and 0DH, the end of the banner.
73AB-73D3
DEFM "Insufficient memory for specified format!" 49 6E 73 75 66 66 69 63 69 65 6E 74 20 6D 65 6D 6F 72 79 20 66 6F 72 20 73 70 65 63 69 66 69 65 64 20 66 6F 72 6D 61 74 21
73ABH-73D3H: the text of 7161H, when HIGH$ leaves no room for the track.
73D4
DEFB 0DH 0D
73D4H: 0DH, the end of the line and of the text.
73D5-73F0
DEFM "Which drive is to be used ? " 57 68 69 63 68 20 64 72 69 76 65 20 69 73 20 74 6F 20 62 65 20 75 73 65 64 20 3F 20
73D5H-73F0H: the question of 6E7CH, when no :d is on the command line.
73F1
DEFB 03H 03
73F1H: 03H, the end of the question: the cursor stays for the reply.
73F2-7401
DEFM "Diskette name ? " 44 69 73 6B 65 74 74 65 20 6E 61 6D 65 20 3F 20
73F2H-7401H: the question of 6F05H, for the diskette name.
7402
DEFB 03H 03
7402H: 03H, the end of the question: the cursor stays for the reply.
7403-7414
DEFM "Master password ? " 4D 61 73 74 65 72 20 70 61 73 73 77 6F 72 64 20 3F 20
7403H-7414H: the question of 6F43H, for the master password.
7415
DEFB 03H 03
7415H: 03H, the end of the question: the cursor stays for the reply.
7416-743B
DEFM "Special non-standard format desired ? " 53 70 65 63 69 61 6C 20 6E 6F 6E 2D 73 74 61 6E 64 61 72 64 20 66 6F 72 6D 61 74 20 64 65 73 69 72 65 64 20 3F 20
7416H-743BH: a question that no code of the file displays.
743C
DEFB 03H 03
743CH: 03H, the end of the question that no code displays.
743D-7452
DEFM "Number of cylinders ? " 4E 75 6D 62 65 72 20 6F 66 20 63 79 6C 69 6E 64 65 72 73 20 3F 20
743DH-7452H: the question of 7024H, for a 5 inch floppy.
7453
DEFB 03H 03
7453H: 03H, the end of the question: the cursor stays for the reply.
7454-7487
DEFM "Boot strap stepping rate <6, 12, 20, 30/40 msecs> ? " 42 6F 6F 74 20 73 74 72 61 70 20 73 74 65 70 70 69 6E 67 20 72 61 74 65 20 3C 36 2C 20 31 32 2C 20 32 30 2C 20 33 30 2F 34 30 20 6D 73 65 63 73 3E 20 3F 20
7454H-7487H: the question of 705DH, for a 5 inch drive.
7488
DEFB 03H 03
7488H: 03H, the end of the question: the cursor stays for the reply.
7489-74BA
DEFM "Bootstrap stepping rate <3, 6, 10, 15/20 msecs> ? " 42 6F 6F 74 73 74 72 61 70 20 73 74 65 70 70 69 6E 67 20 72 61 74 65 20 3C 33 2C 20 36 2C 20 31 30 2C 20 31 35 2F 32 30 20 6D 73 65 63 73 3E 20 3F 20
7489H-74BAH: the question of 7087H, for an 8 inch drive.
74BB
DEFB 03H 03
74BBH: 03H, the end of the question: the cursor stays for the reply.
74BC-74D9
DEFM "Enter number of sides <1,2> ? " 45 6E 74 65 72 20 6E 75 6D 62 65 72 20 6F 66 20 73 69 64 65 73 20 3C 31 2C 32 3E 20 3F 20
74BCH-74D9H: the question of 6FF9H, for the number of sides.
74DA
DEFB 03H 03
74DAH: 03H, the end of the question: the cursor stays for the reply.
74DB-74FB
DEFM "Single or Double density <S,D> ? " 53 69 6E 67 6C 65 20 6F 72 20 44 6F 75 62 6C 65 20 64 65 6E 73 69 74 79 20 3C 53 2C 44 3E 20 3F 20
74DBH-74FBH: the question of 6FBFH, for the density.
74FC
DEFB 03H 03
74FCH: 03H, the end of the question: the cursor stays for the reply.
74FD-750C
DEFM "Drive not ready!" 44 72 69 76 65 20 6E 6F 74 20 72 65 61 64 79 21
74FDH-750CH: the text of 7131H, when the controller's status shows NOT READY.
750D
DEFB 0DH 0D
750DH: 0DH, the end of the line and of the text.
750E-7522
DEFM "Write protected disk!" 57 72 69 74 65 20 70 72 6F 74 65 63 74 65 64 20 64 69 73 6B 21
750EH-7522H: the text of 7146H, for a write protected diskette or drive.
7523
DEFB 0DH 0D
7523H: 0DH, the end of the line and of the text.
7524-7537
DEFM "Drive not in system!" 44 72 69 76 65 20 6E 6F 74 20 69 6E 20 73 79 73 74 65 6D 21
7524H-7537H: the text of 7139H, when the head is not on track 0 after a Restore.
7538
DEFB 0DH 0D
7538H: 0DH, the end of the line and of the text.
7539-7561
DEFM "Load destination diskette and hit <ENTER>" 4C 6F 61 64 20 64 65 73 74 69 6E 61 74 69 6F 6E 20 64 69 73 6B 65 74 74 65 20 61 6E 64 20 68 69 74 20 3C 45 4E 54 45 52 3E
7539H-7561H: the text of 7100H, for drive 0 and when no diskette turns.
7562
DEFB 0DH 0D
7562H: 0DH, the end of the line and of the text.
7563
DEFB 0AH 0A
7563H: 0AH, a new line: the start of the text of 7235H.
7564-757B
DEFM "Invalid Master Password!" 49 6E 76 61 6C 69 64 20 4D 61 73 74 65 72 20 50 61 73 73 77 6F 72 64 21
7564H-757BH: the text of 7235H, for a password with other characters than letters and digits.
757C-757D
DEFB 0AH, 0DH 0A 0D
757CH-757DH: 0AH, a new line, and 0DH, the end of the text.
757E-7593
DEFM "Disk contains data -- " 44 69 73 6B 20 63 6F 6E 74 61 69 6E 73 20 64 61 74 61 20 2D 2D 20
757EH-7593H: the text of 717BH, followed on the line by one of the four texts below.
7594
DEFB 03H 03
7594H: 03H, the end of the text: the cursor stays at its end.
7595-75A7
DEFM "Non-standard format" 4E 6F 6E 2D 73 74 61 6E 64 61 72 64 20 66 6F 72 6D 61 74
7595H-75A7H: the text of 7181H, for a diskette whose directory cylinder is not below the highest cylinder.
75A8
DEFB 0DH 0D
75A8H: 0DH, the end of the line and of the text.
75A9-75BC
DEFM "Unreadable directory" 55 6E 72 65 61 64 61 62 6C 65 20 64 69 72 65 63 74 6F 72 79
75A9H-75BCH: the text of 719BH, for a directory sector 0 without the deleted data mark.
75BD
DEFB 0DH 0D
75BDH: 0DH, the end of the line and of the text.
75BE-75D6
DEFM "Non-initialized directory" 4E 6F 6E 2D 69 6E 69 74 69 61 6C 69 7A 65 64 20 64 69 72 65 63 74 6F 72 79
75BEH-75D6H: the text of 71A0H, for a directory whose date has no slash.
75D7
DEFB 0DH 0D
75D7H: 0DH, the end of the line and of the text.
75D8-75DC
DEFM "Name=" 4E 61 6D 65 3D
75D8H-75DCH: Name=, the start of the text of 71BDH.
75DD-75E4
DEFM "XXXXXXXX" 58 58 58 58 58 58 58 58
75DDH-75E4H: eight X in the file; 71B3H copies the diskette's name here.
75E5-75EB
DEFM " Date=" 20 20 44 61 74 65 3D
75E5H-75EBH: two spaces and Date=, between the name and the date.
75EC-75F3
DEFM "MM/DD/YY" 4D 4D 2F 44 44 2F 59 59
75ECH-75F3H: MM/DD/YY in the file; 71BBH copies the diskette's date here.
75F4
DEFB 0DH 0D
75F4H: 0DH, the end of the line and of the text.
75F5-761C
DEFM "*** The target drive is a hard disk! ***" 2A 2A 2A 20 54 68 65 20 74 61 72 67 65 74 20 64 72 69 76 65 20 69 73 20 61 20 68 61 72 64 20 64 69 73 6B 21 20 2A 2A 2A
75F5H-761CH: the first line of the text of 61FCH.
761D
DEFB 0AH 0A
761DH: 0AH, a new line between the two lines of the text.
761E-7642
DEFM "Are you sure you want to format it ? " 41 72 65 20 79 6F 75 20 73 75 72 65 20 79 6F 75 20 77 61 6E 74 20 74 6F 20 66 6F 72 6D 61 74 20 69 74 20 3F 20
761EH-7642H: the question of 61FCH and, on its own, of 71D1H.
7643
DEFB 03H 03
7643H: 03H, the end of the question: the cursor stays for the reply.
7644-764B
DEFM "LDOSDISK" 4C 44 4F 53 44 49 53 4B
7644H-764BH: LDOSDISK, the default diskette name (6EE6H). The 1992 manual (M-40-060) gives DOSDISK.
764C-7653
DEFM "PASSWORD" 50 41 53 53 57 4F 52 44
764CH-7653H: PASSWORD, the default master password (6F29H).
7654-7673
DEFB 00H x 32 00 x 32
7654H-7673H: 32 bytes of 00H at the end of the file. No code addresses them.