
58
B R
[ B r a n c h ]
This instruction is capable of two different types of pro-
gram branches:
1] Conditional.
2] Unconditional.
This instruction may be used in DO-WHILE loops and IF-
THEN structures.
A conditional branch will branch to another program address or label when a
flag or variable reaches a specified value or state. A conditional branch will be
expressed thus:
‘this will conditional branch to label LOOP_LBL,
‘while variable LOOP_CNT is
‘less than 50 [DO-WHILE}.
BR LOOP_LBL, LOOP_CNT<50
‘this will conditional branch to address 400
‘when I/O line 21 = 1 [IF-THEN]
BR 400, IO 21
An unconditional branch will perform the program branch when reached, for
example:
BR MY_PROG
‘loop to beginning of program
C A L L
[ C a l l S u b r o u t i n e ]
This instruction allows the user to invoke a subroutine within a program. As
with the branch instruction, it may be conditional or unconditional. The condi-
tion can be set on a call in the same fashion as a condition on a branch.
The main difference in operation is that when a subroutine is called, at the end of
a subroutine a RET (return from subroutine) statement must be in place. This
will return to the line of code following the CALL that originally invoked it.
The CALL instruction is expressed thus:
‘
this will call a subroutine
‘labeled WAITIN21 when I/O
‘line
21 becomes active
CALL WAITIN21, IO 21=1
LBL WAITIN21
MOVR 51200
HOLD 2
RET
Branching from inside
a called subroutine to
a label or address outside
that subroutine will cause
a stack fault! If a branch
is used in a subroutine it
must be to a location
within that subroutine!
A subroutine invoked
using the CALL instruction
have a return statement
(RET) at the end of
the subroutine!
MUST
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from