PDP-8 SimulatorWard CunninghamCunningham & Cunningham, Inc. The Digital Equipment Corporation's PDP-8 minicomputer offered tabletop computing at a time when human hands still wove cores. By 1975 retired instances of DEC's most popular eight, the PDP-8e, were showing up on the surplus market. My friend Jim Wilson had one for which I wrote amateur radio software. I wrote this PDP-8 simulator at the same time. One could assemble a program with no more than a basic 8 and a teletype. But the arduous process involving feeding multiple paper tapes multiple times through the teletype's ten character per second reader. I opted for the remote batch environment offered by the university's CDC-6000 series mainframe. I used this simulator to run the stock PAL-8 assembler from a timesharing terminal. I was concerned with execution speed since I expected to run assemblies
often and would be waiting for them to finish. But I was even more concerned
with development speed. Time spent on the simulator wasn't going into my
radio programs. I implemented only those features used by PAL-8. I wrote
in a mixture of FORTRAN and 6000 assembler using a conservative style.
I had only one error. I had the sense of test wrong for the SZA instruction.
I tracked it down by running DEC's hardware diagnostics. (See note below.)
Instructions |
|||
while run
ir = mem[pc] pc = pc+1 case ir ... |
The simulator fetches instructions and then executes them.
All PDP-8 instructions occupy a single twelve-bit word. The first three bits
of an instruction identify one of eight instructions. Six of the instructions operate
on memory locations addressed by the remainder of the instruction word
in a standard way.
OPERATION MEMORY _CODES 0-5_ PAGE /___ ___ ___\___/___\___ ___ ___ ___ ___ ___ ___ | | | | | | | | | | | | | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| |___|___|___|___|___|___|___|___|___|___|___|___| \ / \_________ _________/ INDIRECT ADDRESS ADDRESSING Memory Reference Instruction Bit Assignments Address decoding begins with the lower seven instruction bits forming an offset within a memory page. These are either merged with bits from the program counter or zeros to address a word in the current page or first page respectively. This addressed word is then used directly as the operand or indirectly as the address of the operand. As a final twist, a few words of every page will automatically increment with each indirect reference through them. Note: Ben Fairbank (personal correspondence, 2001) has pointed
out that autoindexing only worked
on page zero. Here is the description from
Introduction to Programming, Digital Equipment Corporation, 1973.
Apparently neither the machine diagnostics or the PAL assembler depended
on this distinction.
|
||
|
|
||
Instruction dispatching takes us to one of eight handlers, seven here and one more in the next section. The six memory referencing instructions are handled in place. The IOT handler calls a FORTRAN subroutine that appears later. | |||
|
|
||
The OPR instruction encodes a variety of register operations into the
remaining bits of the instruction word. Multiple operations can be microcoded
into a single instruction by setting multiple of these bits. The bits
are assigned meaning in groups. We begin with group one.
ROTATE 1
Group 1 Operate Instruction
Bit Assignments
|
|||
|
|
||
The last few bits of OPR's group one encoding are most easily decoded with another dispatch. | |||
|
|
||
Group two OPR encoding assigns mostly different meanings to the remaining
instruction bits.
REVERSE
Group 2 Operate Instruction
Bit Assignments
|
|||
|
|
||
GENERATES GENERATES
AN IOP 4 AN IOP 1 PULSE AT PULSE AT OPERATION TIME 3 TIME 1 IF A 1 IF A 1 _ CODE 6 _ /___ ___ ___\___ ___ ___ ___ ___ ___/___\___/___\ | | | | | | | | | | | | | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| |___|___|___|___|___|___|___|___|___|___|___|___| \________ _______/ \ / DEVICE GENERATES SELECTION AN IOP 2 PULSE AT EVENT TIME 2 IF A 1
IOT Instruction Bit Assignments
|
|||
Compound Dispatch Block Buffering |
|
||
OperationsThe simulator reads commands from a file. Most commands correspond to front-panel switches or buttons. A few more control the loading or punching of tape at the teletype. The remainder measure and report progress within the simulation job. |
|||
ASR-33 Teletype |
|
||
PerspectiveThis program has been formatted to be read by a wider audience than originally intended. The original source was organized as a single file containing both FORTRAN and 6000 assembler. It contained SPACE and EJECT directives that exerted some control over the listing. The assembler listing would show how well the 15- to 30-bit instructions fit into the available 60-bits of each CDC word. A careful programmer also watches for functional unit conflicts and in-stack loops.The coding conventions were adapted from Greg Mansfield, author of the MACE operating system and many of the tools and utilities that ran on it. Some related files have been lost, notably the PAL-8 assembler binary
and the hardware diagnostics tape. I wrote one command script with six
or eight cards and never wrote another. This is missing too.
BibliographyPreserving Computing’s Past: Restoration and Simulation,Maxwell M. Burnet and Robert M. Supnik, 1996 http://www.digital.com/DTJN02/DTJN02HM.HTM A PDP-8/E Simulator for the Apple Macintosh,
Project: PDP-8 Computer,
JavaScript PDP-8 Simulator,
JavaScript PDP-8 Assembler,
DEC's 1967 PDP-8 Pocket Reference Card,
A Seymour Cray Perspective
Image Index
Morse Code Receiver/Transmitter
An Experiment in the Restoration and Preservation of Programs
|