-
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
dexoidan
committed
May 16, 2018
1 parent
f2bbf3c
commit 9e085cb
Showing
3 changed files
with
48 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,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. |
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,8 @@ | ||
#include <stdio.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
char* text = "Hello, World!"; | ||
printf("%s\n", text); | ||
return 0; | ||
} |
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,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 |