Assembly language is a low-level programming language that provides direct control over hardware. It is specific to a computer's architecture and is often used to write performance-critical code.
An assembly program consists of three main sections:
section .data msg db "Hello, World!", 0xA ; Message with a newline len equ $ - msg ; Length of the message section .text global _start _start: mov rax, 1 ; System call: write mov rdi, 1 ; File descriptor: stdout mov rsi, msg ; Message address mov rdx, len ; Message length syscall ; Make the system call mov rax, 60 ; System call: exit xor rdi, rdi ; Exit code: 0 syscall ; Make the system call
This code, written for Linux x86-64 architecture, outputs "Hello, World!" to the terminal.