为什么我没有从堆栈中获取 $a0 的存储值??我只得到改变的价值

问题描述 投票:0回答:0
string_insert:

addi $sp, $sp, -200
sw $a0, 0($sp)
#insertion point
add $t0, $a0, $a2

lb $t2, ($a1)
loop:
  beq $t2, $zero, end # If the character is null, exit the loop
  sb $t2, ($t0)           # Store the current character at the insertion point
  addi $t0, $t0, 1        # Increment the insertion point
  addi $a1, $a1, 1        # Move to the next character of the second string
  lb $t2, ($a1)           # Load the next character of the second string
  j loop

# End of loop
end:
sb $zero, ($t0)
lw $a0, 0($sp)
addi $sp, $sp, 200
li $v0, 4
move $a0, $a0
syscall
jr $ra

$a0 包含 hello,将其存储到堆栈后,我将其更改为 heabc。但是在取回它之后我没有打招呼。

mips
© www.soinside.com 2019 - 2024. All rights reserved.