The Subtract Register instruction performs 2’s complement binary subtraction.  Operand 1 is a register containing a fullword integer.  Operand 2 specifies a register as well.  The fullword in Operand 2 is subtracted from the fullword in Operand 1,  and the difference replaces the contents of Operand 1.  Operand 2 in unchanged by this operation except when Operand 1 and 2 refer to the same register.  Consider the following example,    

 

                            SR    R9,R8

               

 

 

   The contents of the fullword in register 8, x’00000479’, are subtracted from the contents of register 9 which contains x’000003FA’ .  The difference is x’00000181’  and replaces the previous value in R9.  The contents of register 8 are unchanged by this operation.

 

   The condition code is set by this instruction to zero if the result is zero, minus if the result is negative, and plus if the result is positive.

 

            Some Unrelated Subtract Registers

 

              R4 =  X’FFFFFFFE’   -2 IN 2’S COMPLEMENT

              R5 =  X’00000028’  +40 IN 2’S COMPLEMENT

              R6 =  X’00000004’   +4 IN 2’S COMPLEMENT

  

              SR    R4,R4    R4 = X’00000000’ = 0

              SR    R5,R4    R4 = X’0000002A’ = +42

              SR    R5,R6    R5 = X’00000018’ = +24

              SR    R6,R5    R6 = X’FFFFFFE8’ = -24