Skip to content

Instantly share code, notes, and snippets.

@codekittie
Created November 13, 2020 05:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codekittie/53a675f77128bf07bb6c70121eae0220 to your computer and use it in GitHub Desktop.
Save codekittie/53a675f77128bf07bb6c70121eae0220 to your computer and use it in GitHub Desktop.
Khety's first Linux x86_64 assembly program
global _start
section .text
_start:
mov r8, 0
mov r9, 1
mov r11, 1
loop:
mov r10, r8
mov r8, r9
add r9, r10
add r11, 1
cmp r11, 7
jne loop
mov rax, 60
mov rdi, r8
syscall
nasm -f elf64 fib.asm
ld -o fib fib.o
./fib
echo $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment