Some amazing software feats Feb 2016

The introduction of the PDP-8 series was a disruptive, game-changing event, in that it made computers available to a large group of scientists, engineers, and tinkerers. For the first time, more or less, you could walk into a room, sit down at a teletype, and start programming. No more “batch jobs” and “reserving” time on a huge, scarce, over-booked, expensive machine.

Instructions and memory

The PDP-8’s instruction set is very well documented elsewhere. It only has 3 bits to store the “opcode”, i.e. 8 combinations in all. One is for I/O, one is for special “micro” instructions - that leaves a mere 6 operations: a jump, a subroutine call, and only four other instructions, with 2 special bits and a 7-bit operand field. Can this thing really be Turing-complete?

That’s not all: those 32 Kwords of a maximally-configured PDP-8 are split into eight 4 Kword “banks”, and each bank is split into thirty two pages of 128 words each. Since a word is 12 bits, you can only easily access words in a single 4 Kw memory bank. Multiple instructions will be needed for anything beyond 4 Kw.

There is no “load accumulator” instruction, there is only “add to accumulator”. Storing the accumulator clears it! (which makes a lot of sense combined with add-to-accumulator) - for some interesting notes about the instruction set, see this page.

Let’s look at memory: in those days, random memory was magnetic core memory. It has some very unusual properties by today’s measures: reading a memory address is destructive - you have to write it back after a read if you want to preserve it! As a consequence, reading and writing and even modifiying a memory address all take the same amount of time.

And then this: core memory retains its contents when powered off. That means you can stop a PDP-8 from its front panel, turn the machine off, power it up again, and restart it.

Despite the limitations of a PDP-8, people have built various operating systems for this thing, and implemented more than half a dozen programming languages for it. It boggles the mind.


There are two categories of programming languages for the PDP-8:

Compiler-based languages - you write your code in some editor, then you save it (to paper tape, or magnetically if you’re lucky), then you start up the compiler, possibly multiple passes, then you start the linker, and at the end you have a binary, which you can start to see if it works.

This process is tedious, to put it mildly. With a disk, a Fortran compilation of a simple “Hello world” program takes 10 seconds or so, but that increases to about 10 minutes with DECtapes, and even more if you have to save to paper tape and also load each new program that way.

Only then will you know whether you mis-typed anything or forgot a comma.

Some languages for PDP-8 were: Fortan II and IV, Algol, Pascal, Lisp (!), and Forth.

Many of these require at least 8 Kwords of core memory, sometimes even 28 Kw. If you only have 4 Kw, the minimal and default PDP-8 configuration, then all you could probably use is the machine-level instruction “assembly language”.

The compilers and linkers themselves were invariably written with an assembler. It’s hard to imagine how much time and effort it must have taken to design, implement, and test these elaborate software systems, fitting their code and data structures into that quirky 32 Kword, 4096 w/bank, 128 w/page memory layout. Text was stored as two 6-bit characters per word: no lowercase, and only a very limited set of special characters! Six-char var names, what a luxury!

Interpreted languages - imagine sitting at the teletype, entering some commands and getting a computed reply back within a second - nirvana!

That was the promise of interpreted programming languages then, and that’s the appeal of scripting languages today (that distinction is all but gone with today’s performance levels).

On the PDP-8, there was BASIC, which incidentally was designed at just about the same time as the PDP-8 hardware. It lets you enter commands in immediate mode, as well as edit them into a larger program by starting each line with a line number. You could enter strange things like:

20 GOTO 10

And the computer would guarantee to execute them in order, creating an infinite loop in this case. By hitting Control-C (sound familiar?), you could abort the running program and regain control. The line numbers were irrelevant, but by keeping gaps you could then insert additional lines later, such as:

15 PRINT "1 + 2 =", 1+2

Typing “LIST” would print out the entire program:

15 PRINT "1 + 2 =", 1+2
20 GOTO 10

All the essential tools were present for interactive use: a command line, a crude-but-effective editor (with “LOAD” and “SAVE” commands for paper tape or disk files), and your code, waiting to be executed, enhanced, or debugged. In many ways, we still use this same process today.

This approach, and BASIC in general, was definitely the mainstream model for the next twenty years, when 8-bit hobby computers and CP/M and MS-DOS became the dominant systems.

