Rev 109 | Rev 485 | 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" |
||
12 | include "macros.inc" |
||
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 |
||
26 | int 0x40 |
||
27 | |||
28 | redraw: ; redraw event handler |
||
29 | call draw_window ; at first create and draw the window |
||
30 | |||
31 | halyavin | 31 | wait_event: ; main cycle |
32 | mov eax, 10 |
||
33 | int 0x40 |
||
34 | |||
383 | heavyiron | 35 | dec eax ; if event = 1 |
36 | jz redraw ; jump to redraw handler |
||
37 | dec eax ; else if event = 2 |
||
38 | jz key ; jump to key handler |
||
31 | halyavin | 39 | |
40 | |||
383 | heavyiron | 41 | button: ; button event handler |
42 | mov al, 17 ; get button identifier |
||
31 | halyavin | 43 | int 0x40 |
44 | |||
383 | heavyiron | 45 | cmp ah, 1 |
46 | jne wait_event ; return if button id != 1 |
||
31 | halyavin | 47 | |
383 | heavyiron | 48 | or eax, -1 ; exit application |
31 | halyavin | 49 | int 0x40 |
50 | |||
383 | heavyiron | 51 | key: ; key event handler |
52 | mov al, 2 ; get key code |
||
31 | halyavin | 53 | int 0x40 |
54 | |||
383 | heavyiron | 55 | jmp wait_event |
31 | halyavin | 56 | |
57 | draw_window: |
||
58 | mov eax, 12 ; start drawing |
||
59 | mov ebx, 1 |
||
60 | int 0x40 |
||
61 | |||
383 | heavyiron | 62 | xor eax, eax ; create and draw the window |
63 | mov ebx, 100*65536+200 ; (window_cx)*65536+(window_sx) |
||
64 | mov ecx, 100*65536+100 ; (window_cy)*65536+(window_sy) |
||
65 | mov edx, [sc.work] ; work area color |
||
66 | or edx, 0x33000000 ; & window type 3 |
||
67 | mov edi, header ; window header |
||
68 | int 0x40 |
||
31 | halyavin | 69 | |
70 | mov eax, 12 ; finish drawing |
||
71 | mov ebx, 2 |
||
72 | int 0x40 |
||
73 | |||
74 | ret |
||
75 | |||
76 | ; <--- initialised data ---> |
||
77 | DATA |
||
78 | |||
383 | heavyiron | 79 | if lang eq ru |
80 | header db 'Шаблон программы',0 |
||
81 | else if lang eq fr |
||
82 | header db 'La programme poncive',0 |
||
83 | else |
||
84 | header db 'Template program',0 |
||
85 | end if |
||
31 | halyavin | 86 | |
87 | ; <--- uninitialised data ---> |
||
88 | UDATA |
||
383 | heavyiron | 89 | sc system_colors |
31 | halyavin | 90 | |
91 | MEOS_APP_END |
||
92 | ; <--- end of MenuetOS application --->--->--->--->--->--->--->---> |