
Instruction Set
4-42
DAA
Decimal Adjust AL After Addition
DAA
What It Does
DAA converts an 8-bit unsigned binary number that is the sum of two single-byte packed
decimal (BCD) numbers to its packed decimal equivalent.
Syntax
Description
Execute DAA only after executing an ADD or ADC instruction that leaves a two-BCD-digit
byte result in the AL register. The ADD or ADC operands should consist of two packed
BCD digits. DAA adjusts the AL register to contain the correct two-digit packed decimal
result.
Operation It Performs
Form
Opcode
Description
Clocks
Am186 Am188
DAA
27
Decimal-adjust AL after addition
4
4
DAA
if (((AL & 0x0F) > 9) || (AF == 1))
/* low nibble of AL is not yet in BCD format */
{
/* convert low nibble of AL to decimal */
AL = AL + 6;
/* set auxiliary (decimal) carry flag */
AF = 1;
}
else
/* clear auxiliary (decimal) carry flag */
AF = 0;
if ((AL > 0x9F) || (CF == 1))
/* high nibble of AL is not yet in BCD format */
{
/* convert high nibble of AL to decimal */
AL = AL + 0x60;
/* set carry flag */
CF = 1;
}
else
/* clear carry flag */
CF = 0;
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...