On 12/8/2005 at 4:24 PM Jim Leonard wrote:
Is this "half-carry" flag addressable, or is
it just something internal?
A
quick gander at 808x flags doesn't show a "half-carry" flag, unless I'm
missing
something obvious.
Okay, on the 8080, when you do a PUSH PSW, the flags are stored in the
following arrangement:
SZ-H-P-C
If you had a NEC 8080A, the flags are similar:
SZsH-P-C
with the "s" being the subtract flag. The Z80 used a similar, but not
identical arrangement:
SZ-H-PsC
Where "'s" is still the subtract flag, but the parity flag "p" now
serves
as both parity and overlow indicator.
The 8086 has a similar flag arrangement to the 8080 if you do a LAHF
instruction and look at what's in AH:
SZ-H-P-C
The big difference in the half-carry with the Z80 and NEC 8080A from the
Intel 8080 is that one can DAA after a subtract and get a meaningful result
(which is why a "subtract" flag is kept around). The 8086 drops the
problem in the user's lap and adds another instruction, DAS, to do the same
thing.
Cheers,
Chuck