; hello3.asm - Windows program to print "Hello, world" without Irvine files ; To asemble/run using MASM 6.15 ; ; ml /Cx /c /coff hello3.asm ; link32 hello3.obj \masm615\lib\kernel32.lib /subsystem:console ; hello3 .386 .model flat ; Windows system calls extern syscall _GetStdHandle@4: proc extern syscall _WriteConsoleA@20: proc extern syscall _ExitProcess@4: proc .stack 4096 .data greeting byte "Hello, world", 13, 10, 0 greeting_size = $ - offset greeting stdout dword ? result dword ? .code public _main _main proc ; Get stdout handle push -11 ; STD_OUTPUT_HANDLE call _GetStdHandle@4 mov stdout, eax ; Write greeting push 0 ; reserved push offset result ; number of bytes written push greeting_size ; number of bytes to write push offset greeting ; point to string to write push stdout ; handle to write to call _WriteConsoleA@20 ; write ASCII bytes to console ; Exit to Windows push 0 ; exit status call _ExitProcess@4 _main endp end _main