【发布时间】:2021-07-18 12:14:56
【问题描述】:
让我们有例如这个代码:
.data
msg: .asciiz "Hello world!" #message to be shown
.text
li $v0, 4 #instruction for string printing
la $a0, msg #indication of where the string is
syscall #make it print
“li”将调用指令来准备打印,“la”将使变量 msg 转到寄存器“a0”,我知道 syscall 应该打印消息,但它究竟是如何做到的呢?它怎么知道它必须打印哪个寄存器?因为我没有在系统调用中的任何地方指出要打印的寄存器(例如在语言 c 中,它可能类似于 printf("%s",msg)),但它知道无论如何它必须打印 $a0 而我没有知道如何以及为什么。
【问题讨论】: