Dynamic Memory Allocation

All programs, other than the most trivial, need to store data in memory. Intermediate values, sets of data to operate upon, storage for input and output of instructions are examples of what is stored in memory. Typically, a programmer will designate certain memory locations to hold values required by the program. In a PAL-11 program, this can be done using labels and a few assembler directives:

Software Divide

Just as early PDP-11 models had no hardware multiplication support, division routines also had to be provided in software.

Software Multiply

Like many other computers of the time, the base PDP-11/20 model has not have a "multiply" instruction. Any program that needs to multiply numbers needs to provide a routine that can use the existing instructions to perform the multiplication operation. One technique is to use a series of shifts and adds, similar to the way multiplication is done by hand.

Subroutines and Calling Conventions

Every non-trivial program needs a way to reuse fragments of code that are used in more than one place in the program. Subroutines allow the program to jump to another part of the program, execute some instructions, then jump back to where the subroutine was called from. This allows the program to have only one copy of the code, which is important for machines with small amounts of memory. It also allows a programmer to write a series of instructions once, and can be debugged in one place, instead of having to fix the instruction sequence throughout the program. Subroutines also let a programmer break down a complex problem into a set of smaller problems.

The Stack

A "stack" is a basic data structure used to store data. A stack is a predefined area of memory and a variable containing the address to the "top" of the stack. A stack provides two operations, called "push" and "pop", that allow a program to manipulate this structure.

Basic Console Input/Output

Most useful programs require human interaction at the console, to read input from a keybaord, and to write output to a screen or printer. The Teletype Model 33 ASR is the classic console for the early era of PDP-11. Input from the teletype was done using the keyboard, or by using the built-in "low speed" paper tape reader.

Interrupts

The basic function of any computer system is to read some input, perform some calculation, and write some output. The input may be entered on a teletype keyboard, read from a tape or disk, or come from some sensors from a machine. Likewise, the output can be sent to a printer, written to a tape or disk, or send a signal to a motor or transmitter. In many cases, the processor can execute instructions much faster than the input or output device can handle. An efficient system would be able to run those calculations while waiting for the next input to be ready, or for the output to be ready to handle the results of a calculation. Interrupts allow a computer to perform calculations, and be notified when a device requests the attention of the processor.

PAL-11A Syntax

At its most basic, an assembler needs to interpret instruction mnemonics their operands, determine their addressing modes, and encode them into their raw instruction words or bytes. PAL-11A does that, and includes a few other simple features that are very helpful for programmers, such as symbol handling and the ability to encode raw words, bytes, and even character strings into the assembled binary. It does not support macros, which are common in most assemblers; DEC later released an enhanced assembler called MACRO-11 that was one of the primary programming languages of the PDP-11 series.

PAL-11A Absolute Assembler

PAL-11A is the first assembler DEC released for the PDP-11. It reads assembly language source files, and punches out a program ready to be loaded by Absolute Loader. It optionally prints out a listing of the program on the printer, along with the locations of symbols that appear in the program.

Simulating a PDP-11 Using Modern Hardware

As technology progressed and the world of computig systems moved beyond not only the PDP-11 and Digital Equipment Corporation itself, it is becoming very difficult and expensive to find and maintain a PDP-11 system. Fortunately, those same advances have allowed for simulations of PDP-11 systems. SimH ("History Simulator") is a collection of simulators of every PDP-11 model, as well as various vintage IBM, Altair, Data General, HP machines from the 1960s onward.

Paper Tape Software

A very minimal PDP-11/20 installation included a Teletype Model 33 ASR. The "ASR" signified "Automatic Send and Recieve": this model of teletype included a paper tape reader and a punch which ran at 10 bytes per second. With an extra $3900 (~$26k in 2020) burning a hole in your pocket, you could either buy two brand new Volkswagen Beetles, or you could also buy the PC05 High Speed Paper Tape Reader and Punch, which could read paper tapes at the blazing speed of 300 bytes per second, and punch them at 50 bytes per second.

A Note on Numbers

Like many other computer systems created in the 1960s, all PDP-11 literature expresses numbers in octal notation. Each octal digit is made up of three bits, expressing 0 through 7. In this notation, a byte value (8 bits) ranges from 000 to 377, and a word value (16 bits) ranges from 000000 to 177777. This is physically expressed in the PDP-11 console, which groups its switches and lights into threes, making it easier to enter and display numeric values using switches and lights.

The PDP-11 Instruction Set

The PDP-11 processor has a small but powerful set of instructions. There are instructions to add and subtract numbers, move values between registers and memory locations, compare values, branch to other instructions if certain conditions are met, call subroutines, pause the processor until an interrupt occurs, or even halt the processor altogether.

Basic Architecture of the PDP-11

This series of articles will focus on early implementations of the PDP-11 architecture, in particular, the first machine in the series, the PDP-11/20. Later implementations add additional features to the architecture.