INP
STA numOne
OUT
INP
STA numTwo
OUT
LDA numOne
ADD numTwo
STA numThree
OUT
LDA numTwo
ADD numThree
STA numFour
OUT
LDA numThree
ADD numFour
STA numFive
OUT
LDA numFour
ADD numFive
STA numSix
OUT
LDA numFive
ADD numSix
STA numSeven
OUT
LDA numSix
ADD numSeven
STA numEight
OUT
LDA numSeven
ADD numEight
STA numNine
OUT
LDA numEight
ADD numNine
STA numTen
OUT
numOne dat
numTwo dat
numThree dat
numFour dat
numFive dat
numSix dat
numSeven dat
numEight dat
numNine dat
numTen dat
I am using the following code in Little Man Computer to output the first 10 Fibonacci sequence terms, however I need to make a loop out of this, which will let me control the amount of iterations I want to be outputted.
From my understanding, I'd guess I would have to input 3 numbers - two of them being the first Fibonacci sequence terms, the third one being the amount of iterations I want to be outputted. But how can I achieve this?