Running Adventure on the DEC PDP-8 with SIMH

23-07-2015 | Remy van Elst


Table of Contents


pdp-8

  • An original PDP-8/i.

In this guide I'll show you how run the classic Colossal Cave Adventure game on a PDP-8, emulated by the SIMH emulator. The PDP-8 was an 12 bit minicomputer made in 1964 by DEC, the Digital Equipment Corporation. We will install and set up SIMH, the emulator with a RK05 diskimage running OS/8. We will use FORTRAN on OS/8 to load ADVENTURE, then we use our brain to play the game. As a bonus, I also show you how to edit files using EDIT, and show you a bit of the OS/8 system.

Introduction

I've recently accuired a PDP-8 remake, the PiDP-8/i by Oscar Vermeulen. This beautiful piece of hand made hardware uses a Raspberry Pi to emulate a PDP-8 with SIMH. The front panel actually works, you can use the switched to load paper tapes, the RIM and BIN loader and all the other legacy goodness. It is a bit smaller than a real PDP-8, it is scale 2:3. The real PDP-8 has 1.5 cm switched, the PiDP-8 has 1.0 cm switches.

I have an interest in legacy systems like the PDP-11, VAX/VMS and other mainframes and minicomputers. The PiDP-8/i allows me to have a small piece of this legacy myself. It also motivated me to learn more about the PDP-8 and it's hard and software. It also inspired me to write this article about it. Since these systems are way older than me, emulation and recreation are the only way for me to use them, sadly.

I really encourage you to check out the PiDP-8. Order one as well, you can either get a kit to construct yourself, or order an assembled version. Support this beautiful piece of work!

pidp-8

SIMH is an emulator which not only emulates a PDP-8, but a lot more older mainframes and minicomputers. See the website for more information about SIMH.

This guide shows you how to run the classic Colossal Cave ADVENTURE game on an emulated PDP-8 with SIMH. We will use Ubuntu 14.04 as our host operating system, but any OS that runs SIMH will do.

If you like this article, consider sponsoring me by trying out a Digital Ocean VPS. With this link you'll get a $5 VPS for 2 months free (as in, you get $10 credit). (referral link)

Colossal Cave was written by Willie Crowther and quickly became one of the most popular games of that time. Because it was written in FORTRAN it was ported to various machines, even to the IBM-PC and the Apple II.

The PDP-8 can run plain paper tapes with software, but later in it's lifetime it got access to magnetic disks and therefore is able to run actual operating systems. The ADVENTURE game runs, via FORTRAN, on the OS/8 operating system for the PDP-8. Wikipedia has more information on OS/8, that is a very interesting read.

pdp-11

  • An original PDP-8/i with attached periferals.

We will use a disk image graciously provided by Rick Murphy with both OS/8 and the adventure program already compiled in it. You can download it from Rick Murphy's website (direct link to the rk5) or from here. This is a disk image in the RK05 DECpak disk format. The RK05 is a moving head magnetic disk drive approximately 2.5 MB on a 14", single-platter IBM-2315-style front-loading removable disk cartridge.

RK05

  • An original RK05 drive with a mounted RT-11 disk pack.

Installing and configuring SIMH

First create a folder where you will store the disk image and the configuration files, and go in that folder:

mkdir pdp8
cd pdp8

Ubuntu, and many other operating systems, have packages available for SIMH. We can use the built in package manager to install simh:

apt-get install simh

If your distro doesn't have simh, see their website for installation instructions.

Download the prepared disk image:

wget https://raymii.org/s/inc/downloads/pdp/advent.rk05

To make the start up proces easier you can set up an 'pdp8.ini' file with a few commands in it. SIMH will load and run these commands at startup if you execute the pdp8 command.

Our pdp8.ini file has the following in it:

set cpu 32K
set cpu idle
attach rk0 advent.rk05
boot rk0
exit

First it sets up the CPU. Then it attached the advent.rk05 file as the first disk and finally it boots up from that attached disk.

Do note that you don't need to create this file, you can also enter these commands manually at the simh prompt.

Running the PDP-8

In the current folder, execute the following command to start up simh with our configuration file:

pdp8

If all goes well, you should see something like below:

$ pdp8

PDP-8 simulator V3.8-1

.

Some distributions, like Arch name the command simh-pdp8. It does the same thing.

Congratiulations, you are now in a 1960's era operating system. Look around a bit, for example, execute the DIR command:

.DIR

