x86-64 assembly language Flashcards
how to assemble .asm file with yasm to get object .o file
yasm -g dwarf2 -f elf64 example.asm -l example.txt
-g dwarf2
informs assembler to include debugging info in object file
-f elf64
informs assembler to create object file in ELF64 format
example.asm
name of assembly language source file
-l example.txt
informs assembler to create list file named example.list
link object files with ld to get executable program
ld -g -o example example.o
-g
informs linker to include debugging info in final executable file
-o example
specify and create executable file named example
data section of program
section .data; holds initialized variables and constants
variable format
<variableName> <dataType> <initialValue>
</initialValue></dataType></variableName>
text section of program
section .text; includes instructions
starting text section
global _start
_start:
(data types) db
8-bits
(data types) dw
16-bits
(data types) dd
32-bits
(data types) dq
64-bits
(data types) ddq
128-bit integer
(data types) dt
128-bit float
(data declarations) _Var
_bit variable (wVar dw = declaring 16 bit variable)
(data declarations) cVar
single character (8 bits)
(data declarations) strng
string
(data declarations) arr
array
(data declarations) flt1
float
constants are defined as
equ
lowest 32-bits registers
eax, ebx, ecx, edx, esi, edi, ebp, esp, r8d-r15d
64 bit registers
rax, rbx, rcx, rdx, rsi, rdi, rbp, rsp, r8-r15
how to access memory
brackets
brackets vs no brackets
no brackets obtain address of item, brackets access memory / value stored
size qualifiers
byte, dword, qword