MOV  C,A
RRC    ; Move upper 4 bits to lower nibble
RRC
RRC
RRC
XRA C     ; XOR upper nibble with lower
MOV C,A  ; Save result
RRC       ; Move upper 2 bits of lower nibble to lower bits
RRC
XRA C    ; XOR lower bits
MOV C,A
RRC
XRA C
ANI 1

I didn't test this but I *believe* A should have 1 if ODD, zero if EVEN

Ken

On 12/18/24 2:55 PM, Stephen Adolph wrote:
Hi all you assembly programmers.

I'm trying to code up a fast way to calculate parity of an 8 bit value without relying on the parity flag itself.

I have a solution that is abut 40 bytes long and is a loop that checks each bit and manually calculates parity bit.

Is there a quick way I am missing?

Thanks

Reply via email to