Código
STD_OUTPUT_HANDLE equ -11 STD_INPUT_HANDLE equ -10 NULL equ 0 global start extern ExitProcess, GetStdHandle, WriteConsoleA, ReadConsoleInputA section .data ;message we want to display on console msg db "Press a key to continue...", 13, 10, 0 msg.len equ $ - msg consoleInHandle dd 1 section .bss ;buffers declaration buffer_out resd 2 buffer_in resb 32 section .text start: ;starting point of our program push STD_OUTPUT_HANDLE call GetStdHandle ;call to get a handle to the push NULL ;specified mode (input, output...) push buffer_out push msg.len push msg push eax ;contains the GetStdHandle result call WriteConsoleA ;call to print our msg in console read: push STD_INPUT_HANDLE call GetStdHandle ;new call to get input handle push NULL push 1 push buffer_in push eax call ReadConsoleInputA ;call to detect user input ;this function will wait til exit: ;it detects enough keypresses push NULL ;(in this case, 1) call ExitProcess
Este es el comando que he usado:
nasm -fwin32 main.asm -o main.exe