Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个用户输入字符串的程序。该字符串默认存储在寄存器 $v0 中,但我想将 $v0 中的数据复制到字符串标签,这样如果我在程序中将 $v0 用于其他目的,用户输入就不会损坏。我弄清楚该怎么做。如果有人能告诉我怎么做,我会很高兴。
问候
在Spim中,从用户那里读取字符串的服务是 service 8,它作为参数:
$a0
$a1
返回syscall后,缓冲区将被输入文本(最多$a1字节)覆盖,$v0不受影响
$v0
示例用法:
.data buffer: .space 128 .text la $a0, buffer li $a1, 128 # maximum number of bytes to be read li $v0, 8 syscall