The second operand occupies e;ght bytes in storage and has the format of packed
decimal data, as described in Chapter 8, "Decimal Instructions." It is checked
for valid sign and digit codes, and a
data exception is recognized when an
invalid code is detected.
The result of the conversion is a 32-bit
signed binary integer, which is placed in general register R t The maximum
positive number that can be converted
and still be contained in a 32-bit
register is 2,147,483,647; the maximum
negative number (the negative number
with the greatest absolute value) that
can be converted is -2,147,483,648. For
any decimal number outside this range,
the operation is completed by placing
the 32 rightmost bits of the binary
result in the register, and a fixed­
point-divide exception is recognized. Condition Code: unchanged.
The code remains
Program Exceptions:
Access (fetch, operand 2)
Data
Fixed-point divide
Programming Notes
1. An example of the use of the CONVERT TO BINARY instruction is
given in Appendix A.
2. When the second operand is
negative, the result is in two's­
complement notation.
3. The storage-operand references for CONVERT TO BINARY may be multiple­
access references. (See the
section "Storage-Operand Consisten­ cy" in Chapter 5, "Program Execution.") CONVERT TO DECIMAL o 8 12 16 20 31
The first operand is changed from binary
to decimal, and the result is stored at
the second-operand location. The first
operand is treated as a 32-bit signed
binary integer.
The result occupies eight bytes in stor­
age and is 1n the format for packed
decimal data, as described in Chapter 8, "Decimal Instructions." The rightmost
four bits of the result represent the sign. A positive sign ;s encoded as 1100; a negative sign is encoded as 1101. Condition Code: unchanged.
The code remains
Program Exceptions:
Access (store, operand 2)
Programming Notes
1. An example of the use of the CONVERT TO DECIMAL instruction is
given in Appendix A.
2. The number to be converted is a 32-bit signed binary integer obtained from a general register. Since 15 decimal digits are avail­
able for the result, and the deci­ mal equivalent of 31 bits requires
at most 10 decimal digits, an over­
flow cannot occur.
3. The storage-operand references for CONVERT TO DECIMAL may be
multiple-access references. (See
the section "Storage-Operand Consistency" in Chapter 5, "Program Execution.") DIVIDE
DR R t , R2 [RRl '10' I R t I R2 I 0 8 12 15 0 R
t
,D
2
(X
2
,B
2
) [RXl '50 ' I R t I X 2 I B2 O
2
0 8 12 16 20 31
The doubleword first operand (the divi­
dend) is divided by the second operand
(the divisor), and the remainder and the
quotient are placed at the first-operand
location.
The Rt field designates an even-odd pair
of general registers and must designate
an even-numbered register; otherwise, a
specification exception is recognized.
The dividend is treated as a 64-bit
signed binary integer. The divisor, the remainder, and the quotient are treated
as 32-bit signed binary integers. The
remainder is placed in general register Chapter 7. General Instructions 7-17
R t , and the quotient is placed in gener­
al register Rt + 1.
The sign of the quotient is determined
by the rules of algebra. The remainder
has the same sign as the dividend,
except that a zero quotient or a zero
remainder is always positive.
When the divisor is zero, or when the
magnitudes of the dividend and divisor
are such that the quotient cannot be
expressed by a 32-bit signed binary
integer, a fixed-point-divide exception
is recognized. This includes the case
of division of zero by zero.
Condition Code: The code remains
unchanged. Program Exceptions:
Access (fetch, operand 2 of D only)
Fixed-point divide
Specification
EXCLUSIVE OR XR R 11 R2 [RR]
, 17 ' I R t I R2 I 0 8 12 15
X R p D
2
(X
2
,B
2
)
[RX]
'57' I R t I X 2 I B2 D2
o 8 12 16 20 31
XI D1(Bt),I2
[SI]
'97 ' 12 B\ Dt 0 8 16 20 31
XC Dt(L,Bt),D2(B2) [SS] I I / I 'D7' L BI DI B2
/ 0 8 16 20 32 36 47
The EXCLUSIVE OR of the first and second
operands is placed at the first-operand
location.
The connective EXCLUSIVE OR is applied
to the operands bit by bit. A bit posi­
tion in the result is set to one if the
corresponding bit positions in the two
7-18 System/370 Principles of Operation
operands are unlike; otherwise, the
result bit is set to zero.
For EXCLUSIVE OR (XC), each operand is
processed left to right. When the oper­
ands overlap, the result is obtained as
if the operands were processed one byte
at a time and each result byte were
stored immediately after fetching the
necessary operand bytes.
For EXCLUSIVE OR (XI), the first operand
is one byte in length, and only one byte
is stored.
o
1
2
3
Result zero
Result not zero Program Exceptions:
Access (fetch, operand 2, X and XC;
fetch and store, operand 1, XI
and XC) Programming Notes 1. An example of the use of the EXCLU­
SIVE OR instruction is given in
Appendix A.
2. EXCLUSIVE OR may be used to invert
a bit, an operation particularly
useful in testing and setting
programmed binary bit switches.
3. A field EXCLUSIVE-ORed with itself
becomes all zeros. 4. For EXCLUSIVE OR (XR), the sequence
A EXCLUSIVE-OR B, B EXCLUSIVE-OR A,
A EXCLUSIVE-OR B results in the
exchange of the contents of A and B
without the use of an additional
general register.
5. Accesses to the first operand of
EXCLUSIVE OR (XI) and EXCLUSIVE OR (XC) consist in fetching a first­
operand byte from storage and
subsequently storing the updated
value. These fetch and store
accesses to a particular byte do
not necessarily occur one imme­
diately after the other. Thus,
EXCLUSIVE OR cannot be safely used
to update a location in storage if
the possibility exists that another CPU or a channel may also be updat­
ing the location. An example of
this effect is shown for OR (01) in
the section "Multiprogramming and
Multiprocessing Examples" in Appen­
dix A.
Previous Page Next Page