MIPS Assembly/Memory Instructions
< MIPS AssemblyLoad and store instructions use a special syntax:
instr rt, imm(rs)
The memory address used for the load or store is rs + imm. The immediate is sign-extended.
Load Instructions
|
lbu | |
I Type |
Loads a byte and does not sign-extend the value.
|
lhu | |
I Type |
Loads a halfword, or two bytes, and does not sign-extend the value. The halfword must be aligned (i.e., it must start at an even address).
|
lw | |
I Type |
Loads a word (four-bytes) from memory. The word must be aligned (i.e., the last two bits of the address must be zero).
Store Instructions
|
sb | |
I Type |
Stores the least significant (rightmost) byte of rt to memory.
|
sh | |
I Type |
Stores the least significant (rightmost) halfword of rt to memory.
|
sw | |
I Type |
Stores the contents of rt in memory.
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.