8051 code to find a number is even or odd

    A negative number has its msb as binary 1 …Hence we rotate the number through carry to the left and then decide upon the status of the carry flag.

            ORG 000h
            MOV A,#number   ;The number to be checked for positive  or negative
            RLC A ;rotates the accumulator left through carry
            JC  neg
            MOV A,#00h ; moving 0 to show its positive
            SJMP end
            neg: MOV A,#01h ;moving 1 to accumulator to show the number is negative …you can do any other operation.
            end:  NOP