Building the PiDP-8/I was a lot of fun and very rewarding. But using it is the nerdy gift that keeps on giving. I was shocked at how well documented the PDP-8 is after fifty years. There is also a ton of original software still available and as far as I can tell, DEC provides individuals with an implicit hobbiest license, so you are in the clear to continue using the software into its next half-century of history.

FORTRAN 4 code running under OS/8 never looked so beautiful as when displayed by Cool Retrto Term on my old iMac

Naturally Oscar from Obsolescence Guaranteed has a great summary of some first steps in using your PDP-8.

I need not rehash everything he has already done such a great job of documenting, but I have summarized what I found to be some of the most important points here and tried to clarify a few steps I found unclear at first.

Getting Started

The PDP-8 simulation starts automatically and loads OS/8 connected to a 10MB disk pack by default whenever the Pi boots (the OS/8 operating system is discussed later). Otherwise you can start and stop the simulation manually from the shell.

pidp8i start
pidp8i stop

The simulation uses screen for its output. To connect to the running screen session just enter

pidp8i

To force control to the running screen session (for example you need to log in from another machine and screen is already attached to another terminal).

screen -r -d pidp8i

Once in the screen session, you are fully within the simulator. To exit back to the shell type:

Ctrl+A and then D

To detach from the screen session.

Simple Sample Programs

I/O was not a standardized affair during the early stages of computing. Computer operators manipulated the individual bits of a computer’s memory, interacting at the machine code level by setting switches and reading indicator lamps. You would have to load a program by entering the machine code via switches, just to get the machine to understand how to use the paper tape reader to load in another program. You literally had to program the machine with how to use the paper tape to then load the actual program you wanted to run from the tape. We were a ways out from plug-and-play back then.

Have a look at the VFC’s video of David Gesswein using an original PDP-8 and teletype to edit, assemble, and run a program for an idea how things were. David Gesswein is also the operator of the previously mentioned pdp8online.com site.

By the time the PDP-8/I hit the market, it came with a rudimentary (but for its time advanced) operating system called OS/8 which allowed interacting via the teletype or terminal in order to edit files and load programs more easily. The PiDP-8/I starts by default at the OS/8 terminal running on a 10MB disk pack.

However if you really want to understand how a minicomputer works, it is worth the time to play around with entering some programs the hard/fun way. The following are adapted from a great YouTube introduction from Christopher Masto.

Console Orientation

First you should know what the important switches do and what the most important lights represent.

The PiDP-8/I front panel

Hmm, taking a squared, head-on photo of my PiDP-8/I, I realize that the straight line I thought I had on the switches wasn’t that straight.

The PDP-8 is a 12-bit machine, which sounds odd to those born in the PC era. As was common in the 60s and 70s, memory was referenced in octal notation. Octal is a base eight counting system which uses only the numbers 0-7 as contrasted with the common decimal system which is base ten using numbers 0-9. If you are not familiar with non-decimal systems, do a quick search.

Using octal naturally divided bits into groups of three (where three bits can represent 8 different values). That’s why the PDP-8 has alternating groups of three brown and three white toggle switches. So instead of telling you to enter the bit pattern 111100000010, in binary, you would be told to enter 7402 in octal. Note that the white bars on the console also group the indicator lights and switches by three to facilitate this.

The Switch Register (SR), is the only built-in way to interact with the PDP-8  by setting individual bits of memory: toggled down is one and toggled up is a zero. The first three switches represent the Data Field (DF) and the next three represent the Instruction Field (IF). You should ignore these first six switches  as you get started. They are used for accessing a form of extended memory and are not needed for the simple programs below and complicate your basic understanding of the machine.

The next 12 switches represent the actual 12 bits of the system. If you enter a bit pattern here and press Load Add, you change the Program Counter (PC) to that address. The PC keeps track of the next instruction to execute. If you then press Exam you examine the contents of memory at the PC. This updates the location shown in the Memory Address (MA) with the address that is being examined and the actual contents of the core memory are shown in the Memory Buffer (MB). Pressing Exam also increments the PC by one so that it is ready to examine or execute the next instruction. In this way, you can keep pressing Exam to inspect sequential locations in memory by looking at the contents of the MB. Repeated toggles of Exam therefore result in MA being one bit behind the PC.

At any time you can toggle a bit pattern into the front switches. If you then press Dep, you deposit the value of the SR into the address shown in the MA and the contents will be reflected in the MB. Depositing also increments the PC so that you can enter the next value in the next memory address.

If you are familiar with the Altair 8800, this behavior is different and can be confusing. The PDP-8 maintains a separate PC and MA register. Whereas on the 8800 (or rather the Intel 8080 it is based on), setting the program counter is the same as setting the memory address. 

