
; Beer - example of tiny (one section) Win32 program

format PE GUI 4.0

include 'win32a.inc'

; no section defined - fasm will automatically create .flat section for both
; code and data, and set entry point at the beginning of this section


	mov ebx, value1
	mov edx, value2
	fld dword [ebx]
	fadd dword [edx]
	mov eax, value3
	fst dword [eax]
	mov ecx, [value5]
	mov eax, [eax]

	;cmp eax, ecx

	bt eax, 1

	jne exit

	invoke	MessageBoxA,0,_message,_caption,MB_ICONQUESTION+MB_YESNO
	cmp	eax,IDYES
	jne	exit

exit:
	invoke	ExitProcess,0


value1 dd 0.11
value2 dd 0.10
value3 dd 0.0
value4 dd 34.5
value5 dd 0.21

_message db 'Do you need additional place for the beer?',0
_caption db 'Desktop configuration',0

_cmd_open db 'open cdaudio',0
_cmd_eject db 'set cdaudio door open',0
_cmd_close db 'close cdaudio',0

; import data in the same section

data import

 library kernel32,'KERNEL32.DLL',\
	 user32,'USER32.DLL',\
	 winmm,'WINMM.DLL'

 import kernel32,\
	ExitProcess,'ExitProcess'

 import user32,\
	MessageBoxA,'MessageBoxA'

 import winmm,\
	mciSendString,'mciSendStringA'

end data
