Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dexoidan committed May 16, 2018
1 parent f2bbf3c commit 9e085cb
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Hello Assembler

I will sharing all my assembly files that I am able to compile in a operating system.

It is not my goal to provide any tools that can be used to penetration testing, but i dont know if you are using my stuff to this.

Compilation procedure for Linux environment

Compile hello-world-minimal.c:

gcc hello-world-minimal.c -o helloworld_bin
chmod +x helloworld_bin

Compile helloword.asm

nasm -f elf64 helloworld.asm
ld helloworld.o -o helloworld
chmod +x helloworld

It is interesting that C compiled source code is bigger in size than program code that is written in Assembly.
8 changes: 8 additions & 0 deletions hello-world-minimal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <stdio.h>

int main(int argc, char **argv)
{
char* text = "Hello, World!";
printf("%s\n", text);
return 0;
}
20 changes: 20 additions & 0 deletions helloworld.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
; Define variables in the data section
SECTION .DATA
hello: db 'Hello world!',10
helloLen: equ $-hello

; Code goes in the text section
SECTION .TEXT
GLOBAL _start

_start:
mov eax,4 ; 'write' system call = 4
mov ebx,1 ; file descriptor 1 = STDOUT
mov ecx,hello ; string to write
mov edx,helloLen ; length of string to write
int 80h ; call the kernel

; Terminate program
mov eax,1 ; 'exit' system call
mov ebx,0 ; exit with error code 0
int 80h ; call the kernel

0 comments on commit 9e085cb

Please sign in to comment.