# IOTs for the RK8-E Disk Cartridge System

Mnemonic Symbol | Octal Code | Description
--- | --- | ---
DSKP | 6741 | Disk Skip on Flag. If the RK8-E I/O flag is set, the next instruction is skipped. The flag is raised when an I/O operation is completed or an I/O error occured.

DCLR

6742

Disk Clear. The function is regulated by AC(10–11):
AC(10–11) = 00 (DCLS): Clear AC and the status register.
AC(10–11) = 01 (DCLC): Clear AC and all RK8-E registers. This instruction aborts any disk command in progress and resets the maintenance mode.
AC(10–11) = 10 (DCLD): Clear AC and the status register and recalibrate the selected drive to cylinder 0.
AC(10–11) = 11: Undefined. Performs the same function as with AC(10–11) = 00.

DLAG | 6743 | Load Address and Go. The disk cylinder, surface and sector bits (12 least significant bits of the block number) are loaded from AC(0–6), AC(7) and AC(8–11) respectively, and the function indicated by the current content of the command register is executed.
DLCA | 6744 | Load Current Address. The content of AC is loaded into the disk current address register (12 least significant bits of the memory address). The next data transfer between memory and the disk will use this memory start address. After the transfer is completed, the content of the current address register is incremented by the size of the transferred data block.
DRST | 6745 | Read Status. The content of the disk status register is transferred into AC.
DLDC | 6746 | Load Command. The content of AC is loaded into the disk command register. Then AC and the disk status register are both cleared.

DMAN

6747

Maintenance instruction. This instruction is only used by hardware diagnostic software. The function is regulated by bits in the AC which cannot be microprogrammed:
AC(0) = 1: Enter maintenance mode and disable the DLAG IOT.
AC(1) = 1: Enable a shift to the lower data buffer DB4.
AC(2) = 1: Check CRC register. AC(10), the CRC register and the lower data buffer are connected as a shift register, and AC(10) shifts to the CRC, CRC shifts to lower data buffer.
AC(3) = 1: Check command register. The command register is shifted by one bit to the lower data buffer.
AC(4) = 1: Check surface and sector register. The surface and sector register (12 LSBs of the current block number) is shifted by one bit to the lower data buffer.
AC(5) = 1: Check data buffer. AC(10) is shifted to the upper data buffer, the upper data buffer sinks to the lower data buffers when it is full (after 12 shifts).
AC(6) = 1: Check data break request. A single cycle data break request is performed. The direction of data transfer is regulated by the function in the command register.
AC(7) = 1: Transfer the content of the lower data buffer DB4 to the AC.
AC(8): Not used.
AC(9): Not used.
AC(10): Used as data for some maintenance functions.
AC(11): Not used.

## Formatting a DECpack Disk Cartridge

With the PDP-8/E Simulator, formatting a new DECpack disk cartridge is not necessary and would increase the size of the DECpack disk file to its maximum amount (see Technical Notes, below). With the simulator, the Read and Read All resp. the Write and Write All commands are identical. With a hardware RK8-E, to format a new disk, a program has to address every sector and write test patterns (containing the sector number) with the Write All command, which writes the data and the sector header word. The sector header word is used internally by the disk control and cannot be accessed by PDP-8 software. The Read All command then can be used to verify the data written to the initialized sectors. The Read All command prevents the RK8-E from reading sector header words and report header errors that will certainly exist on an unformatted disk.

## Normal Read and Write Operations

For a normal disk read or write, a program has to perform the following steps:

- Set up the memory transfer address using DLCA.
- Set up the command register with 00xy for read and 10xy for write using DLDC (xy is determined by the memory field for the data transfer, the selected disk drive and the disk block number; see the RK8-E window for the exact bit assignment.)
- Set up the required disk address (block number) and start the I/O operation using DLAG.
- Wait until the data is transferred by “Data Break” (Direct Memory Access, DMA) and the RK8-E I/O flag is raised (using DSKP), then check for errors (using DRST to read the status register).

## Seek Only

The sequence for seek only (command register function bits equal three) is different from normal read or write operation. It is necessary to put two skip or interrupt sequences in the program:

- Set up the command register with 300x for seek only and the desired drive number.
- Load the disk address (block number) and go.
- Wait for the RK8-E I/O flag.
- Clear the RK8-E I/O flag. The drive has started to move the head to the desired track.
- If the RK8-E I/O flag is to be set when the seek is complete, bit 4 of the command register must be set to one. So issue a load command (DLDC) with the selected drive number in AC(10–11) and AC(4) = 1.
- Wait for the RK8-E I/O flag.

The alternative to the last two steps is to check the “Head in Motion” bit of the RK8-E status register (bit 1) which is zero when the seek is completed.

When seek operations are started for more than one RK05 drive simultaneously (overlapped seek), care has to be taken to determine which drive has completed its seek operation when the RK8-E I/O flag is raised or a disk interrupt occurs. There are two methods to do this:

- Before selecting a new drive to check its seek status, clear bit 4 of the command register without changing the old drive number. Then change the drive number with bit 4 of the command register equal to a one. When the new drive has completed the seek, there will be no confusion as to which drive set the RK8-E I/O flag.
- Leave bit 4 of the command register set and check bit 1 (“Head in Motion”) of the status register to determine if the now or previously selected drive set the RK8-E I/O flag.

## Capacity of a DECpack Disk Cartridge

A DECpack cartridge has two surfaces, each surface has 200 (+ 3 spare) cylinders, each cylinder has 16 sectors (blocks) with 256 12-bit words. So a disk has block numbers 0–6,495 and a capacity of 1,662,976 words (nearly 2.5 MB); a PDP-8 with four RK05 drives has online access to nearly 10 MB of mass storage.

## Technical Notes

- The PDP-8/E Simulator stores DECpack disk cartridges in files with the extension .rk05. (For compatibility reasons, files with the file type ‘RK8E’ and creator ‘RK8E’ used by the Classic PDP-8/E Simulator are still recognized.) The disk is stored as an unstructured sequence of DECpack disk blocks, each block with 256 12-bit words. Two consecutive 12-bit words aaaaaaaaAAAA BBBBbbbbbbbb are stored in three consecutive bytes aaaaaaaa AAAABBBB bbbbbbbb (MSB at the left in both cases).
- Cylinders of newly created DECpack disk files are not stored in the file until a block of the cylinder is read or written by the PDP-8. Reading never written data returns zeros. The simulator always buffers a complete DECpack disk cylinder in memory.
- The RK8-E uses threads for each RK05 drive, so the drives really work parallel to the simulated PDP-8.
- The header words of the sectors are not simulated explicitly. They are assumed to be always correct. It is impossible for PDP-8 software to access this word temporarily stored in the CRC register with the DMAN IOT.
- The block CRC words are not stored in the DECpack disk file because there is no danger of single bit errors with the simulated disks. The CRC is calculated when a block is read or written and is available for the PDP-8 via the DMAN IOT. However, the PDP-8 can write wrong CRCs to the disk by issuing DMAN instructions shifting the CRC register while an I/O operation is in progress. Then the PDP-8 can read the block back and check for CRC errors. For this purpose, the simulator holds a bit for every block indicating that the CRC of the block was willfully destroyed. This bit array is not stored with the disk image, so CRC errors disappear by unmounting and remounting a DECpack disk or by restarting the simulator.