Set the page register to point at the page of RAM that controls the UART.
There is a bit test instruction. Test the LSB of the UARD data.
Then use the bit set/bit clear instruction to set/clear a bit in memory, if you need to.
Ron I think the OP wants to know if the number of 1's in the register is even or odd. Your are thinking about the even or oddness of the number.
The only way to do that is with a loop. Should not be too hard to do in ASM.
Code:
// assume value is the 8 bit number you want to check.
char bit, count;
bit=0;
count=0;
for(bit=0;bit<8;bit++)
{
if (value&0x01)
count++;
value>>1;
}
}
at this point you can check the low order bit of count for oddness as Ron suggested.
Another way that requires just 7 operations (on 8 bits) is to XOR all the bits.
x=A xor B
x=x xor C
x=x xor D
x=x xor E
x=x xor F
x=x xor G
x=x xor H
Result is in x, done.
Of course you have to have access to all the bits to use this method.
One thing, if you're doing this with a software UART (I'm assuming you're calculating parity from a serial transmission) then you can just test each bit as it arrives. If one = increment a counter register, else do nothing. Then after, you check the LSB of that counter register, which will indicate the number of 1's you've recieved in that byte.
Can also be done for checking certain bits in a stream, such as hamming encoding/decoding on the fly. Works out rather quick - but of course its only for 'software' bit banging comms.