This means that if you enter a memory address on the SR and press Load Add and then press Exam to inspect the location, you cannot enter a new bit pattern on the SR to deposit at the same location. This is because the PC was automatically incremented by pressing Exam. You need to press Load Add again after Exam to set the PC back to the original address before depositing a new value in the same address.

Sound complicated? Not really. Just keep in mind:

  • The PC shows the location of the next instruction to execute, not the current.
  • The PC and MA are separate.
  • To set the PC, set the memory location in the SR and press Load Add.
  • To inspect the contents of the memory location in the PC, press Exam.
  • Exam updates the MA with the address that was in the PC, shows the content of the memory in the MB, and then increments the PC.
  • MB shows the content of the address at the location in the MA not the PC.
  • When you deposit to memory it is at the location indicated on the PC.
  • Both Dep and Exam automatically increment the PC for sequential input.

You will learn the other indicator lamps and switches as you move forward. For now, you have enough knowledge to key in some simple programs.

Simple Halt Program

The simplest program is to tell the computer to stop (halt). The program doesn’t do anything, but you can exercise your knowledge of the most important switches and lights on your PiDP-8/I. Remember that we are ignoring the first six bits of the SR for our examples and that all numbers are octal.

  1. Press Stop to stop the machine.
  2. Toggle 0010 on the SR and press Load Add. This sets the PC to 0010. This is where our program will start.
  3. Toggle 7402 on the SR and press Dep. This writes 7402 (the octal representation of the HALT command) into memory location 0010, the current location of the PC. You know this has occurred because the MA is updated with the location you set in the PC and the MB shows your deposited command. This also advances the PC by one to ready it for the next command.
  4. Toggle 0010 and press Load Add to return to the start address of our program.
  5. Press Start

Pressing Start, executes the program starting at address 0010. In this case 0010 has the HALT instruction, which stops the computer, so you see the PC increment to the next instruction (0011) and the computer stops.

If you want to run the program again, you have to re-load the PC with 0010 and press Start again.

This is because Start will start executing at the location currently in the PC and your program already incremented the PC to 0011. If you just press Start, the computer will continue execution with the instruction at address 0011, which is undefined at this point and you may see pretty blinkenlights as the computer processes whatever happens to be in memory.

Increment Accumulator Five Times

Most computers of the 50s and 60s had an accumulator-based architecture. The accumulator (AC) is the main register where operations happen. These are usually mathematical operations (e.g. the accumulation of a result), but can be other operations. This was before the advent of multiple general purpose registers that we know today. This program simply increments the AC five times and stops.

  1. Press Stop to stop the machine.
  2. Toggle 0010 on the SR and press Load Add. This sets the PC to 0010.
  3. Toggle 7001 on the SR press Dep. This writes 7001 (the octal representation of the increment AC command) into memory location 0010. The MA is updated with 0010 and 7001 is shown in the MB.
  4. Leaving the SR toggled to 7001, press Dep four more times to deposit the same value on the SR into the subsequent memory locations. Notice that each time Dep is pressed that the PC and the MA both are incremented with the PC always one step ahead. You will stop with the MA on 0014 (the last memory location you wrote) and the PC on 0015 (the next instruction to write).
  5. Toggle 7402 on the SR and press Dep. This writes 7402 (the octal representation of the HLT command) to memory location 0015 and increments the PC to 0016.
  6. Toggle 0010 (the start of the program) and press Load Add. At this point you can verify your program by pressing Exam. You should see the following, using repeated presses of Exam to increment through your program:
    • 0010 : 7001
    • 0011 : 7001
    • 0012 : 7001
    • 0013 : 7001
    • 0014 : 7001
    • 0015 : 7402
  7. If anything is wrong, correct the program by setting the PC to the location you memory location you need to update and using Dep to update the location.
  8. When all is correct, return to memory location 0100 and press Start.

What should you see? Since you incremented the AC five times, you should see a five in the AC. The PC should stop at 0016: one position beyond your last command: the HTL entered at address 0015.

The PDP-8 might be old, but it is still fast enough so that you couldn’t actually seen any of the steps executed. What if you wanted to inspect every step? Let’s run it again with a small change.

  1. Press Stop to stop the machine.
  2. Toggle 0010 on the SR and press Load Add. This sets the PC to 0010.
  3. Toggle Sing Inst. Now when you start it, only one instruction at a time is executed.
  4. Press Start. The first instruction is executed. MA is at 0010, the beginning of our program and the PC is at 0011, the next instruction. Note that the AC shows 0001.
  5. Press Cont to resume the next instruction. The second instruction is executed. MA is at 0011, the second instruction of our program and the PC is at 0012, the next instruction. Note that the AC shows 0002.
  6. Continue pressing Cont to go through your whole program.

