I am looking at this Little man computer problem:
Write a Little Monkey Computer program that can convert an n-bit binary number into a number using the base-10 number system. Display the natural number as output before halting the program.
The first input determines the value for n. It is assumed this value will be equal to four, or greater.
For example, if the first input is eight (8) then eight subsequent inputs are requested. If the subsequent inputs number were 1, 0, 0, 1, 0, 0, 0, 0 then the output would be 9.
n input values are provided by the user, one for each bit: The first of these is the least-significant bit.
The nth input is the most-significant bit.
My attempt:
IN
STO NUMBER
IN
STO A
IN
STO B
IN
STO C
IN
STO D
LOOPB: LDA FOUR
BRZ ENDB
SUB ONE
STO FOUR
LDA RESB
ADD B
STO RESB
BRP LOOP
ENDB:LDA RESB
OUT
HLT
ONE: DAT 1
EIGHT: DAT 8
FOUR: DAT 4
TWO: DAT 2
POWERONE: DAT 1
RESA: DAT 000
RESB: DAT 000
RESULT: DAT 000
NUMBER: DAT 0
A: DAT 0
B: DAT 0
C: DAT 0
D: DAT 0
I do not how to solve this question, how to make 00001001 would convert to 9 on LMC? I not sure how to do multiplication on LMC.