ANI
Chapter
3.
Instruction
Set
AND
Memory with Accumulator
Opcode
Operand
ANA
M
This instruction ANDs the contents of the specified memory location with the accumulator and stores the
re~ult
in
the accumulator. The carry flag
is
reset to zero.
Example:
~ll
___
0
______
0
__
0
______
l~
Cycles:
Sta
tes:
Addressing:
Flags:
2
7
register indirect
Z,S,P,CY,AC
Since any bit ANDed with a zero produces a zero and any bit ANDed with a one remains unchanged,
AND
is
frequently used to zero particular groups of bits. The following example ensures
that
the high-order four bits of
the accumulator
are zero, and the low-order four bits
ar~
unchanged. Assume that the C register contain-;
OFH:
Accumulator
C Register
1 1 1
o
000
000
0
o 0
1
o 0
OFCH
OFH
OCH
AND
IMMEDIATE
WITH
ACCUMULATOR
ANI
performs a logical
AND
operation using the contents of the second byte
of
the instruction and the accumu-
lator. The result
is
pldced
in
the accumulator.
AN
I also resets the carry flag to zero.
Op co
de
Operand
ANI
data
The operand must specify the
data to
be
used
in
the
AND
operation. This data may
be
in
the form of a number,
an
ASCII constant, the label
of
some previously defined value, or
an
expression. The data may not exceed one
byte.
The assembler's relocation feature treats
all
external and relocatable symbols
as
16-bit addresses. When one of
these symbols appears
in
the operand expres<;ion of
an
immediate instruction, it must
be
preceded
by
either the
HIGH or
LOW
operator to specify which byte of the address
is
to
be
used
in
the evaluation of the expression.
When
neither operator
is
present, the assembler assumes the
LOW
operator and issues an error message.
3-7