The Exclusive Or Immediate instruction performs a logical bit by bit “exclusive or” 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 exclusive or-ed internally with the immediate constant and contains the final result.  The immediate constant is not changed.  The table below shows the results of “exclusive or-ing” two bits together.

 

                                                 Bit 1      Bit 2    Result

                                                    0           0            0

                                                    0           1            1

                                                    1           0            1

                                                    1           1            0

 

   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 Exclusive Or Immediates

 

              BYTE1  DC   X’00’

              BYTE2  DC   X’FF’

              BYTE3  DC   X’C3’

 

       XI    BYTE1,X’12’         BYTE1 = X’12’    Condition Code = 1

       XI    BYTE1,X’FF’         BYTE1 = X’FF’    Condition Code = 1

       XI    BYTE1,C’A’          BYTE1 = X’C1’    Condition Code = 1

       XI    BYTE1,B’11110000’   BYTE1 = X’F0’    Condition Code = 1

       XI    BYTE2,X’12’         BYTE2 = X’ED’    Condition Code = 1

       XI    BYTE2,X’FF’         BYTE2 = X’00’    Condition Code = 0

       XI    BYTE2,C’A’          BYTE2 = X’3E’    Condition Code = 1

       XI    BYTE2,B’11110000’   BYTE2 = X’0F’    Condition Code = 1

       XI    BYTE3,X’12’         BYTE3 = X’D1’    Condition Code = 1

       XI    BYTE3,X’FF’         BYTE3 = X’3C’    Condition Code = 1

       XI    BYTE3,C’A’          BYTE3 = X’02’    Condition Code = 1

       XI    BYTE3,B’11110000’   BYTE3 = X’33’    Condition Code = 1