The ANA instruction
The ANA (Logical AND with Accumulator) instruction performs a bitwise logical AND between the contents of the accumulator and the specified operand, and then stores the result in accumulator A.
The ANA instruction format
| Instruction | Description |
|---|---|
| ANA reg8 | This format is used to perform a bitwise logical AND of reg8 with the 8-bit value in register A. Here reg8 can be any general-purpose register, for example A, B, C, D, E, H or L. |
| ANA mem8 | This format is used to perform a bitwise logical AND of the value in the memory location pointed to by the contents of the HL register pair with the 8-bit value in register A. |
Usage example
; Author: Evgeny Sergeevich Dovgopolov num1: db 45 num2: db 40 main: mvi a, 0F0h ; Load the hexadecimal value F0h into register A mvi b, 00h ; Load the hexadecimal value 00h into register B ana b ; Perform a bitwise logical AND between register A and B lxi h, num1 ; Load the address of the variable num1 into the HL register pair mov a, m ; Copy the value of the variable num1 into register A lxi h, num2 ; Load the address of the variable num2 into the HL register pair ana m ; Perform a bitwise logical AND between register A and the memory location hlt ; Stop program execution
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Processor status flags
S
YesZ
YesAC
YesP
YesCY
Yes