NASM
Comprehensive study of nasm covering fundamental concepts and advanced applications.
Advanced Topics
System Calls and Interfacing with Operating Systems
What Are System Calls?
System calls are special requests your program makes to the operating system (OS) to do things like print text, read files, or exit.
Using System Calls in NASM
On Linux, you:
- Set up arguments in registers (like
eax
,ebx
,ecx
) - Use the
int 0x80
instruction to ask the OS to help
Example: Printing to the Screen
mov eax, 4 ; syscall number for write
mov ebx, 1 ; file descriptor 1 = stdout
mov ecx, message ; pointer to your message
mov edx, 13 ; message length
int 0x80 ; make the call
Why This Matters
System calls connect your NASM programs to the real world: files, screens, keyboards, and more!
Learning to use them is essential for any non-trivial app.
Examples
Writing text to the terminal using a Linux system call.
Exiting a program cleanly with a system call.
In a Nutshell
System calls enable NASM programs to interact with the operating system.