HLASM - BC = Branch on Condition

The opcode of the BC instruction is X'47'.

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.

  1. Conditionally branch forward to skip some logic.
  2. Conditionally branch backward to repeat some logic.
  3. Select a logic path by means of a branch table.

Arguments

  1. 4-bit condition mask (in the instruction).
  2. destination address (index, base, displacement).

Function

  1. The processor uses the PSW's two-bit condition code as an index into the 4-bit condition mask.
  2. 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.
  3. The condition code does not change.

Special Cases

  1. None.

Related Instructions

  1. BCR branches to a location that is specified in a register.
  2. BRC branches to a location whose address is specified relative to the current instruction address.
  3. BRCL branches to a location whose address is specified relative to the current instruciotn address.
  4. BCTR is intended for creating loops.
  5. BXLE and BXH are intended for scanning tables.

Hardware

  1. All hardware supports the BC instruction.

Remarks

  1. The PSW's Amode setting determines how many bits are used for the destination address.
  2. 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 BC.
  3. Some instructions will alter the condition code in the PSW, some won't. When a BC 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 BC instruction.

Examples

         YREGS                          * Define register names
         ...
         BC    B'1000',MY_LABEL         * Branch in case....
         ...
         BC    B'1111',0(,R14)          * Return to caller
         ...
MYLABEL  DS    0H
         ...

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.
Running Tyrannosaurus Rex 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.