andi
Logical AND immediate
Performs a logical AND of an immediate value and the second operand, storing the result in the second operand.
Used in
- Arithmetic, logic and bitsM68K assembly
- trap #15 and its tasksM68K assembly
- Exceptions and the vector tableM68K assembly
- Multiply and divide, with the remainderM68K assembly
- Bit tests, shifts, masks and counting set bitsM68K assembly
- A subroutine with its arguments in registersM68K assembly
- A jump tableM68K assembly
- Convert a number to a string in any baseM68K assembly
- A bouncing ballM68K assembly
- The snake gameM68K assembly
XNZVC –●●00
- ● depends on the result
- 0 always 0
- – not changed
Forms that affect the flags differently are shown in their row.
Forms
andi ,Size .b X●N●Z●V●C●
Privileged
These forms require supervisor mode. In user mode they raise a privilege violation. See user and supervisor mode.
andi ,Size .w X●N●Z●V●C●
Operands
#imm- An immediate value written after
#: a number, character or label, such as#10,#$FFor#'a'. It must fit the operation’s size: byte-128to255, word-32768to65535, or long-2147483648to4294967295; signed and unsigned spellings are accepted. More <ea>- An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With
opt p=68020, an allowedd(An,Xn)ord(PC,Xn)mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More ccr- The condition-code register: the low byte of
sr, containing theX,N,Z,VandCflags. More sr- The 16-bit status register. Its upper byte contains system flags; its lower byte contains the condition codes. More
move.l #$ABCD, d0
andi.w #$FF00, d0 ; keep high byte only: d0 = $AB00