Volume 3: General-Purpose and System Instructions - Stanford ...
Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...
AMD64 Technology 24594 Rev. 3.10 February 2005DAADecimal Adjust after AdditionAdjusts the value in the AL register into a packed BCD result and sets the CF and AFflags in the rFLAGS register to indicate a decimal carry out of either nibble of AL.Use this instruction to adjust the result of a byte ADD instruction that performed thebinary addition of one 2-digit packed BCD values to another.The instruction performs the adjustment by adding 06h to AL if the lower nibble isgreater than 9 or if AF = 1. Then 60h is added to AL if the original AL was greater than99h or if CF = 1.If the lower nibble of AL was adjusted, the AF flag is set to 1. Otherwise AF is notmodified. If the upper nibble of AL was adjusted, the CF flag is set to 1. Otherwise, CFis not modified. SF, ZF, and PF are set according to the final value of AL.Using this instruction in 64-bit mode generates an invalid-opcode (#UD) exception.Mnemonic Opcode DescriptionDAA 27Decimal adjust AL.(Invalid in 64-bit mode.)rFLAGS AffectedID 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, and 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.136 DAA
24594 Rev. 3.10 February 2005 AMD64 TechnologyDASDecimal Adjust after SubtractionAdjusts the value in the AL register into a packed BCD result and sets the CF and 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, and 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 InstructionsDAArFLAGS 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, and 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
- Page 116 and 117: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 118 and 119: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 120 and 121: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 122 and 123: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 124 and 125: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 126 and 127: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 128 and 129: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 130 and 131: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 132 and 133: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 134 and 135: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 136 and 137: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 138 and 139: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 140 and 141: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 142 and 143: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 144 and 145: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 146 and 147: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 148 and 149: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 150 and 151: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 152 and 153: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 154 and 155: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 156 and 157: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 158 and 159: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 160 and 161: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 162 and 163: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 164 and 165: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 168 and 169: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 170 and 171: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 172 and 173: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 174 and 175: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 176 and 177: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 178 and 179: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 180 and 181: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 182 and 183: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 184 and 185: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 186 and 187: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 188 and 189: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 190 and 191: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 192 and 193: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 194 and 195: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 196 and 197: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 198 and 199: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 200 and 201: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 202 and 203: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 204 and 205: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 206 and 207: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 208 and 209: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 210 and 211: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 212 and 213: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 214 and 215: AMD64 Technology 24594 Rev. 3.10 Fe
AMD64 Technology 24594 Rev. 3.10 February 2005DAADecimal Adjust after AdditionAdjusts 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 carry out of either nibble of AL.Use this instruction to adjust the result of a byte ADD instruction that performed thebinary addition of one 2-digit packed BCD values to another.The instruction performs the adjustment by adding 06h to AL if the lower nibble isgreater than 9 or if AF = 1. Then 60h is added to AL if the original AL was greater than99h or if CF = 1.If the lower nibble of AL was adjusted, the AF flag is set to 1. Otherwise AF is notmodified. If the upper nibble of AL was adjusted, the CF flag is set to 1. Otherwise, CFis not modified. SF, ZF, <strong>and</strong> PF are set according to the final value of AL.Using this instruction in 64-bit mode generates an invalid-opcode (#UD) exception.Mnemonic Opcode DescriptionDAA 27Decimal adjust AL.(Invalid in 64-bit mode.)rFLAGS AffectedID 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.136 DAA