如何停止装配mips读取\ n

时间:2017-12-27 22:29:13

标签: string assembly mips paragraph mars-simulator

我正在使用MARS在MIPS Assembly中编程。 我正在使用:

读取字符串
li   $v0,8           #take in input
la   $a0, buffer     #load byte space into address
li   $a1, 20         # allot the byte space for string
move $t0,$a0         #save string to t0
syscall

使用以下方式打印:

la    $a0, buffer    #reload byte space to primary address
move  $a0,$t0        # primary address = t0 address (load pointer)
li    $v0,4          # print string
syscall

但是,当我打印字符串时,它会打印附加到字符串的段落。我相信这是因为我按下“输入”才能进入下一步。如何删除此'\n'?保留它是不可能的,否则我的程序结果是:

The string you wrote is example
[\n which I didn't want to happen]and it has 8 characters.

我希望它是:The string you wrote is example and it has 8 characters.

0 个答案:

没有答案