将 10 个整数添加到 $t0 中并打印结果,不确定实现是否正确以及为什么不打印?火星 MIPS 组装
.data
a1: .word 2
a2: .word 3
a3: .word 5
a4: .word 7
a5: .word 11
a6: .word 13
a7: .word 17
a8: .word 19
a9: .word 23
a10: .word 29
main:
lw $t1,a1
add $t0,$t0,$t1
lw $t1,a2
add $t0,$t0,$t1
lw $t1,a3
add $t0,$t0,$t1
lw $t1,a4
add $t0,$t0,$t1
lw $t1,a5
add $t0,$t0,$t1
lw $t1,a6
add $t0,$t0,$t1
lw $t1,a7
add $t0,$t0,$t1
lw $t1,a8
add $t0,$t0,$t1
lw $t1,a9
add $t0,$t0,$t1
lw $t1,a10
add $t0,$t0,$t1
li $v0, 1
lw $a0, $t0
syscall
li $v0, 10
syscall
我想了解我是否将标签中存储的整数正确添加到 $t0 中。如果正确实现,为什么我无法打印 $t0 中存储的值?
.data
a1: .word 2
a2: .word 3
a3: .word 5
a4: .word 7
a5: .word 11
a6: .word 13
a7: .word 17
a8: .word 19
a9: .word 23
a10: .word 29
main:
lw $t1,a1
add $t0,$t0,$t1
lw $t1,a2
add $t0,$t0,$t1
lw $t1,a3
add $t0,$t0,$t1
lw $t1,a4
add $t0,$t0,$t1
lw $t1,a5
add $t0,$t0,$t1
lw $t1,a6
add $t0,$t0,$t1
lw $t1,a7
add $t0,$t0,$t1
lw $t1,a8
add $t0,$t0,$t1
lw $t1,a9
add $t0,$t0,$t1
lw $t1,a10
add $t0,$t0,$t1
li $v0, 1
lw $a0, $t0
syscall
li $v0, 10
syscall
I want to understand if I am adding the integers stored in labels correctly in $t0. and if it is correctly implemented why am I not able to print the value stored in $t0?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论