Intermediate

Multiply Subroutine

Write a subroutine that multiplies two numbers.

Write a MULTIPLY subroutine that computes R0 * R1 and returns the result in R0.

Requirements:
• The subroutine label must be MULTIPLY

• Input: R0 and R1 contain the two numbers

• Output: R0 = R0 * R1

• Must save and restore all registers it uses (except R0)

• Must handle the case where either input is 0

• Main program should compute 6 * 7 = 42, then print '4' followed by '2'

To print a two-digit number:
• Divide by 10 to get the tens digit (count how many times you can subtract 10)

• The remainder is the ones digit

• Convert each to ASCII and print

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28