| Binary Arithmetic Instructions | |||||
| Name | Description | Code | Operation | operands | operand size |
|---|---|---|---|---|---|
| add | Add |
add dest,source | dest = dest + source | reg, reg reg, mem mem, reg reg, const mem, const |
byte word dword |
| sub | Subtract (set CF if borrow) |
sub dest,source | dest = dest - source | ||
| adc | Add with Carry | adc dest,source | dest = dest + source + CF | ||
| sbb | Subtract with borrow | sbb dest,source | dest = dest - source - CF | ||
| cmp | Compare (update flags as sub) |
cmp op1,op2 | op1 - op2 | ||
| xadd | Exchange and Add | xadd dest,source | source = dest, dest = dest + source |
||
| neg | Negate (two-complement) |
neg op | op = 0 - op (signed) | reg mem |
byte word dword |
| inc | Increment (does not affect CF) |
inc op | op = op + 1 | ||
| dec | Decrement (does not affect CF) |
dec op | op = op - 1 | ||
| all the above binary arthimetic instruction update SF,ZF,PF and OF flags | |||||
| mul | Multiply (unsigned) (set CF and OF when upper half is nozero) |
mul op | ax = al * op | reg mem |
byte |
| dx:ax = ax * op | word | ||||
| edx:eax = eax * op | dword | ||||
| div | Divide (unsigned) | div op | al = ax / op, ah = rest |
byte | |
| ax = dx:ax / op, dx = rest |
word | ||||
| eax = edx:eax / op, edx = rest |
dword | ||||
| imul | Signed Integer Multiply | imul op | ax = al * op | reg mem |
byte |
| dx:ax = ax * op | word | ||||
| edx:eax = eax * op | dword | ||||
| imul dest,source | dest = dest * source | reg, reg reg, mem reg, const |
word,word dword,dword |
||
| imul dest,source,const | dest = source * const | reg,reg,const reg,mem,const |
word,word,word dword,dword,dword |
||
| idiv | Signed Integer Divide | idiv op | al = ax / op, ah = rest |
reg mem |
byte |
| ax = dx:ax / op, dx = rest |
word | ||||
| eax = edx:eax / op, edx = rest |
dword | ||||