branch-and-save facility, the BRANCH AND
SAVE (BAS or BASR) instructions may be
used for the same purpose. Both save
the address of the next instruction as
link information in a general register
and then cause execution to continue
from a different instruction sequenceat the branch address specified by this instruction. They differ in that BRANCH
AND LINK places additional information
(the instruction-length code, condition
code, and program mask) inthe leftmost
byte ofthe link information, whereas
BRANCH AND SAVE places zeros inthat byte.
BRANCH ANDSAVE, when available, is
recommended for use in place of BRANCH
AND LINK in programs that are intended
to be executed onSystem/370 models
equipped withthe extended-architecture (370-XA) mode. When such a model is
operating in the370-XA mode, the infor
mation placed by BRANCH AND LINK inthe leftmost byte of the linkage register
while 24-bit addressing is in effect may
lead to problems if the same program may
be used with 31-bit addressing; BRANCH
AND SAVE sets the leftmost byteto zero
with 24-bit addressing, which is compat
ible with 31-bit addressing. (For more
information on 31-bit addressing and on
subroutine linkage methods for the370-XA mode, see the IBM System/370 Extended Architecture Principles of
Operation,SA22-7085.) The following example compares the oper
ation of these instructions and of the
unconditional-branch instruction BRANCHON CONDITION (BC or BCR with a mask of
15). Assume that each instruction in
turn ;s located at the current instruc
tion address, ready to be executed next.
Assume also that general register 5 is
to receive the linkage information, and
that general register 6 containsthe branch address.
The format of the BALR instruction is:
Machine FormatOp Code 05 5 6
Assembler Format
BALR 5,6
The BASR instruction has the same
format, but the op code isOD. For comparison with the RR-format
instructions, the results of two
RX-format instructions are also shown.
The format of the BAL instruction is:
Machine FormatOp Code
45 5 o 60001 Assembler Format
BAL5,0(0,6) The BAS instruction has the same format,
but the op code is 4D.
The BCR instruction specifies only one
register:
Machine FormatOp Code 07 F 6
Assembler Format
BCR 15,6
Assume that:
Register 5 contains BB BB BB BB.
Register 6 contains 82 46 8A CEo
PSW bits 32-63 contain00 00 10 D6.
Condition code is01{2}. Program mask is 1100{2}. The effect of executing each instruction
in turn is as follows:
InstructionRegister 2 PSW (32-63)
Before BB BB BB BB00 00 10 D6
BCR15,6 BB BB BB BB 00 46 8A CE
BAL5,0(0,6) 9C 00 10 DA 00 46 8A CE
BAS5,0(0,6) 00 00 10 DA 00 46 8A CE
BALR 5,6 5C00 10 D8 00 46 8A CE
BASR 5,600 00 10 D8 00 46 8A CE
Note that a value of zero in theR2 field of any of the RR-format
instructions indicates that the branch
ing function is not to be performed; it
does not refer to registerO. Thus, the
instruction BALR8,0 may be used to
preserve the current condition code in
bits 2 and 3 of register 8 for future
inspection. Register0 can be desig
nated by the Rt field, however. In the
RX-format branch instructions, branching
occurs independent of whether there is a
value of zero in theB2 field or X 2 Appendix A. Number Representation and Instruction-Use Examples A-9
SAVE (BAS or BASR) instructions may be
used for the same purpose. Both save
the address of the next instruction as
link information in a general register
and then cause execution to continue
from a different instruction sequence
AND LINK places additional information
(the instruction-length code, condition
code, and program mask) in
byte of
BRANCH AND SAVE places zeros in
BRANCH AND
recommended for use in place of BRANCH
AND LINK in programs that are intended
to be executed on
equipped with
operating in the
mation placed by BRANCH AND LINK in
while 24-bit addressing is in effect may
lead to problems if the same program may
be used with 31-bit addressing; BRANCH
AND SAVE sets the leftmost byte
with 24-bit addressing, which is compat
ible with 31-bit addressing. (For more
information on 31-bit addressing and on
subroutine linkage methods for the
Operation,
ation of these instructions and of the
unconditional-branch instruction BRANCH
15). Assume that each instruction in
turn ;s located at the current instruc
tion address, ready to be executed next.
Assume also that general register 5 is
to receive the linkage information, and
that general register 6 contains
The format of the BALR instruction is:
Machine Format
Assembler Format
BALR 5,6
The BASR instruction has the same
format, but the op code is
instructions, the results of two
RX-format instructions are also shown.
The format of the BAL instruction is:
Machine Format
45 5 o 6
BAL
but the op code is 4D.
The BCR instruction specifies only one
register:
Machine Format
Assembler Format
BCR 15,6
Assume that:
Register 5 contains BB BB BB BB.
Register 6 contains 82 46 8A CEo
PSW bits 32-63 contain
Condition code is
in turn is as follows:
Instruction
Before BB BB BB BB
BCR
BAL
BAS
BALR 5,6 5C
BASR 5,6
Note that a value of zero in the
instructions indicates that the branch
ing function is not to be performed; it
does not refer to register
instruction BALR
preserve the current condition code in
bits 2 and 3 of register 8 for future
inspection. Register
nated by the Rt field, however. In the
RX-format branch instructions, branching
occurs independent of whether there is a
value of zero in the