I know that I need to do repeated addition, but I'm having trouble with the loops; I just do not understand them at all.
Here is a program that multiplies a number by 2, without a loop.
INP
STA num1
LDA num1
ADD num1
STA num1
OUT
HLT
num1 DAT
I know that I need to add a loop, but I'm just lost. Where do I put the loop? How do I construct a loop with the LMC's branch commands?
The end result of my project is a program that will multiply two numbers together, depending on what the user inputs. For example, if 4 and 5 were input, the program would carry out the equation 4 + 4 + 4 + 4 + 4 = 20. I do not know how to construct a loop to carry this out, and I've been staring blankly at the instructions set for days.