公告
财富商城
积分规则
提问
发文
2019-09-04 08:21发布
再贱就再见
li $s5, 2 add $a0, $s5, $0 li $v0, 4 syscall
Why system out is (null) in spim ?
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).
2
(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.
最多设置5个标签!
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 label2
), the console prints out(null)
.Try this
Now it should print 2
Check out this table for syscall op codes.