Debugging MIPS和Assembly查找参数块的部分
在函数中,给定的参数包含一个参数块。在该参数块中,前两部分包含单独的字符串,第三部分将存储组合字符串。如何确定参数块各部分的地址位置?执行索引或间接寻址 下面是一个例子:Debugging MIPS和Assembly查找参数块的部分,debugging,assembly,mips,Debugging,Assembly,Mips,在函数中,给定的参数包含一个参数块。在该参数块中,前两部分包含单独的字符串,第三部分将存储组合字符串。如何确定参数块各部分的地址位置?执行索引或间接寻址 下面是一个例子: .data .align 2 problem1: .word str_a1 # First number .word str_a2 # Second number .word buf_a # Place to store the result .w
.data
.align 2
problem1:
.word str_a1 # First number
.word str_a2 # Second number
.word buf_a # Place to store the result
.word 1 # Length of both numbers and result buf
.word out_a # Where to start printing the answer
.text
...
la $a0,problem # Address of parameters for
jal print_label # problem 1, and do it.
print_label:
...
move $s0, $a0 # copy the loc of the parm block to s0
li $v0, 4 # print 1st number
lw $a0, 0($s0)
syscall
li $v0, 4 # print 2nd number
lw $a0, 4($s0) # Indexing!
syscall
li $v0, 4 # print newline at end
la $a0, result3
syscall
标签表示是不相关的。本质上,$a0的内容被复制到$s0中,并通过索引进行访问。如果你要增加它的“指针”,那就是间接位移
执行任何操作,它们都可以保存在参数块$a0中的位移位置,然后按照标签问题1所示进行读取。您能举个例子吗?标签是一个地址,您需要某个对象的地址,只需在那里放置一个唯一的标签。是的。寄存器a0是参数块的地址。对于该地址,它包含For单词。1.字符串的地址。2.字符串的地址。3.另一个字符串4的地址。字符串的长度。如何访问这些值?