CSE 111, Fall 2000

#### HW #12: P88 ASSEMBLY-LANGUAGE PROGRAMMING

Neither of the following problems requires the use of the computer. You should do them with pencil and paper.

Both problems ask you to hand-trace a P88 assembly-language program. The best way to do this is to make a table, with one column for each of the CPU registers and memory registers that you need to keep track of. The only CPU registers you will need to keep track of are AX (the accumulator) and CF (the condition flag). The memory registers you will need to keep track of will depend on the program. Then each row of the table will correspond to a step of the program.

1. Do Biermann, p. 268, #1, which asks you to determine what a certain P88 assembly-language program does.

   The way to do this is to hand-trace the program on several different inputs, so that you can figure out what input-output relation it computes. For this HW, please try at least the following three inputs: -7, 0, 7.

   However, note that it will not be enough to say that input -7 produces output x, input 0 produces output y, and input 7 produces output z. Instead, you must say what the input-output behavior of the program is in general, so that if I asked you what its output would be for, say, -254 or, say, 32, you would be able to tell me without having to hand-trace the program.

2. Write a P88 assembly-language program that inputs 3 integers and outputs their product. Be sure to hand-trace your program to demonstrate that it works.

#### DUE AT THE START OF LECTURE, WEDNESDAY, DEC. 6