sb

Store byte

Stores the low 8 bits of t1 at the address in t2 plus an offset.

RISC-V manual: sb

Used in

Forms

  • sb , ()

Pseudo-instructions

The assembler turns these into one or more real instructions.

Store the low-order 8 bits of $t1 into the effective memory byte address

  • Store to Address

Operands

t1
Any integer register, x0 to x31, or its named alias, such as zero, t0 or t6.
imm12
A signed 12-bit immediate, -2048 to 2047.
t2
An integer register. It may be the same register as t1.
imm32
A 32-bit immediate, -2147483648 to 4294967295.
label
A named address in the program, such as the start of a loop or a variable in .data.
# value is initialized and naturally aligned for this operation.
.data
value: .word 0
.text
la t0, value
li t1, 42
# Store 42 (byte 2A) at value; inspect Memory.
sb t1, 0(t0)