The 8088 processor provides us with a few logical operations that operate at the bit level. The logical operations are the same as discussed in computer logic design; however our perspective will be a little different. The four basic operations are AND, OR, XOR, and NOT.

The important thing about these operations is that they are bitwise. This means that if “and ax, bx” instruction is given, then the operation of AND is applied on corresponding bits of AX and BX. There are 16 AND operations as a result; one for every bit of AX. Bit 0 of AX will be set if both its original value and Bit 0 of BX are set, bit 1 will be set if both its original value and Bit 1 of BX are set, and so on for the remaining bits. These operations are conducted in parallel on the sixteen bits. Similarly the operations of other logical operations are bitwise as well.


X 0 0 1 1

Y 0 1 0 1

55
AND operation
AND performs the logical bitwise and of the two
X Y X and Y
operands (byte or word) and returns the result to the
0 0 0
destination operand. A bit in the result is set if both
0 1 0
corresponding bits of the original operands are set;
1 0 0
otherwise the bit is cleared as shown in the truth table.
1 1 1
Examples are “and ax, bx” and “and byte [mem], 5.” All

possibilities that are legal for addition are also le gal for the AND operation.
The different thing is the bitwise behavior of this operation.
OR operation


OR performs the logical bitwise “inclusive or” of the two operands (byte or word) and returns the result to the destination operand. A bit in the result is set if either or both corresponding bits in the original operands are set otherwise the result bit is cleared as shown in the truth table. Examples are “or ax, bx” and “or byte [mem], 5.”

XOR operation


X or Y 0 1 1 1


XOR (Exclusive Or) performs the logical bitwise
X Y X xor Y
“exclusive or” of the two operands and returns the result
0 0 0
to the destination operand. A bit in the result is set if the
0 1 1
corresponding bits of the original operands contain
1 0 1
opposite values (one is set, the other is cleared) otherwise
1 1 0
the result bit is cleared as shown in the truth table. XOR

is a very important operation due to the property that it is a reversible
operation. It is used in many cryptography algorithms, image processing, and
in drawing operations. Examples are “xor ax, bx” and “xor byte [mem], 5.”

NOT operation

NOT inverts the bits (forms the one’s complement) of the byte or word operand. Unlike the other logical operations, this is a single operand instruction, and is not purely a logical operation in the sense the others are, but it is still traditionally counted in the same set. Examples are “not ax” and “not byte [mem], 5.”

0 comments