I have two values stored in R0
and R1
. I am comparing the two as follows:
MOV R3, #(R0 XOR R1)
CJNE R3,#0,NOT_EQUAL
Apparently it is not possible to use the XOR OPERATOR this way.
Is there another way to compare R0
with R1
and check is they are equal or not?
Since you want to perform the XOR
at runtime, you will have to use instructions to accomplish that. Unfortunately, the XRL
instruction only operates on the A
register, so you might have to do some rearranging. Assuming A
is not available, but R3
is, you can do:
MOV R3, A ; save A to R3
MOV A, R0
XRL A, R1
XCH A, R3 ; restore A and put the result into R3
CJNE R3, #0, NOT_EQUAL
If A
is available, you can use the CJNE
accepting a memory operand knowing that registers are memory mapped:
MOV A, R0
CJNE A, 1, NOT_EQUAL ; 1 is the bank0 address of R1