Created
April 22, 2019 18:42
-
-
Save gynvael/45d5a7f9e576f315975a0ff36e041831 to your computer and use it in GitHub Desktop.
nasm + MinGW gcc test
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
gynvael:haven-windows>nasm test.asm -f win64 -o test.obj && gcc test.obj | |
gynvael:haven-windows>a.exe | |
// this actually shows the message box | |
gynvael:haven-windows>gcc --version <----------------------------- make sure you have a 64-bit mingw gcc | |
if you don't, go to [1] and get mingw-w64-install.exe file | |
gcc (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 | |
Copyright (C) 2018 Free Software Foundation, Inc. | |
This is free software; see the source for copying conditions. There is NO | |
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
gynvael:haven-windows>nasm -v | |
NASM version 2.12rc2 compiled on Jan 27 2016 | |
[1] https://sourceforge.net/projects/mingw-w64/files/?source=navbar (when installing, be sure to install a 64-bit version!) |
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
[bits 64] | |
global WinMain | |
extern MessageBoxA | |
extern ExitProcess | |
section .data | |
msg: db "Hi there!", 0 | |
section .text | |
WinMain: | |
push rbp | |
mov rbp, rsp | |
sub rsp, 0x20 | |
xor rcx, rcx | |
lea rdx, [msg] | |
mov r8, rdx | |
mov r9, rcx | |
call MessageBoxA | |
xor rax, rax | |
call ExitProcess | |
; pop rbp | |
; ret | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment