After the instruction is executed, register 5 contains 00 00 00 17 = 23 1 0 • AND (N, rJR, NI, NC)
When the lBoolean operator AND is applied to two bits, the
result is one when both bits are one; otherwise, the result
is zero. When two bytes are ANDed in System/370, each
pair of bits is handled separately; there is no connection
from one bit position to another.AND(NI) A frequent use of the AND instruction is to set a particular
bit to zero. For example, assume that storage location 4891
contains0100 0011
2
, To set the rightmost bit of this byte
to zero without affectirig the other bits, the following
instruction can be used (assume that register 8 contains00 00 48 90): Machine Format Op Code B1
°1
94 FE 8001 Assembler Format Op Code 0, (B
1
),12 NI 1 (8). X'FE'
When this instruction is executed, the byte in storage is
ANDed with the immediate byte:
Location 48910100 00112 Immediate byte 1111 11102
Result:0100 00102 The resulting byte, with bit 7 set to zero, is stored in
location 4891. Condition code 2 is set.
Branch and link (BAL, BALR)
The BRANCH AND LINK instructions are commonly used
to branch to a subroutine with the option of later returning
to themain instruction sequence. For example, assume that
you wish to branch to a subroutine at storage address1160. Also assume:
The contents of register 2 are not significant.
Register 5<:ontains 00 00 11 50. Address 00 00 C6 contains a aAL instruction. (pSW bits 40-63
will contain00 00 CA after of BAL)
The format of the BAL iristruction is:
Machine FormatOp Code R1 X
2
B2 Assembler Format Op Code R
1
, 02 (X
2
, B
2
)
BAL2,X'10'(O,5) 292 System/370 Principles of Operation
After the instruction is executed:
Register 2 (bits 8-31) contains00 00 CA PSW bits 40-63 contain 00 11 60 The programmer can return to the main instruction se quence at any time with a BRANCH ON CONDITION (BCR)
instruction that specifies register 2 and a mask of 15
10 , pro vided that register 2 has not meanwhile been disturbed.
The BALR instruction with the R2 field equal to zero may
be used to load a register for use as a base register. For
example, in the assembly language the sequence of statements:
BALR15,0 USING *,15
tells the assembly program that register 15 is to be used as
the base register in assembling this program and that when
the program is executed, the address of the next sequential
instruction following the BALR will be placed in theregis ter. (The USING statement is an assembler instruction and
is thus not a part of the object program.)
At any time, the condition code may be preserved for
future inspection with BALR1,0. Bits 2 and 3 of the regis ter (Rl) contain the condition code.
Branch on Condition (BC, BCR)
The BRANCHON CONDITION instructions test the condi tion code to see whether a branch should or should not be
taken. The branch is taken only if the condition code is as
specified by a mask.
Mask Condition
ValueCode 8 0 4 1
2 2
1 3
For example, assume that an ADD (A, AR) operation has
been performed and you wish to branch to address6050 if
the sum is zero or less (condition code =0 or 1). Also
assume:
Register10 contains 00 00 50 00 Register 11 contains 00 00 10 00 The RX form of the instruction performs the required
test (and branch, if necessary) when written as:
Machine FormatOp Code M1 X
2
B2 02I L- _4_7 -..1.-1 Assembler Format Op Code M
1
, 02 (X
2
, B
2
)
BC12,X'50'( 11,1 0) A mask of 15 indicates a branch on any condition (an
unconditionalbranCh). A mask of zero indicates that no
branch is to occur (a no-operation).
When the lBoolean operator AND is applied to two bits, the
result is one when both bits are one; otherwise, the result
is zero. When two bytes are ANDed in System/370, each
pair of bits is handled separately; there is no connection
from one bit position to another.
bit to zero. For example, assume that storage location 4891
contains
2
,
to zero without affectirig the other bits, the following
instruction can be used (assume that register 8 contains
°1
94 FE 8
1
),
When this instruction is executed, the byte in storage is
ANDed with the immediate byte:
Location 4891
Result:
location 4891. Condition code 2 is set.
Branch and link (BAL, BALR)
The BRANCH AND LINK instructions are commonly used
to branch to a subroutine with the option of later returning
to the
you wish to branch to a subroutine at storage address
The contents of register 2 are not significant.
Register 5
will contain
The format of the BAL iristruction is:
Machine Format
2
B2
1
,
2
, B
2
)
BAL
After the instruction is executed:
Register 2 (bits 8-31) contains
instruction that specifies register 2 and a mask of 15
1
The BALR instruction with the R2 field equal to zero may
be used to load a register for use as a base register. For
example, in the assembly language the sequence of statements:
BALR
tells the assembly program that register 15 is to be used as
the base register in assembling this program and that when
the program is executed, the address of the next sequential
instruction following the BALR will be placed in the
is thus not a part of the object program.)
At any time, the condition code may be preserved for
future inspection with BALR
Branch on Condition (BC, BCR)
The BRANCH
taken. The branch is taken only if the condition code is as
specified by a mask.
Mask Condition
Value
2 2
1 3
For example, assume that an ADD (A, AR) operation has
been performed and you wish to branch to address
the sum is zero or less (condition code =
assume:
Register
test (and branch, if necessary) when written as:
Machine Format
2
B2 02
1
,
2
, B
2
)
BC
unconditional
branch is to occur (a no-operation).