BAR 16bitOffset,ARn,ARm,EQ/NEQ
6-60
BAR 16bitOffset,ARn,ARm,EQ/NEQ Branch on Auxiliary Register Comparison
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
BAR 16bitOffset,ARn,ARm,EQ 1000 1111 10nn nmmm
CCCC CCCC CCCC CCCC
1 − 4/2
BAR 16bitOffset,ARn,ARm,NEQ 1000 1111 11nn nmmm
CCCC CCCC CCCC CCCC
1 − 4/2
Operands
16bit-
Offset
16-bit signed immediate constant offset value (−32768 to +32767 range)
ARn
Lower 16 bits of auxiliary registers XAR0 to XAR7
ARm
Lower 16 bits of auxiliary registers XAR0 to XAR7
Syntax Description Condition Tested
NEQ Not Equal To ARn != ARm
EQ Equal To ARn = ARm
Description Compare the 16-bit contents of the two auxiliary registers ARn and ARm
registers and branch if the specified condition is true; otherwise continue
execution without branching:
If (tested condition = true) PC = PC + signed 16-bit offset;
If (tested condition = false) PC = PC + 2;
Note: If (tested condition = true) then the instruction takes 4 cycles.
If (tested condition = false) then the instruction takes 2 cycles.
Flags and
Modes
None
Repeat This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
Example ;
String compare:
MOVL XAR2,#StringA ; XAR2 points to StringA
MOVL XAR3,#StringB ; XAR3 points to StringB
MOV @AR4,#0 ; AR4 = 0
Loop:
MOVZ AR0,*XAR2++ ; AR0 = StringA[i]
MOVZ AR1,*XAR3++ ; AR1 = StringB[i], i++
BAR Exit,AR0,AR4,EQ ; Exit if StringA[i] = 0
BAR Loop,AR0,AR1,EQ ; Loop if StringA[i] = StringB[i]
NotEqual: ; StringA and B not the same
.
Exit: ; StringA and B the same