stb (Store Byte) instruction
Purpose
Stores a byte of data from a general-purpose register into a specified location in memory.
Syntax
Bits | Value |
---|---|
0 - 5 | 38 |
6 - 10 | RS |
11 - 15 | RA |
16 - 31 | D |
Description
The stb instruction stores bits 24-31 of general-purpose register (GPR) RS into a byte of storage addressed by the effective address (EA).
If GPR RA is not 0, the EA is the sum of the contents of GPR RA and D, a 16-bit signed two's complement integer sign-extended to 32 bits. If GPR RA is 0, then the EA is D.
The stb instruction has one syntax form and does not affect the Fixed-Point Exception Register or Condition Register Field 0.
Parameters
Item | Description |
---|---|
RS | Specifies source general-purpose register of stored data. |
D | Specifies a 16-bit, signed two's complement integer sign-extended to 32 bits for EA calculation. |
RA | Specifies source general-purpose register for EA calculation. |
Examples
The following code stores bits 24-31 of GPR 6 into a location in memory:
.csect data[rw]
buffer: .long 0
# Assume GPR 4 contains address of csect data[rw].
# Assume GPR 6 contains 0x0000 0060.
.csect text[pr]
stb 6,buffer(4)
# 0x60 is now stored at the address of buffer.