beautypg.com

Brnz (branch if not zero) – Echelon Neuron User Manual

Page 86

background image

BRNZ (Branch If Not Zero)

The BRNZ instruction performs a conditional branch if TOS is not zero. The

BRNZ instruction uses one of two addressing modes: absolute and relative. The

BRNZ instruction branches forward or backward with a signed relative

displacement of -126 to +129 bytes if TOS is not zero; otherwise, program

operation continues with the next instruction. TOS is consumed by this

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 BRNZ 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 SBRNZ (Short Branch If Not Zero) for a shorter conditional branch with

the same condition, and BRZ (Branch If Zero) for a conditional branch with the

opposite condition.
The BRNZ instruction applies to Series 3100, 5000, and 6000 devices.

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

label:

BRNZ displacement

BRNZ label

Table 21 describes the attributes of the BRNZ instruction.

Table 21. BRNZ Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

BRNZ

72

2

4

None


Example:
The following example assumes that the stack already has an array of data

values from which we want to process non-zero values and skip zero values.

search brnz numFnd

br search ; skip zeros

numFnd ...

76

Neuron Assembly Language Instruction Statements