Register 8:
FIELD3 (before):
FIELD3 (after):
12 34 56 78
not significant
34 56 78
As another example:
Machine Format Op Code 8E 9 5 * * * * Register Format STCM 9,8'0101',FIELD2 Register 9: 01 23 45 67
FIELD2 (before): not significant
FIELD2 (after): 23 67 STORE MULTIPLE (STM)
Assume that the contents of general
registers 14, 15, 0, and 1 are to be
stored in consecutive four-byte fields
starting with location 4050 and that:
Register 14 contains 00 00 25 63.
Register 15 contains 00 01 27 36.
Register 0 contains 12 43 00 62.
Register 1 contains 73 26 12 57.
Register 6 contains 00 00 40 00. The initial contents of locations 4050-405F are not significant.
The STORE MULTIPLE instruction allows
the use of just one instruction to store
the contents of the four registers:
Machine Format Op Code 90 E 1 6 050
1
Assembler Format
STM 14,1,X'50'(6)
After the instruction is executed:
Locations 4050-4053 contain 00 00 25
63.
Locations 4054-4057 contain 00 01 27
36.
Locations 4058-4058 contain 12 43 00 62.
Locations 405C-405F contain 73 26 12
57.
TEST UNDER MASK (TM)
The TEST UNDER MASK instruction examines
selected bits of a byte and sets the
condition code accordingly. For
example, assume that:
Storage location 9999 contains F8.
Register 7 contains 00 00 99 90. Assume the instruction to be:
Machine Format Op Code 91 C3 7
Assembler Format
TM 9(7),8'11000011' The instruction tests only those bits of
the byte in storage for which the mask
bits are ones:
F8 = 1111 1011{2} Mask = 1100 0011{2} Test = 11xx xx11{2} Condition code 3 is set: all selected
bits in the test result are ones. (The
bits marked "x" are ignored.)
If location 9999 had contained 89, the
test would have been:
89 = 1011 1001{2} Mask = 1100 0011{2} Test = 10xx xx01{2} Condition code 1 is set: the selected
bits are both zeros and ones.
If location 9999 had contained 3C, the
test would have been: 3C = 0011 1100{2} Mask = 1100 0011{2} Test = OOxx xxOO{2} Condition code 0 is set:
bits are zeros.
all selected
Note: Storage location 9999 remains
unchanged.
Appendix A. Number Representation and Instruction-Use Examples A-27
TRANSLATE CTR) The TRANSLATE instruction can be used to
translate data from any character code
to any other desired code, provided that
each character code consists of eight bits or fewer. An appropriate transĀ­
lation table is required in storage.
In the following example, EBCDIC code ;s
translated to ASCII code. The first
step is to create a 256-byte table in
storage locations 1000-10FF. This table
contains the characters of the ASCII code in the sequence of the binary
representation of the EBCDIC code; that
is, the ASCII representation of a charĀ­
acter is placed in storage at the
starting address of the table plus the binary value of the EBCDIC represenĀ­
tation of the same character.
For simplicity, the example shows only
the part of the table containing the decimal digits: 10FO 10F9 Assume that the four-byte field at storĀ­
age location 2100 contains the EBCDIC code for the digits 1984:
Locations 2100-2103 contain Fl F9 F8
F4.
Register 12 contains 00 00 21 00. Register 15 contains 00 00 10 00. As the instruction:
Machine Format Op Code L D:z DC 03 C 000 I F 0001 Assembler Format Op Code D1(L,B1),D:z(B:z) TR 0(4,12),0(15) A-28 System/370 Principles of Operation is executed, the binary value of each EBCDIC byte is added to the starting
address of the table, and the resulting
address is used to fetch an ASCII byte:
Table starting address: 1000 First EBCDIC byte: F1
Address of ASCII byte: 10F1 After execution of the instruction:
Locations 2100-2103 contain 31 39 38
34.
Thus, the ASCII code for the digits 1984
has replaced the EBCDIC code in the
four-byte field at storage location 2100. TRANSLATE AND TEST (TRT)
The TRANSLATE AND TEST instruction can be used to scan a data field for characĀ­
ters with a special meaning. To indiĀ­
cate which characters have a special
meaning, a table similar to the one used
for the TRANSLATE instruction is set up,
except that zeros in the table indicate
characters without any special meaning
and nonzero values indicate characters
with a special meaning.
The figure "Translate-and-Test Table"
that follows has been set up to distinĀ­
guish alphameric characters (A to Z and
o to 9) from blanks, certain special
symbols, and all other characters which
are considered invalid. EBCDIC coding
is assumed. The 256-byte table is
assumed stored at locations 2000-20FF.
Previous Page Next Page