Created
December 10, 2016 18:43
-
-
Save vpetrigo/63ed542e10302a1bee6880e18e41f001 to your computer and use it in GitHub Desktop.
Minimal ASM files
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
# Build command: gcc linux.s -o linux.out | |
.intel_syntax noprefix | |
.extern puts | |
.text | |
.globl main | |
main: | |
lea rdi, message | |
call puts | |
ret | |
message: .asciz "Hello, World!" |
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
; Command for the command line by using MinGW64: | |
; nasm -f win64 windows.asm -o windows.o && ld -o windows.exe windows.o -L /mingw64/x86_64-w64-mingw32/lib -lkernel32 -lmsvcrt | |
; ExitProcess is essential here | |
; otherwise you'd get SEGFAULT | |
extern ExitProcess | |
extern puts | |
section .data | |
message db "Hello, World!", 0 | |
section .text | |
main: | |
lea rcx, [message] | |
call puts | |
mov ecx, eax | |
call ExitProcess | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment