15292 History of Computing

15292
History of Computing

SPRING 2020

COMPUTING ASSIGNMENT 3

image of PDP-11 console

ASSIGNMENT

Due: Monday, February 17 by 9:00AM

In the 1960s and 1970s (and even beyond), mini-computers were a new way to get into the world of computing without being tied to the large mainframes from manufacturers such as IBM. Mini-computers were smaller, requiring only a small part of a room, and these machines were designed so that users could create their own programs more easily than before.

Digital Equipment Corporation was the leading manufacturer of mini-computers, particularly with their PDP series, the most famous being the PDP-8. In this assignment, you will work with a PDP-11 simulator online to enter in a few programs as the console operator would. Note that the PDP series had the means to attach a punched tape reader and have the machine read much more elaborate programs from punched tape, but the programs you will write are relatively short so you can enter them directly on the PDP-11 front console. This assignment will give you the experience of programming in the early days when you had to enter code in the machine's language which you will see is very tedious and error-prone. (Have fun!)

The simulator is available to run at this website:

https://skn.noip.me/pdp11/pdp11.html

Here is a picture of the front console from the simulator with some notes on some of its features. (We will not explore the entire machine.)

PDP-11 simulator console

On the console, there are three rows of lights. The first row shows some monitoring functions for the computer, such as RUN (lit when a program is running). The second row shows the address of a word of memory and the third row shows the data stored at that address in memory. NOTE: The address and data are shown in OCTAL (base 8)!!! Every group of three lights represents an octal digit:

binary   000  001  010  011  100  101  110  111
octal      0    1    2    3    4    5    6    7
For example, in the picture above, the current address being displayed is 001401 in octal (0 000 001 100 000 001) and the data displayed is 000720 in octal (0 000 000 111 010 000). We will not use the leftmost 6 lights of the Address lights.

Below the lights are a set of 22 numbered entry switches that toggle (try them out by clicking them). These line up under the address and data rows so you can enter in an address or data value. We will not use switches #16 through #21; leave them as is.

There are also command switches at the bottom right:

LOAD ADRS (Load Address) - Loads the current setting of the entry switches into the Address lights.
EXAM (Examine) - Displays the data currently stored at the address displayed in the Address lights.
DEP (Deposit) - Stores the current setting of the entry switches into the next available Address based on the Address lights.
CONT (Continue) - Continue running the program where it had stopped last.
ENABLE/HALT - Enable the program for execution, or halt the program.
START - Start the program beginning at the address shown in the Address lights.

When you start the simulator, you will see that the machine boots up with a computation being performed on the data lights.

Assignment Instructions

In this assignment, you will enter two additional programs and get them to run. To demonstrate that you have entered the programs, you will record your work into a video that you will submit, along with a text file that answers some simple questions about the simulator and your work. You should practice your work first to make sure that you can do it with little to no errors so that your video is as short as possible. Store the answers to the questions given below in a plain ASCII text file named pdp11answers.txt.

  1. Start the simulator. Observe that the machine boots up performing some operation on the Data lights. In your file pdp11answers.txt, explain what the booter is doing on the front console. Be more specific than just saying that it is changing the Data lights. What specific computation is it doing?

  2. You will now enter a new program starting at address (octal) 001000 that will create a "light chaser" (a single data light that circles round and round). Here is the program shown in octal, along with the corresponding assembly language instructions:

    Address  Data    Code
    001000   012700  mov #1, r0    (move the value 1 into register 0)
    001002   000001                (the value 1 for the previous command)
    001004   006100  rol r0        (rotate register 0 left one position)
    001006   000005  reset
    001010   000775  br .-4        (branch back 4 words, goto address 001000)
    

    To enter this program, follow these steps:

    1. Flip the ENABLE/HALT switch down to stop/halt the data display.
    2. Enter 001000 (octal) on the entry switches. (flip switch #9 up, all others down). - TYPO CORRECTED
    3. Press the LOAD ADRS switch to load 001000 into the Address lights.
    4. Enter 012700 (octal) on the entry switches. (flip up switches #12, #10, #8, #7, #6, and all others down)
    5. Press DEP to deposit this value at the current address.
    6. Enter 000001 (octal) on the entry switches.
    7. Press DEP to deposit this value in the next address. (Note that when you do this, the address automatically advances by 2. You only have to load the first address when you enter a program.)
    8. Enter 006100 (octal) on the entry switches and press DEP.
    9. Enter 000005 (octal) on the entry switches and press DEP.
    10. Enter 000775 (octal) on the entry switches and press DEP.

    Before you run your program, you should check to make sure each address has the correct data:

    1. Enter 001000 (octal) on the entry switches and press LOAD ADRS.
    2. Press EXAM to see what data is stored at octal address 001000.
    3. Press EXAM again to see what data is stored at octal address 001002.
    4. Press EXAM again to see what data is stored at octal address 001004.
    5. Press EXAM again to see what data is stored at octal address 001006.
    6. Press EXAM again to see what data is stored at octal address 001010.

    If all of the data values are correct, move on to the next step. Otherwise, go back and start over.

    Now you can run your program:

    1. Enter 001000 (octal) on the entry switches and press LOAD ADRS.
    2. Click the ENABLE/HALT switch to lift it to ENABLE mode.
    3. Click the START switch.

    You should see a single light in the Data section that races around and around. Congratulations! You just entered and ran your first PDP-11 program.

    Record your process of entering, checking and running the program into a video in MP4 or WMV format and name this lightchaser.mp4 or lightchaser.wmv. Practice a few times so that your video does not contain errors or wasted time. Please try to keep your video short.

    In your text file pdp11answers.txt, answer the following question: To make the light race to the right instead of left, you need to use the ror command (rotate right). How would this command be encoded at octal address 001004? (Hint: look in the PDP-11 Handbook in Chapter 4 for a list of PDP-11 instruction codes.)

  3. You will now enter another program that computes the sum of the positive integers from 1 to n (i.e. 1 + 2 + ... + n). Here is the program you will enter (do not worry about the assembly language mnemonics):

    Address  Data    Code
    001000   013702  mov @#sr, r2 (start)
    001002   177570  switch register
    001004   005000  clr r0
    001006   005001  clr r1
    001010   005200  inc r0 (loop)
    001012   060001  add r0, r1
    001014   020002  cmp r0, r2
    001016   001374  bne loop (branch if r0 != r2 to loop)
    001020   010100  mov r1, r0
    001022   000000  halt
    001024   000765  br start (branch to start instruction to execute again)
    

    Enter this program in the same manner as you did in the previous problem. Once entered, follow the steps in the previous problem to check your data entries to make sure they're correct before you try to run the program. (You must be very careful and deliberate here... it's VERY easy to make mistakes!)

    Once you are certain the program is entered correctly, run the program to compute the sum of the first 50 positive integers:

    1. Enter 001000 (octal) on the entry switches and press LOAD ADRS.
    2. Click the ENABLE/HALT switch to lift it to ENABLE mode.
    3. Enter the decimal value 50 on the entry switches IN OCTAL (000062).
    4. Click the START switch.

    Your program should run and halt, displaying the result in the Data lights. In your text file pdp11answers.txt, show that the results are correct by converting the final answer (shown in binary/octal) back to decimal. Show your work.

    You should record your process of entering, checking and running the program into a video in MP4 or WMV format and name this sum_to_n.mp4 or sum_to_n.wmv. Practice a few times so that your video does not contain errors or wasted time. Please try to keep your video short.

  4. Answer the following question in the pdp11answers.txt file: What does that white toggle switch do in the bottom row? Why do you think it is necessary?

OTHER FACTORS

Zip up all files (two videos and a text file) and hand in to Autolab.

Assignments will be graded out of 100 points. For maximum credit (100 points), your videos must show correct entry, checking and execution of the two programs along with correct answers for the four questions posed. Points may be deducted for videos that run excessively long.

Submissions may be handed in up one lecture late with a 20% penalty.

Many thanks to Paul Nankervis for the simulator and retrocmp.com for the sample programs!