This repository has been archived by the owner on Jan 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b9b0f0
commit 2dbd3c4
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |