Toggling in a simple program DEC PDP-8 and PiDP-8 using the switch register
Published: 08-06-2016 | Author: Remy van Elst | Text only version of this article
Table of Contents
- An original PDP-8/i.
In this guide I'll show you how to toggle in a simple program on the DEC PDP-8or the PiDP-8, or in a front-panel simulator named BlinkenBone if you lack thehardware. I have a replica of the PDP-8/I (the PiDP-8) but lacked the actualknowledge on the front panel and switches to get started and do something cool.This guide has step by step instructons, with pictures, and basic explanation.After all, what is an expensive blinking light panel without fun stuff to togglein?
As you might know, I'm a fan of the PDP line of computers and legacy systems ingeneral. Mainframes, homecomputers, you name it and I probably like it. Addflashing lights, panels and big controls to it and you have my attention in notime.
Plus, in previous jobs I've worked on mainframes, VAX and PDP systems and theemulators used to keep those systems running on modern hardware. Thinkhospitals, banks, insurance companies, train signalling control and the likes.So, the interest did not spawn from nowhere.
Oscar Vermeulen created an amazing replica of the PDP-8/I. It's a frontpanel with working switches and LED's, plus a simple Raspberry Pi running theSIMH emulator. I've written multiple articles on the PDP and PiDP-8and I like the device a lot in general.
I did however only use the serial console and SSH to control the PDP-8 computer.Since I'm managing a lot of Linux/UNIX systems that's what I'm familiar with.But, the PiDP-8 (and the PDP-8/I) has a front panel with switches and lights.The lights show the different parts of the system, like the memory, programcounter and contents of the registers and the switches allow you to manuallycontrol all those aspects.
There is little documentation on using those switches, except for the excellentmanuals from DEC. No simple, get started using the switches guide. This pageaims to solve that by showing you, step by step, how to toggle in a very, verysimple program, by hand. What it does? It manually moves a bit through theAccumulator lamps.
I found the program and tutorial on this page, it is from the BlinkenBoneauthor. This page is based on that, but hopefully, geared more to new users.
This guide covers the BlinkenBone panel simulator, explains the Switches,explains the Lamps (Register Indicators), explains the program and then startswith the step by step guide to toggle that in.
BlinkenBone is another super nice project which provides the front panels ofvarious PDP computers as a JAVA based GUI and backend server. It describesitself as
an architecture to connect simulators of vintage computers with"Blinkenlight panels".
If you don't have a PDP-8 or PiDP-8 replica, you can use BlinkenBone to still beable to use the front panel of such an actual machine. This page has a lotof very detailed information on the PDP-8/I and it's front panel. It is a verygood read.
The above picture is a screenshot of BlinkenBone running on my machine showingthe PDP-8/I front panel while running Adventure. I have the luck of having anactual replica, the PiDP-8, but for those without one, this is an excellentalternative.
Read this page for installation instructions on BlinkenBone. It is Javasoftware, so it runs on Windows, Mac and Linux. There is also a specialRaspberry Pi version. Installation is very easy, download the archive, extractit and run the starting script.
BlinkenBone also has a few other simulated panels, for example for thePDP-11/70, PDP-10 KI10 and a PDP-11/20. Please make some time to play with thosesince it's awesome.
Jorg Hoppe, behind the BlinkenBone, noted that it is an excellent idea and agreat experience to run the BlinkenBone software on a large touchscreen.Quoting, "Operating the panel in original size on a 23 inch screen with yourfingers is absolutely worth the extra $$$. (I use an Acer 232TL under Win10).".I did try it myself on a small Asus Transformer tablet running Windows 10, 10inch, and even that is a very nice experience.
Switches and Lamps
An actual PDP-8/I front panel.
I'll use the term PDP-8 further on in the tutorial, but by that I also mean thePiDP-8 or the BlinkenBone GUI.
The below sections cover the functions of the switches and the lamps. Skip overit if you just want to start toggling.
Front Panel switches
The front panel of the PDP-8/I has 26 switches. From left to right, the firstthree control the
Data Field (DF). DF determines the core memory field of datastorage and retrieval.
The second three control the
Instruction Field (IF). IF determines the corememory field from which instructions are to be taken.
The third, fourth, fifth and sixth pair of switches control the
SwitchRegister (SR). The Switch Register provides a means of manually setting a12-bit word and load that into the PC (program counter) by pressing the
LoadAdd key or load the content into the
MB (Memory Buffer) and core memory withthe
The last switches are, from left to right, in order the following.
Start: Starts the program by turning off the program interrupt circuits clearing the AC (Accumulator) and L (Link), setting the Fetch state, and starts the central processor.
Load Add(Load Address): This key transfers the content of
SR(Switch Register) into
PC(Program Counter), the content of
INST FIELDswitches into
IF, the content of the
DATA FIELDswitches into
DF, and clears the major state flip-flops.
Dep(Deposit): This key transfers the content of
SR(Switch Register) into
MB(Memory Buffer) and core memory at the address specified by the current content of
PC(Program Counter). The major state flip-flops are cleared. The contents of
PC(Program Counter) is then incremented by one to allow storing of information in sequential core memory addresses by repeated operation of the
Exam: This key transfers the content of core memory at the address specified by the content of
PC(Program Counter), into the
MB(Memory Buffer). The content of the
PC(Program Counter) is then incremented by one to allow examination of the contents of sequential core memory addresses by repeated operation of the
Examkey. The major state flip-flop register cleared. The
MA(Memory Address) indicates the address of the data in the MB.
Cont(Continue): This key sets the RUN flip-flop to continue the program in the state and instruction designated by the lighted console indicators, at the address currently specified by the
PC(Program Counter) if key
SS(Single Step) is not on.
Stop: Causes the RUN flip-flop to be cleared at the end of the instruction in progress at the time the key is pressed.
Sing Step(Single Step): This key causes the RUN flip-flop to be cleared to disable the timing circuits at the end of one cycle of operation. Thereafter, repeated operation of the
Contkey steps the program one cycle at a time so that the operator can observe the contents of registers in each major state.
Sing Inst(Single Instructon): This key allows execution of one instruction. When the computer is started by pressing the
Sing Instkey causes the RUN flip-flop to be cleared at the end of the last cycle of the current instruction. Thereafter, repeated operation of the
Contkey steps the program one instruction at a time.
Register Indicators Lamps
The Lamps are called
Register Indicators. These are also explained below, fromtop to bottom.
PC(Program Counter): The
PCcontains the location of the next instruction to indicators be performed.
MA(Memory Address): Indicate the content of
MA. Usually, the contents of
MAindicators denote the core memory address of the word currently or previously read or written. After operation either the
Examkey, the contents of
MAindicate the core memory address just examined or deposited into.
MB(Memory Buffer): Indicates the content of
MB. Usually, the contents of
MBindicators designate the word just written at the core memory address in
L(Link): Indicates the content of
AC(Accumulator): Indicates the content of
MQ(Multiplier Quotient): Indicates the content of the multiplier quotient.
MQholds the multiplier at the beginning of a multiplication and holds the least-significant half of the product at the conclusion. It holds the least-significant half of the dividend at the start of division and holds the quotient at the conclusion.
Major state indicators
These lamps indicate that the processor is currently performing or has performedsuch a cycle.
Fetch for example indicates that the processor is currentlyperforming or has performed a
Ion: Indicates the status of the
INT.ENABLEflip-flop. When lit, the interrupt control is enabled for information exchange with an I/O device.
Pause: Indicates the status of the
PAUSEflip-flop when lit. The PAUSE flip-flop is set for 2.75 microseconds by any
IOTinstruction that requires generation of
IOPpulses or by any
EAEinstruction that requires shifting of information.
Run: Indicates the status of the
RUNflip-flop. When lit, the internal timing circuits are enabled and the machine performs instructions.
These lamps indicate that the processor is currently performing or has performedsuch an instruction. For example,
And indicates that the processor iscurrently performing or has performed an
The above sections were slightly adapted from this page.
The program to blink lamps
The program we are going to toggle in is a very simple program. It sets a bit inthe accumulator and
HALT's. When we, the user, press the
Cont switch, itshifts the bit to the left in the
AC, and so on.
We are going to use an assembler to assemble the assembly code into binary. Inthis case we are using
palbart. You can download palbart here and readmore on it here. In case the download site ever goes down, I've mirroredthe C code here and the linux executable here.
Below you can find the assembler code of the program:
/ shifter - manually move a bit through the Accumulator lamps*100 / start addr CLA CLL IAC / Link=AC=0, AC++. AC now 1LOOP, RAL / rotate the bit left through AC and Link HLT / wait for user to CONTinue JMP LOOP / again$
There are comments in the code, and if you want to read more about the PDP-8assembly instruction set on this page named "What is the PDP-8 instructionset?". By reading that you understand the code above a bit more.
Make sure you have downloaded
palbart. Save the above code, for example in afile named
shifter.pal. Then run it through the assembler:
chmod +x ./palbart ./palbart shifter.pal
A file "shifter.lst" is produced:
/ shifter - manually move a bit through the Accumulator lamps Page 1 1 / shifter - manually move a bit through the Accumulator lamps 2 3 0100 *100 / start addr 4 00100 7301 CLA CLL IAC / Link=AC=0, AC++. AC now 1 5 LOOP, 6 00101 7004 RAL / rotate the bit left through AC and Link 7 00102 7402 HLT / wait for user to CONTinue 8 00103 5101 JMP LOOP / again 9 10 $ No detected errors No links generated
The first collumn represents the
Address and the second column represents the(binary)
Contents of that register.
Step by step
So, we have the memory addresses and the data, but how do we toggle that in?Start by firing up your
PiDP-8, PDP or start up the BlinkenBone.
After downloading and extracting BlinkenBone, navigate to that folder and, onUbuntu, start the
prepare.sh script to install dependencies:
sudo bash prepare.sh
On other distro's, install
Start the PDP-8 with the
ADVENT disk coupled:
sudo bash pdp8i_os8advent.sh
A Java window with the front panel opens, and the terminal starts up the SIMHemulator. Wait a few moments until it is finished. The terminal shows thefollowing:
WELCOME TO ADVENTURE!! WOULD YOU LIKE INSTRUCTIONS? >
Above is a video of a screen recording showing the front panel while ADVENT isrunning. If it's not loading, view it on Youtube.
Now on the panel (PDP-8, PiDP-8 or emulator) toggle the
Stop switch. Bytoggle, I mean, push it so that it changes state and push it again so that thestate is back as it was before the first toggle.
After toggling the
Stop switch, the Lamps should stop moving. We've stoppedthe execution of ADVENT and OS/8.
Switch Register switches are Octal. In this case that means that theyrepresent 0 to 7 (8 possibilities). From left to right, a pair of three switchesrepresent the values
1. If you toggle the rightmost switch, itcontain the value
1. If you toggle the middle switch and the rightmost switch,it will contain the value
3 and so on. Below is a picture to make it moreclear:
Do note that the
Dep switch is in the oposite position. In the pictures belowit looks like it's always toggled, and that is the case, so don't worry.
After we toggled the
STOP switch, we can start toggling in the program. Thefirst thing we do is toggle in the value
100 and then toggle the
Load Addswitch to set the start address in the
PC (program counter):
The octal value
100 is represented by the switch positions
000 001 000 000.
The second instruction we toggle in is 7301 (
Link=AC=0, AC++. AC now 1). Theoctal value on the switches it:
111 011 000 001. Do note not to toggle the
Load Add switch, but the
Dep switch. I made that mistake a few times atfirst. We are not loading that address, but we are depositing the value in theaddress we loaded earlier. Below is a picture:
The third instruction we toggle in is 7004 (
rotate the bit left through AC andLink). The octal value is:
111 000 000 100. Picture below:
The fourth instruction is 7402 (
wait for user to CONTinue). The octal valueis:
111 100 000 010. Picture below:
The fifth instruction is 5101 (
JMP to LOOP, start over). The octal value is:
101 001 000 001. Picture below:
The sixth instruction we are toggling in is the same as the first, 0100. Togglethe
Load Add switch to set the start address in the
PC (program counter):
Now the program is in the memory of the PDP. By toggling in 0100 and thenloading that address, we make sure that when we toggle START, the PDP startsexecution there.
So, the next thing to do is toggle the
START switch. What happens is that theon the Accumulator lamp row, all lamps turn of and one lights up. Then nothinghappens. Toggle the
Cont switch, then the Lamp turns off and the Lamp left ofit lights on. See the three examples below:
The basic flow is: set a bit, then start the loop which shifts that bit, thenhalts until the user toggles the continue switch.
Here below is a recording showing the emulator running this program:
If it's not loading, view it on Youtube here.
That's all there is. I hope you have enjoyed this guide and enjoyed playing withthe PDP-8.adventure, articles, dec, fortran, os-8, pdp, pdp-8, pidp8, simh