AAD

From Asmpedia

Jump to: navigation, search

ASCII adjust before division

Intel AMD
+ +


Mode


32 64
+ -


Definition:

Adjusts two unpacked BCD (binary-coded decimal) values in al and ah to a single binary value in al and clears ah:

al += BaseValue*ah, ah = 0; // see pseudo-code below


Operation in pseudo code:

aad(optional imm8 BaseValue)
{
  if (x64)
  {
     throw #UD; // invalid opcode exception 
  }

  if (optional BaseValue)
  {
     BaseValue = 0x0A; // base 10
  }

  al = (al + (ah * BaseValue)) & 0xff;
  ah = 0;
  SF(al);
  ZF(al);
  PF(al); 
}


Opcodes (x86):


D5 0A base 10
D5 imm8 base imm8


EFLAGS



:31

:30

:29

:28

:27

:26

:25

:24

:23

:22
ID
:21
VIP
:20
VIF
:19
AC
:18
VM
:17
RF
:16

:15
NT
:14
IOPL
:13:12
OF
:11
DF
:10
IF
:9
TF
:8
SF
:7
ZF
:6

:5
AF
:4

:3
PF
:2

:1
CF
:0
0000000000------0--?---SS0?0S1?


Annotated WinDbg disassembly (x86):

d50a            aad
d50f            aadb    0Fh


Annotated WinDbg disassembly (x64):

d5              ???


Related instructions:

* AAA
* AAM
* AAS
Personal tools