Assembly Hello Windows Example

This simple example keeps looping until the user cancels it. Download the assembly source code: ASMHELLOWIN.zip

TITLE Hello Windows

.686
.model flat,stdcall
.stack 8192
ExitProcess PROTO, dwExitCode:DWORD
MessageBoxA PROTO, hwnd:DWORD, lpText:PTR BYTE, lpCaption:PTR BYTE, uiStyle:DWORD

.data
hello BYTE "Hello Windows!",0

.code
WinMain PROC

msgbox:
	mov   ebx, 40h          ; 64 is the information icon
	or    ebx, 1h           ; 1 is the OK/Cancel buttons
	pushd ebx               ; uiStyle
	mov   ebx, offset hello
	pushd ebx               ; lpCaption
	pushd ebx               ; lpText
	pushd 0                 ; hwnd
	call  MessageBoxA
	cmp   eax, 1h           ; 1 is the OK button being pressed; compare eax to 1
	je    msgbox            ; if eax equals 1, jump to msgbox:

	pushd 0
	call	ExitProcess

WinMain ENDP
END WinMain