CMPR 0/1/2/3
6-82
CMPR 0/1/2/3 Compare Auxiliary Registers
SYNTAX OPTIONS OPCODE OBJMODE RPT CYC
CMPR 0 0101 0110 0001 1101 1 − 1
CMPR 1 0101 0110 0001 1001 1 − 1
CMPR 2 0101 0110 0001 1000 1 − 1
CMPR 3 0101 0110 0001 1100 1 − 1
Operands None
Description Compare AR0 to the 16-bit auxiliary register pointed to by ARP. The
comparison type is determined by the instruction.
CMPR 0: if(AR0 = AR[ARP]) TC = 1, else TC = 0
CMPR 1: if(AR0 > AR[ARP]) TC = 1, else TC = 0
CMPR 2: if(AR0 < AR[ARP]) TC = 1, else TC = 0
CMPR 3: if(AR0 != AR[ARP]) TC = 1, else TC = 0
Flags and
Modes
ARP The 3-bit ARP points to the current valid Auxiliary Register, XAR0 to XAR7.
This pointer determines which Auxiliary register is compared to AR0.
TC If the test is true, TC is set, else TC is cleared.
Repeat This instruction is not repeatable. If this instruction follows the RPT
instruction, it resets the repeat counter (RPTC) and executes only once.
Example
TableA: .word 0x1111
.word 0x2222
FuncA:
MOVL XAR1,#VarA
MOVZ AR0,*XAR1++
MOVZ AR1,*XAR1
CMPR 0
B Equal,TC
CMPR 2
B Less,TC
.
.
; Initialize XAR1 Pointer
; Load AR0 with 0x1111, clear AR0H,
; ARP = 1
; Load AR1 with 0x2222, clear AR1H
; AR0 = AR1? No, clear TC
; Don’t branch
; AR1 > AR2? Yes, set TC
; Branch to “Less”