

The Load Positive instruction copies 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.
LPR insures that the
contents of Operand 1 will be non-negative after the operation has completed if
an overflow has not occured. Positive
integers and zero are unchanged by this instruction. For negative 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
2 (Positive)
Operand 1 > 0 BH, BP
3 (Overflow)
Overflow BO
An overflow condition can
occur only when Operand 2 contains the maximum negative value that will fit in
a register (- 2,147,483,648). An
overflow occurs because the absolute value will not fit in a single register.
Consider the instruction
below.
LPR R5,R10
The contents of register 10
are examined and determined to be positive.
As a result, 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 is positive after
completion of the operation, the condition code is set to 2. The diagram below illustrates this
operation.

Some Unrelated LPR’s
R4 = X’FFFFFFFF’ -1
R5 = X’00000028’ +40
R6 = X’80000000’ MAXIMUM
NEGATIVE VALUE
R7 = X’00000000’ ZERO
LPR
R4,R5 R4 = X’00000028’ R5 =
X’00000028’ Cond. Code = Positive
LPR
R5,R4 R5 = X’00000001’ R4 =
X’FFFFFFFF’ Cond. Code = Positive
LPR
R5,R6 R5 = X’FFFFFFFF’ R6 =
X’80000000’ Cond. Code = Overflow
LPR
R6,R7 R6 = X’00000000’ R7 =
X’00000000’ Cond. Code = Zero
LPR
R4,R4 R4 = X’00000001’ Cond.
Code = Positive