411 REFERENCE · Wikibooks
360 Assembly/360 Instructions/BCT
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
BCT Branch on Count 46 70 RXB
__TOC__
Purpose of Instruction
The BCT instruction subtracts 1 from the value of the contents of the target register specified in the first argument. If the value in the target register after the subtraction is zero, no branch occurs. Otherwise the program branches to the specified address. Note that if the result in the target register before subtraction is 0, the result is negative 1 and the branch occurs. If the value in the target register before subtraction is the smallest possible value, the result is the highest possible value, the overflow is ignored and the branch occurs.
Typical Usage
To do a loop statement where 1 is subtracted from the value contained in the target register, and a branch should occur if the result is not 0.
Operation
The value contained in the target register specified as the first argument is reduced by 1. If the value after subtraction is 0, execution continues with the instruction following this instruction. Otherwise, execution transfers to the address specified as the second argument.
Condition Codes
Condition codes are not changed. If the value is the lowest possible value and overflow to the highest value occurs, it is ignored.
Exceptions and Faults
If the address to branch to is not in the same PSW storage key (unless this process' storage key is 0) a protect violate exception occurs.
If the address to branch to is odd, an address exception occurs.
If the address is not within available memory, a specification exception occurs.
Alternative branch instructions
The BCTR instruction provides the same functionality but with the branch address in another register.
BCR BCTG 45 BAL 47 BC