Comprehensive study of nasm covering fundamental concepts and advanced applications.
Assembly programs often need to perform actions like reading files or printing output. This is done by making system calls to the operating system.
You load specific values into registers (like eax
, ebx
) to tell the OS what you want, then trigger a software interrupt (like int 0x80
on Linux).
mov eax, 1 ; syscall number for exit
xor ebx, ebx ; exit code 0
int 0x80 ; invoke syscall
write
: Output to console or fileread
: Input from console or fileexit
: End the programSystem calls are the foundation for all applications, from simple scripts to complex browsers, as they allow software to interact with hardware safely.
Using int 0x80
to print a message in Linux.
Reading user input by calling the appropriate system call.
System calls let assembly programs interact with the OS to perform useful tasks like reading input or writing output.