(all PDP-8 blog entries can be seen by clicking here)
In my blog entry
I loaded the Hello World test program into memory automatically using SIMH’s load command rather than emulating all of the futzing around one would really do on a PDP-8 to really load a program from paper tape.
In this, my final installation of using the PDP-8 emulator, I will show you how to do the entire process manually, pretty near to what one would have had to do on a real PDP-8.
We will be using the Hello World program, prog3.bin, that was written in the prior blog entry.
I figured this procedure out by reading the book “Introduction to Programming” which can be googled as IntroToProgramming1969.pdf.
When you turn a PDP-8 on, the memory is randomly set and there is no ROM memory to get things bootstrapped like there would be on any even near-modern computer. Instead, you had to enter your boot strap program by hand into memory using the PDP-8 switch register.
To enter the instruction 6014 at address 7756, first you would set the switch register to 111 111 101 110 and then transfer that into the program counter. Then you would set the switch register to 110 000 001 100 and deposit that into memory. That would get one instruction encoded. The boot strap program is small, but this is still a painfully slow process (and there is no room for mistakes).
This painfully slow process is what we are going to emulate.
The ‘boot strap’ program for the PDP-8 is called the RIM loader. This tiny program can load programs in RIM format from the paper tape reader.
Generally the only thing the RIM loader is used for is to load the larger BIN loader which can read files in BIN format from the paper tape reader. The BIN loader is a much longer program and so you really don’t want to load that using the switch register.
Once the BIN loader is in memory, you would use that to load your own application from paper tape. The RIM and BIN loaders are in high memory, and normally not overwritten. Once you load them you don’t have to do so again until the computer is shut off or your application over writes them.
Step 1: Load the RIM Loader
In SIMH, we don’t have a switch register to enter instructions into memory. Instead we use the deposit command. We will start ‘depositing’ the RIM loader at memory location 7756. This is done with the slightly easier to use deposit (d) command:
d 7756 6014 d 7757 6011 d 7760 5357 d 7761 6016 d 7762 7106 d 7763 7006 d 7764 7510 d 7765 5357 d 7766 7006 d 7767 6011 d 7770 5367 d 7771 6016 d 7772 7420 d 7773 3776 d 7774 3376 d 7775 5357 d 7776 0 d 7777 0
Just copy and paste those commands into SIMH. You can then see the instructions you deposited using the examine (e) command:
sim> e -m 7756-7777 7756: RFC 7757: RSF 7760: JMP 7757 7761: RFC RRB 7762: CLL RTL 7763: RTL 7764: SPA 7765: JMP 7757 7766: RTL 7767: RSF 7770: JMP 7767 7771: RFC RRB 7772: SNL 7773: DCA I 7776 7774: DCA 7776 7775: JMP 7757 7776: AND 0 7777: AND 0
Step 2: Load the Binary Loader
You can get the binary loader from this location. Download it, place in your PDP-8 directory and rename to something simpler like loader.bin.
Now attach the binary loader file to the paper tape reader:
sim> attach ptr loader.bin
Load the binary loader using the RIM loader:
sim> go 7756 <<press control-E>> to halt the CPU Simulation stopped, PC: 07760 (JMP 7757) sim>
The binary loader is now in memory.
Step 3: Load your application using the binary loader:
Set the switch register to 3777 and attach your application’s bin file to the paper tape reader. I am using the Hello World application written in a prior blog entry which is in the file prog3.bin
sim> deposit sr 3777 sim> attach ptr prog3.bin sim>
To load from the tape reader, start execution of the binary loader at memory location 7777:
sim> go 7777 HALT instruction, PC: 07701 (KCC) sim>
The Hello World Application is now loaded into memory, starting at location 200 (because that is where we told the assembler to place it).
To run the application program, we start execution with memory location 200:
sim> run 200 HELLO WORLD! HALT instruction, PC: 00210 (JMS 212) sim>
Pretty cool, huh! Of course it would have been a lot cooler if I had a real PDP-8, could toggle in the RIM loader and a real paper tape reader to read paper tape with, but I’ll make do with what I have.