The XRA instruction

The XRA (Exclusive OR with Accumulator) instruction is used to perform a bitwise logical exclusive OR operation between the contents of the accumulator and the specified operand. The result of this operation is then stored in accumulator A.

The XRA instruction format

InstructionDescription
XRA reg8 This format is used to perform a bitwise logical exclusive OR operation between the 8-bit value in register A and reg8. Here reg8 can be any general-purpose register, for example A, B, C, D, E, H or L.
XRA mem8 This format is used to perform a bitwise logical exclusive OR operation between the 8-bit value in register A and the value in the memory location pointed to by the contents of the HL register pair.

Usage example

; Author: Evgeny Sergeevich Dovgopolov

num1: db 00101101b
num2: db 11000011b

main:
    mvi     a, 0A5h  ; Load the hexadecimal value A5h into register A
    mvi     b, 0FFh  ; Load the hexadecimal value FFh into register B
    xra     b        ; Perform a bitwise logical exclusive OR between register A and B

    lxi     h, num1  ; Load the address of the num1 variable into the HL register pair
    mov     a, m     ; Copy the value of the num1 variable into register A
    lxi     h, num2  ; Load the address of the num2 variable into the HL register pair
    xra     m        ; Perform a bitwise logical exclusive OR between register A and memory

    hlt              ; Stop program execution

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".

Processor status flags

S
Yes
Z
Yes
AC
Yes
P
Yes
CY
Yes