Brc (branch if carry) – Echelon Neuron User Manual
Page 81

BRC (Branch If Carry)
The BRC instruction performs a conditional branch if the Carry flag is set. The
BRC instruction uses the relative addressing mode. The BRC instruction
branches forward or backward with a signed relative displacement of -126 to
+129 bytes if the Carry flag is set; otherwise, program operation continues with
the next instruction. The displacement expression must resolve at link time to a
value in the range -128 to +127 (two less than the actual displacement because
the displacement calculation includes the size of the BRC operation itself).
The Neuron Assembler also supports the use of a label for the displacement
expression; manual calculation of the displacement value is not required.
See also BRNC (Branch If Not Carry).
The BRC instruction applies to Series 3100, 5000 and 6000 devices.
Syntax:
The BRC instruction requires a single operand to specify the displacement or
label:
BRC displacement
BRC label
Table 17 describes the attributes of the BRC instruction.
Table 17. BRC Instruction
Instruction
Hexadecimal
Opcode
Instruction
Size (Bytes)
CPU Cycles
Required
Affect on
Carry Flag
BRC
33
2
2
Used
Example:
The following example assumes that TOS and NEXT have data values to be
added. The ADD instruction adds them and sets the Carry flag for the unsigned
addition. The BRC instruction branches to the Ovflw label if the Carry flag is
set, otherwise the program continues. The BR instruction ensures that the code
at the Ovflw label is only run when needed.
add ; (result, -, -)
brc Ovflw
...
br Common
Ovflw ... ; handle Carry set condition
Common ...
Neuron Assembly Language Reference
71