Note that if you press Cont after reaching the end of your program (i.e. when the PC shows 0016) you are then entering into undefined memory and execution will be unpredictable. This is why we halted our program with HTL when we reached the end. 

Remember to toggle back the Sing Inst switch before moving on to another program.

Increment Accumulator and Loop to Beginning

That was so much fun, we’re going to do it again! And again, and again.

  1. Press Stop to stop the machine.
  2. Toggle 0010 on the SR and press Load Add. This sets the PC to 0010.
  3. Toggle 7001 on the SR and press Dep to increment the AC.
  4. Toggle 5010 on the SR and press Dep. This is a jump (JMP) instruction. All JMP instructions start with five and are followed by the address to jump to (010).
  5. Toggle 0010 (the start of the program) on the SR and press Load Add.
  6. Press Start.

You should see the AC completely lit up. The PDP-8 is fast enough to fill the accumulator quicker than the eye can see. When it maxes out the AC, it overflows. The is what the Link bit indicates.

You will also note that the Jmp and Opr lamps are on. These are the two types of instructions that the computer is currently running (increment AC is an operate type instruction). You will also see that the Fetch and Execute lamps are on. This is because the computer is in an endless state of fetching instructions (increment AC and JMP) and executing them. Finally the Run lamp is on because, well, the program is running.

Press Stop and the program stops at some point with a random value in the AC. Press Cont to continue the execution.

Feel free to toggle Sing Inst to step your way through incrementing the AC.

Increment Accumulator and Loop with Delay

Let’s make some real blinkenlights that you can appreciate. By adding a delay to our loop to increment the AC, we should be able to see the bits fill up.

To do this we will use the increment and skip if zero. This instruction is provided with a memory location. It then increments this memory location and if that memory location is not zero it executes the next instruction. If it is zero, it skips the next instruction. In this way, we can build a delay into our simple loop by incrementing a random memory location until it overflows to zero.

  1. Press Stop to stop the machine.
  2. Toggle 0010 on the SR and press Load Add. This sets the PC to 0010.
  3. Toggle 7001 on the SR to increment the accumulator and press Dep.
  4. Toggle 2034 on the SR to enter the ISZ instruction and  press Dep. This actually tells the computer to execute an ISZ (2xxx) on a specific memory location (0034). This location will be incremented and if not zero, will go on to the next instruction.
  5. Toggle 5011 on the SR to jump back to the ISZ instruction and press Dep. This tells the computer to execute a JMP (5xxx) to a specific memory location (0011). This means that after incrementing in the previous instruction via ISZ, we will do it again. By creating this loop, we build a delay until the memory location overflows to zero. In this case, it skips the jump back and moves on to the next instruction.
  6. Toggle 5010 on the SR to jump back to beginning of program and press Dep. This actually tells the computer to execute a JMP (5xxx) to a specific memory location (0010). We want to start over again and increment the AC again.
  7. Toggle 0010 on the SR and press Load Add to reset the PC to the beginning of the program.
  8. Press Start.

Blinkenlights!

You should see the AC slowly fill up and overflow into the Link bit. The PDP-8 is still so fast that the first five bits of the AC look like they are always on, but the upper seven are visibly incremented.

Hit Stop and use the Sing Inst toggle along with Cont to step through the program. You can see address 0034 get filled up by watching the MB as you step through.

At full speed, this endless loop produces a decent light pattern on the console, but if you really want a nice looking one, start up Spacewar!

SimH Tips

The SimH simulator at the heart of this recreation is well-documented. Both in general and specifically for running a PDP-8 simulation. Have a look at that documentation to find out what all is possible.

SimH has its own interface. To exit from the PiDP-8/I simulation into SimH type

Ctrl+E 

Return to the simulation by typing 

CONT

In the SimH interface you can control the simulation environment such as connecting virtual peripherals like to load a paper tape. Here are some vital commands.

attach connect a virtual device provided a path to the device file.

attach ptr /opt/pidp8i/share/media/pt/binloader.pt to attach the bin loader tape at the provided path to the paper tape reader.

RUN resets all devices, deposits the argument (if given) as an address into the PC and starts execution. If no argument, it starts execution at the current PC.

GO  does not reset devices, deposits the argument (if given) as an address into the PC and starts execution. If no argument, it starts execution at the current PC.

CONT does not reset devices and resumes execution at the current PC.

STEP resumes execution at the current PC for the number of instructions given as an argument.

BOOT resets all devices and bootstraps the device and unit given by its argument. If no unit is supplied, unit 0 is bootstrapped.

Load FOCAL the Really Hard Way

