The Load Negative instruction copies the two’s complement of the absolute value of  the contents of the register specified by Operand 2, into the register specified by Operand 1.  The contents of Operand 2 are unchanged by this operation.  Recall that absolute value of an integer x, denoted by  | x | , is defined as follows,

 

                            | x |  =  x   if  x ³ 0  and | x | = -x   if x < 0

 

For example, | 7 | = 7 since 7 ³ 0, and | -5 | = 5 since -5 < 0.

 

   LNR insures that the contents of Operand 1 will be negative or zero after the operation has completed.  Negative integers and zero are unchanged by this instruction.  For positive integers, the two’s complement of the integer is placed in Operand 1.

 

   The condition code is set by this instruction based on the final contents of Operand 1.

 

                                    Condition Code         Meaning             Test With

 

                                       0   (Zero)                 Operand 1 = 0         BE, BZ

                                       1   (Negative)           Operand 1 <  0       BM, BL

                                     

An overflow condition can not occur.

 

Consider the instruction below.

 

                            LNR   R5,R10

 

The contents of register 10 are examined and determined to be positive.  As a result, the complement of the contents of register 10 are copied to register 5, destroying the previous value in register 5. Register 10, which contains a binary number equal to 120 in decimal, is unaffected by the operation.  Since the contents of R5 are negative after completion of the operation, the condition code is set to 1.  The diagram below illustrates this operation.

 

            

 

 

 

        Some Unrelated LNR’s

 

              R4 =  X’FFFFFFFF’  -1

              R5 =  X’00000028’  +40

              R6 =  X’80000000’  MAXIMUM NEGATIVE VALUE

              R7 =  X’00000000’  ZERO

  

 LNR    R4,R5   R4 = X’FFFFFFD8’ R5 = X’00000028’ Cond. Code = Negative

 LNR    R5,R4   R5 = X’FFFFFFFF’ R4 = X’FFFFFFFF’ Cond. Code = Negative

 LNR    R5,R6   R5 = X’80000000’ R6 = X’80000000’ Cond. Code = Negative

 LNR    R6,R7   R6 = X’00000000’ R7 = X’00000000’ Cond. Code = Zero

 LNR    R4,R4   R4 = X’FFFFFFFF’ Cond. Code = Negative