Make your own free website on Tripod.com
Up ] Docs Home ]

AAA - ASCII Adjust for Addition

Next ]

*

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

?


Code Mnemonic Description
37 AAA ASCII adjust AL after addition

Description
Adjusts the sum of two unpacked BCD values to create an unpacked BCD result. The AL register is the implied source and destination operand for this instruction. The AAA instruction is only useful when it follows an ADD instruction that adds (binary addition) two unpacked BCD values and stores a byte result in the AL register. The AAA instruction then adjusts the contents of the AL register to contain the correct 1-digit unpacked BCD result.

If the addition produces a decimal carry, the AH register is incremented by 1, and the CF and AF flags are set. If there was no decimal carry, the CF and AF flags are cleared and the AH register is unchanged. In either case, bits 4 through 7 of the AL register are cleared to 0.
Operands Bytes Clocks
1 3 NP

Flags
ID unaffected DF unaffected
VIP unaffected IF unaffected
VIF unaffected TF unaffected
AC unaffected SF undefined.
VM unaffected ZF undefined.
RF unaffected AF sets to 1 if there is a decimal borrow; otherwise, it's cleared to 0.
NT unaffected PF undefined.
IOPL unaffected CF sets to 1 if there is a decimal borrow; otherwise, it's cleared to 0.
OF undefined.