% ************************************************************************
%     MessageLoop for assembler generators.
%     (C) 2007, Alexander G. Karpov a.k.a. mrhx & opkdx
%     http://mrhx.clan.su/
%     Russia, Saint Petersburg.
%
%     v1: August 18, 2007: visg0.9
%     v2: October 31,2007: compatibility with fasm by opkdx
% ************************************************************************

%code
%if any_window_exists
; Message loop function.

%set ASM_FUNC_NAME message_loop
%include asm_func

	mov	edi, %ASM_OFFSET%msg_
	xor	ebx, ebx

begin_of_message_loop:

	push	ebx
	push	ebx
	push	ebx
	push	edi
	%ASM_ICALL0%GetMessage%ASM_ICALL1%

	test	eax, eax
	jz	end_of_message_loop

	push	edi
	%ASM_ICALL0%TranslateMessage%ASM_ICALL1%

	push	edi
	%ASM_ICALL0%DispatchMessage%ASM_ICALL1%

	jmp	short begin_of_message_loop

end_of_message_loop:

	mov	eax, %ASM_MEM0%msg_.wParam%ASM_MEM1%;
	ret

%include asm_func_end


%end if
%nocode

% ************************************************************************
