I am trying to create a MIPS program where the user sets how many input values they want to enter(with a maximum of up to 5 values), and then input those values.
To do this I want to use a loop which would prompt the user to enter the value into the console, and then move that value from $v0 into the stack. But I am unsure of how to increment the stack pointer inside of a loop. I originally tried something like:
# Initialize t6 to zero, this is stack pointer value
add $t6, $zero, $zero
# Initialize stack to hold 5 register values
addi $sp, $sp, -20
# Load register value into stack
sw $vo, $t6($sp)
And then increment my stack pointer value by 4 each iteration. But I am getting a '"$t6": operand is of incorrect type' error. Is there a way to increment the stack pointer value inside of a loop?
Yes I do know that I can just do this with an array but I am trying to practice so that I can learn to properly use the stack. Thank you in advance for your help!