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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

24594 Rev. 3.10 February 2005 AMD64 TechnologyDASDecimal Adjust after SubtractionAdjusts the value in the AL register into a packed BCD result <strong>and</strong> sets the CF <strong>and</strong> AFflags in the rFLAGS register to indicate a decimal borrow.Use this instruction adjust the result of a byte SUB instruction that performed abinary subtraction of one 2-digit, packed BCD value from another.This instruction performs the adjustment by subtracting 06h from AL if the lowernibble is greater than 9 or if AF = 1. Then 60h is subtracted from AL if the original ALwas greater than 99h or if CF = 1.If the adjustment changes the lower nibble of AL, the AF flag is set to 1; otherwise AFis not modified. If the adjustment results in a borrow for either nibble of AL, the CFflag is set to 1; otherwise CF is not modified. The SF, ZF, <strong>and</strong> PF flags are set accordingto the final value of AL.Using this instruction in 64-bit mode generates an invalid-opcode (#UD) exception.Mnemonic Opcode DescriptionDASRelated <strong>Instructions</strong>DAArFLAGS Affected2FDecimal adjusts AL after subtraction.(Invalid in 64-bit mode.)ID VIP VIF AC VM RF NT IOPL OF DF IF TF SF ZF AF PF CFExceptionsU M M M M 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.DAS 137

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

Saved successfully!

Ooh no, something went wrong!