1
2;--- Win32 "hello world" console application.
3;--- assemble: JWasm -coff Win32_1.ASM
4;--- link:     JWlink format win pe file Win32_1.OBJ lib kernel32.lib
5;--- or, linking with MS link:
6;---           link Win32_1.obj kernel32.lib
7
8    .386
9    .MODEL FLAT, stdcall
10    option casemap:none
11
12STD_OUTPUT_HANDLE equ -11
13
14WriteConsoleA proto :dword, :dword, :dword, :dword, :dword
15GetStdHandle  proto :dword
16ExitProcess   proto :dword
17
18    .CONST
19
20string  db 13,10,"hello, world.",13,10
21
22    .CODE
23
24main proc c
25
26local   dwWritten:dword
27local   hConsole:dword
28
29    invoke  GetStdHandle, STD_OUTPUT_HANDLE
30    mov     hConsole,eax
31
32    invoke  WriteConsoleA, hConsole, addr string, sizeof string, addr dwWritten, 0
33
34    xor     eax,eax
35    ret
36main endp
37
38;--- entry
39
40mainCRTStartup proc c
41
42    invoke  main
43    invoke  ExitProcess, eax
44
45mainCRTStartup endp
46
47    END mainCRTStartup
48