Question: Write an assembly language program to multiply two 16-bit integers for the LC-3 computer. Multiplication is achieved by addition as in: X.Y = X +

Write an assembly language program to multiply two 16-bit integers for the LC-3 computer. Multiplication is achieved by addition as in:

X.Y = X + X + X. + X

Y times

The program will prompt for and read two numbers, the multiplicand and the multiplier, and store them in registers R1 and R2 after converting them to decimal from ASCII. You will define two constants PLUSx30 (x30) and MINUSx30 (x-30) to convert the numbers to and from ASCII. The program will use a loop to add the contents of R1 to itself by using the contents of R2 as a counter and decrementing R2 by 1 each time through the loop. The sum (that is, the product) will be accumulated in the R3. The loop will terminate when R2 reaches 0. R3 will now contain the product of R1 and R2.

The program will display the ASCII version of the product. Since we are not able to display mutli-digit numbers correctly, you should test multiplying numbers where the product does not exceed 9.

Next, you implement the multiplication algorithm in a subroutine, Name the subroutine Multiply. Since the multiply subroutine requires two parameters, you can pass the multiplicand and the multiplier in registers R1 and R2. You can use R0 to return the product to the calling program. You can use the previous program to test the Multiply subroutine.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!