Skip to content
This repository has been archived by the owner on Jan 1, 2019. It is now read-only.

Commit

Permalink
Create hello_world.asm
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitbatra123 authored Oct 1, 2017
1 parent 9b9b0f0 commit 2dbd3c4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions hello_world.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
;
;"hello, world" in assembly language for Linux
;
;to compile:
;
;nasm -f elf hello.asm
;ld -s -o hello hello.o

section .text
global _start ;must be declared for linker (ld)

_start: ;tell linker entry point

mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel

mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel

section .data

msg db 'Hello, world!',0xa ;our dear string
len equ $ - msg ;length of our dear string

0 comments on commit 2dbd3c4

Please sign in to comment.