Question: Our assembly language (see image) has no operator for multiplication. But multiplication can be performed by repeatedly adding one number to a running total and
Our assembly language (see image) has no operator for multiplication. But multiplication can be performed by repeatedly adding one number to a running total and reducing the other number by one until the second number becomes zero. Write an assembly language program that displays the product of two input numbers.

Message load x store x clear x add x increment x subtract x decrement x compare x x-> R R-> x 0 -> X R + x -> R X + 1 -> X R - X -> R X - 1 -> x if x > R then 100 -> CCR elseif x CCR elseif x = R then 010 -> CCR goto x goto xif CCR = 100 goto xif CCR = 010 goto xif CCR = 001 goto xif CCR != 010 store input in x output x jump x jumpgtx jumped x jumpit x jumpne x in x out x halt OK Figure 10.1 Typical Assembly Language Instruction Set Binary Op Code Operation Meaning + 0000 LOAD X CON(X) 0001 STORE X R CON(X) 0010 CLEAR X 0 CON(X) 0011 ADD X R+ CONX) 0100 INCREMENT X CON(X) + 1 CON(X) 0101 SUBTRACT X R-CON(X) R 0110 DECREMENT X CON(X) - 1 CON(X) 0111 COMPAREX if CON(X) > R then GT = 1 else 0 if CON(X) = R then EQ = 1 else 0 if CON(X)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
