initial import
[staff/goc4/2018bti7061.git] / asm-4-codification / examples / helloWorld / eatsyscall.asm
1 ; Executable name : EATSYSCALL
2 ; Version : 1.0
3 ; Created date : 1/7/2009
4 ; Last update : 2/18/2009
5 ; Author : Jeff Duntemann
6 ; Description : A simple program in assembly for Linux, using NASM 2.05,
7 ; demonstrating the use of Linux INT 80H syscalls to display text.
8 ;
9 ; Build using these commands:
10 ; nasm -f elf -g -F stabs eatsyscall.asm
11 ; ld -o eatsyscall eatsyscall.o
12 ;
13
14 SECTION .data ; Section containing initialised data
15
16 EatMsg: db "Eat at Joe's!",10
17 EatLen: equ $-EatMsg
18
19 SECTION .bss ; Section containing uninitialized data
20
21 SECTION .text ; Section containing code
22
23 global _start ; Linker needs this to find the entry point!
24
25 _start:
26 nop ; This no-op keeps gdb happy...
27 mov eax,4 ; Specify sys_write call
28 mov ebx,1 ; Specify File Descriptor 1: Standard Output
29 mov ecx,EatMsg ; Pass offset of the message
30 mov edx,EatLen ; Pass the length of the message
31 int 80H ; Make kernel call
32
33 MOV eax,1 ; Code for Exit Syscall
34 mov ebx,0 ; Return a code of zero
35 int 80H ; Make kernel call
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63