Difference between revisions of "Assembler:Commands:AND"
m |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Assembler]] | ||
'''command''' and ''destination'', ''source'' | '''command''' and ''destination'', ''source'' | ||
Line 17: | Line 18: | ||
(However, two memory operands cannot be used in one instruction.) Each bit of the result is set to 1 if both corresponding bits of the first and second operands are 1; otherwise, it is set to 0. | (However, two memory operands cannot be used in one instruction.) Each bit of the result is set to 1 if both corresponding bits of the first and second operands are 1; otherwise, it is set to 0. | ||
− | [ | + | [https://c9x.me/x86/html/file_module_x86_id_12.html c9x.me/x86/html/file_module_x86_id_12.html] |
</div> | </div> | ||
Line 63: | Line 64: | ||
and [SomeSymbol],rax | and [SomeSymbol],rax | ||
− | + | {{AssemblerCommandSeeAlso}} | |
− | |||
− | |||
− | |||
== External links == | == External links == | ||
* [https://wikipedia.org/wiki/X86_instruction_listings wikipedia.org/wiki/X86_instruction_listings] | * [https://wikipedia.org/wiki/X86_instruction_listings wikipedia.org/wiki/X86_instruction_listings] | ||
* [https://wikibooks.org/wiki/X86_Assembly/Other_Instructions wikibooks.org/wiki/X86_Assembly/Other_Instructions] | * [https://wikibooks.org/wiki/X86_Assembly/Other_Instructions wikibooks.org/wiki/X86_Assembly/Other_Instructions] | ||
− | * [ | + | * [https://c9x.me/x86/ c9x.me/x86/] |
* [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org] | * [http://www.asmpedia.org/index.php?title=Main_Page asmpedia.org] | ||
+ | * [http://ref.x86asm.net/ ref.x86asm.net] |
Latest revision as of 02:38, 5 January 2018
command and destination, source
The AND instruction is used for supporting logical expressions by performing bitwise AND operation. The bitwise AND operation returns 1, if the matching bits from both the operands are 1, otherwise it returns 0.
destination = destination & source
Example:
| destination: 0101 | | source: 0011 | |------------------------------------| | After AND -> destination: 0001 |
The OF and CF flags are cleared; the SF, ZF, and PF flags are set according to the result. The state of the AF flag is undefined.
Performs a bitwise AND operation on the destination (first) and source (second) operands and stores the result in the destination operand location. The source operand can be an immediate, a register, or a memory location; the destination operand can be a register or a memory location. (However, two memory operands cannot be used in one instruction.) Each bit of the result is set to 1 if both corresponding bits of the first and second operands are 1; otherwise, it is set to 0.
Command Parameters[edit]
Parameter | Description |
---|---|
destination | The destination operand |
source | The source operand |
Examples[edit]
and al,1
and ax,1
and ax,1
and eax,1
and rax,1
and al,al
and ax,ax
and ax,ax
and eax,eax
and rax,rax
and [eax],eax
and [rax],rax
and [00123ABC],eax
and [SomeSymbol],rax