The easiest way is to use the C functions. In its simplest use, printf()
takes a string as a parameter and writes it on the standard output.
This code should work:
format PE console
entry start
include 'win32a.inc'
section '.text' code executable
start:
push hello
call [printf]
pop ecx
push 0
call [ExitProcess]
section '.rdata' data readable
hello db 'Hello world!', 10, 0
section '.idata' data readable import
library kernel32, 'kernel32.dll',
msvcrt, 'msvcrt.dll'
import kernel32, ExitProcess, 'ExitProcess'
import msvcrt, printf, 'printf'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…