Appenclix A. Instruction Use Examples The following examples illustrate the use of many System/360 instructions. Note that these examples
closely approximate machine language to best illus­
trate the operation of the system. For clarity, the
mnemonic for each operation code is used instead of
the actual machine code. In addition, whenever possi­
ble, the contents of registers, storage locations, and so
on, are given in decimal notation rather than the actual
binary formats. When binary formats are used, they
are segmented into bytes (eight bits) for ease of visual
comparison.
Included at the end of this Appendix are program­
ming examples that utilize the assembly language
symbols and formats'.
Load Complement The two's complement of general register 4 is to be
placed into general register 2.
Assume:
Condition code = 2; greater than zero
Reg 2 (before) 00000000 00000000 00000010 11010110 Reg 4 00000000 00000000 01001001 11010101 The instruction is: Op Code
LCR 2 4
Reg 2 (after) 1111111111111111 1011011000101011 Reg 2 contains the two's complement of Reg 4.
Condition code setting = 1; less than zero.
Load Multiple
General registers 5, 6, and 7 are to be loaded from
consecutive words starting at 3200. Assume:
Reg 5 (before)
Reg 6 (before)
Reg 7 (before)
Reg 12
Loc 3200-,3203 Loc 3204-3207 Loc 3208-3211 The instruction is: Op Code
LM
Reg 5 (after)
Reg 6 (after)
Reg 7 (after)
5
R.
7 Condition code: unchanged.
122
12 00 00 75 63 00 00 01 26 00 32 76 45 00 00 30 00 00 12 57 27 00 00 25 63
73 26 00 12
D2 200 00 12 57 27 00 00 25 63
73 26 00 12 Compare The contents of register 4 are to be algebraically com­
pared with the contents of register 2.
Assume:
Reg 2
Reg 4
The instruction is: Op Code
CR 4 2 00 00 03 92 00 00 03 47
Condition code = 1; first operand low.
Divide (Fixed Point)
The contents of the even/odd pair of general registers
6 and 7 are to be divided by the contents of general
register 4.
Assume:
Reg 6 (before) 00000000 00000000 00000000 00000000 ( 1st Word)
Reg 7 (before) 0000000000000000 0000100011011110 = +2270 (.2ndWord)
Reg 4 00000000 00000000 00000000 00110010 = + 50 The instruction is: Op Code
DR 6 4
Heg 6 (after) 000000000000000000000000 00010100 ( remainder) = +20 Heg 7 (after) 00000000 000000000000000000101101 (quotient) = +45
Condition code: unchanged.
The instruction divides the contents of registers 6
and 7 by the content of register 4. The quotient re­
places the content of register 7, and the remainder
replaces the content of register 6. Convert to Binary
The signed, packed decimal field at double-word loca­
tion 1000-1007 is to be converted into a binary integer
and placed in general register 7.
Assume:
Reg 5
Reg 6
Loe 1000-1007 Reg 7 (before) 00 00 00 50 00 00 09 00 00 00 00 00 00 25 59 4+
11111111 111000001111011110111111
The instruction is: Op Code x, 0, CVB 7 5 6 50 Reg 7 (after) 00000000000000000110001111111010 Condition code: unchanged.
Convert to Decimal The binary contents of general register 3 are to be
converted into a packed decimal integer of 15 digits
and sign and stored in double-word location 2000. Assume: 00 00 00 40 00 00 18 60 Reg 4
Reg 15
Reg 3
Loc 2000 (before) 00000000 00000000 010 11 0 11 01000001 01 47 63 27 42 73 21 17
The instruction is:
op Code R, x, CVD I 3 4 15 100 Loc 2000 (after) 00 00 00 00 00 23 36 1 +
Condition code: unchanged.
Store Multiple The contents of general registers 14, 15, 0, and 1 are
to be stored in consecutive words starting with 4050. Assume:
Reg 14
Reg 15
Reg 0 Reg 1.
Reg 6
Loc 4050-4053 (before)
Loc 4054-4057 (before)
Loc 4058-4061 (before)
Loc 4062-4065 (before)
The instruction is: Op Code Ra 00 00 25 63 00 01 27 36
12 43 00 62
73 26 12 57 00 00 40 00 63 25 41 32
17 25 63 42 07 16 32 71
98 67 45 21 0, c=i_TM __ __ _____ 50 ____ Loc 4050-4053 (after)
Loc 4054-4057 (after)
Loc 4058-4061 (after)
Loc 4062-4065 (after)
Condition code: unchanged Decimal Add 00 00 25 63 00 01 27 36
12 43 00 62
73 26 12 57
The signed, packed decimal field at location 500-503 is to be added to the signed, packed decimal field at
location 2000-2002. Assume:
Reg 12
Reg 13
Loc 2000-2002 (before)
Loc 500-503 00 00 20 00 00 00 04 80 38 46 0- 01 1.2 34 5+
The instruction is: Op Code L, L, B, Loc 2000-2002 (after) 73 88 5+
Condition code = 2; sum is greater than zero. Zero and Add 0, 20 i'U The signed, packed decimal field at location 4500- 4502 is to be moved to location 4000-4004 with four
leading zeros in the result field.
Assume:
Reg 9
Loc 4000-4004 (before)
Loc 4500-4502 The instruction is: k 00 00 40 00 12 34 56 78 90 38 46 0- 0, a
O 2 500 i'U Loc 4000-4004 (after) 00 00 38 46 0- Condition code = 1.; sum is less than zero.
Compare Decimal The contents of location 700-703 are to be compared
algebraically with the contents of location 500-503. Assume:
Reg 12
Reg 13
Loc 700-703 Loc 500-503 The instruction is: 00 00 05 50 00 00 04 00 1.7 25 35 6+ 06 72 1.4 2+ 100 i'U Condition code = 2; first operand is high. Multiply Decimal The signed, packed decimal field in location 1200-1204 is to be multiplied by the signed, packed decimal field
in location 500-501, and the product is to be placed in
location 1200-1204. Assume:
Reg 4
Reg 6
Loc 1200-1.204 (before)
r ,oc 500-501 The instruction is: Op Code L, k Bl
Loc 1200-1204 (after)
Condition code: unchanged.
a 00 00 12 00 00 00 02 50 00 00 38 46 0- 32 1- I 6 I 250 01 23 45 66 0+ Appendix A 123
Previous Page Next Page