Remark: This article describes the assembler/machine language instruction AND. For information on the BASIC operator of the same name, see AND (BASIC).
AND (short for "Logic AND") is the mnemonic for a machine language instruction which performs a bit-wise boolean "and" between the eight bits in the operand and the eight bits of the accumulator. Each resulting bit is a one (1) only if the corresponding bits of the operand and the accumulator are also one (1). If either corresponding bit is zero (0) then the resulting bit will be zero (0). The result is stored in the accumulator. In this way, the AND operation masks the value in the accumulator with the value in the operand.
AND supports eight different addressing modes to determine the operand, as shown in the table at right.
In the assembler formats listed, nn represents a single-byte (8-bit) figure, and nnnn is a two-byte (16-bit) address.
With some addressing forms (marked with an asterisk, *, in the "Number of cycles" column) the execution time for AND depends on the circumstances: In cases where the indexing requires the CPU to "reach across" a page boundary from the base address, the execution time is 1 cycle longer than listed here.
AND affects 2 of the CPU's status flags: