How To Emulate Unix V7 Using Simh (2015)

John David Pressman


Unix v7, released for the PDP-11 line of minicomputers in 1979 is one of computings classics. Just a year before The C Programming Language had been released in its first edition by Bell Labs. In this release is the first appearance of pcc, the Portable C Compiler which began C’s ascendancy as the de facto systems language in use today. This is the same year that Bill Joy stepped down as lead developer of vi. Many of the programs you use on a daily basis can trace their ancestry here.

The emulator we’ll be using, SIMH, was written in 1993 to preserve the dying minicomputer culture that spawned Unix, VMS and other operating systems of the seventies and eighties. As a result, most of the images to boot are old, and their instructions have not kept up with the times. This is a short tutorial to correct this for V7.

Installing SIMH

SIMH can be downloaded from its website for free. Precompiled executable are available for Windows, if you use a Unix or Unix-like platform such as Macintosh or Linux downloading from the site means compiling the sources yourself. However it is highly likely that alternative, more convenient means exist.

On Macintosh, SIMH can be installed using homebrew with the command:

brew install simh

On Linux, your distribution probably includes a copy of SIMH in its repositories. With Debian you would run the command:

sudo apt-get install simh

After you’ve installed the emulator it’s time to boot a copy of Unix.

Booting An Image

Before we continue, it’s best practice to specify what versions of software are being used in a tutorial. The author is using:

As a further disclaimer the author has only tried this on Linux, and cannot speak in further detail for Windows or Macintosh operating systems.

Before we can boot Unix we need to get a copy of it. Unix boot images have been preserved on multiple sites across the net. We’ll be using the one provided on SIMH’s website here. Another site has an outdated README that provided critical material for this tutorial. If you use a different image these instructions will not work. Once you have downladed the image it would probably be prudent to copy it into a directory of its own and then change directories to it. In this case we will name our directory unix-emulation:

mkdir unix-emulation;
cp unix-emulation/;
cd unix-emulation;

This will help keep boot files and other artifacts in a contained clean workspace. Unpack the file.

unzip -d uv7

Now run the emulator with the ‘pdp11’ command:

media@low:~/unix-emulation/uv7$ pdp11

PDP-11 simulator V3.8-1

Once at the sim prompt you’ll want to run the following commands:

Set the cpu type to that of a PDP-11/45:

set cpu 11/45

Set the teletype output to seven bits.

set tto 7b

Next you’ll want to attach the boot image to the rl device, which emulates a cartridge disk controller:

att rl unix_v7_rl.dsk

Boot the image from the drive:

boot rl

The next prompt you get will be a single ‘@’ character, type ‘boot’:

New Boot, known devices are hp ht rk rl rp tm vt 

Next you will want to type in the device to boot from and what directory:

: rl(0,0)rl2unix

And if all goes well you should see:

: rl(0,0)rl2unix
mem = 177856

This prompt means you have successfully booted the system, but don’t start using it just yet…

Completing The Installation

Before you can start using your new Unix install you must make a /tmp directory, if you do not do this essential programs such as Portable C Compiler (pcc) will fail to execute. Furthermore the default user included with the system, the deceased Dennis MacAlistair Ritchie is missing a home directory. Kudos goes to Markus Wandel for writing a tutorial about this in 2002 describing these steps.

First we want to create a tmp directory.

mkdir /tmp
chmod 777 /tmp

Next we want to create the user directory and change the ownership of it to dmr:

mkdir /usr/dmr
chown dmr /usr/dmr
chgrp 3 /usr/dmr

Then press control-D to exit the current prompt and login as dmr, the account requires no password.