GitHub_collection_hello-world/a/assembler_nasm_linux64.asm
2020-11-07 10:09:48 +13:00

18 lines
670 B
NASM

section .rodata
msg db "Hello World", 0xA ; String to print
len equ $- msg ; Length of string
section .text
global _start ; Specify entry point to linker
_start:
mov eax, 1 ; System call ID (sys_write)
mov edi, eax ; File descriptor (stdout)
mov esi, msg ; Text to print
mov edx, len ; Length of text to print
syscall ; Call kernel
mov eax, 60 ; System call ID (sys_exit)
xor edi, edi ; Error code (EXIT_SUCCESS)
syscall ; Call kernel