如何解决MIPS:提取时地址超出范围
我是MIPS的初学者。在对MARS进行插入排序时,同时为隐含方法和非隐含方法获取时,遇到“地址超出范围”的相同错误。 这是我的隐蔽方法代码:
move $s0,$a1 # s0 = n
jal isort_rec
isort_rec:
subu $sp,$sp,16 #create its stack frame
sw $ra,8($sp) #save the return address to caller
sw $s0,4($sp) #callee saved registers
sw $s1,0($sp) #callee saved registers
ble $s0,$zero,out_rec #out the reclusive when n <= 0
subi $s0,$s0,1 #n=n-1
jal isort_rec #reclusive,saying that before it have been already sorted
subi $t2,1 # i=n-1
lw $s1,str($s0) # key = str[n] $s1
while_loop: #while loop
bltz $t2,out_loop #out_loop consequence1
lb $t1,0($t2) # str[i] $t1
bge $s1,$t1,out_loop #out_loop consequence2
addi $t3,$t2,1 # $t3 = i+1
lb $t4,0($t3) # str[i+1] $t4
sb $t4,0($t1) #str[i+1]=str[i]
subi $t2,1
j while_loop #loop
out_loop:
sb $t4,0($s1) # str[i+1] = key
#out_rec
out_rec:
lw $ra,8($sp) #restore the return address
lw $s0,4($sp) #restore $s0
lw $s1,0($sp) #restore $s1
addi $sp,16 #restore the stack pointer
jr $ra
错误发生在行
out_loop:
sb $t4,0($s1) # str[i+1] = key
这是$ s1的地址超出范围
感谢您阅读这么长的问题,如果您能帮助我进行调试,我将非常感谢 非常感谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。