Percom DoubleDOS 4.24 for the Model I - The Boot Sector Disassembled
Page Customization
Page Index
Boot Sector
Other Navigation
Introduction/Summary
Percom DoubleDOS 4.24 Boot Sector Disassembly (Model I)
DoubleDOS (DBLDOS in Percom's manual) is the double density disk operating system Percom Data Company supplied with the Percom Doubler, the adapter that lets the Model I Expansion Interface read and write double density diskettes. Its files carry the text MODIFIED FOR DOUBLE DENSITY OPERATION BY JAMES W STUTSMAN - COPYRIGHT (c) 1980. The boot sector is cylinder 0, sector 0 of a DoubleDOS system diskette: 256 bytes, the only sector of the single density cylinder 0 that holds data (sectors 1-9 hold E5H). The directory has no BOOT/SYS entry; DIR/SYS is its first file.
When the computer is reset with a diskette in drive 0, the ROM reads this sector into 4200H-42FFH and jumps to 4200H. The boot sector switches the Doubler to double density with the command code FFH, seeks and reads the sectors of SYS0/SYS from cylinder 1, sector 0 on into the buffer 4D00H-4DFFH, and loads the records of SYS0/SYS as it goes: load blocks to their addresses, every other record passed over, until the transfer address record sends it to 4E00H. It does not read the directory: SYS0/SYS is always the first file of the diskette's first block of ten sectors (the directory's entry for SYS0/SYS, extent 00H 02H, says the same).
The boot sector is the same, byte for byte, on the DoubleDOS 4.20, 4.23 and 4.24 system diskettes.
How the Boot Sector Reads a Sector
| Step | What the code does |
|---|---|
| 1 | Drive 0 is selected (01H to 37E1H, 4250H) before each read. |
| 2 | The sector goes into the sector register and the cylinder into the data register in one store of Register Pair DE at 37EEH (4279H), then Seek 13H (stepping rate 3, no verify) runs to the end. |
| 3 | Read Sector 88H is issued and every byte is taken by polling DATA REQUEST in the status register (4293H-42AAH), with three tests of the bit for each test of BUSY so that the loop keeps up with double density. |
| 4 | The final status is masked with 9CH (not ready, record not found, CRC error, lost data); a failed read is tried once more (4275H), and a second failure shows DISK ERROR and stops (4265H). |
Notes
Variables
Memory and Hardware Outside the Boot Sector
| Address Size | Contents |
|---|---|
| 37E1H 1 byte | Drive Select Latch 01H, drive 0, stored before each read (4252H). |
| 37ECH 1 byte | Controller Command (write) and Status (read) FFH: the Doubler's switch to double density (4200H); D0H: Force Interrupt (4202H, 42ADH); 13H: Seek (4280H); 88H: Read Sector (428AH). The status is polled for BUSY and DATA REQUEST and masked with 9CH at the end. |
| 37EDH 1 byte | Track Register Set to 00H (420BH). |
| 37EEH 1 byte | Sector Register The sector to read (Register E, 4279H). |
| 37EFH 1 byte | Data Register The cylinder for the Seek (Register D, 4279H), then each byte read (4299H). |
| 41F4H-41FBH 8 bytes | Stack The Stack Pointer is set to 41FCH (4204H); the deepest use is the loader's call, the call of 4275H, the call of 4279H and its two pushes. |
| 4D00H-4DFFH 256 bytes | Sector Buffer Each sector of SYS0/SYS in turn (Register Pair BC of the alternate set, 4211H). |
Registers Kept Across the Byte Fetch
| Register Size | Contents |
|---|---|
| BC' 2 bytes | Buffer Pointer 4DFFH at the start; Register C wraps to 00H when a new sector is needed (424DH). |
| DE' 2 bytes | Disk Address Register D the cylinder, Register E the next sector; 0100H at the start (420EH). |
Outside Routines
| Address | Use |
|---|---|
| 01C9H | ROM: Clear the Screen 4207H. |
| 0033H | ROM: Display a Character Register A at the cursor (4269H). |
| 0040H | ROM: Line Input Waits for ENTER after DISK ERROR (4271H). |
| 4E00H | SYS0/SYS Transfer Address Reached by JP (HL) at 424BH. |
Disassembly
4200H - Switch the Doubler to Double Density and Set Up
The ROM's power up routine reads cylinder 0, sector 0 of drive 0 into 4200H-42FFH in single density and jumps to 4200H (06C9H). It leaves Register Pair HL pointing at the controller's command and status register 37ECH, Register Pair DE at the data register 37EFH and Register Pair BC at 4200H, with the interrupts off and the head on cylinder 0.
4215H - Load SYS0/SYS Record by Record
SYS0/SYS is a load module: a record type byte, a length byte, then the record. Type 01H is a load block (two address bytes and length minus 2 data bytes), type 02H the transfer address, and every other type (05H the name, 1FH the copyright text) is passed over by its length.
4240H - Jump to the Transfer Address of SYS0/SYS
The transfer address record is 02H, a length byte (02H) and the address, 4E00H in SYS0/SYS.
424CH - Fetch the Next Byte of SYS0/SYS
Returns the next byte of SYS0/SYS in Register A. The buffer is 4D00H-4DFFH; when it is used up, the next sector is read into it. Register Pair BC of the alternate set is the buffer pointer, Register Pair DE of the alternate set the cylinder and sector of the next sector.
4265H - Display DISK ERROR and Stop
Reached from 4258H when a sector of SYS0/SYS cannot be read in two tries.
4275H - Read a Sector, Two Tries
Reads cylinder Register D, sector Register E into the buffer at Register Pair BC. Returns the Z FLAG set when the read succeeded.
4279H - Seek and Read One Sector
Seeks to cylinder Register D and reads sector Register E into the buffer at Register Pair BC, polling the controller's status register for each byte. Returns Register A the error bits of the status and the Z FLAG set when there are none.
42B4H - The DISK ERROR Message and the Copyright Text
The rest of the sector is data.