7.5.100 TRANSLATE AND TEST
TRT D1(L,B1),D2(B2) [SS]
The bytes of the first operand are used as eight-bit arguments to select
function bytes from a list designated by the second-operand address. The
first nonzero function byte is inserted in general register 2, and the
related argument address in general register 1.
The L field specifies the length of only the first operand.
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. Calculation of the address of the function byte is performed as in the TRANSLATE instruction. The function byte retrieved from the list is inspected for a value of zero.
When the function byte is zero, the operation proceeds with the next byte of the first operand. When the first-operand field is exhausted before a nonzero function byte is encountered, the operation is completed by setting condition code 0. The contents of general registers 1 and 2 remain unchanged.
When the function byte is nonzero, the operation is completed by inserting the function byte in general register 2 and the related argument address in general register 1. This address points to the argument byte last translated. The function byte replaces bits 24-31 of general register 2, and bits 0-23 of this register remain unchanged. In the 24-bit addressing mode, the address replaces bits 8-31 of general register 1, and bits 0-7 of this register remain unchanged. In the 31-bit addressing mode, the address replaces bits 1-31 of general register 1, and bit 0 of this register is set to zero.
When the function byte is nonzero, either condition code 1 or 2 is set, depending on whether the argument byte is the rightmost byte of the first operand. Condition code 1 is set if one or more argument bytes remain to be translated. Condition code 2 is set if no more argument bytes remain.
The contents of access register 1 always remain unchanged.
Access exceptions are recognized only for those bytes in the second operand which are actually required. Access exceptions are not recognized for those bytes in the first operand which are to the right of the first byte for which a nonzero function byte is obtained.
Resulting Condition Code:
All function bytes zero
Nonzero function byte; first-operand field not exhausted
Nonzero function byte; first-operand field exhausted
* Access (fetch, operands 1 and 2)
1. An example of the use of the TRANSLATE AND TEST instruction is given in Appendix A, "Number Representation and Instruction-Use Examples."
2. TRANSLATE AND TEST may be used to scan the first operand for characters with special 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.