Home  Site Map  Instruction Index 

XOR  -  XOR Bitwise Instruction


The XOR Instruction performs an XOR action with the second operand on the first operand. The first operand holds the result of this operation.

When both matching bits are 0 thet are not changed, and all matching 1's abecome zero. Non-matching bits of 0's and 1's become 1.

The second operand can be either a Register, Immediate value or a memory address. However 2 memory addresses cannot be used together.

This command has 3 parts, Instruction, then either operand can be a Register or memory address.


Assembly
Sample
Description   16 bit Machine
  Code
XOR AL, 0x03 ;  8 bit immediate number with AL   34 03
XOR AX, 0x0003 ;  16 bit immediate number with AX   35 03 00
XOR BL, 0x03 ;  8 bit immediate number with Register   80 F3 03
XOR BX, 0x0003 ;  16 bit immediate number with Register   81 FB 03 00
XOR [BX], 0x03 ;  8 bit immediate number with memory
;  address
  80 37 03
XOR [BX], 0x0003 ;  16 bit immediate number with memory
;  address
  81 79 03 00
XOR AL, BL ;  8 bit Registers   30 D8
XOR BL, AL ;  8 bit Registers   32 D8
XOR AX, BX ;  16 bit Registers   31 D8
XOR BX, AX ;  16 bit Registers   33 D8
XOR [BX], AX ;  Register to memory address   31 07
XOR AX, [BX] ;  Memory address to Register   33 07
XOR [BX+2], AX ;  Register to   31 47 02
XOR AX, [BX+2] ;  Memory address and offset to Register   33 47 02