DOSPLUS 3.5 for the Model III - SYSGEN/CMD Disassembled
Page Customization
Page Index
SYSGEN/CMD
Other Navigation
Introduction/Summary
DOSPLUS 3.5 SYSGEN/CMD Disassembly - Making a System Disk (Model III)
SYSGEN/CMD puts the DOSPLUS system on a formatted diskette or rigid drive, run from the DOS command level as SYSGEN :dr [filespec] (XFER=value); its heading reads SYSGEN - DOSPLUS System generation - 3.52, a later version number than the other utilities. It is a load module of 6 blocks, 1338 bytes, at 5200H-567FH and 568AH-5743H with the transfer address 5200H, after the two comment records (the name SYSGEN and the copyright notice); 5680H-5689H, between the two parts, is not loaded. SYSGEN/CMD is on the Model III master only.
SYSGEN copies from drive 0, the system drive, to the drive given: the boot sectors of cylinder 0, a new configuration sector (sector 2 of BOOT/SYS, which SYS0/SYS reads at boot), and each system file whose entry is in the first directory sectors. It works below the file system: the directory sectors are read and written by logical file number, the files' granules are taken in the target's GAT by SYSGEN itself, and the files are copied through two file control blocks it fills, one from drive 0's entry and one pointed at the new extent.
The Parts of SYSGEN/CMD
| Address | Contents |
|---|---|
| 5200H-5243H | The heading and the five buffer pages (5200H). |
| 5244H-52F1H | EVAL@, the target drive, the bootstrap file, DCHECK, the density of cylinder 0, the first directory sectors (5244H). |
| 52F2H-5343H | A clean diskette, and the 8 inch cylinder 0 (52F2H). |
| 5344H-53D0H | The boot sectors, from drive 0 or the bootstrap file (5344H). |
| 53D1H-5427H | The configuration sector (53D1H). |
| 5428H-550AH | The system files (5428H). |
| 550BH-5672H | The end and the errors, granules, a granule's bit, the hash code, directory sectors, a single density track (550BH, 5533H, 5580H, 55A0H, 55B0H, 55FBH). |
| 5673H-5743H | The data (5673H). |
How SYSGEN Works
The target must be a drive other than drive 0 (Protected system device), there, and not write protected (5244H). Its cylinder 0 is verified in single density, then in double density. The HIT must be empty from byte 02H on, so only BOOT/SYS and DIR/SYS may be on the diskette (Disk contains illegal files, 52F2H): SYSGEN is for a diskette just formatted. For an 8 inch floppy whose cylinder 0 is double density, the drive control table gets single density values and cylinder 0 is formatted again in single density with 16 sectors, all its granules marked in use (55FBH).
The boot sectors are drive 0's cylinder 0 sectors 0 and 1, with the target's directory cylinder in byte 2 of sector 0; or, with a bootstrap file, its first sector written as sectors 0 and 1 and the rest of the file from sector 3 on (5344H). Sector 2 is made anew (53D1H): DCT and the target's drive control table bytes +0BH-13H, then fixed values, the boot flags 0EH (time and date prompts, the logo) with bit 0 and the address when XFER is given, the cursor character 5FH, the step rate 03H; the configuration of drive 0's BOOT/SYS is not copied.
For each logical file number from 02H to 14H, drive 0's entry is read; an active system file is copied (5428H). Its entry goes to the same place in the target's directory (moved on when the target's directory is shorter, 55E1H) with one extent of free granules found from two cylinders below the directory cylinder up (5533H), and the hash code of its name into the target's HIT (55A0H). The file is read whole into memory, a page a sector, and written to the new extent. At the end the GAT and the HIT are written and SYSGEN returns by EXIT@, with no message (550BH).
Differences from the Manual
The manual does not say that the target may not be drive 0, that it must hold no file but BOOT/SYS and DIR/SYS, that the configuration sector is written with fixed values instead of the system's own (so the SYSTEM settings saved on drive 0 are not carried over), that a bootstrap file's first sector goes to both sector 0 and sector 1, or that SYSGEN shows no message when it is done. Each system file must fit in one run of free granules.
5745H, the mark of a double density cylinder 0, is not in the loaded file and is written only when cylinder 0 is double density; for a single density cylinder 0 it keeps whatever memory held, so the 8 inch case at 5310H can be taken on that leftover byte.
Variables
SYSGEN/CMD Variables
| Address Size | Contents |
|---|---|
| 53E8H-53E9H 2 bytes | XFER The value of XFER, the operand of LD DE (53E7H). |
| 558EH, 559EH 1 byte each | Bit opcodes The second bytes of SET n,A and BIT n,A (5589H, 5599H). |
| 561CH-561DH, 5628H 3 bytes | Track operands The pairs of each sector and the cylinder of the IDs (5617H, 5601H). |
| 5680H-5688H 9 bytes | Kept DCT The target's DCT+0BH-13H (5307H). |
| 5744H 1 byte | Directory cylinder Of the target (52EFH). |
| 5745H 1 byte | Density mark FFH for a double density cylinder 0 (52D5H). |
| 5746H 1 byte | Target drive (5287H). |
| 5747H-5748H 2 bytes | Extent Of the file being copied (547EH). |
| 5749H-574AH 2 bytes | End page After the file read (54E8H). |
| 574BH-5754H 10 bytes | Buffers The five buffer pages (5219H). |
| 5755H-5775H 33 bytes | Source block The drive; from 5756H the reader's file control block (54A6H). |
| 5776H-5796H 33 bytes | Destination block From 5777H the bootstrap file, then the writer (5296H, 54B4H). |
Outside Routines
| Address | Contents |
|---|---|
| 4467H | SYS0/SYS: DSPLY@ (5204H). |
| 4479H | SYS0/SYS: EVAL@ (5248H). |
| 44A3H | SYS0/SYS: LOCDCT% (528BH). |
| 4424H | SYS0/SYS: OPEN@ (529CH). |
| 4488H | SYS0/SYS: DISKIO% (52A4H, 5665H). |
| 4436H | SYS0/SYS: READ@ (534DH, 54DAH). |
| 4439H | SYS0/SYS: WRITE@ (54F4H). |
| 4451H | SYS0/SYS: DIVD@ (5537H). |
| 4FC1H | SYS2/SYS: routine 6, fill a file control block from an entry (55F8H). |
| 4409H | SYS0/SYS: ERROR@ (5530H). |
| 4030H | SYS0/SYS: ABORT@ (552AH). |
| 402DH | SYS0/SYS: EXIT@ (5521H). |
| 0033H | ROM: display a character (5257H). |
| 0040H | ROM: line input (525FH). |
Disassembly
5200H - SYSGEN
SYSGEN/CMD's transfer address, entered from the DOS command level with Register Pair HL at the command line after the word SYSGEN: SYSGEN :dr [filespec] (XFER=value). SYSGEN makes a formatted diskette (or rigid drive) on which no file has been made into a system disk: it writes the boot sectors (from drive 0, or from a bootstrap file), the configuration sector 2 of BOOT/SYS, and a copy of every system file of drive 0 (the directory entries of logical file numbers 02H-14H) into granules from two cylinders below the directory up, then the GAT and the HIT. The heading gives the version 3.52. First five buffer pages are placed above 5800H or above LOW$, with room for the largest system file below HMEM$.
5244H - The Command Line and the Target Drive
EVAL@ with the block 56BAH; nothing given is an asterisk and a new command line (BREAK the error 30H). The first field must be a drive (no field 2FH, not a drive 2BH) other than drive 0 (28H, Protected system device). A bootstrap file (the second field) is opened. DCHECK must find the drive (08H) and it must not be write protected (0FH). The target's cylinder 0 sector 2 is verified in single density, then in double density (5745H := FFH); the diskette is set to be logged and its GAT, HIT and directory sector 2 are read into the first three buffers.
52F2H - A Clean Diskette, and an 8 Inch Cylinder 0
Every byte of the target's HIT from 02H on must be 00H: only BOOT/SYS and DIR/SYS may be on it, else Disk contains illegal files. DCT+0BH-13H are kept at 5680H. An 8 inch floppy whose cylinder 0 is double density gets the single density values of 5673H and cylinder 0 is formatted again in single density (55FBH), its granules marked in use in the GAT.
5344H - The Boot Sectors
From a bootstrap file: its first sector, with byte 2 set to the target's directory cylinder, goes to sectors 0 and 1 of cylinder 0, and the rest of the file to sectors 3 on. Without one: drive 0's cylinder 0 sectors 0 and 1, sector 0 with the directory cylinder of the target, are written to the target.
53D1H - The Configuration Sector
Sector 2 of cylinder 0, the page of BOOT/SYS that SYS0/SYS reads at boot: DCT and the nine kept bytes DCT+0BH-13H, then fixed values: 10H the boot flags 0EH (time and date prompts, logo; bit 0 with XFER), 11H-12H XFER's address, 13H 00H, 14H 5FH (the cursor character), 15H 00H, 16H 03H (the step rate), the rest 00H. The target's DCT+0BH-13H are put back from 5680H.
5428H - The System Files
For each logical file number from 02H to 14H (directory sectors 4 on, entry 0, moved on for a short directory by 55E1H), drive 0's entry is read; an active system file (bits 6 and 4) is copied: its entry goes into the target's directory with one new extent of granules found free in the GAT (5533H), from two cylinders below the target's directory cylinder up; the hash code of its name goes into the target's HIT; the file is read whole into the pages from the fourth buffer by READ@ and written by WRITE@ through a second file control block that points to the new extent.
550BH - The End
The GAT and the HIT of the target are written (SWRITE of sectors 0 and 1); SYSGEN ends by EXIT@ without a message. 5524H is Disk contains illegal files and ABORT@; 552DH posts the error code in Register B, 552EH the one in Register A, with bit 6 set (no frame), so ERROR@ ends through ABORT@.
5533H - Granules for a File
Register Pair HL = the sectors of the file, Register Pair DE = a cylinder and a granule: finds the first run of free granules (DCT+0FH sectors each, the count rounded up) from there on in the GAT, crossing to the next cylinder after DCT+10H granules, and sets them in use. Returns Register Pair HL = the extent (Register L the cylinder, Register H the starting granule in bits 7-5 and the granules less 1 in bits 4-0) and Register Pair DE = the granule after the run.
5580H - Set or Test a Granule's Bit
5580H sets bit Register E (0-7) of Register A by a SET n,A whose second byte is made at 558EH; 5590H tests it by a BIT n,A made at 559EH (the Z FLAG when the granule is free).
55A0H - The Hash Code of a Name
The 11 characters at Register Pair HL, each XORed in and the result rotated left; 00H becomes 01H, as the DOS's hash codes are never 00H.
55B0H - A Directory Sector by Logical File Number
55B0H reads (error 11H) and 55C4H writes (error 12H) the directory sector of logical file number Register B on drive Register C through the page at Register Pair HL, whose Register L becomes the entry's offset (55D8H: bits 7-5 the entry, bits 4-0 the sector less 2). 55E1H fits a logical file number of the first directory sectors to a short directory: when its sector is past DCT+0EH it moves to the next entry of an earlier sector (bit 5), or the one after (bit 6).
55FBH - Format a Single Density Cylinder
Builds the track image for cylinder Register D in the fourth buffer from the count and byte pairs at 568AH (the gap and index mark, then for each of DCT+0DH sectors the ID with the sector number from the table at 56AAH and a data field of 256 bytes 6CH, then the end), and writes it by DFORMT.
5673H - The Data
The values DCT+0BH-13H of a single density 8 inch cylinder, DCT and the kept bytes (5680H-5688H, not loaded), the count and byte pairs of a single density track, a table of 10 sector numbers no instruction uses, the table of 16 sector numbers, the evaluation block with XFER (type 40H, a number), the heading (version 3.52) and the message. 5744H on is not loaded.