beautypg.com

Brz (branch if zero) – Echelon Neuron User Manual

Page 87

background image

BRZ (Branch If Zero)

The BRZ instruction performs a conditional branch if TOS is zero. The BRZ

instruction uses the relative addressing mode. The BRZ instruction branches

forward or backward with a signed relative displacement of -126 to +129 bytes if

TOS is 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 BRZ

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

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

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

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

label:

BRZ displacement

BRZ label

Table 22 describes the attributes of the BRZ instruction.

Table 22. BRZ Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

BRZ

73

2

4

None


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

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

search brz zeroFnd

br search ; skip non-zeros

zeroFnd ...

Neuron Assembly Language Reference

77