The Subtract Register instruction performs 2s 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, x00000479, are subtracted from the contents of register 9 which contains x000003FA . The difference is x00000181 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 = XFFFFFFFE -2 IN 2S COMPLEMENT

R5 = X00000028 +40 IN 2S COMPLEMENT

R6 = X00000004 +4 IN 2S COMPLEMENT

SR R4,R4 R4 = X00000000 = 0

SR R5,R4 R4 = X0000002A = +42

SR R5,R6 R5 = X00000018 = +24

SR R6,R5 R6 = XFFFFFFE8 = -24