2006-01-03 10:43:31 +01:00
|
|
|
|
; <--- description --->
|
2007-03-01 23:32:12 +01:00
|
|
|
|
; compiler: FASM 1.67
|
|
|
|
|
; name: Basic window example for KolibriOS
|
|
|
|
|
; version: 1.02
|
|
|
|
|
; last update: 1/03/2007
|
2006-01-03 10:43:31 +01:00
|
|
|
|
; written by: Ivan Poddubny
|
|
|
|
|
; e-mail: ivan-yar@bk.ru
|
2007-03-01 23:32:12 +01:00
|
|
|
|
;modified by: Heavyiron
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; <--- include all MeOS stuff --->
|
|
|
|
|
include "lang.inc"
|
2007-05-10 15:48:35 +02:00
|
|
|
|
include "..\..\..\..\macros.inc"
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; <--- start of MenuetOS application --->
|
|
|
|
|
MEOS_APP_START
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; <--- start of code --->
|
|
|
|
|
CODE
|
2007-03-01 23:32:12 +01:00
|
|
|
|
|
|
|
|
|
mov eax,48 ; get system colors
|
|
|
|
|
mov ebx,3
|
|
|
|
|
mov ecx,sc
|
|
|
|
|
mov edx,sizeof.system_colors
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2007-03-01 23:32:12 +01:00
|
|
|
|
|
|
|
|
|
redraw: ; redraw event handler
|
|
|
|
|
call draw_window ; at first create and draw the window
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2009-08-26 13:23:22 +02:00
|
|
|
|
mcall 9, procinfo, -1
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
wait_event: ; main cycle
|
|
|
|
|
mov eax, 10
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
dec eax ; if event = 1
|
|
|
|
|
jz redraw ; jump to redraw handler
|
|
|
|
|
dec eax ; else if event = 2
|
|
|
|
|
jz key ; jump to key handler
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
button: ; button event handler
|
|
|
|
|
mov al, 17 ; get button identifier
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
cmp ah, 1
|
|
|
|
|
jne wait_event ; return if button id != 1
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
or eax, -1 ; exit application
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
key: ; key event handler
|
|
|
|
|
mov al, 2 ; get key code
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
jmp wait_event
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
mov eax, 12 ; start drawing
|
|
|
|
|
mov ebx, 1
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
xor eax, eax ; create and draw the window
|
|
|
|
|
mov ebx, 100*65536+200 ; (window_cx)*65536+(window_sx)
|
|
|
|
|
mov ecx, 100*65536+100 ; (window_cy)*65536+(window_sy)
|
|
|
|
|
mov edx, [sc.work] ; work area color
|
|
|
|
|
or edx, 0x33000000 ; & window type 3
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mov edi, title ; window title
|
2007-03-01 23:32:12 +01:00
|
|
|
|
int 0x40
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov eax, 12 ; finish drawing
|
|
|
|
|
mov ebx, 2
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
; <--- initialised data --->
|
|
|
|
|
DATA
|
|
|
|
|
|
2007-03-01 23:32:12 +01:00
|
|
|
|
if lang eq ru
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>',0
|
2007-03-01 23:32:12 +01:00
|
|
|
|
else if lang eq fr
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db 'La programme poncive',0
|
2007-03-01 23:32:12 +01:00
|
|
|
|
else
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db 'Template program',0
|
2007-03-01 23:32:12 +01:00
|
|
|
|
end if
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; <--- uninitialised data --->
|
|
|
|
|
UDATA
|
2007-03-01 23:32:12 +01:00
|
|
|
|
sc system_colors
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2009-08-26 13:23:22 +02:00
|
|
|
|
procinfo rb 1024
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
MEOS_APP_END
|
|
|
|
|
; <--- end of MenuetOS application --->
|