Bit Manipulation Instructions in 8086(Logical Instructions):
The Bit Manipulation Instructions in 8086 or Logical Instructions are
- NOT
- AND
- OR
- XOR
- TEST
NOT Instruction : NOT destination.
The NOT instruction inverts each bit of a byte or a word. The destination can be register or a memory location.
Flags : NOT instruction affects no flag.
AND Instruction : AND destination, source.
This instruction logically ANDs each bit of the source byte or word with the corresponding bit in the destination and stores result in the destination. The source may be an immediate number, a register or a memory location. The destination may be a register or a memory location. The source and destination both cannot be memory locations in the same instruction. The CF and OF are both 0 after AND. The PF, SF and ZF are affected. AF is undefined.
OR Instruction : OR destination, source.
This instruction logically ORs each bit of the source byte or word with the corresponding bit in the destination and stores result in the destination. The source may be an immediate number, a register or a memory location. The destination may be a register or a memory location. The source and destination both can not be memory locations in the same instruction. The CF and OF are both 0 after OR. The PF, SF and ZF are affected. AF is undefined.
XOR Instruction : XOR destination, source.
This instruction logically XORs each bit of the source byte or word with the corresponding bit in the destination and stores result in the destination. The source may be an immediate number, a register or a memory location. The destination may be a register or a memory location. –The source and destination both cannot be memory locations in the same instruction. The CF and OF are both 0 after XOR. The PF, SF and ZF are affected. AF is undefined.
TEST Instruction : TEST destination, source.
This Bit Manipulation Instructions in 8086 ANDs the contents of a source byte or word with the contents of the specified destination word. Flags are affected. But neither operand is changed. PF, SF and ZF will be updated to show the results of the ANDing. PF has meaning only for the lower 8 bits of the destination. AF will be undefined.