The other interpreted language on the PDP-8 was FOCAL, developed by DEC. Just as BASIC, this was a completely self-contained system. It ran (barely) in just 4 Kw, and there was no “operating system” in sight. Focal-69, the most widespread variant, was the operating system.

Again, looking at the hardware this all ran on, and the fact that these systems themselves had to be programmed in assembly language, raising the conceptual bar to make a PDP-8 an interactive and highly responsive system was quite a revolution at the time.

Operating systems

Then came magnetic storage. Even if an expensive (but fast!) fixed-head DF32 with 4 platters could only hold 128 Kwords of memory, it changed the landscape for good. Gone were the time sinks of loading, saving, re-loading, and damaged or lost paper tapes. The operating system turned these disks (and DECtapes) into data filing cabinets. That’s why they’re called “files”!

File names were up to 6 characters, with a 2-letter “extension” to indicate the type of file (does this ring a bell?). This was also the start of utilities such as “PIP”, the Peripheral Interchange Program which could shuttle data around from one file to the next, from paper tape to disk, from disk to teletype, and so on.

The computer was starting to become more of an information processor, and less of a purely computational / number-crunching engine. And the PDP-8 was right in the middle of all this, with well over half a million units in the field.

The PDP-8 was fertile territory for several groundbreaking operating systems:

OS/8 was the first and main one - a PDP-8 + disk or DECtape + OS/8 was all you needed to get tons of work done (or games). A slow but very respectable precursor of the Personal Computer.

And then more people wanted to join in on the game. Most of the time, all these computers were just sitting, twiddling their thumbs after all, waiting for a bunch of sluggish carbon-based life-forms to press the next key on their keyboard. What a silly waste of (the computer’s) time!

Meet TSS-8, the time-sharing system: it gave each user a “time slice” of a single shared PDP-8, swapping data to and from a disk, as needed to maintain the illusion. While one person was typing, another one could be running a calculation, and they’d both get good mileage out of the system. Just hook up a few more terminals to the machine, and you’re off. Apparently, up to 17 users could share a PDP-8, and its smallest configuration only needed 12 Kwords of RAM!

There’s also ETOS/8 - a virtualising OS, giving each user the illusion of a complete machine.

SIMH and the PiDP-8/i

Last but certainly no less impressive, there’s the SIMH emulator and Oscar’s PiDP-8/i mod to display SIMH’s internal state (see the “Software” section on this page) - he does this by poking around in the (simulated) memory space - a clever way to let the simulator run full speed while still presenting a continuous glimpse inside via the LEDs. All thanks to multi-tasking in Linux.

Everything mentioned above can be tried on the PiDP-8/i. The front panel has a special trigger, where the three INST-FIELD switches in combination with the SINGLE-STEP toggle can be used to start up different software sets, as prepared by Oscar on his pipaOS-based SD card image (which will boot quite a bit faster than a standard Raspbian distro).

Here are the front-panel quick-launch cheat codes:

Octal  IF-sw  Description
  0     000    (used on power-up, set to same as slot 7)
  1     001    RIM Loader at 7756, paper tape/punch enabled
  2     010    TSS/8 multi-user system. Up to 7 telnet logins
  3     011    OS/8 on DECtape (a lot slower, also simulated)
  4     100    Spacewar! With vc8e output on localhost:2222
  5     101    (empty slot, 10-instr binary counter demo)
  6     110    ETOS/8, also with telnet logins on port 4000
  7     111    OS/8 on RK05 10MB disk cartridge

The best resource for all this is really the PiDP-8/i website. It has all the information you might want and lots of pointers to other documentation, software, and the pidp-8 discussion group.

Note that on a single core Raspberry Pi A+ or B+, SIMH runs flat-out, consuming nearly 100% CPU - yet the system remains fairly responsive, even when logged in via a network session. To regain most of the processor time, you can suspend SIMH by entering “ctrl-e” - and later enter “cont” to resume the simulation and blinking. You don’t need to quit simh to get a shell prompt: just type “ctrl-a ctrl-d” to suspend the session and “~/” to resume it.

That’s it for our brief excursion into the world of computing 50 years ago - fun from the 60’s!

Weblog © Jean-Claude Wippler. Generated by Hugo.