AAA
From Asmpedia
Revision as of 21:40, 6 April 2007; view current revision
←Older revision | Newer revision→
←Older revision | Newer revision→
[edit]
ASCII adjust after addition
| Intel | AMD |
|---|---|
| + | + |
Mode
| 32 | 64 |
|---|---|
| + | - |
Definition:
Adjusts the sum of two unpacked BCD (binary-coded decimals) values:
mov al, 8 mov bl, 4 add al, bl ; al = 12, unpacked BCD byte can contain only 0..9 aaa ; ah = 1, al = 2
Operation in pseudo code:
aaa()
{
if (x64)
{
throw #UD; // invalid opcode exception
}
if ((al & 0x0f) || (AF == 1))
{
al = (al + 6) & 0x0f;
++ah;
AF = CF = 1;
}
else
{
AF = CF = 0;
AL &= 0x0f;
}
}
Opcodes (x86):
| 37 |
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 |
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - | - | - | - | - | - | 0 | - | - | ? | - | - | - | ? | ? | 0 | S | 0 | ? | 1 | S |
Annotated WinDbg disassembly (x86):
37 aaa
Annotated WinDbg disassembly (x64):
37 ???
Related instructions:
* AAD * AAM * AAS

