Instructions to perform Exclusive OR operation in 8085 Microprocessor

Microprocessor8085

In 8085 Instruction set, and specially in its logical group of instructions, we have AND, OR, XOR, NOT type of instructions. 8085 does not have instructions to perform NAND, NOR, XNOR operations directly. Now let us discuss the instructions to perform XOR operations only.

To perform XORing of two numbers, 8085 imposes the restriction that one of the operands must be kept in the Accumulator. The other operand can be at any one of the following possible locations −

ClassificationsExamples
The other operand can be kept in 8-bit immediate data in the instruction.
XRI 43H
XRI FFH
The other 8-bit operand can be kept in a memory location and whose memory address will be pointed by HL register pair.
XRA M
The other 8-bit operand can be kept in a 8-bit registerXRA B
ORA C

Here is the list of instructions available in 8085 instruction set suitable for XORing operations

Mnemonics,Operand
Opcode(in HEX)
Bytes
XRA A
AF
1
XRA B
A8
1
XRA C
A9
1
XRA D
AA
1
XRA E
AB
1
XRA H
AC
1
XRA L
AD
1
XRA M
AE
1
XRI Data
EE
2

The XOR operation performs bit-wise XOR of the two operands. If X is a bit of Accumulator, and Y is a bit of the other operand in the same bit position, the XOR operation is performed as per the following truth table.

Truth Table for XOR Operation

X
Y
X OR Y
0
0
0
0
1
1
1
0
1
1
1
0

The XOR instruction will affect the flag register bits as follows −

  • S, P, and Z flags are updated based on the result;
  • Cy and Ac flags are reset to 0;
raja
Published on 27-Dec-2018 14:33:42
Advertisements