Boolean Instructions


Boolean logic is important in circuitry design and has a parallel in programming logic. The instructions for boolean logic are AND, OR, XOR, TEST, and NOT, all of which can be used to clear, set, and test bits. The following table shows selected boolean instructions.

Operation Description
AND The Boolean function which is true only if all its arguments are true.
OR The Boolean function which is true if any of its arguments are true.
XOR Exclusive or. “A XOR B” means “A or B, but not both.”
NOT The Boolean function which is true only if its input is false.
TEST TEST sets the flags as AND does, but does not change the bits referenced in the target operand.

AND Instruction
The AND instruction performs a boolean (bitwise) AND operation between each pair of matching bits in two operands and places the result in the destination operand.

AND — Logical AND

Usage: AND dest, src

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

Performs a logical AND of the two operands replacing the destination with the result.
Clocks
Operands 286 386 486 Size Bytes
reg, reg 2 2 1 2
mem, reg 7 7 3 2-4
reg, mem 7 6 1 2-4
reg, immed 3 2 1 3-4
mem, immed 7 7 3 3-6
accum, immed 3 2 1 2-3

The AND instruction is often used to clear selected bits and preserve others.