Skip to main content

AND

Compute the bitwise AND of the two operands, storing the result in the left operand.

OpcodeBytesCyclesFormExample
$7633and b:_, {u_byte}and b:1, 123
$ce43and p:_, {u_pair}and p:2, 12345
$7733and i:_, {u_byte}and i:4, 123
$cf43and i:_, {u_pair}and i:4, 12345
$7833and i:_, xhex {xint}and i:4, xhex $d000_0000
$7933and b:_, b:_and b:1, b:2
$7a33and p:_, p:_and p:2, p:4
$7b33and i:_, i:_and i:4, i:8
Condition flagOutput
zero (ZF)If the result is zero, this flag is 1; otherwise it is 0.
negative (NF)This flag is updated with the highest bit of the result.
For example, if and b:0, $f0 stores $80 in b:0, then NF will be 1.
overflow (OF)This flag is always 0.
carry (CF)This flag is always 0.

Notes

  • and is commonly used for bitmask operations.

  • Large literal values such as $d000_0000 must be compatible with XHEX encoding.