eax |
ecx |
edx |
ebx |
esi |
edi |
ebp |
esp |
Mnemonic |
Purpose |
Examples |
mov src,dest |
Move data between registers, load immediate data into registers, move data between registers and memory. |
mov $4,%eax # Load constant into eax mov %eax,%ebx # Copy eax into ebx mov %ebx,123 # Copy ebx to memory address 123 |
add src,dest |
dest=dest+src |
add %ebx,%eax # Add ebx to eax |
mul src |
Multiply eax and src as unsigned integers, and put the result in eax. High 32 bits of product go into eax. |
mul %ebx #Multiply eax by ebx |
jmp label | Goto the instruction label:. Skips anything else in the way. | jmp post_mem mov %eax,0 # Write to NULL! post_mem: # OK here... |
cmp a,b |
Compare two values. Sets
flags that are used by the conditional jumps (below). WARNING:
compare is relative to *last* argument, so "jl" jumps if b<a! |
cmp $10,%eax |
jl label | Goto label if previous comparison came out as less-than. Other conditionals available are: jle (<=), je (==), jge (>=), jg (>), jne (!=), and many others. | jl loop_start # Jump if eax<10 |