šŸ‘šŸ˜Š

On 12/18/24 4:02 PM, Stephen Adolph wrote:
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

Reply via email to