Adds and subtracts arbitrary values. The destination (where the result is stored) is the first value provided (i.e. the left value).
Basic Use:
We can use a combination of registers and immediates as operands:
mov rax, 1
add rax, 2 ; rax now contains 3
sub rax, 1 ; rax now contains 2
mov rcx, 2
add rax, rcx ; as above, rax now contains 4
sub rax, rcx ; rax is now back to 2
Allow multiplication of arbitrary values. Takes a single argument, multiples rax/eax/ax (depending on operand size) by src (whatever follows mul instruction). Result is stored in rax/eax/ax.
Basic Use:
mov eax, 10
mov ecx, 10
mul ecx ; rax now contains 100
mov rax, 5
mov rcx, 7
mul rcx ; rax now contains 35
As with mul, div takes a single argument, and divides the value stored in the dividend register(s) by it. This is typically AX/EAX/RAX (and the *dx equivalents), but may vary a bit depending on the size.
RDX is also needed. RDX is where the remainder will be stored. This register will need to be set to 0 before division can take place. Otherwise you'll get a SIGFPE.
TL;DR: RAX/src (src = rcx in this case). Results stored in RAX, remainder stored in RDX.
Basic Use:
; clearing the register where the
; high bits would be stored, we're only using what's in rax!
mov rdx, 0
mov rax, 10
mov rcx, 2
div rcx ; rax now contains 5