If I load the word 0x586978 in register 8 (MIPS)..?
Why does lbu 0($8), 1($8), and 2($8) not load 78, 69, and 58 respectively, it is loading the bits
Answers
husoski
Because that isn't what the lbu instruction does. LBU <r1>, <offset>(<r2>) This loads a byte from memory into the lowest (rightmost) 8 bits of the destination register <r1> and sets the remaining bits in <r1> to zeros. The address of the byte in memory is the contents of <r2> plus the value of the <offset>. Get used to this notation if you're going to be using assembly languages. It's very common for either () parentheses or [] brackets to be used around a register to indicate "indirect addressing". That means the register doesn't have the value that the instruction will use, but rather has the memory address of the value.
Was this article helpful?