Hello World in assembly for x86

Code :


;author:md.jamal mohiuddin

global _start

section .text

_start:
;print hello world on the screen

mov eax,0x4 ;system call number
mov ebx,0x1 ;fd =1
mov ecx,message ;buf points to the message
mov edx,11 ;len = 11
int 0x80 ;trap interrupt(software defined)

;exit gracefully

mov eax,0x1 ;system call number
mov ebx,0x3 ;first argument
int 0x80 ;trap interrupt(software defined)



section .data

message : db "Hello World\n"


To execute
 nasm -f elf32 -o hello.o hello.asm 

ld -o hello hello.o
./hello

To check the return type: echo $?

Comments

Popular posts from this blog

bb.utils.contains yocto

Difference between RDEPENDS and DEPENDS in Yocto

PR, PN and PV Variable in Yocto