Loading a program from tape - Part 1: Introduction
I thought it might be fun to figure out how to load a program from paper tape. This exercise actually revealed a lot of very interesting information so I'm going to try and write a little mini-series of posts, covering in detail all of the different aspects of the paper tape loading process that I have discovered.
This first post is a high-level overview of how tape loading works and an example of how to load a program from a virtual tape in an emulated PDP-11.
Overview of approach
The general approach to loading a tape is as follows;
A bootstrap program is loaded into memory and executed.
The bootstrap program loads a tape loader program, known as the absolute loader.
The absolute loader is used to load the program from tape into memory.
To demonstrate the process, I have written a demonstration program to load BASIC from paper tape into memory and run it. Here is the sample code:
set cpu 11/70,4M ;set realcons=localhost set realcons panel=11/70 set realcons interval=8 set realcons connected set ptr enable set ptp enable D 157744 016701 D 157746 000026 D 157750 012702 D 157752 000352 D 157754 005211 D 157756 105711 D 157760 100376 D 157762 116162 D 157764 000002 D 157766 157400 D 157770 005267 D 157772 177756 D 157774 000765 D 157776 177550 attach ptr DEC-11-L2PC-PO.ptap go 157744 attach ptr DEC-11-AJPB-PB.ptap go 157500
To execute this code, you'll need to download and place the two ptap files into the same folder as the boot.ini. You can find the links in the references section below.
These first four lines are the standard boilerplate to set up the CPU and panel display.
set cpu 11/70,4M ;set realcons=localhost set realcons panel=11/70 set realcons interval=8 set realcons connected
The next two lines enable the paper tape reader and the paper tape punch.
set ptr enable set ptp enable
The next series of lines deposit the bootstrap loader into memory. I am going to write an entire separate post where I describe line-by-line the operation of the bootstrap loader. For now, suffice to say that this code loads the absolute loader from tape.
D 157744 016701 D 157746 000026 D 157750 012702 D 157752 000352 D 157754 005211 D 157756 105711 D 157760 100376 D 157762 116162 D 157764 000002 D 157766 157400 D 157770 005267 D 157772 177756 D 157774 000765 D 157776 177550
The next line loads the virtual absolute loader tape into the paper tape reader.
attach ptr DEC-11-L2PC-PO.ptap
The next line executes the bootstrap loader by setting the program counter value to 157744, which is the first memory address of the bootstrap loader code above:
When the bootstrap loader completes loading the absolute loader into memory the code halts to allow the operator to switch out the absolute loader tape and insert the tape that contains the program that is to be loaded. The operator would then press the continue button on the operator panel to execute the absolute loader and load the program from tape.
The next line loads the virtual BASIC tape into the paper tape reader.
attach ptr DEC-11-AJPB-PB.ptap
The final line of code executes the absolute loader to load the BASIC tape into memory.
Output from running the code
If the code runs successfully, BASIC will start running and you will see output something like this:
*** booting tapeload1 *** *** Start client/server *** *** RPi 4 detected PDP-11 simulator V4.0-0 Current REALCONS build Aug 14 2019 Disabling XQ Searching realcons controller "11/70" ... Connecting to host localhost ... HALT instruction, PC: 157500 (MOV PC,SP) PDP-11 BASIC, VERSION 007A *O
I'll do a separate video on how to use BASIC on the PDP-11.
I used a couple of very helpful resources to develop this post;
I mentioned in my post on a really useful resource for learning PDP-11, that there were a series of training videos made by DEC in 1977 that describe a lot of the features of the PDP-11. Two of them in particular describe the tape loading process in detail; Tape 23 - IO Programming part C and Tape 24 - IO Programming part D.