DIRECT.SV   7            FRTS  .SV  26            BASIC .WS  11
PIP   .SV  11            PASS2 .SV  20            SET   .SV  20
FOTP  .SV   8            PASS2O.SV   5            RTFLOP.SV  15
[...]
BRTS  .SV  15            LCSYS .BI   3            ADVENT.LD 145
F4    .SV  20            UCSYS .BI   3            LOAD  .LS   8

 162 FILES IN 2648 BLOCKS -  544 FREE BLOCKS

You can get help at any moment using the HELP command:

.HELP
<[?3L[?4L[?5L[?5LHJ\
OS/8 MONITOR COMMANDS

CMD     PROG    EXPL

ASSIGN  KBM     ASSIGNS LOGICAL NAME
BACKSP  CAMP    BACKSPACES DEV
BASIC   BASIC   ENTERS BASIC SYSTEM
BOOT    BOOT    BOOTSTRAPS TO DEV
CCL     CCL     DISABLES CCL
COMPARE SRCCOM  COMPARES FILES
COMPILE PAL8    COMPILES PROG
    F4/FORT
    BASIC
    RALF
    SABR
COPY    FOTP     COPIES FILES
CREATE  EDIT     OPENS FILE FOR EDITING
[...]
#NNN    TAKE INTERNAL OCTAL FORM OF FILENAME
@FILE   REPLACE IN CMD LINE BY FILE'S CONTENTS
$       COMPLEMENT DEFAULT ALTMODE SWITCH

Editing files on OS/8 with EDIT

If you just want to run adventure, skip this section.

You can edit a file for example, using a LINE EDITOR. First create the file, in this example, A.PA.

.CREATE A.PA

#

You can edit files with the EDIT command later on.

Your prompt changes from a . to a #. If this is an existing file, you must read the first page into the buffer by typing

#R

To insert text at the top of the buffer, use I. To append to the end, use A.

#I
THIS IS A TEST

Press CTRL+L to exit the edit prompt.

You can start inserting before any line by typing $nI where $n is the line number (which is never displayed). For example, to insert a line before line 20, use 20I.

The L command lists the current buffer:

#L
THIS IS A TEST

5L displays line 5 and 1,5L displays lines 1 through 5. . indicates the current line. If you type .L the current line is displayed.

To delete a line, use $nD where $n is . or a line number. To change a line use $nC where $n is . or a line number. It deletes the line indicated by $n, then waits for you to type in a replacement.

As said, EDIT reads a page from disk into the buffer. When you are done with that page and ready to move to the next type N. This writes the existing page to the output file (P command), clears the buffer (K command), and reads the next page from the input file (R command). You can use the P, K, and R commands individually, but be careful. Doing these commands out of sequence can mess up your file.

When you are done editing, use the E command to exit. This will write the current buffer to the output file, then copy all remaining pages from the input to the output file if you aren't already on the last page.

#E

You can use the TYPE command to see the contents of a file:

.TYPE A.PA
THIS IS A TEST

See this page for a detailed guide on using PDP-8 EDIT.

Running Adventure

To run Adventure we first need to run the FORTRAN environment. Start it up with the following command R FRTS:

.R FRTS
*

Your prompt changes to a *. The HELP command explains what the R command does:

R   KBM   RUNS PROGRAM FROM SYS:

Tell the FORTRAN system we want to load Adventure with the following command, ADVENT.LD:

*ADVENT.LD

Press the ESCAPE key on your keyboard to start the execution. Below you'll find the full sequence of commands plus some ADVENTURE output:

$ pdp8

PDP-8 simulator V3.8-1

.R FRTS
*ADVENT
*$
WELCOME TO ADVENTURE!!  WOULD YOU LIKE INSTRUCTIONS? 

> NO
YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING. 
AROUND YOU IS A FOREST.  A SMALL STREAM FLOWS OUT OF THE BUILDING AND
DOWN A GULLY.

> ENTER 
YOU ARE INSIDE A BUILDING, A WELL HOUSE FOR A LARGE SPRING.

THERE ARE SOME KEYS ON THE GROUND HERE.

THERE IS A SHINY BRASS LAMP NEARBY.

THERE IS FOOD HERE.

THERE IS A BOTTLE OF WATER HERE. 

> TAKE LAMP
TAKEN. 

> 

To exit SIMH and the PDP-8, press CTRL+E. SIMH will stop and you will be back at your command prompt.

You can view some more help on the PDP-8 SIMH version by executing (in OS/8) the following command:

.TYPE ADVENT.DC

Enjoy!


Tags: adventure, dec, fortran, os-8, pdp, pdp-8, pidp8, simh,