360 Assembly/360 Instructions/BCT

< 360 Assembly < 360 Instructions

BCT Branch on Count Opcode 46 / Decimal 70 4 byte RX Instruction

Format

BCT  target_register,displacement(index_register,base_register)
  BCT 2,LABEL
  BCT 15,106(10)
  BCT 0,256(7,6)
RX Instruction (4 bytes)
Byte 1 Byte 2 Bytes 3 and 4
target register Branch address
(In Hex) (8 bits)
Opcode
46
(4 bits)

0..F
(4 bits)
index
register

0..F
(4 bits)
base
register

0..F
(12 bits)
displacement
0..FFF

The target and base_register values will be determined automatically by the assembler if the USING pseudo-instruction has been used, and the target address label used (the displacement) is within 4096 bytes of the value of some base register.

Availability

The BCT instruction is available on all models, 360, 370 and z/System.

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

Alternative branch instructions


Previous Instruction
BCR
360 Assembly Instructions   Next Instruction
BCTG
Previous Opcode
45
Next Opcode
47
360 Assembly Language
360 Family Introduction · Basic FAQ · 360 Family · 360 Architecture
360 Instruction Set 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions
Syntaxes and Assemblers 360 Assemblers· Pseudo Instructions
Instruction Extensions Floating Point · High-Level Languages
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.