55 lines
2.4 KiB
HTML
55 lines
2.4 KiB
HTML
<html><!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
|
<html>
|
|
|
|
<head>
|
|
<title>80386 Programmer's Reference Manual -- Opcode AAA</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="S17_02.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/S17_02.HTM">17.2 Instruction Format</a><br>
|
|
<b>next:</b><a href="AAD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/AAD.HTM"> AAD ASCII Adjust AX before Division</a>
|
|
<p>
|
|
<hr>
|
|
<p>
|
|
<h1>AAA -- ASCII Adjust after Addition</h1>
|
|
<pre>
|
|
|
|
|
|
|
|
Opcode Instruction Clocks Description
|
|
|
|
37 AAA 4 ASCII adjust AL after addition
|
|
</pre>
|
|
<h2>Operation</h2>
|
|
<pre>
|
|
|
|
|
|
|
|
IF ((AL AND 0FH) > 9) OR (AF = 1)
|
|
THEN
|
|
AL := (AL + 6) AND 0FH;
|
|
AH := AH + 1;
|
|
AF := 1;
|
|
CF := 1;
|
|
ELSE
|
|
CF := 0;
|
|
AF := 0;
|
|
FI;
|
|
</pre>
|
|
<h2>Description</h2>
|
|
Execute AAA only following an <a href="ADD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/ADD.HTM">ADD</a> instruction that leaves a byte result in the AL register. The lower nibbles of the operands of the <a href="ADD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/ADD.HTM">ADD</a> instruction should be in the range 0 through 9 (BCD digits). In this case, AAA adjusts AL to contain the correct decimal digit result. If the addition produced a decimal carry, the AH register is incremented, and the carry and auxiliary carry flags are set to 1. If there was no decimal carry, the carry and auxiliary flags are set to 0 and AH is unchanged. In either case, AL is left with its top nibble set to 0. To convert AL to an ASCII result, follow the AAA instruction with <a href="OR.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/OR.HTM">OR</a> AL, 30H.
|
|
<h2>Flags Affected</h2>
|
|
AF and CF as described above; OF, SF, ZF, and PF are undefined
|
|
<h2>Protected Mode Exceptions</h2>
|
|
None
|
|
<h2>Real Address 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="S17_02.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/S17_02.HTM">17.2 Instruction Format</a><br>
|
|
<b>next:</b><a href="AAD.HTM" tppabs="http://webster.cs.ucr.edu/Page_TechDocs/Doc386/AAD.HTM"> AAD ASCII Adjust AX before Division</a>
|
|
</body>
|
|
|