A little intro before I just type the program. What is multiplication exactly?
Repeated addition of the number.
So if I was to perform 2 x 3, I'd get the answer by adding 2 three times. 2 + 2 + 2.
Take 4 registers. Say A, B, C, D.
A (Accumulator) should store the Product.
B should store the carry, if any.
C should store the first number. (like 2)
D should store the second number. (like 3)
PROGRAM:
RST1 is a software interrupt which can be used by programmers to interrupt the program. Preferred over HLT because that requires a reset using one of the physical buttons of the kit.
|