Thank you
Applications that use the parity flag?
The parity flag is a bit in the CPU-status-register,
wich is set by a result of a arithmetic instruction
and can be use for following instructions like jp "offset",
to jump when parity flag is set.
Dirk
That's a pretty lame explanation.
The parity flag is a bit in the CPU-status-register,
which is set by a result of a arithmetic or logical instruction
when the L/O 8 bits of the result have even parity.
(at least on an 8086/8088, I haven't yet found a description for
any later processor)
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
--
Arargh410 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html
To reply by email, remove the garbage from the reply address.
| Please, anybody tell me what are applications of parity flag.
I scanned all code I've written so far (~14 GB) for JPE/JPO and
found it only in an RS232 driver module and in an very old 8-bit
calculation. Perhaps some modem-drivers use it as well,
but the x86 parity flag works on low 8 bits only, so it's of limited use.
If someone can proof this wrong, please let me know on which CPU.
__
wolfgang
The purpose of the parity flag was to allow some source-level
compatibility with the 8085 processor which also supported a
parity flag. Early on, Intel provided a "source-level converter"
program that translated 8085 source code to 8086 source code
that was semantically identical (and I've actually had to work
with the output of that translator, yuck). In any case, they
needed the parity flag to make the transition from the 8085
to the 8086 occur smoothly.
Cheers,
Randy Hyde
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.
> Hi,
> Please, anybody tell me what are applications of parity flag .
>
> Thank you
As Randall Hyde points out, the 8086 and all its descendents has a
parity flag mostly because the Intel 8-bit 8088 had one, and Intel
wanted to make sure that 8088 code could be easily ported to the new
16-bit processor.
Most likely the main reason that a lot of the early 8-bitters had
parity bits is that in the old, old days there were UARTs that did not
have the ability to do parity generating and checking in hardware, so
the processor had to do it in software.
And for sure there were paper tape punches and readers in the old
days. They used 7 data bits and a parity bit, and the processor had
to do the parity checking in software on many of them.
Having a parity flag in hardware made the overhead of doing this much,
much less than either counting bits or having a look up table.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
To transmit the 9th bit, use "stick" parity in the serial chip
("stuck-at-0" or "stuck-at-1").
To receive, check if the serial port reports a parity error,
and check the parity in software (using FLAGS.PF). Using
these two error conditions, you can re-create the 9th bit.
--
geezer@ | http://my.execpc.com/~geezer
execpc.com | http://my.execpc.com/~geezer/osd
>On Thu, 21 Oct 2004 01:24:58 +0000 (UTC), spam...@crayne.org (Advait
>Raut) wrote in comp.lang.asm.x86:
>
>> Hi,
>> Please, anybody tell me what are applications of parity flag .
>>
>> Thank you
>
>As Randall Hyde points out, the 8086 and all its descendents has a
>parity flag mostly because the Intel 8-bit 8088 had one, and Intel
>wanted to make sure that 8088 code could be easily ported to the new
>16-bit processor.
I think you want to change 8088 to 8080, twice. :-)
Both the 8086 and 8088 were 16-bitters, internally.
:I think you want to change 8088 to 8080, twice. :-)
That is correct, albeit incomplete. My first personal computer, which used
an 8008, also had a parity flag, and was almost certainly the first Intel
processor to do so.
-- Chuck