HLASM - BCR = Branch on Condition Register
The opcode of the BCR instruction is X'07'.
Usage
This instruction implements the IF function by conditionally skipping
a part of the program's logic. Alternatively it can be used to build a loop
by branching back.
- Conditionally branch forward to skip some logic.
- Conditionally branch backward to repeat some logic.
Arguments
- 4-bit condition mask (in the instruction).
- Register holding the destination address.
Function
- The processor uses the PSW's two-bit condition code as an index into the
4-bit condition mask.
- If the selected mask-bit is one, then it branches to the address
specified in the second argument. If the bit is zero, then the processor
continues with the next instruction.
- The condition code does not change.
Special Cases
- If the destination address is in register 0 no branch will be taken.
- If the destination address is in register 0 AND the mask is B'1111'
then no branch will be taken but a serialization function will be performed
instead.
Overview of rules, regarding condition mask and register number
|
Mask = B'0000' |
B'0000' < Mask < B'1111' |
Mask = B'1111' |
R0 |
Never branch nowhere |
Maybe branch nowhere |
Always branch nowhere
(Serialize + Checkpoint) |
R1-R15 |
Never branch somewhere |
Maybe branch somewhere |
Always branch somewhere |
Related Instructions
- BC branches to a location that is directly
addressable in base-displacement form.
- BCTR is intended for building loops.
- BASR and BALR both expect a
return tby means of a BCR instruction.
Hardware
- All hardware supports the BCR instruction.
Remarks
- The PSW's Amode setting determines how many bits are used for the
destination address.
- HLASM supports various so-called extended mnemonics that
have an implied mask value. For an overview please refer to the
list of extended mnemonics for BCR.
- Some instructions will alter the condition code in the PSW, some won't.
When a BCR instruction tests the condition code, it may have been set by
the preceding instruction, or it may have remained unchanged during the
execution of the last few instructions. Thus, it is possible that the
condition code was set quite a few instructions before being tested by the
current BCR instruction.
Examples
YREGS * Define register names
...
BCR B'1000',R5 * Branch in case....
...
BCR B'1111',R14 * Return to caller
...
To the Opcodes Overview.
To the English Homepage for Hlasm.com.
To the General Homepage for Bixoft and Hlasm.com.
This site is a member of WebRing.
You are invited to browse the
list of mainframe-loving sites.
|
|
Dinos are not dead. They are alive and well and living in data centers all
around you. They speak in tongues and work strange magics with computers.
Beware the dino! And just in case you're waiting for the final demise of
these dino's: remember that dinos ruled the world for 155-million years!
|
Dinos and other anachronisms
[ Join Now
| Ring Hub
| Random
|
<< Prev
|
Next >>
]
|
Below you find the logo of our
sponsor
and logos of the web-standards that this page adheres to.