MIPS Assembly – lui $t0, 4097?

4097 = 1001 hex

so, the first instruction puts 0x10010000 into register t0. lui is “load upper immediate”, with “upper” meaning the upper 16 bits, and “immediate” meaning that you are giving it a literal value (4097). 4097 as an “upper” value becomes 0x10010000.

ori is “or immediate”, with 8 being the immediate value, so the resulting address in a0 is 0x10010008, which is the address where Aarray lives.

The final instruction lw is “load word” which loads from the memory address in t0 (which at this point is still just 0x10010000) plus 4 bytes (the 4 is an offset from t0 and results in an address where ALength lives) 4 bytes of data into a1.

Leave a Comment