MIPS程序没有给出正确的输出

时间:2016-02-22 17:00:25

标签: loops assembly mips

我正在编写一个程序,将用户的10个数字转换为.word。该计划是:

.data
msg1: .asciiz"Ener the number: "

fibs: .word 0,0,0,0,0,0,0,0,0,0
.text

main:
li $t0, 0

loop:  # (loop condition, TODO)
bgt $t0,9 ,exit
li $t1, 0 # i = 0

la $a0,msg1 # display prompt string
li $v0,4
syscall
li $v0,5 # read 1st integer into $t0
syscall
move $t2,$v0
lw $t2, fibs($t1) # fib = fibs[i]
addi $t1, $t1, 4 # i++ <= +4
j loop
exit:
move $a0,$t1 # output sum
li $v0,1
syscall
li $v0, 10 # exit the program
syscall

然而,循环永远不会结束并且不断地接受输入...我希望它停止并向我显示输入10个整数后输入的数字

0 个答案:

没有答案