and( <var>, <num1>, <num2> )
This will perform a logical AND as follows:
Take num1 and AND it with num2, write the result to var.
A = B AND 15
and(A, B, 15)
AND is useful for restricting information to be processed. For example, if you are looking at a byte but you are only interested in the lower nibble, you could:
Likewise, if you wanted the upper nibble, you could:
and(A, A, %1111)
Likewise, you can use AND to mask out everything except specific bits that you wish to check, such as:
and(A, A, %11110000)
which means discard everything except the third bit (b2).
and(A, A, %100)