86
4-6-7
Branching Instruction Lines
When an instruction line branches into two or more lines, it is sometimes
necessary to use either interlocks or TR bits to maintain the execution condi-
tion that existed at a branching point. This is because instruction lines are
executed across to a right-hand instruction before returning to the branching
point to execute instructions one a branch line. If a condition exists on any of
the instruction lines after the branching point, the execution condition could
change during this time making proper execution impossible. The following
diagrams illustrate this. In both diagrams, instruction 1 is executed before
returning to the branching point and moving on to the branch line leading to
instruction 2.
Instruction 1
00002
00000
Instruction 2
Branching
point
Instruction 1
00002
00000
Instruction 2
Branching
point
Diagram B: Incorrect Operation
Diagram A: Correct Operation
00001
Address
Instruction
Operands
00000
LD
00000
00001
Instruction 1
00002
AND
00002
00003
Instruction 2
Address
Instruction
Operands
00000
LD
00000
00001
AND
00001
00002
Instruction 1
00003
AND
00002
00004
Instruction 2
If, as shown in diagram A, the execution condition that existed at the branch-
ing point cannot be changed before returning to the branch line (instructions
at the far right do not change the execution condition), then the branch line
will be executed correctly and no special programming measure is required.
If, as shown in diagram B, a condition exists between the branching point
and the last instruction on the top instruction line, the execution condition at
the branching point and the execution condition after completing the top in-
struction line will sometimes be different, making it impossible to ensure cor-
rect execution of the branch line.
There are two means of programming branching programs to preserve the
execution condition. One is to use TR bits; the other, to use interlocks
(IL(02)/IL(03)).
The TR area provides eight bits, TR 0 through TR 7, that can be used to tem-
porarily preserve execution conditions. If a TR bit is placed at a branching
point, the current execution condition will be stored at the designated TR bit.
When returning to the branching point, the TR bit restores the execution sta-
tus that was saved when the branching point was first reached in program
execution.
The previous diagram B can be written as shown below to ensure correct
execution. In mnemonic code, the execution condition is stored at the
branching point using the TR bit as the operand of the OUTPUT instruction.
TR Bits
Inputting, Modifying, and Checking the Program
Section 4-6