13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24594 Rev. 3.10 February 2005 AMD64 TechnologyAAAASCII Adjust After AdditionAdjusts the value in the AL register to an unpacked BCD value. Use the AAAinstruction after using the ADD instruction to add two unpacked BCD numbers.If the value in the lower nibble of AL is greater than 9 or the AF flag is set to 1, theinstruction increments the AH register, adds 6 to the AL register, <strong>and</strong> sets the CF <strong>and</strong>AF flags to 1. Otherwise, it does not change the AH register <strong>and</strong> clears the CF <strong>and</strong> AFflags to 0. In either case, AAA clears bits 7–4 of the AL register, leaving the correctdecimal digit in bits 3–0.This instruction also makes it possible to add ASCII numbers without having to maskoff the upper nibble ‘3’.Using this instruction in 64-bit mode generates an invalid-opcode exception.Mnemonic Opcode DescriptionAAA 37Create an unpacked BCD number.(Invalid in 64-bit mode.)Related <strong>Instructions</strong>AAD, AAM, AASrFLAGS AffectedID VIP VIF AC VM RF NT IOPL OF DF IF TF SF ZF AF PF CFExceptionsU U U M U M21 20 19 18 17 16 14 13–12 11 10 9 8 7 6 4 2 0Note: Bits 31–22, 15, 5, 3, <strong>and</strong> 1 are reserved. A flag set to 1 or cleared to 0 is M (modified). Unaffected flags are blank. Undefinedflags are U.VirtualException Real 8086 Protected Cause of ExceptionInvalid opcode, #UD X This instruction was executed in 64-bit mode.AAA 61

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!