0

我在尝试调试我的代码以使打印语句出现故障时遇到了真正的问题。我正在使用 MARS MIPS 模拟器。以下代码打印:

程度!测试学位!测试

什么时候应该打印

程度!测试

.data

test:       .ascii      "degree!\n"

test4:      .ascii      "test\n"

.text
main:
la  $a0, test
li  $v0, 4
syscall 

la  $a0, test4
li  $v0, 4
syscall 

j EXIT


EXIT:
4

2 回答 2

1

字符串不是以空值结尾的。使用.asciiz代替.ascii

于 2012-04-03T22:25:37.123 回答
1

您需要使用.asciiz而不是.ascii获取以 NULL 结尾的字符串。

于 2012-04-03T22:25:48.037 回答