Assembling/Compiling to SIMH PDP-8 Paper Tape and Executing the Paper Tape Program

(all PDP-8 blog entries can be seen by clicking here)

Now that I have successfully assembled and executed the Hello World! program I thought it would be fun to write the program to paper tape, then load and execute it from paper tape.

I just kind of had to stumble around to figure this out on my own. There are many references to how to load a binary image from paper tape, but nothing on how to create the image. Turns out to be quite simple.

Here is the Hello World program, again, with a couple of modifications:

/PDP-8 PAL ASSEMBLY LANGUAGE PROGRAM TO PRINT HELLO WORLD!

        *200                    /LOCATE PROGRAM STARTING AT ADDR 200
        AIX1=10                 /SETUP AUTOINDEX REGISTER 1

        CLA                     /CLEAR ACCUMULATOR
        CLL                     /CLEAR AC LINK
        TAD CHRSTR              /LOAD 1ST WRD OF CHRSTR (WHICH IS
                                /THE ADDR OF CHRSTR)
        DCA AIX1                /STORE THAT IN AUTOINDEX REG 1

LOOP,   NOP                     /TOP OF LOOP TO READ AND PRINT STRING
                                /I USE A NOP JUST TO MAKE IT EASIER TO
                                /INSERT CODE BELOW THE LABEL.
        TAD I AIX1              /INCR ADDR IN AIX1, THEN LOAD AC FROM THAT
        SNA                     /IF AC IS NOT ZERO, SKIP NEXT INSTRUCTION
        HLT                     /HALT CPU
        JMS TTYO                /CALL OUTPUT ROUTINE
        JMP LOOP                /REPEAT LOOP

TTYO,   0                       /TTY OUTPUT ROUTINE. THE FIRST WORD OF
                                /A SUBROUTINE MUST BE EMPTY (0) BECAUSE
                                /THE JMS INSTRUCTION INSERTS THE RETURN
                                /ADDR IN THIS WORD.
        TLS                     /WRITE AC TO THE OUTPUT DEVICE (TTY)
        TSF                     /IF TTY IS READY, SKIP NEXT INSTRUCTION.
        JMP .-1                 /TTY IS NOT READY, SO CHECK AGAIN
        CLA                     /CLEAR AC
        JMP I TTYO              /RETURN TO CALLER

CHRSTR, .                       /1ST WORD IS ADDR OF STRING
        "H;"E;"L;"L;"O;" ;"W;"O;"R;"L;"D;"!
        000                     /<EOT>

The first change is to change JMP I [7600 to HLT. Since the operating system won’t be running, the program cannot return to it. Instead, I just need to halt the CPU.

The second change is to encode the string HELLO WORLD! differently. I found this syntax in one of the manuals that will encode the string into memory in ASCII rather than SIXBIT.

Copy and paste this little program into the PDP-8 using EDIT as described in a prior blog entry. I called it PROG3.PA.

When assembling PROG3.PA, I direct the output of the BIN file to the paper tape punch like this:

.<press control-E>
Simulation stopped, PC: 01207 (KSF)
sim> attach ptp prog3.bin
PTP: creating new file
sim> go

.PAL PTP:<PROG3
ERRORS DETECTED: 0
LINKS GENERATED: 0

.

The binary image of the assembled program is now in the file prog3.bin. In ye goode olde days, to load this from tape required entering a ‘RIM’ boot loader into memory using the front toggle switches, then loading the binary loader from paper tape into memory, and finally loading the program itself from paper tape. Here is the flow chart for just loading the program from paper tape:

loading

All of the manual steps to load a program should still work, but the writers of SIMH have made this much easier for us by just using the LOAD command. Maybe some day I’ll try doing it the manual way, but right now I just want to see this work.

So next I detach the PC’s file from the paper tape punch, and then use the load command to get the program into memory:

.
Simulation stopped, PC: 01207 (KSF)
sim> detach ptp
sim> load prog3.bin
sim>

The program has now been loaded into memory from the paper tape image. I told the assembler to locate the program starting at address 200 so I will start the CPU running at location 200:

sim> run 200
HELLO WORLD!
HALT instruction, PC: 00210 (JMS 212)
sim>

And there you have it: assembling to paper tape, and then loading and running the program from paper tape. OK, I cheated a bit with the load command, but the process is working.

 

Advertisements
This entry was posted in c-retro and tagged . Bookmark the permalink.

2 Responses to Assembling/Compiling to SIMH PDP-8 Paper Tape and Executing the Paper Tape Program

  1. Pingback: SIMH PDP-8: Manually Loading the RIM Loader, the Binary Loader, and an Application from Paper Tape | Big Dan the Blogging Man

  2. Very interesting,thank you

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s