area cannot be used. Because TEST AND SET per­
mits no other CPU access to the test byte between
the moment of fetching (for testing) and the mo­
ment of storing all ones (setting), the possibility is
eliminated of a second program's testing the byte
before the first program is able to set it.
It should-be noted that TEST AND SET does not
interlock against storage accesses by channels.
Test Under Mask
TM lSI] 91 D1
o 8 16 20 31
The stat6Jt)f the first-operand bits selected by a mask
is used to set the condition code.
The byte of immediate data, 12, is used as an
eight-bit mask. The bits of the mask are made to
correspond one for one with the bits of the character
in storage specified by the first-operand address.
A mask bit of one indicates that the storage bit is
to be tested. When the mask bit is ,zero, the storage
bit is ignored. When all storage bits thus selected
are zero, the condition code is made O. The code is
also made 0 when the mask is all zeros. When the
selected bits are all ones, the code is made 3; other­
wise, the code is made 1. The character in storage is
not changed.
Access exceptions associated with the storage
operand are recognized for one byte, even when the
mask is all zeros.
Resulting Condition Code:
o Selected bits all zeros; or the mask is all zeros
1 Selected bits mixed zeros and ones
2 -
3 Selected bits all ones
Program Exceptions:
Access (fetch, operand 1)
Translate
[SS]
The eight-bit bytes of the first operand are used as
arguments to reference the list designated by the
second-operand address. Each eight-bit function
byte selected from the list replaces the correspond­
ing argument in the first operand.
The L field applies only to the first operand.
The bytes of the first operand are selected one by
one for translation, proceeding left to right. Each
argument byte is added to the initial second-operand
address. The addition is performed following the
rules for address arithmetic, with the argument byte
treated as an eight-bit unsigned integer and extended
with high-order zeros. The sum is used as the ad­
dress of the function byte, which then replaces the
original argument byte.
The operation proceeds until the first-operand
field is exhausted. The list is not altered unless an
overlap occurs.
When the operands overlap, the result is obtained
as if each result byte were stored immediately after
the corresponding function byte is fetched.
Condition Code:
The code remains unchanged.
Program Exceptions:
Access (fetch, operand 2; fetch and store, oper­
and 1) PTogranumrnng The instruction TRANSLATE may be used to con­
vert data from one code to another code.
Another purpose for which the instruction may be
used is to rearrange data. This may be accomplished
by placing a pattern in the destination area, by desig­
nating the pattern as the first operand of TRANS­
LATE, and by designating the data that is to be re­
arranged as the second operand. Each byte of the
pattern contains an eight-bit number specifying the
byte destined for this position. Thus, when the in­
struction is executed, the pattern selects the bytes of
the second operand in the desired order.
Because the eight-bit argument byte is added to
the initial second-operand address to obtain the ad­
dress of a function byte, the list may contain 256
bytes. In cases where it is known that not all eight­
bit argument values will occur, it is possible to re­
duce the size of the list.
The fetch and subsequent store accesses to a par­
ticular byte in the first-operand field do not neces­
sarily occur one immediately after the other.
Translate and Test Lo-.-D---LD _L-----'----1-..fB, I 8 16 20 32 36 47 o
General Instructions 145
Page of G A22-7 0004 Revis.ed September 1, 1975
By TNL: GN22-0498
The eight-bit bytes of the first operand are used as
arguments to reference the list designated by the
second-operand address.
The L field applies only to the first operand.
Each eight-bit function byte thus selected from
the list is used to determine the continuation of the
operation. When the function byte is a zero, the
operation proceeds by fetching and translating the
next argument byte. When the function byte is
nonzero, the operation is completed by inserting the
relat.ed argument address in general register 1 and by
inserting the function byte in general register 2.
The bytes of the first operand are selected one by
one for translation, proceeding from left to right.
The first operand remains unchanged in storage.
Fetching of the function byte from the list is per­
formed as in TRANSLATE. The function byte re­
trieved from the list is inspected for the all-zero
combination.
When the function byte is zero, the operation
proceeds with the next operand byte. When the first­
operand field is exhausted before a nonzero function
byte is encountered, the operation is completed by
setting condition code O. The contents of general
registers 1 and 2 remain unchanged. "'hen the function byte is nonzero, the related
argument address is inserted in the low-order 24 bits
of gtmeral register 1. This address points to the ar­ gtim1ent last translated. The high-order eight bits of
register 1 remain unchanged. The function byte is
insetted in the low-order eight bits of general regis­
ter 2. Bits 0-23 of register 2 remain unchanged.
Condition code 1 is set when one or more argu­
ment bytes remain to be translated. Condition code
2 is set if the last function byte is the only nonzero
byte. Resu'iting Condition Code:
o All function bytes are zero
1 Nonzero function byte before the first operand
field is exhausted
2 The last function byte is the only nonzero byte
3 - Pros'ram Exceptiom: Access (fetch, operands 1 and 2)
Programming Note
The instruction TRANSLATE AND TEST may be
used to scan the first operand for characters with
spedal meaning. The second operand, or list, is set
up with all-zero function bytes for those characters
to be skipped over and with nonzero function bytes
for the characters to be detected.
146 System/370 Principles of Operation Unpack I F3 I L, I L2 I B, I o 8 12 16 20 32 36 47
The format of the second operand is changed from
packed to zoned, and the result is placed in the first­
operand location.
The digits and sign of the packed operand are
placed unchanged in the first-operand location, using
the zoned format. Zones with coding of 1111 are
supplied for all bytes except the low-order byte,
which receives the sign of the packed operand. The
operand sign and digits are not checked for valid
codes.
The result is obtained as if the fields were pro­
cessed right to left. The second operand is extended
with high-order zero digits before unpacking, if nec­
essary. If the first-operand field is too short to con­
tain all significant digits of the second operand, the
remaining high-order digits are ignored.
When the operands overlap, the result is obtained
as if the operands were processed one byte at a time
and each result byte were stored immediately after
the necessary operand byte is fetched. The entire
rightmost second-operand byte is used in forming
the first result byte. For the remainder of the field,
information for two result bytes is obtained from a
single second-operand byte, and the high-order digit
of the byte remains available and is not refetched.
Thus, two result bytes are stored immediately after
fetching a single operand byte.
Condition Code:
The code remains unchanged.
Program Exceptions:
Access (fetch, operand 2; store, operand 1)
Programming Notes
A field that is to be unpacked can be destroyed by
improper overlapping. If it is desired to save storage
space for unpacking by overlapping the operand
fields, the low-order position of the first operand
must be to the right of the low-order position of the
second operand by the number of bytes in the sec­
ond operand minus two. If only one or two bytes are . to be unpacked, the low-order positions of the two
operands may coincide.
Previous Page Next Page