On 12/8/2005 at 5:14 PM Allison wrote:
8080/8085 have a flag that is set when ther eis a carry
from the low 4
bits to the upper as part of the DAA (Decimal Adjust Accumulator). Not
only is it mostly undocumented therre are a bunch of instructions like
Jumps that work with it also undocumented. While I've never deleved
deeper than I had to with 8086/88 I'd bet it exits there and and with
a few more permutations added. It's not unique to Intel!
It's still there--and is one of the reasons this little tibit still works
to convert a 4-bit binary value to ASCII hex:
and al,15
add al,90h
daa
adc al,40h
daa
Of course, on the '86 it's probably faster to just translate the thing
(XLAT) or even use an indexed move--and rather than use a shift and mask to
separate the two hex nibbles, one could use an AAM with a 10H in the second
byte of the opcode instead of the default 0AH. But on the 8080, a cute
trick saved a bunch of code because indexing wasn't easy.
BTW, where was the first place this little trick was employed? I think I
can remember seeing it in the Intel MDS monitor code.
Cheers,
Chuck