Register | Function | 16-bit low end | 8-bit |
eax | Accumulator | ax | ah, al |
ebx | (base index) | bx | bh, bl |
ecx | (count) | cx | ch, cl |
edx | (data) | dx | dh, dl |
edi | (destination index) | do | |
esi | (source index) | si | |
ebp | Frame pointer | bp | |
esp | Stack top pointer | sp |
Register | Function |
cs | Code section |
ds | Data section |
ss | Stack section |
es | (extra section) |
fs | (supplemental section) |
gs | (supplemental section) |
S | Sign |
Z | Zero |
C | Carry |
P | Parity |
O | Overflow |
32-bit EIP (Instruction Pointer Register)
Base | +( | Index | * | Scale | )+ | Displacement |
eax ebx ecx edx esp ebp esi edi |
eax ebx ecx edx ebp esi edi |
1 2 3 4 |
Name Number |
Caller ... | |
call target | Transfer of control from caller to the subroutine by
|
Subroutine | |
pushl %ebp movl %esp, %ebp |
Save base pointer of the caller New base pointer (activation record/frame) |
Callee ... | Body of Subroutine |
movl %ebp,%esp popl %ebp |
Restore the callers stack top pointer Restore the callers base pointer |
ret | Return of control from the subroutine to the caller by alter the program counter (CS:IP) register to the saved address of the caller. |
Caller ... |
NEXT:... ... jmp NEXT ;GOTO NEXT
jmp dest | unconditional | NEXT:... ... jmp NEXT ;GOTO NEXT | |
Unsigned conditional jumps | |||
jcc dest | |||
ja/jnbe | C=0 and Z=0 | Jump if above | |
jae/jnb | C=0 | Jump if above or equal to | |
jb/jnae | C=1 | Jump if below | |
jbe/jna | C=1 or Z=1 | Jump if below or equal to | |
jc | C=1 | Jump if carry set | |
je/jz | Z=1 | Jump if equal to | |
jnc | C=0 | jump if carry cleared | |
jne/jnz | Z=0 | jump if not equal | |
jnp/jpo | P=0 | jump if no parity | |
jp/jpe | P=1 | jump on parity | |
jcxz | cx=0 | jump if cx=0 | gcc does not use |
jecxz | ecx=0 | jump if ecx=0 | gcc does not use |
Signed conditional jumps | |||
jcc dest | |||
jg/jnle | Z=0 and S=0 | jump if greater than | |
jge/jnl | S=0 | jump if greater than or equal | |
jl/jnge | S=1 | jump if less than | |
jle/jng | Z=1 or S=1 | jump if less than or equal | |
jno | O=0 | jump if no overflow | |
jns | S=0 | jump on no sign | |
jo | O=1 | jump on overflow | |
js | S=1 | jump on sign |
Termination condition | ||
loop label | ecx = 0 | gcc does not use |
loopz/loope lab el | ecx =0 or ZF = 0 | gcc does not use |
loopnz/loopne label | ecx = 0 or ZF = 1 | gcc does not use |
initialize esi and edi with addresses for source and destination strings
initialize ecx with count
Set the direction flag with cld to count up, with std to cound down
prefix string-operation
Register | Function |
st | |
st(0) | |
st(1) | |
... | |
st(7) |