MIPS-无法从创建的数组中检索值

时间:2018-10-13 22:30:57

标签: arrays mips32

在MIPS中,我创建了一个数组并分配了正确的空间量。数组的基地址为$ s3,我用值(1,2,3,4,5,6)填充了它。但是,当尝试获取第二个值(2)时,遇到错误。代码如下:

addi $t0, 0 #count = 0

loop_start:
beq $t0, $t2, exit_loop #loop condition
li $v0, 5 #take input from user
syscall
sw $v0, 0($s3) #store it into the array
addi $s3, 4 #move to the next element of the array

addi $t0, 4 #count++

j loop_start #latch onto the beginning of the loop

exit_loop:

lw $t7, 4($s3)
li $v0, 1
move $a0, $t7
syscall

0 个答案:

没有答案