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.
我想创建一个这样的子程序:
但是我们不应该使用寄存器和内存来保存当前数字。我们必须通过更改代码(自修改)来解决这个问题。有什么办法吗?
这是我找到的解决方案:
# subroutine nextInt: # return value is in $v0 add $v0,$zero,0 la $t0,nextInt # load subroutine address lw $t1,0($t0) # load content of address addi $t1,$t1,1 # change content (increment) sw $t1,0($t0) # save jr $ra