0xFFFFFFA4
Bit 7 of 0xA4 is 1, so
lb
extends
that bit to all high order three bytes of $10
.
Loading
and storing bytes is used
for processing text and for low-level
systems programs
(such as assemblers and operating systems).
Graphics programs, also, make frequent use
of these operations.
Both operations could be done using
lw
and
sw
along
with bit manipulation instructions,
but it is convenient to have byte-length load and store.
There is an instruction for storing a byte:
sb t,off(b) # The byte at off+b <— low-order # byte from register $t. # b is a base register. # off is 16-bit two's complement.
There is no need for two "store byte" instructions. Whatever is in the low-order byte of the register is copied to memory. The rest of the register is ignored. Of course, the register does not change.