CS 10, Fall 1997 (Section 1)

Lab 10, Part II: Assembly Language


Assignment for next lab


Lab Instructions

Turn to the PIPPIN User's Guide on p. 188 in your book and read through the summaries of each command. Notice that PIPPIN gives us commands for addition and subtraction (ADD, ADI, SBD, SBI), but not multiplication. Your goal today is to use the Apple MacPippin stack to write a PIPPIN program which will perform multiplication of two non-negative integers.

Assume that the two integers to multiply will be stored in memory cells 14 and 15. Your PIPPIN program should compute their product and store it in cell 16.

Below is an algorithm for performing multiplication through a series of repeated additions. It assumes that the two numbers to be multiplied are stored in cells 14 and 15, and stores their product in cell 16:

  1. Initialize the contents of cell 16 to 0.

  2. If cell 15 contains the value 0, then go to step 3. If cell 15 contains a value a greater than 0, then perform the following steps:

  3. Halt

Refer to the PIPPIN User's Guide on p. 188 to help you implement this algoirthm as an assembly language program.

Call one of us over and show us your program when you have finished.

Hints :