APPENDIX NUMBER REPRESENTATION AND INSTRUCTION-USE EXAMPLES
Number Representation ••••••••••••••••••••••••••••••••••••• A-2
Binary Integers •..••••••••••••••.••..••••••••••••••••••• A-2
Signed Binary Integers •.••....•.•.••.••••••.•••••••••• A-2
Unsigned Binary Integers •••..••••••••••••••.•••••••••• A-4
Decimal Integers .•.••.••••••.••••••••..•••••••••.••••••• A-5
Floating-Point Numbers .....••..........••.••••.•...••••. A-5
Conversion Example ..•.•.••...•••••••••.••.••••.••••••••. A-7
Instruction-Use Examples ••••••••••••••••.••••••••••••••••• A-7
Machine Format ..••••••••••••.•••••••••.•••••••••.•••.••• A-7
Assembler-Language Format •••.••••••.••.••••••••••.•.•••• A-7
General Instructions •.•.....••..•..•.•••..•..•••.•••...••. A-8
ADD HALFWORD (AH) •.•••••.•••..••..••••..••.••••••••••••• A-8
AND (N, NC, NI, NR) •••..•••••.••••••••••••••••.••••••••• A-8
NI Example .•••••••••••.•••...•..••••.•••••••.•••..•••• A-8
Linkage Instructions (BAL, BALR, BAS, BASR) •••••••••.••. A-8 Other BALR and BASR Examples •••••.•..••.••••.•••...••• A-lO BRANCH ON CONDITION (BC, BCR) ..•.•••••••.••••••••••••... A-lO BRANCH ON COUNT (BCT, BCTR) ..•••..••.•.••..•••••..•••••• A-lD BRANCH ON INDEX HIGH (BXH) .•...•.......•....••........•• A-ll
BXH Example 1 •••.••.•..•..•••••...••..••.•...........• A-l!
BXH Example 2 •...••....•...•.••.•..•.•.•.•.•••..•••••• A-l! BRANCH ON INDEX LOW OR EQUAL (BXLE) ••..••..•••.••••..••• A-12
BXLE Example 1 •...•...•.....•...•....•••.•..........•• A-l2
BXLE Example 2 .•.••.•..•.•.•...•.•...•..•.•....•...... A-12 COMPARE HALFWORD (CH) .•......•••..•..•.•...•••••..•••••. A-12 COMPARE LOGICAL (CL, CLC, CLI, CLR) •••...•.••........••• A-13 CLC Example •.•...•...•.•.....•.....•.......•...•.•.•.• A-13 CLI Example ............•.............................. A-l3 CLR Example .....•••........•................•.•..••.•. A-l4 COMPARE LOGICAL CHARACTERS UNDER MASK (CLM) •••.•....••.• A-l4 COMPARE LOGICAL LONG (CLCL) ........................•.... A-14 CONVERT TO BINARY (CVB) ..•.•.•.••••....•.........•....•. A-l6 CONVERT TO DECIMAL (CVD) .•.•.•.•.•.•••.•.•.•..•.•.••..•. A-l6
DIVIDE (0, DR) ••.•••...•••.••.•.••••.•.••••••••••..•.••. A-16 EXCLUSIVE OR (X, XC, XI, XR) •..••.•....•.•.••.......•.•. A-17 XC Example .......•....••.............•.•.•.......•..•. A-17
XI Example .•..••••...•.•....••..•....•••.•••.•...•..•. A-18 EXECUTE (EX) .•...•.••......•.•••••....•••....•....•.•.•. A-l8
INSERT CHARACTERS UNDER MASK (ICM) •..•.••..••.•.•...••.. A-19 LOAD (L, LR) .•....•...•....••....•......•.•......•...•.. A-20 LOAD ADDRESS (LA) •••...•...•.•••••..••.•••••..•......... A-20 LOAD HALFWORD (LH) ••.•...•...••.••••...••.•.•.••...•...• A-20 MOVE (MVC, MVI) ••••.•.•..•.•••...•..•..••.•.••...•.••.•. A-2! MVC Example •..•.•....................•................ A-21
MVI Example •..••.•...•••..•.•.•.•.•...........•.•...•. A-2l MOVE INVERSE (MVCIN) .......••••.••••••.•.••••••.•••••••. A-22 MOVE LONG (MVCL) .•••..••••.••.••••••.••••.•••.••••..•.•. A-22 MOVE NUMERICS (MVN) ....••...•.•...•..•••..•••••....••••. A-23 MOVE WITH OFFSET (MVO) ..•.•..••.•••..•••..•.•.•.•.•..•.. A-23 MOVE ZONES (MVZ) ••••..•••••••••••••••••••••.•.•.••.•.••. A-24
MUL TIPL Y (M, MR) •••....••.•.•••.•••..••••.•.•.•••.••..•• A-24 MULTIPLY HALFWORD (MH) .••.•.•••••••••..•••••••.•••...••. A-24 OR (0, OC, 01, OR) .•..••....•....•..••..•.•.••...•...•.. A-25 01 Example ••.•••••.•••••.•••••••••••••••••••.••••••... A-25 PACK (PACK) .•...•••...•••••.•••••••••••••••.•••.•..••.•• A-25
SHIFT LEFT DOUBLE (SlDA) ..•.....•...••.••••.•••..•••••.. A-26
SHIFT LEFT SINGLE (SLA) •..•••..•.•.••..••••.••.••...••.. A-26 STORE CHARACTERS UNDER MASK (STCM) ••••••••••••.••..•••.. A-26 STORE MULTIPLE (STM) .••.•••••••••••••••••••.••.••••••.•• A-27
TEST UNDER MASK (TM) ••••.••...•••••.•••••.••••..•..••.•. A-27
TRANSLATE (TR) .............•.....•.•.•.•................ A-28
TRANSLATE AND TEST (TRT) •.•.•••••••••••••••••.•...•..... A-28 UNPACK (UNPK) .•••••...•.••••••..••••••.••.•••.••••••••.. A-30 Decimal Instructions •.•.•••..••....••.••••••.•••••.•.•.••• A-30 ADD DECIMAL (AP) •....••••...••.•••..••••••••.•...•..•••• A-3D COMPARE DECIMAL (CP) •••••••••..•••••••••••••••••••..••.. A-3I DIVIDE DECIMAL (DP) ...•••.•.••••••••••••••••••••.•••.••. A-3I EDIT (ED) ••••••.••••.•••.••••.••••••••••••.••••••.••••.• A-3I Appendix A. Number Representation and Instruction-Use Examples A-I
EDIT AND MARK (EDMK) •••••••••••••••••••••••••••••••••••• A-33 MULTIPLY DECIMAL (MP) ••••••••••••••••••••••••••••••••••• A-34
SHIFT AND ROUND DECIMAL (SRP) ••••••••••••••••••••••••••• A-34
Decimal Left Shift •••••••••••••••••••••••••••••••••.•• A-34
Decimal Right Shift ••••••••••••••••••••••••••••••••••• A-35
Decimal Right Shift and Round ••••••••••••••••••••••••• A-35
Multiplying by a Variable Power of 10 ••••••••••••••••• A-35 ZERO AND ADD (ZAP) ••••••••••.••••••••••••••••••••••••••• A-36 Floating-Point Instructions ••••••.•••••••••••••••••••••••• A-36
ADD NORMALIZED (AD, ADR, AE, AER, AXR) •••••••••••••••••• A-36
ADD UNNORMALIZED (AU, AUR, AW, AWR) ••••••••••••••••••••• A-36 COMPARE (CD, CDR, CE, CER) ....•••••••.•••••••••••••..••• A-37 DIVIDE (DD, DDR, DE, DER) .••..•••••••.••••••••••••••••.• A-37 HALVE (HDR, HER) •••••...•••••••••.•••.•••••••••••••••.•• A-38 MULTIPLY (MD, MDR, ME, MER, MXD, MXDR, MXR) ••••••••••.•• A-38
Floating-Point-Number Conversion •..••••••••••••••••••.•• A-38
Fixed Point to Floating Point ••••••••••••••••••••••..• A-39
Floating Point to Fixed Point .••••••••.••••••••.•••.•• A-39
Multiprogramming and Multiprocessing Examples ••••••••••••. A-40 Example of a Program Failure Using OR Immediate ••••••••• A-40 Conditional Swapping Instructions (CS, CDS) .••..•••...•. A-40 Setting a Single Bit •••.••.••••••.•.•••••••••••••.•••• A-41 Updating Counters .•••••..•.•••.••••••.••••.••••••••.•• A-41
Bypassing POST and WAIT ••..•..••.•.•••••..•••••••••.•... A-42 BYPASS POST Routine ..•...•..•...•.•..•..•.•.•...•..... A-42 BYPASS WAIT Routine .•••..•..•..••••••...••.•.......... A-42 LOCK/UNLOCK .•••.•.•••.•.••.....••.•••.•••.•.•..•••••••.. A-42 LOCK/UNLOCK with LIFO Queuing for Contentions ••.•••.•. A-43 LOCK/UNLOCK with FIFO Queuing for Contentions .•.•.•... A-44 Free-Pool Manipulation •••.••..•.••..••........•.••••..•• A-46 NUMBER REPRESENTATION
BINARY INTEGERS
each bit of the positive binary integer
and adding one. As an example using the
halfword format, the binary number with
the decimal value +26 is made negative
(-26) in the following manner:
Signed Binary Integers
Signed binary integers are most commonly
represented as halfwords (16 bits) or
words (32 bits). In both lengths, the
leftmost bit (bit 0) is the sign of the
number. The remaining bits (bits 1-15
for halfwords and 1-31 for words) are
used to specify the magnitude of the
number. Binary integers are also
referred to as fixed-point numbers, because the radix point (binary point)
is considered to be fixed at the right,
and any scaling is done by the program­
mer. Positive binary integers are in true
binary notation with a zero sign bit.
Negative binary iritegers are in two's­
complement notation with a one bit in
the sign position. In all cases, the
bits between the sign bit and the left­
most significant bit of the integer are
the same as the sign bit (that is, all
zeros for positive numbers, all ones for
negative numbers).
Negative binary integers are formed in
two's-complement notation by inverting
A-2 System/370 Principles of Operation +26 0 000 0000 0001 1010 Invert 1 111 1111 1110 0101 Add 1 1
-26 1 111 1111 1110 0110 (Two's
complement
form)
(S is the sign bit.)
This is equivalent to subtracting the
number:
from 00000000 00011010 1 00000000 00000000 Negative binary integers are changed to
positive in the same manner.
The following addition examples illus­
trate two's-complement arithmetic and
overflow conditions. Only eight bit
positions are used.
1. +57 = 0011 1001 +35 = 0010 0011 +92 = 0101 1100
Previous Page Next Page