Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Executable name : EATSYSCALL
- ; Version : 1.0
- ; created date: 1/7/2009
- ; last update: 1/7/2009
- ; Description : A simple assembly app for Linux, using NASM 2.05,
- ; demonstrating the use of Linux INT 80H syscalls
- ; to display text.
- ;
- ; Build using these commands:
- ; nasm -f elf -g -F stabs eatsyscall.asm
- ; ld -o eatsyscall eatsyscall.o
- ;
- SECTION .data ; Section containing intialized data
- EatMsg: db "Eat at Joe's!", 10
- EatLen: equ $-EatMsg
- SECTION .bss ; Section containing uninitialized data
- SECTION .text ; Section containing code
- global _start ; Linker needs this to find the entry point!
- _start:
- nop ; This no-op keeps gdb happy (see text)
- mov eax, 4 ; Specify sys_write syscall
- mov ebx, 1 ; specify file descriptor 1: Standard Output
- mov ecx, EatMsg ; pass offset of the message
- mov edx, EatLen ; pass the length of the message
- int 80H ; make syscall to output the text to stdout
- mov eax, 1 ; Specify exit syscall
- mov ebx, 0 ; return a code of zero
- int 80H ; make syscall to terminate the program
Advertisement
Add Comment
Please, Sign In to add comment