Skip to main content

Write assembly language code for NASM compiler for hello world

Here is the code




 section .text

global _start


_start:

mov eax, 4 ; system call for write

mov ebx, 1 ; file descriptor for standard output

mov ecx, msg ; pointer to the message

mov edx, len ; length of the message

int 0x80 ; call the kernel



mov eax, 1   ; system call for exit

xor ebx, ebx ; exit status 0

int 0x80     ; call the kernel

section .data

msg db 'Hello, World!', 0xA ; the message and a newline character

len equ $ - msg ; length of the message

Comments