variables f,g,h,i and j are assigned to registers $s0, $s1, $s2, $s3, and $s4 respectively
The base addresses for the arrays A and B are in registers $s6 and $s7
addi $t0, $s6, 4 #load the forth element of array A into $t0 add $t1, $s6, $0 #load the first element of array A into $t1 sw $t1, 0($t0) #store $t0(the forth element of array A) into $t1 lw $t0, 0($t0) #load $t0 into $t0 add $s0, $t1, $t0 #add $t1 and $t0 into $s0
comments are added by me and are my attempt at understanding the code
I really don't understand lines three and four. How did these temporary registers "become arrays"?
specifically the part '0($t0)' is what's confusing me. Wouldn't this imply that $t0 is an array and we're trying to access the first element of that array?
P.S. I have to convert this code to C after, so I'll post my conversion after I've gained a better understanding of this code.
Edited 4 Years Ago by steven.myers.3726: cleaning up code