Skip to content

Instantly share code, notes, and snippets.

@c33k
Last active December 15, 2015 20:40
Show Gist options
  • Save c33k/5320050 to your computer and use it in GitHub Desktop.
Save c33k/5320050 to your computer and use it in GitHub Desktop.
Assembly codes and Exercises
#A Hello World in assembly language - linux x86 - by Vivek-Ramachandran
#compile it with the commands bellow:
#
# as -o HelloWorld.o HelloWorld.s
# ld -o HelloWorld HelloWorld.o
.data
HelloWorld:
.ascii "Hello world!\n"
.text
.globl _start
_start:
#load arguments for syscall write (number 4. You can check it with >>> cat /usr/include/unistd.h)
#write( index, buffer, size )
movl $4, %eax
movl $1, %ebx
movl $HelloWorld, %ecx
movl $13, %edx #13 bytes
int $0x80
#exit(0)
movl $1, %eax
movl $0, %ebx
int $0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment