nice! thanks Ken. I was thinking about that approach. my mistake was thinking I needed to zero out the unused bytes between stages but the ani 1 fixes that.
On Wed, Dec 18, 2024 at 6:56 PM Kenneth Pettit <[email protected]> wrote: > 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 > > >
