NASM Coding: Basics

Here are the General-Purpose CPU registers that we'll work with and their descriptions:

Register Size Typical Purpose (Convention)
rax
=
r0
64-bit Accumulator; return value; syscall number
rbx
=
r1
64-bit General-purpose
rcx
=
r2
64-bit Counter (loops, shifts)
rdx
=
r3
64-bit Data register; I/O length; syscall arguments
rsi
=
r4
64-bit Source index; pointer to input data
rdi
=
r5
64-bit Destination index; pointer to output data
rbp
=
r6
64-bit Base pointer (stack frame reference)
rsp
=
r7
64-bit Stack pointer (top of stack)
r8
64-bit General-purpose; syscall arguments
r9
to
r15
64-bit General-purpose