; This file was generated by MenuetBASIC Compiler
; Author: Jarek Pelczar
; E-mail: jarekp3@wp.pl
; 
; Input file: menuet.bas
; Output file: menuet.asm
org 0
use32
App_Header:
	db 'MENUET01'
	dd 1
	dd APP_START
	dd I_END
	dd 0x100000
	dd 0x09FFFF
	dd 0
	dd 0
APP_START:
mov esp,0x9FFFF
	push ebp
	mov ebp,esp
	call DOREDRAW
	mov esp,ebp
	pop ebp
____L100:
	push ebp
	mov ebp,esp
	call WAITEVENT
	mov esp,ebp
	pop ebp
	mov dword [EV],eax
	mov eax,dword [EV]
	mov ebx,eax
	mov eax,1
	cmp ebx,eax
	jne L2
	push ebp
	mov ebp,esp
	call DOREDRAW
	mov esp,ebp
	pop ebp
	jmp L1
L2:
	mov eax,dword [EV]
	mov ebx,eax
	mov eax,2
	cmp ebx,eax
	jne L4
	push ebp
	mov ebp,esp
	call GETKEY
	mov esp,ebp
	pop ebp
	jmp L3
L4:
	mov eax,dword [EV]
	mov ebx,eax
	mov eax,3
	cmp ebx,eax
	jne L6
	push ebp
	mov ebp,esp
	call GETBUTT
	mov esp,ebp
	pop ebp
	mov ebx,eax
	mov eax,1
	cmp ebx,eax
	jne L8
	jmp INTERNAL_app_exit
	jmp L7
L8:
L7:
	jmp L5
L6:
L5:
L3:
L1:
	jmp ____L100
	jmp INTERNAL_app_exit
WINDOWREDRAW:
; Begin of user asm block

 mov eax,12
 mov ebx,[ebp+4]
 int 0x40
; End of user asm block
	ret
MAKEWINDOW:
; Begin of user asm block

 mov eax,0
 mov ebx,[ebp+20]
 mov ecx,[ebp+16]
 mov edx,[ebp+12]
 mov esi,[ebp+8]
 mov edi,[ebp+4]
 int 0x40
; End of user asm block
	ret
DOREDRAW:
	mov eax,1
	push eax
	push ebp
	mov ebp,esp
	call WINDOWREDRAW
	mov esp,ebp
	pop ebp
	add esp,4
	mov eax,100
	push eax
	mov eax,150
	push eax
	push ebp
	mov ebp,esp
	call MKDWORD
	mov esp,ebp
	pop ebp
	add esp,8
	push eax
	mov eax,100
	push eax
	mov eax,100
	push eax
	push ebp
	mov ebp,esp
	call MKDWORD
	mov esp,ebp
	pop ebp
	add esp,8
	push eax
	mov eax,128
	push eax
	mov eax,128
	push eax
	mov eax,128
	push eax
	push ebp
	mov ebp,esp
	call RGB
	mov esp,ebp
	pop ebp
	add esp,12
	push eax
	push ebp
	mov ebp,esp
	call BODYCOLOR
	mov esp,ebp
	pop ebp
	add esp,4
	push eax
	mov eax,64
	push eax
	mov eax,64
	push eax
	mov eax,46
	push eax
	push ebp
	mov ebp,esp
	call RGB
	mov esp,ebp
	pop ebp
	add esp,12
	push eax
	push ebp
	mov ebp,esp
	call GRABCOLOR
	mov esp,ebp
	pop ebp
	add esp,4
	push eax
	mov eax,128
	push eax
	mov eax,0
	push eax
	mov eax,0
	push eax
	push ebp
	mov ebp,esp
	call RGB
	mov esp,ebp
	pop ebp
	add esp,12
	push eax
	push ebp
	mov ebp,esp
	call MAKEWINDOW
	mov esp,ebp
	pop ebp
	add esp,20
	mov eax,4
	push eax
	mov eax,4
	push eax
	mov eax,8388608
	push eax
	mov eax,_LC1
	push eax
	push ebp
	mov ebp,esp
	call PUTSTR
	mov esp,ebp
	pop ebp
	add esp,16
	mov eax,2
	push eax
	push ebp
	mov ebp,esp
	call WINDOWREDRAW
	mov esp,ebp
	pop ebp
	add esp,4
	ret
MKDWORD:
; Begin of user asm block

 mov eax,dword [ebp+4]
 shl eax,16
 or ax,word [ebp+8]
; End of user asm block
	ret
RGB:
; Begin of user asm block

 xor eax,eax
 mov al,byte [ebp+12]
 shl eax,8
 or al,byte [ebp+8]
 shl eax,8
 or al,byte [ebp+4]
; End of user asm block
	ret
BODYCOLOR:
; Begin of user asm block

 mov eax,dword [ebp+4]
 or eax,0x03000000
; End of user asm block
	ret
GRABCOLOR:
; Begin of user asm block

 mov eax,dword [ebp+4]
 or eax,0x80000000
; End of user asm block
	ret
WAITEVENT:
; Begin of user asm block

 mov eax,10
 int 0x40
; End of user asm block
	ret
GETKEY:
; Begin of user asm block

 mov eax,2
 int 0x40
; End of user asm block
	ret
GETBUTT:
; Begin of user asm block

 mov eax,17
 int 0x40
 and eax,0x0000FF00
 shr eax,8 
; End of user asm block
	ret
PTRVALUE:
; Begin of user asm block

 mov eax,dword [ebp+4]
 mov al,byte [eax]
 and eax,0x000000FF
; End of user asm block
	ret
STRLEN:
	mov eax,0
	mov dword [SLEN],eax
____LSTR1:
	mov eax,dword [ebp+4]
	push eax
	push ebp
	mov ebp,esp
	call PTRVALUE
	mov esp,ebp
	pop ebp
	add esp,4
	mov dword [RR],eax
	mov eax,dword [RR]
	mov ebx,eax
	mov eax,0
	cmp ebx,eax
	je L10
	mov eax,dword [SLEN]
	push eax
	mov eax,1
	add eax,dword [esp]
	add esp,4
	mov dword [SLEN],eax
	mov eax,dword [ebp+4]
	push eax
	mov eax,1
	add eax,dword [esp]
	add esp,4
	mov dword [ebp+4],eax
	jmp ____LSTR1
	jmp L9
L10:
L9:
	mov eax,dword [SLEN]
	ret
PUTSTR:
	mov eax,dword [ebp+16]
	push eax
	mov eax,65536
	mul dword [esp]
	add esp,4
	push eax
	mov eax,dword [ebp+12]
	add eax,dword [esp]
	add esp,4
	mov dword [XY],eax
	mov eax,dword [ebp+4]
	push eax
	push ebp
	mov ebp,esp
	call STRLEN
	mov esp,ebp
	pop ebp
	add esp,4
	mov dword [SL],eax
; Begin of user asm block

  mov eax,4
  mov ebx,dword [XY]
  mov ecx,dword [ebp+8]
  mov edx,dword [ebp+12]
  mov esi,dword [SL]
  int 0x40

; End of user asm block
	ret
INTERNAL_app_exit:
	mov eax,-1
	int 0x40
	cli ; It MUST fail if exit didn't work (assasination :)
VAR_POOL_SIZE dd VAR_POOL_END-VAR_POOL_BEGIN
I_END:
_LC0:
	db "Compiled with MBASIC. Author: Jarek Pelczar",0
_LC1:
	db "MBASIC TEST",0
VAR_POOL_BEGIN:
dummy_variable: rd 1
EV: rd 1
SLEN: rd 1
RR: rd 1
XY: rd 1
SL: rd 1
VAR_POOL_END:
