Created
November 13, 2020 05:24
-
-
Save codekittie/53a675f77128bf07bb6c70121eae0220 to your computer and use it in GitHub Desktop.
Khety's first Linux x86_64 assembly program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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