CS 207
Due Monday, September 16, 1996

Load the following program into the PDP8/E and run it. The program starts at address 0200, and expects the switch register to contain some number N at the time execution begins. The program computes some number, depending on the value of N, and puts the computed number into the accumulator before halting.

Your assignment is (1) to figure out what this program does, and (2) to comment the code as fully as you can. I recommend that you run the program a few times with a variety of small values of N. You should start to recognize a pattern. In class on Friday, we will look more closely at this program.


Addr     Instruction

0200     7201               CLA IAC
0201     3232               DCA A
0202     7201               CLA IAC
0203     3233               DCA B
0204     7404               OSR
0205     7041               CMA IAC
0206     3235               DCA NEGN
0207     2235               ISZ NEGN
0210     7410               SKP
0211     5227               JMP END
0212     2235               ISZ NEGN
0213     7410               SKP
0214     5227               JMP END

0215     7200     GUTS,     CLA
0216     1232               TAD A
0217     1233               TAD B
0220     3234               DCA C
0221     1233               TAD B
0222     3232               DCA A
0223     1234               TAD C
0224     3233               DCA B
0225     2235               ISZ NEGN
0226     5215               JMP GUTS

0227     7200      END,     CLA
0230     1233               TAD B
0231     7402               HLT

0232     0000      A,       0000
0233     0000      B,       0000
0234     0000      C,       0000
0235     0000      NEGN,    0000




Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057
(507) 663-4364, jondich@carleton.edu