Slide 11.6: OR instruction
Slide 11.8: NOT instruction
Home

XOR Instruction


The XOR instruction performs a boolean (bitwise) exclusive-OR operation between each pair of matching bits in two operands and places the result in the destination operand. The operands can be 8, 16, or 32 bits, and they must be the same size.
X Y X XOR Y
0 0 0
0 1 1
1 0 1
1 1 0

XOR — Exclusive OR

Usage: XOR dest, src

Flag O D I S Z A P C
Result *     * * ? * 0

Performs a bitwise exclusive OR of the operands and returns the result in the destination.
Clocks
Operands 286 386 486 Size Bytes
reg, reg 2 2 1 2
mem, reg 7 6 3 2-4
reg, mem 7 7 2 2-4
reg, immed 3 2 1 3-4
mem, immed 7 7 3 3-6
accum, immed 3 2 1 2-3
 XORed with 0   XORed with 1   XORed Twice 
 .code
 mov   eax, 12345678h
 xor   eax, 00000000h
 call  WriteHex
 .code
 mov   eax,  12345678h
 xor   eax, 0FFFFFFFFh
 call  WriteHex
 .code
 mov   eax, 0
 mov   al, 00111010b
 mov   ch, 10100011b
 xor   al, ch
 xor   al, ch
 call  WriteHex
 Output  Output  Output