* better
[mascara-docs.git] / hw / i386.reference / AAS.htm
blobe5b05fac059842a3a3cab50815d9500cdf339dd2
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Opcode AAS</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="AAM.htm"> AAM ASCII Adjust AX after Multiply</A><BR>
10 <B>next:</B><A HREF="ADC.htm"> ADC Add with Carry</A>
11 <P>
12 <HR>
13 <P>
14 <H1>AAS -- ASCII Adjust AL after Subtraction</H1>
16 <PRE>
17 Opcode Instruction Clocks Description
19 3F AAS 4 ASCII adjust AL after subtraction
20 </PRE>
22 <H2>Operation</H2>
24 <PRE>
25 IF (AL AND 0FH) > 9 OR AF = 1
26 THEN
27 AL := AL - 6;
28 AL := AL AND 0FH;
29 AH := AH - 1;
30 AF := 1;
31 CF := 1;
32 ELSE
33 CF := 0;
34 AF := 0;
35 FI;
36 </PRE>
38 <H2>Description</H2>
40 Execute AAS only after a
41 <A HREF="SUB.htm">SUB</A> instruction that leaves the byte result in the
42 AL register. The lower nibbles of the operands of the
43 <A HREF="SUB.htm">SUB</A> instruction must
44 have been in the range 0 through 9 (BCD digits). In this case, AAS adjusts
45 AL so it contains the correct decimal digit result. If the subtraction
46 produced a decimal carry, the AH register is decremented, and the carry and
47 auxiliary carry flags are set to 1. If no decimal carry occurred, the carry
48 and auxiliary carry flags are set to 0, and AH is unchanged. In either case,
49 AL is left with its top nibble set to 0. To convert AL to an ASCII result,
50 follow the AAS with <A HREF="OR.htm">OR</A> AL, 30H.
52 <H2>Flags Affected</H2>
54 AF and CF as described above; OF, SF, ZF, and PF are undefined
56 <H2>Protected Mode Exceptions</H2>
58 None
60 <H2>Real Address Mode Exceptions</H2>
62 None
64 <H2>Virtual 8086 Mode Exceptions</H2>
66 None
69 <P>
70 <HR>
71 <P>
72 <B>up:</B> <A HREF="c17.htm">
73 Chapter 17 -- 80386 Instruction Set</A><BR>
74 <B>prev:</B><A HREF="AAM.htm"> AAM ASCII Adjust AX after Multiply</A><BR>
75 <B>next:</B><A HREF="ADC.htm"> ADC Add with Carry</A>
76 </BODY>