BNE - Branch Not Equal Command
Branches if the zero flag is not set(cleared). This occurs if you load a value other than 0 into the accumulator or a comparison is not equal.
If the result of the CMP comparison isn’t zero(equal) then zero flag will be cleared.
When this is the case the task will branch (skip) to the label referenced in the BNE command.
If the comparison is zero then the task keeps rolling past.
BRZ (Branch if Zero) is the opposite of this.
It will also branch if you simply load a value that isn’t 0.
Examples
{
LDA #3 //Load 3 into the Accumulator
CMP #5 //Compare if the Accumulator value is 5
BNE NoMatch //Will branch to the label "NoMatch:" because they are not equal.
LDA ~7 //Load ~7
CMP #0x03 //Compare it to 0x03
BNE Label //If it matches continue on if it didn't match branch to "Label:"
Start(0x1c,112,x,x,x,x,x)//Watches all incomming 1C messages for area 112.
copy @0,~0,7 //Copy the msg to ~0-6. ~1 is area, ~3 is preset, ~5 is offset.
LDA ~3 //Get Preset byte (The Op code)
CMP #0x03 //Check if the incomming Preset Byte matches opcode for P4
BNE ON //If preset 4 branch to the label "ON:" if P4 continue.
LDA ~7 //Load ~7
BNE Label //If the value is anything but zero branch to "Label:"
}