Mips Output syscall

 ̄綄美尐妖づ 提交于 2020-01-17 11:14:04

问题


li $s5, 2
add $a0, $s5, $0
li $v0, 4
syscall

Why system out is (null) in spim ?


回答1:


Looks like you are trying to print an int, but the system call code you are providing stands for "print string".

As you have no label called 2 (hence no string starting at address of label 2), the console prints out (null).

Try this

li $a0, 2 #integer to be printed
li $v0, 1 #system call code 1: print_int
syscall

Now it should print 2

Check out this table for syscall op codes.



来源:https://stackoverflow.com/questions/4580367/mips-output-syscall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!