
Instruction Set
4-45
DAS
Decimal Adjust AL After Subtraction
DAS
What It Does
DAS converts an 8-bit unsigned binary number that is the difference of two single-byte
packed decimal (BCD) numbers to its packed decimal equivalent.
Syntax
Description
Execute DAS only after a SUB or SBB instruction that leaves a two-BCD-digit byte result
in the AL register. The SUB or SBB operands should consist of two packed BCD digits.
DAS adjusts the AL register to contain the correct packed two-digit decimal result.
Operation It Performs
Form
Opcode
Description
Clocks
Am186 Am188
DAS
2F
Decimal-adjust AL after subtraction
4
4
DAS
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;
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...