Could someone point out to me what algorithm the Z80 has for the DAA
instruction? (answer please in terms of: if H-flag is set and N-flag
is set then subtract 6 or something like that.)
So far I have emulated it with the intel equivalents, but
there seems to be some differences.
Thanks.
Sean Young.
: Could someone point out to me what algorithm the Z80 has for the DAA
: instruction? (answer please in terms of: if H-flag is set and N-flag
: is set then subtract 6 or something like that.)
It's a fairly long table in the current Z80 User's Manual on page A5-94.
--
-=-=-=-=-=-=-=-=-=-=-=- Check out DIBs and TCJ -=-=-=-=-=-=-=-=-=-=-=-=-
Dave Baldwin: dib...@netcom.com | The Computer Journal 1(800)424-8825
DIBs Electronic Design | Home page "http://www.psyber.com/~tcj/"
Voice : (916) 722-3877 | Hands-on hardware and software
TCJ/DIBs BBS: (916) 722-5799 | TCJ/DIBs FAX: (916) 722-7480
-=-=-=-=-=-=- @#$%^&* I can't even quote myself! Oh,well. -=-=-=-=-=-=-
Sean Young.
: Could someone point out to me what algorithm the Z80 has for the DAA
: instruction? (answer please in terms of: if H-flag is set and N-flag
: is set then subtract 6 or something like that.)
: So far I have emulated it with the intel equivalents, but
: there seems to be some differences.
: Thanks.
: Sean Young.
N . C . high . H . low . # added . C after
. . nibble . . nibble . to A . execution
.................................................
add, adc, inc operands:
0 0 0~9 0 0~9 00 0
0 0~8 0 a~f 06 0
0 0~9 1 0~3 06 0
0 a~f 0 0~9 60 1
0 9~f 0 a~f 66 1
0 a~f 1 0~3 66 1
1 0~2 0 0~9 60 1
1 0~2 0 a~f 66 1
1 0~3 1 0~3 66 1
.................................................
sub, sbc, dec, neg operands:
1 0 0~9 0 0~9 00 0
0 0~8 1 6~f fa 0
1 7~f 0 0~9 a0 1
1 6~f 1 6~f 9a 1
states: 1m, 4t
flags: S Z H P/V C used, N unused.
--
[todd] Saving Virtual Trees;
> states: 1m, 4t
> flags: S Z H P/V C used, N unused.
Thanks! This is exactly what I was looking for! (and I'm not kidding).
Sean.