In the last few articles on x86 assembly, we discussed a variety of concepts which include x86 Instruction Set Architecture, x86 syntax types, data representation, commonly used x86 instructions, building x86 assembly programs by assembling and linking, using gdb to debug the programs, the use of tools like ObjDump, segmentation faults and control flow instructions.
This article covers the logical instructions supported in x86 assembly. Some of the logical instructions such AND, OR and XOR also have an effect on conditional flags like ZF and PF. So, we will also discuss how these logical instructions can also be used to control the flow of the program.
Programming with logical instructions in x86 assembly
The logical instructions perform basic logical operations on their operands. The following table illustrates the mnemonics used in x86 assembly when writing assembly programs.
Mnemonic Description AND Bitwise logical AND OR Bitwise logical OR XOR Bitwise logical exclusive OR NOT Bitwise logical NOT
While the first three instructions (AND, OR, XOR) in the preceding table perform binary operations, the NOT instruction performs unary operations. In the next few sections, we will discuss