Getting Started with Blinking Lights on Old Iron

If you ever go to a computer history museum, you’ll be struck by how bland most modern computers look. Prior to 1980 computers had lights and switches, and sometimes dials and meters. Some had switchboard-like wiring panels and some even had oscilloscope-like displays. There’s something about a machine with all those switches and lights and displays that gets your hacker juices flowing. Have you ever wanted to get started in retrocomputing? Is it difficult? Do you need a lot of money? That depends on what your goals are.

There are at least three ways you can go about participating in retrocomputing: You can pony up the money to buy actual antique computers, you can build or buy old computers recreated with anywhere from zero to one hundred percent of period-authentic components, or you can experiment with emulators that run on a modern computer. As a hybrid of the second and third option there are also emulations in FPGAs.

You can see that the first option can be very expensive and you will probably have to develop a lot of repair and restoration skills. Watching [Mattis Lind] twiddle the bits on an actual PDP-8 in the clip above is great, but you’ll need to work up to it. The two techniques which get you going without the original hardware don’t have to break the bank or even cost anything presuming you already have a PC.

Although some sneer at emulation, for some machines it is almost the only way to go. You couldn’t buy the original EDSAC, for example. It is also a good way to get started without a lot of expense or risk. But regardless of how you do it, there’s one thing in common: you have to know how to operate the thing.

Simh and BlinkenBone

One common way to emulate an old computer is to use the SimH suite. It has emulations for a large number of old computers. Normally, the emulation has a console and you appear to be entering data into some sort of terminal. Technically, that’s fine but it doesn’t give you that feel of handling the old hardware.

However, SimH does support an interface that can drive a real or simulated front panel for some machines. For example, earlier we covered the PiDP-8 kit, which uses SimH on a Raspberry Pi driving a fairly authentic-looking PDP-8 front panel. With BlinkenBone, though, you can run a Java front panel for many classic machines and thanks to SimH, they aren’t just mock ups. They work.

So let’s look at what it takes to operate a PDP-8 through the front panel. The PDP-8 — from DEC or Digital Equipment Corporation — started life in 1965. A base model cost about $18,500 — a whole lot of money in those days. The “straight 8” was full of discrete components and was the size of a refrigerator. We’ll look at a PDP-8/I, a machine made with ICs around 1968. While it was large by today’s standards, it wasn’t the size of a fridge.

Why the PDP-8? Well, there are several reasons. First, the PDP-8 is very simple, yet fairly representative of early computers. Second, thanks to BlinkenBone, you can play along with no hardware at all. If you have a PiDP-8, that will work too. If you are lucky enough to have access to a real working PDP-8, then you are all set.

If you don’t want to read the blow-by-blow, you might prefer watching the video, below.

A Tour of the PDP-8/I Front Panel

The PDP-8/I has 26 switches. There are also two obvious key switches: one for on/off, and another to lock the panel (both of these are missing on the PiDP-8). Starting at the left, you’ll see the following switches:

  • Data field (3) – Sets the data field (which has 4K page of memory used for data)
  • Instruction field (3) – Sets the instruction field
  • Address/Data switches (12) – Sets the 12-bit address or 12-bit data word. Up position is zero and the leftmost switch is bit 0. Color groups correspond to octal digits.
  • Start – Press down to run program
  • Load Add – Press down to load address on switches to be current address
  • Dep – Press up to transfer data switches to current memory location and increment the current location
  • Exam – Press down to load the lights with the memory contents at the current location and increment current location
  • Cont – Continue after a stop (as opposed to Start, which starts over)
  • Stop – Stop execution
  • Sing Step -A toggle switch that lets you step a machine cycle at a time; SimH doesn’t support this and the PiDP-8 uses this switch to do things like reboot the underlying Raspberry Pi
  • Sing Inst – Another toggle switch that causes the machine to handle Start and Cont by executing one instruction and halting

Your PC probably has gigabytes of RAM memory organized as 8-bit bytes. The PDP-8 has the ability to address 4K or RAM organized as 12-bit words. Even in those days, 4,096 words of memory wasn’t very much, so the data and instruction fields let you have multiple 4K fields if you could afford the extra memory.

On a real PDP-8 Dep is reversed — you push it up instead of down. This is to prevent you from accidentally writing over memory if you get the switches mixed up. The PiDP-8, by default, doesn’t reverse the switch, although you can do it with a simple modification.

The lights — and remember, on a real system these are not LEDs — show the address and data, as I mentioned earlier. It also shows registers. The lights in the panel’s right-hand box show the current instruction (first column), the current machine cycle (middle column), and the machine state (right column).

Simple Instructions

If you are wondering how the PDP-8 uses 8 lights to show what instruction is executing, it is simple. There are only 8 instructions. That may sound incredible if you are used to modern computers, but it is true. A machine that could compile Fortran programs, run Basic, and do lots of other tasks only had 8 instructions. So much for the invention of the reduced instruction set computer (RISC) many years later.

Honestly, 8 instructions is a bit of a half-truth. There are 8 opcodes. One of those op codes has a few sub codes (but only a few). Later enhancements used the I/O instruction to do things, further increasing the instruction set.

Each 12-bit instruction starts with a 3-bit opcode. You can do a logical and, a signed add, an increment and skip-if-zero operation. You can store the accumulator (and clear it in the process), or jump to a location or a subroutine. Each of those instructions allows for a 7-bit address. You can set another bit to indicate the memory address is indirect and another bit to indicate the 7-bit address is relative to the current page of memory or page zero. Obviously, with only 7 bits, instructions could not operate on any memory location, so page 0 was a way to communicate between disparate areas of your program.

One op code contains two groups of “microcode” instructions. These can do things like clear the accumulator, invert the accumulator or increment the accumulator. Not only can the instruction (the OPR instruction) do those things, it can do any or all of them in one instruction. There’s also a defined order of operation, so you do things like clear the accumulator and increment it to put a 1 in the register.

There’s no subtract (negate and add will work). There’s no logical or instruction (hint: remember DeMorgan’s law). But there is enough that you can do significant programming. It just takes a lot of instructions.

There are even more subtitles. Self-modifying code was common and some memory addresses magically increment when you use them as indirect addresses. A tutorial on programming the PDP-8 could be a whole post by itself, but I wanted to give you a flavor for what programming on a machine like this looks like. Different machines had different indirection and memory addressing schemes, but these general principles were very common in this era. If you really want to dig in, you could do worse than read [Douglas W. Jones’] reference manual.

Test Program

Consider this program in octal:

7301     ; load accumulator with 1 and clear link (carry)

7001     ; increment accumulator

7430     ; skip if link=0

7402    ; halt

5001    ; jump to location 1

In operation, this will zero the accumulator and the link bit (the carry) and then add one to the accumulator repeatedly until the carry bit sets. Then the program will halt. If you restart it, it will stop on each loop since the carry won’t get cleared when you resume. You could also single step it using the rightmost switch.

How can you enter a program like this using the front panel?

Using the Front Panel

If you are using Blinkenbone, go to this page and download the package for your operating system. You’ll also find instructions on how to launch the emulator (a batch or script file).

By default, the script file will load an operating system and run, but that’s way more advanced than we want. We want to flip switches. So press the Stop button after the front panel appears (remember, depress down). Now you are ready to start flipping switches.

  1. Press all 12 data/address switches up. Press Load Addr. Note the Program Counter lights all turn off.
  2. Set the data/address switches to 7301 (DDD UDD UUU UUD where U is up and D is down).
  3. Press Dep (remember, press this switch up). Note that the Program Counter is now 1, the Memory Address display is now 0, and the memory buffer shows the code you entered.
  4. Repeat steps 2 and 3 for the other instructions (7001, 7430, 7402, and 5001).
  5. Put the data/address switches back to zero (all up). Press Load Addr. Then press Start.

That’s it. You’ll see the accumulator flash and the link light will turn on. Then the processor will stop. If you want to examine your program, repeat step 1, but press Exam repeatedly and watch the Memory Buffer lights. You might also want to repeat step 1, press the Sing Inst button down and then press Cont repeatedly to watch the program execute one instruction at a time.

Getting Loaded

In practice, most people never did what you just did. Do you notice the box on the left of the panel marked “Rim Loader” with some numbers within? That was the stage one loader. You would toggle those codes in (starting at address 7756) and run it. Then a more advanced loader would read from some other device (probably paper tape, but maybe something more magnetic). That loader could then read what you wanted to run (like a compiler or — if you had a big system with disks or tape — an operating system).

Realistically, though, if you really want to do that, you can just restart the SimH and let it do all the work. The default for the PDP-8 plays Adventure, and if you start it, you’ll see that the data display on the front panel makes a very nice show while you play (I assume that’s deliberate).

Next Steps

It can be fun to learn about old computers and finding ways around these old machine’s limitations. If nothing else, coding for a PDP-8 will make PIC or AVR assembly language seem luxurious. SimH can simulate lots of machines, some with front panels. There are also many replica kits for blinking light machines ranging from fake Altair 8800s, to COSMAC Elf replacements, and more. Of course, every front panel was different, but they do tend to share common ideas.

You could argue that these old machines don’t have practical value anymore. That’s probably true. But then again, it isn’t much different from someone wanting to restore an old motorcycle, or build a model ship and people do that all the time.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *