ST is used to copy the fullword stored in the register specified by operand 1 into the fullword memory location specified by operand 2. Consider the following example,

 

ST R9,AFIELD

In this case, the contents of register 9 are copied to the fullword in memory denoted by AFIELD. This operation destroys the previous contents of AFIELD but leaves R9 unchanged.

 

Since ST is an RX instruction, an index register may be coded as part of operand 2. Notice that in the previous example, no index register was specified. When the index register is omitted, the assembler chooses R0, which does not contribute to the address. The following example illustrates this idea.

 

ST R9,AFIELD(R5)

 

The assembler converts AFIELD to a base register and displacement, while R5 is the index register. For instance, the expression AFIELD(R5) might (we can not determine the base register) be equivalent to the explicit address 0( R5,R3 ) - displacement = 0, index register = R5, base register = R3 (see Explicit Addressing). The effective address is computed by adding the base register contents to the index register contents plus the displacement. If the index register contains an 8, then AFIELD(R5) refers to the fullword that begins at an 8 byte displacement from the beginning byte of AFIELD. The following examples illustrate several explicit addresses that include an index register.

 

 

In the first explicit address, 4( R4, R3), the effective address is computed by adding the contents of base register 5, the contents of index register 3, and the displacement ( 1000 + 4 + 4 = 1008 ). The second address 0( R5, R3) is computed as 1000 + 8 + 0 = 1008, and the third address, 4( R5, R3 ) is computed to be 1000 + 8 + 4 = 100C (hexadecimal).

 

If an index register is not explicitly coded, as in the instruction ST R9,AFIELD, the assembler chooses R0 as the index register, which does not contribute to the effective address.

 

Some Unrelated STs

 

R7 = X00001000

R8 = X00000004

R9 = X00000008

AFIELD DC F20 AFIELD = X00000016

BFIELD DC F-1 BFIELD = XFFFFFFFF

CFIELD DC F0 CFIELD = X00000000

ST R7,AFIELD AFIELD = X00001000

ST R8,AFIELD AFIELD = X00000004

ST R8,BFIELD BFIELD = X00000004

ST R7,AFIELD(R8) CHANGES BFIELD TO X00001000

ST R7,AFIELD(R9) CHANGES CFIELD TO X00001000

1) Operand 2 should denote a fullword in memory. It is possible to store the contents of a register into 4 bytes of memory that are not aligned on a fullword, but the assembler will warn you that operand 2 is not properly aligned. If the field involved cannot be aligned conveniently, consider using STCM to copy the contents of a register into memory.