* remove "\r" nonsense
[mascara-docs.git] / i386 / i386.reference / DAA.htm
blob3138a6eaf296523abc20eacce700fc6cdc03c488
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Opcode DAA</TITLE>
5 </HEAD>
6 <BODY>
7 <B>up:</B> <A HREF="c17.htm">
8 Chapter 17 -- 80386 Instruction Set</A><BR>
9 <B>prev:</B><A HREF="CWD.htm"> CWD/CDQ Convert Word to Doubleword/Convert Doubleword to Quadword</A><BR>
10 <B>next:</B><A HREF="DAS.htm"> DAS Decimal Adjust AL after Subtraction</A>
11 <P>
12 <HR>
13 <P>
14 <H1>DAA -- Decimal Adjust AL after Addition</H1>
16 <PRE>
17 Opcode Instruction Clocks Description
19 27 DAA 4 Decimal adjust AL after addition
20 </PRE>
22 <H2>Operation</H2>
24 <PRE>
25 IF ((AL AND 0FH) > 9) OR (AF = 1)
26 THEN
27 AL := AL + 6;
28 AF := 1;
29 ELSE
30 AF := 0;
31 FI;
32 IF (AL > 9FH) OR (CF = 1)
33 THEN
34 AL := AL + 60H;
35 CF := 1;
36 ELSE CF := 0;
37 FI;
38 </PRE>
40 <H2>Description</H2>
42 Execute DAA only after executing an
43 <A HREF="ADD.htm">ADD</A> instruction that leaves a
44 two-BCD-digit byte result in the AL register. The
45 <A HREF="ADD.htm">ADD</A> operands should
46 consist of two packed BCD digits. The DAA instruction adjusts AL to
47 contain the correct two-digit packed decimal result.
49 <H2>Flags Affected</H2>
51 AF and CF as described above; SF, ZF, PF, and CF as described in
52 <A HREF="appc.htm">Appendix C</A>.
54 <H2>Protected Mode Exceptions</H2>
56 None
58 <H2>Real Address Mode Exceptions</H2>
60 None
62 <H2>Virtual 8086 Mode Exceptions</H2>
64 None
67 <P>
68 <HR>
69 <P>
70 <B>up:</B> <A HREF="c17.htm">
71 Chapter 17 -- 80386 Instruction Set</A><BR>
72 <B>prev:</B><A HREF="CWD.htm"> CWD/CDQ Convert Word to Doubleword/Convert Doubleword to Quadword</A><BR>
73 <B>next:</B><A HREF="DAS.htm"> DAS Decimal Adjust AL after Subtraction</A>
74 </BODY>