Compare bits in assembly

Baran picture Baran · Apr 28, 2011 · Viewed 7.1k times · Source

How can I compare two bits if they are equal or not in 8051? I need to jump if two bits are equal. I have a value in a register and I am searching if this value is equal another constant value. Example: I have "EDh" value and I have another value in R0 register.

Answer

Oliver Charlesworth picture Oliver Charlesworth · Apr 28, 2011

To compare a register and an immediate (a constant), and then conditionally jump, you can use the CJNE instruction.