Assembler:Commands:AND
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