stbx
Store Byte Indexed - 7C 00 00 1C
stbx

Instruction Syntax

Mnemonic Format Flags
stbx rS,rA,rB None

Instruction Encoding

0
1
1
1
1
1
S
S
S
S
S
A
A
A
A
A
B
B
B
B
B
0
0
0
0
0
0
0
0
0
0
0

Field Bits Description
Primary Opcode 0-5 011111 (0x1F)
rS 6-10 Source register
rA 11-15 Base register
rB 16-20 Index register
Reserved 21-29 000000000
Reserved 30-31 00

Operation

EA ← (rA) + (rB)
(EA) ← (rS)[24:31]

The effective address is calculated by adding the base register to the index register. The least significant byte of the source register is stored at the effective address.

Note: The stbx instruction stores the least significant byte (bits 24-31) of the source register to memory using indexed addressing.

Affected Registers

Memory

Examples

Basic Store Byte Indexed

# Store byte using indexed addressing
stbx r3, r4, r5     # Store byte from r3 at address r4 + r5

Array Access with Index

# Store byte in array using index register
li r4, array        # Load array base address
li r5, 2            # Index = 2
stbx r3, r4, r5     # Store byte at array[2]

Dynamic Addressing

# Store byte using dynamic index
li r4, base_addr    # Load base address
add r5, r6, r7      # Calculate index dynamically
stbx r3, r4, r5     # Store byte at base_addr + index

Related Instructions

stb, stbu, stbux, lbzx

Back to Index