Re: Application of parity flag
From: TS (spamtrap_at_crayne.org)
Date: 10/22/04
- Next message: wolfgang kern: "Re: math co-processor exceptions"
- Previous message: alex: "Re: PC boot block programming madness"
- In reply to: spamtrap_at_crayne.org: "Re: Application of parity flag"
- Next in thread: Chris Giese: "Re: Application of parity flag"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 22 Oct 2004 01:10:35 +0000 (UTC)
>About the only practical use that I can think of testing parity of
>communications data (which is usually handled by hardware).
>
> mov al,<byte to be tested>
> test al,al
> jp <somewhere> ; byte has even parity
> ; byte has odd parity
I guess that creating checksums (Parity=XOR of all bits) is the main
purpose for the parity flag.
There is another useage for the parity flag, which has nothing to do
with parity: FPU comparations (e.g. FCOMI) set PF whenever the
operands are unordered and clear it if they can be compared.
However, you can also use it for creating semi-random numbers or
interesting patterns: I´ve used it for calculating cellular automata
once, and the paritiy of an ever incremented byte also gives a rather
interesting binary sequence...
You might even use PF to check the corresponding bit in a value which
has been loaded into EFLAGS via LAHF, POPF, IRET, a task switch or
whatever.
- Next message: wolfgang kern: "Re: math co-processor exceptions"
- Previous message: alex: "Re: PC boot block programming madness"
- In reply to: spamtrap_at_crayne.org: "Re: Application of parity flag"
- Next in thread: Chris Giese: "Re: Application of parity flag"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|