Rev 485 | Rev 1144 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; <--- description ---> |
383 | heavyiron | 2 | ; compiler: FASM 1.67 |
3 | ; name: Basic window example for KolibriOS |
||
4 | ; version: 1.02 |
||
5 | ; last update: 1/03/2007 |
||
31 | halyavin | 6 | ; written by: Ivan Poddubny |
7 | ; e-mail: ivan-yar@bk.ru |
||
383 | heavyiron | 8 | ;modified by: Heavyiron |
31 | halyavin | 9 | |
10 | ; <--- include all MeOS stuff ---> |
||
11 | include "lang.inc" |
||
485 | heavyiron | 12 | include "..\..\..\..\macros.inc" |
31 | halyavin | 13 | |
14 | |||
15 | ; <--- start of MenuetOS application ---> |
||
16 | MEOS_APP_START |
||
17 | |||
18 | |||
19 | ; <--- start of code ---> |
||
20 | CODE |
||
21 | |||
383 | heavyiron | 22 | mov eax,48 ; get system colors |
23 | mov ebx,3 |
||
24 | mov ecx,sc |
||
25 | mov edx,sizeof.system_colors |
||
485 | heavyiron | 26 | mcall |
383 | heavyiron | 27 | |
28 | redraw: ; redraw event handler |
||
29 | call draw_window ; at first create and draw the window |
||
30 | |||
1143 | diamond | 31 | mcall 9, procinfo, -1 |
32 | |||
31 | halyavin | 33 | wait_event: ; main cycle |
34 | mov eax, 10 |
||
485 | heavyiron | 35 | mcall |
31 | halyavin | 36 | |
383 | heavyiron | 37 | dec eax ; if event = 1 |
38 | jz redraw ; jump to redraw handler |
||
39 | dec eax ; else if event = 2 |
||
40 | jz key ; jump to key handler |
||
31 | halyavin | 41 | |
42 | |||
383 | heavyiron | 43 | button: ; button event handler |
44 | mov al, 17 ; get button identifier |
||
485 | heavyiron | 45 | mcall |
31 | halyavin | 46 | |
383 | heavyiron | 47 | cmp ah, 1 |
48 | jne wait_event ; return if button id != 1 |
||
31 | halyavin | 49 | |
383 | heavyiron | 50 | or eax, -1 ; exit application |
485 | heavyiron | 51 | mcall |
31 | halyavin | 52 | |
383 | heavyiron | 53 | key: ; key event handler |
54 | mov al, 2 ; get key code |
||
485 | heavyiron | 55 | mcall |
31 | halyavin | 56 | |
383 | heavyiron | 57 | jmp wait_event |
31 | halyavin | 58 | |
59 | draw_window: |
||
60 | mov eax, 12 ; start drawing |
||
61 | mov ebx, 1 |
||
485 | heavyiron | 62 | mcall |
31 | halyavin | 63 | |
383 | heavyiron | 64 | xor eax, eax ; create and draw the window |
65 | mov ebx, 100*65536+200 ; (window_cx)*65536+(window_sx) |
||
66 | mov ecx, 100*65536+100 ; (window_cy)*65536+(window_sy) |
||
67 | mov edx, [sc.work] ; work area color |
||
68 | or edx, 0x33000000 ; & window type 3 |
||
485 | heavyiron | 69 | mov edi, title ; window title |
383 | heavyiron | 70 | int 0x40 |
31 | halyavin | 71 | |
72 | mov eax, 12 ; finish drawing |
||
73 | mov ebx, 2 |
||
485 | heavyiron | 74 | mcall |
31 | halyavin | 75 | |
76 | ret |
||
77 | |||
78 | ; <--- initialised data ---> |
||
79 | DATA |
||
80 | |||
383 | heavyiron | 81 | if lang eq ru |
485 | heavyiron | 82 | title db 'Шаблон программы',0 |
383 | heavyiron | 83 | else if lang eq fr |
485 | heavyiron | 84 | title db 'La programme poncive',0 |
383 | heavyiron | 85 | else |
485 | heavyiron | 86 | title db 'Template program',0 |
383 | heavyiron | 87 | end if |
31 | halyavin | 88 | |
89 | ; <--- uninitialised data ---> |
||
90 | UDATA |
||
383 | heavyiron | 91 | sc system_colors |
31 | halyavin | 92 | |
1143 | diamond | 93 | procinfo rb 1024 |
94 | |||
31 | halyavin | 95 | MEOS_APP_END |
96 | ; <--- end of MenuetOS application --->--->--->--->--->--->--->---> |