beautypg.com

Brnc (branch if not carry) – Echelon Neuron User Manual

Page 83

background image

BRNC (Branch If Not Carry)

The BRNC instruction performs a conditional branch if the Carry flag is not set.

The BRNC instruction uses the relative addressing mode. The BRNC

instruction branches forward or backward with a signed relative displacement of

-126 to +129 bytes if the Carry flag is not 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

BRNC 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 BRC (Branch If Carry).
The BRNC instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The BRNC instruction requires a single operand to specify the displacement or

label:

BRNC displacement

BRNC label

Table 19 describes the attributes of the BRNC instruction.

Table 19. BRNC Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

BRNC

32

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 BRNC instruction branches to the Ok label if the Carry flag is not

set, otherwise the program continues. The BR instruction ensures that the code

at the Ok label is only run when needed.

add ; (result, -, -)

brnc Ok

... ; handle Carry set condition

br Common

Ok ...

Common ...

Neuron Assembly Language Reference

73