FOCAL is the revolutionary programming paradigm that hardly anyone today has heard of. Like BASIC, it was interactive, meaning that you wrote, ran, and edited programs interactively all in one environment. This was a major shift since programming before was usually done by punching code into cards or tape, compiling, assembling, and then ultimately running and at any time get errors that required you to start over, often having to repunch everything. With FOCAL (and BASIC), you programmed directly on the terminal, executed directly, and got immediate results. Today we remember BASIC since it was ported to all kinds of minicomputer systems, while FOCAL was DEC-only.

Oscar has a great tutorial on how to get up-and-running with FOCAL69, but it relies on using USB thumb drives to replace paper tape. With a small modification to his procedure, you can mount the paper tape just using commands to SimH to attach the files from your local filesystem, saving you the trouble of connecting the Pi to a USB hub. Download the necessary tape images from here.

PiDP-8/I Software: Files in media/copytoUSBsticks/ of tip

  1. Boot the PiDP-8/I and load RIM loader by setting IF to 001 and toggling Sing Step. Toggling Sing Step is a shortcut Oscar built into the PiDP-8/I to allow quick execution of pre-loaded scripts. In this case script 001.
  2. Press the Stop switch to halt the computer,
  3. Set the SR switches to 7756, the address in memory where the RIM Loader starts
  4. Press the Load Add switch to toggle the switch values into the PC. Check that the PC register shows 7756
  5. Press the Exam switch to retrieve the contents of the address shown in the MB. It should be 6014, because script 001 loads the high-speed RIM Loader. Note that the PC register has already increased to show the next address, 7757. 
  6. Press Exam to read the value stored in that address, it should be 6011.
  7. Continue all the way to 7775 if you want to check the integrity of the RIM loader. At any point skip to next step.
  8. Put the BIN Loader paper tape into the reader by escaping to simH command Ctrl-E and running attach command attach ptr /opt/pidp8i/share/media/pt/binloader.pt pointing to wherever you saved the paper tape image.
  9. Make sure PC is still at 7756 and type cont in simH. The front panel will come to life and after a few seconds, the tape will be loaded into memory. Because the RIM loader needs to be as short as possible, it does not exit gracefully.
  10. Press Stop to stop tape read. With a real PDP, you’d do that when you see that the tape is through.
  11. The BIN Loader is now loaded into core memory. It occupies addresses 7625-7752 and address 7777. To check it has indeed loaded:
  12. Set the SR switches to 7777 and press Load Add then Exam. The MB line should show the value 5301.
  13. Press Load Add. Address 7777 is also where the BIN loader needs to start executing.
  14. Put the FOCAL69 paper tape into the reader by escaping to simH command (Ctrl-E) and running attach command attach ptr /opt/pidp8i/share/media/pt/focal69.pt
  15. Set the SR switches to 3777. The BIN Loader will read the SR switch settings and take this as your signal that the High Speed Reader should be used – not a slow Teletype paper tape reader.
  16. Make sure the PC still contains 7777, that’s where execution starts, and type cont at the simH prompt. After a few seconds, the BIN Loader tape has been read in and the PDP-8 stops executing. As opposed to the RIM Loader, the BIN Loader does end elegantly once it has done its job.
  17. Focal has now been read into memory. Normally, RIM and BIN loader will both remain in the upper page of core memory, ready for a next program load after you are done with the current program (in this case, Focal). Now run Focal.
  18. Run Focal by setting the SR switches to 0200, the start address of Focal, then press Load Add and then Start
  19. The Focal prompt will appear as a single asterisk. Type _TYPE “HELLO, WORLD”  and imagine how this was a revolution to those sat behind a teletype terminal fifty years ago.

Play Spacewar!

Spacewar! is regarded as the first video game and is still fun to play. Originally designed in 1962 for the PDP-1, it features a dogfight between two spaceships around the gravity well of a star with realistic physics that are still impressive today.

You can visit the Computer History Museum in Mountain View, California to play it on an actual PDP-1, or you can load up a native port on your PiDP-8/I. The trouble here is that Spacewar! was designed to output to a vector-based display like an oscilloscope and not a raster-based display that we are accustomed to with LCD panels or even VGA tubes. Fortunately there is a workaround for that because the modern graphics design language Processing can handle the stream of vector input that Spacewar! generates. 

  1. Install Processing (processing.org
  2. Load Kyle Owen’s  vc8e.pde script https://groups.google.com/g/pidp-8/c/1UBD1RbawJk/m/KHK0OKN1AgAJ 
  3. Modify the script to point to the IP address of your PiDP-8/I
  4. Set IF to 4 and power up your PiDP-8/I.
  5. Run the vc8e.pde script in processing and geek out!