
这条指令。是分配一个word类型的空间给变量a,并初始化成-12。其具体的地址,在编程的时候“不知道”。必须在整个汇编程序汇编完之后,连接,并可能“重定位”,这些变量的地址才会真正知道。
编译时,开发工具通常都会生成类似于“.map”和“.lst”之类的文件,里面会有详细的变量和函数之类的地址信息。具体文件,得查阅MIPS汇编程序开发工具的相关手册(抱歉,我手边没有)。
有问题继续交流,谢谢。
# Assume the size of element in array A and B is 4 bytes.lw $t0, 16($s7) # Load B[4] into $t0
mul $t1, $t0, 4 # Compute the offset (B[4] * 4 bytes)
add $t2, $s6, $t1 # Compute the address of A[B[4]]
lw $t3, 0($t2) # Load A[B[4]] into $t3
sub $s0, $s1, $t3 # Compute f = g - A[B[4]]
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)