The And Immediate instruction performs a logical bit by bit “and” between a byte in memory  and an immediate constant.  Operand 1, the target,  is a byte in memory and Operand 2, the source, specifies the immediate constant.  The byte in memory is “and-ed” internally with the immediate constant and contains the final result.  The immediate constant is not changed.  The table below shows the results of “anding” two bits together.

 

                                                 Bit 1      Bit 2    Bit 1 and Bit 2

                                                    0           0                  0

                                                    0           1                  0

                                                    1           0                  0

                                                    1           1                  1

 

   This instruction sets the condition code as follows:

 

                 0  if all target bits are set to 0.  Test this condition with BZ or BNZ.

                 1  if any target bit is set to 1.  Test this condition with BM or BNM.

 

        Some Unrelated And Immediates

 

              BYTE1  DC   X’00’

              BYTE2  DC   X’FF’

              BYTE3  DC   X’C3’

 

       NI    BYTE1,X’12’         BYTE1 = X’00’    Condition Code = 0

       NI    BYTE1,X’FF’         BYTE1 = X’00’    Condition Code = 0

       NI    BYTE1,C’A’          BYTE1 = X’00’    Condition Code = 0

       NI    BYTE1,B’11110000’   BYTE1 = X’00’    Condition Code = 0

       NI    BYTE2,X’12’         BYTE2 = X’12’    Condition Code = 1

       NI    BYTE2,X’FF’         BYTE2 = X’FF’    Condition Code = 1

       NI    BYTE2,C’A’          BYTE2 = X’C1’    Condition Code = 1

       NI    BYTE2,B’11110000’   BYTE2 = X’F0’    Condition Code = 1

       NI    BYTE3,X’12’         BYTE3 = X’02’    Condition Code = 1

       NI    BYTE3,X’FF’         BYTE3 = X’C3’    Condition Code = 1

       NI    BYTE3,C’A’          BYTE3 = X’C1’    Condition Code = 1

       NI    BYTE3,B’11110000’   BYTE3 = X’C0’    Condition Code = 1