STC is used to copy the rightmost byte of a register into main storage.  The register is represented by operand 1, and the main storage area is designated by operand 2.  Since STC is an RX instruction, the storage area can be designated by using an index register.

 

 

   The STC instruction above takes the rightmost byte of register 8 and copies it into the first byte of FIELDA, a field in main storage.  One advantage to STC is the ability to use an index register to move a single byte from a register to memory.  STC and IC are the only byte-oriented RX instructions.  In the following example we assume that register 5 contains x’000000C1’ and that register 7 contains x’00000003’. 

 

                         STC    R5,FIELDA(R7)   

 

The instruction above would store the character “A” (x’C1’) into the fourth byte of FIELDA.

 

    

    For the following examples, assume that R8 contains x’11223344’ and that R4 contains x’00000002’

 

          FIELDA   DC    X’AABBCCDD’

          FIELDB   DC    C’ABCD’

                                       Result:

                   STC   R8,FIELDA     FIELDA = x’44BBCCDD’

                   STC   R8,FIELDA(R4) FIELDA = x’AABB44DD’

                   STC   R8,FIELDB     FIELDB = x’44C2C3C4’

                   STC   R8,FIELDB(R4) FIELDB = x’C1C244C4’

1.  Remember that STC is a byte oriented instruction that only copies the rightmost byte of a register.  The companion to STC is IC (Insert Character).