Translate (TRN)/OP=15

Format

OP AF BF A Syllable B Syllable C Syllable

OP = 15

AFBF Number of digits or characters to be translated. A value of 0000 is equal to a length of 10,000 units. AF or BF may be indirect. A literal flag will cause an Invalid Instruction (IEX = 21) fault. See Compatibility Notes A.14.1.

The A Syllable is the address of the source field to be translated. Address may be indexed, indirect or extended. The final address controller data type may be UN, SN or UA.
The B Syllable is the address of the translate table. Address may be indexed, indirect or extended. The final address controller data type is ignored. Some processors have restrictions on this address. See Compatibility Notes A.14.4.
The C Syllable is the address of the destination field. Address may be indexed, indirect or extended. The final address controller data type must be UA or UN. Use of SN data type will cause an Invalid Instruction fault (IEX = 03). See Compatibility Notes A.14.2.

Function

The Translate instruction substitutes a character from the translate table in the B field for each digit or character in the source A field and moves the substituted character, or the low-order digit of that character to the destination C field.

If the A field's data type is UN or SN, assume a EBCDIC numeric subset zone (F) before translation. If SN, the first digit (sign) is ignored.

If the final C address controller data type is UN, store only the digit portion of each translated character.

Each A field character itself is used to calculate an offset to the B address. The character found at B plus offset is substituted for the A field character and moved to the C field.

The offset can be calculated by mapping the bits of the A field character to form a three digit offset value. The high order three bits of the source byte are zero extended to become the low-order three bits of the first offset digit. The next three bits of the source byte are zero extended to become the low-order three bits of the second offset digit. The final two bits are shifted left one bit position (adding a low-order zero bit) and the three resulting bits are zero-extended to become the low-order three bits of the third and final offset digit. A tabulation of offsets for all possible characters is here.

Overflow/Comparison Flags

The Overflow Toggle and Comparison Flags are unchanged by this instruction.

Overlap

If the A and C data types are both UA or both UN, the A and C fields may totally overlap. All other forms of overlap may produce incompatible results. See Compatibility Notes A.14.3.

Examples

Example (1) Translate One Character

OP AFBF A Syllable B Syllable C Syllable
15 0001 A Field (UA) B Field C Field (UA)
                    BEFORE              AFTER
   A Field            C6                 C6
   B Field+614        7C                 7C
   C Field            nn                 7C
   Comparison Flags   nn              unchanged
   Overflow Flag      nn              unchanged
instructions/trn.txt · Last modified: 2008/11/25 11:20 by scott
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki