XOR             XOR operation                        Flags: O D I T S Z A P C
0 - - - * * ? * 0
XOR destination,source

Logic destination ← destination XOR source

XOR performs a bit-by-bit "exclusive or" on its two operands, and
returns the result in the destination operand. XOR sets each bit
of the result to one if only one of the corresponding bits is set
to one.

XOR truth table
a b a XOR b
0 0 0
0 1 1
1 0 1
1 1 0


Example: mov al,110001b
xor al,001101b
; al = 111100b

Example: xor [mFlag],1 ; Flip 0->1, 1->0


Opcode Format
30 /r XOR r/m8,r8
31 /r XOR r/m16,r16
31 /r XOR r/m32,r32
32 /r XOR r8,r/m8
33 /r XOR r16,r/m16
33 /r XOR r32,r/m32
34 ib XOR AL,imm8
35 iw XOR AX,imm16
35 id XOR EAX,imm32
80 /6 ib XOR r/m8,imm8
81 /6 iw XOR r/m16,imm16
81 /6 id XOR r/m32,imm32
83 /6 ib XOR r/m16,imm8
83 /6 ib XOR r/m32,imm8


Length and timing
Operands Bytes 8088 186 286 386 486 Pentium
reg, reg 2 3 3 2 2 1 1 UV
mem, reg 2+d(0,2) 24+EA 10 7 7 3 3 UV
reg, mem 2+d(0,2) 13+EA 10 7 6 2 2 UV
reg, imm 2+i(1,2) 4 4 3 2 1 1 UV
mem, imm 2+d(0,2) 23+EA 16 7 7 3 3 UV*
+i(1,2)
acc, imm 1+i(1,2) 4 4 3 2 1 1 UV

* = not pairable if there is a displacement and immediate