stb

Store Byte

stb RS, D(RA)

Stores the low 8 bits of a register to memory.

Details

Store the low 8 bits of RS to the byte in memory at the effective address formed by adding the displacement D (sign-extended) to RA, or to the displacement alone if RA is 0. This is a Base category instruction with no status field updates.

Pseudocode Operation

EA ← EXTS(D, 16) + (RA | 0)
MEM(EA, 1) ← RS[56:63]

Programming Note

The stb instruction is commonly used to store a single byte from a register into memory. Ensure that the destination address is properly aligned for optimal performance and avoid accessing invalid or protected memory regions to prevent exceptions.

Example

stb r3, 0(r4)

// Store byte from r3 to address r4.

Encoding

Binary Layout
10
0
DS
6
RS
11
RA
16
SIMM[15:0]
 
Format D-form
Opcode 0x98000000
Extension Base

Operands

  • RS
    Source Register
  • D
    Displacement
  • RA
    Base Register
  • EA
    Effective Address