Last active
December 3, 2024 11:15
-
-
Save SourLemonJuice/6df94858c4b4061d814684c0b80df814 to your computer and use it in GitHub Desktop.
x86_64 Linux assmbely(nasm) example for printing Hello World.
This file contains hidden or 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
| ; Thanks for: | |
| ; https://p403n1x87.github.io/getting-started-with-x86-64-assembly-on-linux.html | |
| global _start | |
| SYS_WRITE equ 1 | |
| SYS_EXIT equ 60 | |
| STDOUT equ 1 | |
| SECTION .data | |
| hello db "Hello, World.", 10 | |
| hello_len equ $-hello | |
| SECTION .text | |
| _start: | |
| mov rax, SYS_WRITE | |
| mov rdi, STDOUT | |
| mov rsi, hello | |
| mov rdx, hello_len | |
| syscall | |
| push rax | |
| mov rax, SYS_EXIT | |
| pop rdi | |
| sub rdi, hello_len | |
| syscall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment