; This file was generated by MenuetBASIC Compiler
; Author: Jarek Pelczar
; E-mail: jarekp3@wp.pl
; 
; Input file: mode13h.bas
; Output file: mode13h.asm
; Additional flags: -fdos-app 
org 0
App_Header:
	mov ax,cs
	mov ds,ax
	mov es,ax
	mov ss,ax
	mov esp,app_stack
	push ebp
	mov ebp,esp
	call GMODE
	mov esp,ebp
	pop ebp
	mov eax,1
	mov dword [I],eax
L1:
	mov eax,30
	cmp eax,dword [I]
	jb L2
	mov eax,1
	mov dword [J],eax
L3:
	mov eax,30
	cmp eax,dword [J]
	jb L4
	mov eax,dword [J]
	push eax
	mov eax,1
	sub eax,dword [esp]
	not eax
	add esp,4
	push eax
	mov eax,30
	mul dword [esp]
	add esp,4
	push eax
	mov eax,dword [I]
	push eax
	mov eax,1
	sub eax,dword [esp]
	not eax
	add esp,4
	add eax,dword [esp]
	add esp,4
	push eax
	mov eax,dword [I]
	push eax
	mov eax,dword [J]
	push eax
	push ebp
	mov ebp,esp
	call BXOR
	mov esp,ebp
	pop ebp
	add esp,8
	pop ebx
	mov [TABLICA+ebx*4],eax
	mov eax,dword [I]
	push eax
	mov eax,dword [J]
	push eax
	mov eax,dword [J]
	push eax
	mov eax,1
	sub eax,dword [esp]
	not eax
	add esp,4
	push eax
	mov eax,30
	mul dword [esp]
	add esp,4
	push eax
	mov eax,dword [I]
	push eax
	mov eax,1
	sub eax,dword [esp]
	not eax
	add esp,4
	add eax,dword [esp]
	add esp,4
	mov eax,[TABLICA+eax*4]
	push eax
	push ebp
	mov ebp,esp
	call PUTPIXEL
	mov esp,ebp
	pop ebp
	add esp,12
	inc dword [J]
	jmp L3
L4:
	inc dword [I]
	jmp L1
L2:
	push ebp
	mov ebp,esp
	call WKEY
	mov esp,ebp
	pop ebp
	push ebp
	mov ebp,esp
	call TMODE
	mov esp,ebp
	pop ebp
	jmp INTERNAL_app_exit
GMODE:
; Begin of user asm block

 mov ax,0x0013
 int 0x10
; End of user asm block
	ret
TMODE:
; Begin of user asm block

 mov ax,3
 int 0x10
; End of user asm block
	ret
PUTPIXEL:
	mov eax,dword [ebp+8]
	push eax
	mov eax,320
	mul dword [esp]
	add esp,4
	push eax
	mov eax,dword [ebp+12]
	add eax,dword [esp]
	add esp,4
	mov dword [PIXPOS],eax
	mov eax,dword [ebp+4]
	mov dword [PIXCOLOR],eax
; Begin of user asm block

 push ax
 push di
 push es
 mov ax,0xA000
 mov es,ax
 mov bl,byte [PIXCOLOR]
 mov di,word [PIXPOS]
 mov byte [es:di],bl
 pop es
 pop di
 pop ax
; End of user asm block
	ret
WKEY:
____LWKEY1:
; Begin of user asm block

 xor ax,ax
 int 0x16
 cmp al,0
 jne www1
; End of user asm block
	jmp ____LWKEY1
; Begin of user asm block

 www1:
; End of user asm block
	ret
BXOR:
; Begin of user asm block

 mov eax,dword [ebp+4]
 xor eax,dword [ebp+8]
; End of user asm block
	ret
INTERNAL_app_exit:
	mov eax,0x4C00 ; Dos exit 
	int 0x21
VAR_POOL_SIZE dd VAR_POOL_END-VAR_POOL_BEGIN
I_END:
times 1024 db 0
app_stack:
_LC0:
	db "Compiled with MBASIC. Author: Jarek Pelczar",0
VAR_POOL_BEGIN:
dummy_variable dd 0
I dd 0
J dd 0
PIXPOS dd 0
PIXCOLOR dd 0
VAR_POOL_END:
TABLICA: rd 900
