Created
August 13, 2013 23:40
-
-
Save mouseroot/6226770 to your computer and use it in GitHub Desktop.
Asm stuffs
This file contains hidden or 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
| #!/bin/bash | |
| app="load" | |
| rm *.o | |
| nasm -f elf $app.asm | |
| gcc -o $app $app.o |
This file contains hidden or 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
| extern printf | |
| extern scanf | |
| global main | |
| %macro restore 1 | |
| add esp, 4 * %1 | |
| %endmacro | |
| section .data | |
| hi: db "Hello world",10,0 | |
| buffer: dw 0 | |
| scanstr: db "%s\n",0 | |
| section .text | |
| main: | |
| push dword hi | |
| call printf | |
| push dword buffer | |
| push dword scanstr | |
| call scanf | |
| push dword hi | |
| call printf | |
| ;Restore the stack | |
| restore 4 | |
| ;add esp,4 * 4 | |
| mov eax,0 | |
| ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment