Member-only story
Writing an X86–64 Assembly Language Program
Part VII: Quick Reference
This article is more of a reference guide for those learning x86–64 Assembly Language. I hope you find the information and links at the bottom helpful.
This reference guide is part seven of a series
- Part one: Getting Started Writing Assembly Language
- Part two: Finding an Efficient Development Cycle for writing Assembly Language
- Part three: Writing an X86–64 Assembly Language Program: Printing Command Line Arguments
- Part four: Writing an X86–64 Assembly Language Program: Sending Function Arguments and Receiving a Return Value
- Part five: Writing an X86–64 Assembly Language Program: Conditionals, Jumping, and Looping
- Part six: Writing an X86–64 Assembly Language Program: How to Determine String Length
Registers
General-purpose registers — there are 16 general-purpose registers — rax
, rbx
, rcx
, rdx
, rbp
, rsp
, rsi
, rdi
, r8
, r9
, r10
, r11
, r12
, r13
, r14
, r15
data
- section is used for declaring initialized data or constantsbss
- section is used for declaring non initialized variablestext
- section is used for coderdi
- first argumentrsi
- second argumentrdx
- third argumentrcx
- fourth argumentr8
- fifth argumentr9
- sixth
The first six integer or pointer arguments are passed in registers rdi
, rsi
, rdx
, rcx
, r8
, r9
. r10
is used as a static chain pointer in the case of nested functions.
rax
is used as the return value from a function.
The registers rbx
, rbp
, and r12
– r15
are preserved registers.
All other registers must be saved by the caller if it wishes to preserve its values.
OPERATIONS
ADD
- integer addSUB
- subtractMUL
- unsigned multiplyIMUL
- signed multiply