Files
2024-02-19 00:25:23 -05:00

60 lines
2.2 KiB
HTML

<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>80386 Programmer's Reference Manual -- Opcode DAA</title>
</head>
<body>
<b>up:</b> <a href="C17.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/C17.HTM">Chapter 17 -- 80386 Instruction Set</a><br>
<b>prev:</b><a href="CWD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/CWD.HTM"> CWD/CDQ Convert Word to Doubleword/Convert Doubleword to Quadword</a><br>
<b>next:</b><a href="DAS.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/DAS.HTM"> DAS Decimal Adjust AL after Subtraction</a>
<p>
<hr>
<p>
<h1>DAA -- Decimal Adjust AL after Addition</h1>
<pre>
Opcode Instruction Clocks Description
27 DAA 4 Decimal adjust AL after addition
</pre>
<h2>Operation</h2>
<pre>
IF ((AL AND 0FH) &gt; 9) OR (AF = 1)
THEN
AL := AL + 6;
AF := 1;
ELSE
AF := 0;
FI;
IF (AL &gt; 9FH) OR (CF = 1)
THEN
AL := AL + 60H;
CF := 1;
ELSE CF := 0;
FI;
</pre>
<h2>Description</h2>
Execute DAA only after executing an <a href="ADD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/ADD.HTM">ADD</a> instruction that leaves a two-BCD-digit byte result in the AL register. The <a href="ADD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/ADD.HTM">ADD</a> operands should consist of two packed BCD digits. The DAA instruction adjusts AL to contain the correct two-digit packed decimal result.
<h2>Flags Affected</h2>
AF and CF as described above; SF, ZF, PF, and CF as described in <a href="APPC.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/APPC.HTM">Appendix C</a>.
<h2>Protected Mode Exceptions</h2>
None
<h2>Real Address Mode Exceptions</h2>
None
<h2>Virtual 8086 Mode Exceptions</h2>
None
<p>
<hr>
<p><b>up:</b> <a href="C17.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/C17.HTM">Chapter 17 -- 80386 Instruction Set</a><br>
<b>prev:</b><a href="CWD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/CWD.HTM"> CWD/CDQ Convert Word to Doubleword/Convert Doubleword to Quadword</a><br>
<b>next:</b><a href="DAS.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/DAS.HTM"> DAS Decimal Adjust AL after Subtraction</a>
</body>