Rev 4051 | Rev 4215 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4051 | Rev 4213 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; |
1 | ; |
2 | ; END |
2 | ; END |
3 | ; KolibriOS Team 2005-2013 |
3 | ; KolibriOS Team 2005-2013 |
4 | ; |
4 | ; |
5 | include "lang.inc" |
- | |
6 | include "..\..\..\macros.inc" |
- | |
7 | ; |
5 | ; |
8 | ; and if we know that high 24 bits of eax are zero, we can use 1st form |
6 | ; and if we know that high 24 bits of eax are zero, we can use 1st form |
9 | ; the same about ebx,ecx,edx |
7 | ; the same about ebx,ecx,edx |
Line 10... | Line -... | ||
10 | - | ||
11 | meos_app_start |
- | |
12 | code |
- | |
13 | draw_window: |
- | |
14 | mov al,12 |
- | |
15 | mcall ,1 |
- | |
16 | - | ||
17 | mov al,14 |
8 | |
18 | mcall ;eax=14 - get screen max x & max y |
- | |
19 | movzx ecx,ax |
- | |
20 | shr eax,17 |
- | |
21 | shl eax,16 |
- | |
22 | lea ebx,[eax-110 shl 16+222] |
- | |
23 | shr ecx,1 |
- | |
24 | shl ecx,16 |
- | |
25 | lea ecx,[ecx-65 shl 16+137] |
- | |
26 | - | ||
27 | xor eax,eax |
- | |
28 | mcall , , ,0x019098b0,0x01000000 ;define and draw window |
- | |
29 | - | ||
30 | mov al,13 |
- | |
31 | mcall ,<0,223> ,<0,275> |
- | |
32 | mcall ,<1,221>,<1,136>,0xffffff |
- | |
33 | mcall ,<2,220>,<2,135>,0xe4dfe1 |
- | |
34 | mcall ,<16,189>,<97,23>,0x9098b0 |
- | |
35 | - | ||
36 | mov al,8 |
- | |
37 | mcall ,<16,90> ,<20,27>,4,0x990022 ;eax=8 - draw buttons |
- | |
38 | mcall ,<113,90>, ,2,0xaa7700 |
- | |
39 | mcall , ,<54,27>,1,0x777777 |
- | |
40 | mcall ,<16,90> , ,3,0x007700 |
- | |
41 | mcall ,<17,186>,<98,20>,5,0xe4dfe1 |
- | |
42 | - | ||
43 | mov al,4 |
- | |
44 | mcall ,<28,105>,0x80000000,label4 ;eax=4 - write text |
- | |
45 | mcall ,<35,24> ,0x80ffffff,label2 |
- | |
46 | mcall ,<34,58> , ,label3 |
- | |
47 | mcall ,<47,37> , ,label5 |
9 | use32 ; âêëþ÷èòü 32-áèòíûé ðåæèì àññåìáëåðà |
48 | mcall ,<43,71> , ,label6 |
- | |
49 | - | ||
50 | mov al,12 |
- | |
Line -... | Line 10... | ||
- | 10 | org 0x0 ; àäðåñàöèÿ ñ íóëÿ |
|
- | 11 | ||
- | 12 | db 'MENUET01' ; 8-áàéòíûé èäåíòèôèêàòîð MenuetOS |
|
- | 13 | dd 0x01 ; âåðñèÿ çàãîëîâêà (âñåãäà 1) |
|
- | 14 | dd START ; àäðåñ ïåðâîé êîìàíäû |
|
- | 15 | dd IM_END ; ðàçìåð ïðîãðàììû |
|
- | 16 | dd I_END ; êîëè÷åñòâî ïàìÿòè |
|
- | 17 | dd stacktop ; àäðåñ âåðøèíû ñòåêà |
|
- | 18 | dd 0x0 ; àäðåñ áóôåðà äëÿ ïàðàìåòðîâ |
|
- | 19 | dd cur_dir_path |
|
- | 20 | ||
- | 21 | include 'lang.inc' |
|
- | 22 | include '../../../macros.inc' |
|
- | 23 | include '../../../proc32.inc' |
|
- | 24 | include '../../../dll.inc' |
|
- | 25 | include '../../../develop/libraries/box_lib/load_lib.mac' |
|
- | 26 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
|
- | 27 | ||
- | 28 | @use_library |
|
- | 29 | ||
- | 30 | align 4 |
|
- | 31 | START: |
|
- | 32 | ||
- | 33 | load_libraries l_libs_start,end_l_libs |
|
- | 34 | inc eax |
|
- | 35 | test eax,eax |
|
- | 36 | jz close |
|
- | 37 | ||
- | 38 | push dword check1 |
|
- | 39 | call [init_checkbox2] |
|
- | 40 | ||
- | 41 | stdcall dll.Init,[init_lib] |
|
- | 42 | ||
- | 43 | invoke ini_get_int,ini_file,asettings,aautosave,0 |
|
- | 44 | mov [autosave],eax |
|
- | 45 | cmp eax,1 |
|
- | 46 | jne @f |
|
- | 47 | bts dword [check1.flags],1 |
|
- | 48 | @@: |
|
- | 49 | mcall 40,0x00000027 |
|
51 | mcall ,2 |
50 | redraw: |
52 | 51 | call draw_window |
|
53 | still: |
52 | still: |
54 | mov al,10 |
53 | mov al,10 |
55 | mcall ;wait here for event |
54 | mcall ;wait here for event |
- | 55 | dec eax |
|
- | 56 | jz redraw |
|
56 | dec eax |
57 | dec eax |
57 | jz draw_window |
58 | jz key |
Line -... | Line 59... | ||
- | 59 | dec eax |
|
- | 60 | jz button |
|
- | 61 | ||
- | 62 | push dword check1 |
|
- | 63 | call [check_box_mouse2] |
|
- | 64 | bt dword [check1.flags],1 |
|
- | 65 | jnc @f |
|
- | 66 | mov [autosave],1 |
|
- | 67 | jmp still |
|
- | 68 | @@: |
|
- | 69 | mov [autosave],0 |
|
58 | dec eax |
70 | jmp still |
59 | jnz button |
71 | |
60 | 72 | key: |
|
61 | mov al,2 |
73 | mov al,2 |
62 | mcall ;eax=2 - get key code |
74 | mcall ;eax=2 - get key code |
63 | mov al,ah |
75 | mov al,ah |
64 | cmp al,13 |
76 | cmp al,13 |
65 | jz restart |
77 | jz restart |
66 | cmp al,19 |
78 | cmp al,19 |
67 | jz run_rdsave |
79 | jz checkbox |
68 | cmp al,27 |
80 | cmp al,27 |
69 | jz close_1 |
81 | jz close |
70 | cmp al,180 |
82 | cmp al,180 |
71 | jz restart_kernel |
83 | jz restart_kernel |
Line 72... | Line 84... | ||
72 | cmp al,181 |
84 | cmp al,181 |
73 | jz power_off |
- | |
74 | jmp still |
85 | jz power_off |
75 | 86 | jmp still |
|
76 | button: |
87 | |
77 | mov al,17 |
88 | button: |
78 | mcall ;eax=17 - get pressed button id |
89 | mcall 17 ;eax=17 - get pressed button id |
79 | xchg al,ah |
90 | xchg al,ah |
80 | dec eax |
91 | dec eax |
81 | jz close_1 |
92 | jz close |
82 | dec eax |
93 | dec eax |
83 | jz restart_kernel |
- | |
84 | dec eax |
- | |
85 | jz restart |
94 | jz restart_kernel |
Line 86... | Line 95... | ||
86 | dec eax |
95 | dec eax |
87 | jnz run_rdsave |
96 | jz restart |
88 | ; dec eax ; we have only one button left, this is close button |
97 | dec eax |
- | 98 | jnz checkbox |
|
89 | ; jnz still |
99 | |
90 | 100 | power_off: |
|
91 | power_off: |
101 | push 2 |
- | 102 | jmp mcall_and_close |
|
92 | push 2 |
103 | |
93 | jmp mcall_and_close |
104 | restart: |
- | 105 | push 3 |
|
94 | restart: |
106 | jmp mcall_and_close |
- | 107 | ||
- | 108 | restart_kernel: |
|
- | 109 | push 4 |
|
- | 110 | ||
- | 111 | mcall_and_close: |
|
- | 112 | invoke ini_set_int,ini_file,asettings,aautosave,[autosave] |
|
- | 113 | cmp [autosave],1 |
|
- | 114 | jne no_save |
|
- | 115 | mcall 70,rdsave |
|
- | 116 | test eax,eax |
|
- | 117 | js no_save |
|
- | 118 | mov ecx,eax |
|
- | 119 | mcall 18,21 |
|
- | 120 | mov ecx,eax |
|
- | 121 | @@: |
|
- | 122 | push ecx |
|
- | 123 | mcall 23,50 |
|
- | 124 | dec eax |
|
- | 125 | jnz no_red |
|
- | 126 | call draw_window |
|
- | 127 | no_red: |
|
- | 128 | pop ecx |
|
95 | push 3 |
129 | mcall 9,proc_info |
96 | jmp mcall_and_close |
- | |
97 | restart_kernel: |
130 | cmp [proc_info+50],9 |
Line 98... | Line 131... | ||
98 | push 4 |
131 | je no_save |
99 | mcall_and_close: |
- | |
100 | pop ecx |
132 | jmp @b |
101 | mov al,18 |
133 | no_save: |
102 | mcall ,9 |
134 | pop ecx |
- | 135 | mcall 18,9 |
|
- | 136 | ||
- | 137 | close: |
|
103 | 138 | mcall -1 |
|
- | 139 | ||
104 | close_1: |
140 | checkbox: |
- | 141 | btc dword [check1.flags],1 |
|
- | 142 | jc .1 |
|
- | 143 | mov [autosave],1 |
|
105 | or eax,-1 |
144 | jmp .draw |
Line -... | Line 145... | ||
- | 145 | .1: |
|
- | 146 | mov [autosave],0 |
|
- | 147 | .draw: |
|
- | 148 | push dword check1 |
|
- | 149 | call [check_box_draw2] |
|
- | 150 | jmp still |
|
- | 151 | ||
- | 152 | draw_window: |
|
- | 153 | mov al,12 |
|
- | 154 | mcall ,1 |
|
- | 155 | ||
- | 156 | mcall 14 ;eax=14 - get screen max x & max y |
|
- | 157 | movzx ecx,ax |
|
- | 158 | shr eax,17 |
|
- | 159 | shl eax,16 |
|
- | 160 | lea ebx,[eax-110 shl 16+222] |
|
- | 161 | shr ecx,1 |
|
- | 162 | shl ecx,16 |
|
- | 163 | lea ecx,[ecx-70 shl 16+117] |
|
- | 164 | ||
- | 165 | xor eax,eax |
|
- | 166 | mcall , , ,0x019098b0,0x01000000 ;define and draw window |
|
- | 167 | ||
- | 168 | mov al,13 |
|
- | 169 | mcall ,<0,223> ,<0,118> |
|
- | 170 | mcall ,<1,221>,<1,116>,0xffffff |
|
- | 171 | mcall ,<2,220>,<2,115>,0xe4dfe1 |
|
- | 172 | ||
- | 173 | mov al,8 |
|
- | 174 | mcall ,<16,90> ,<20,27>,4,0x990022 ;eax=8 - draw buttons |
|
- | 175 | mcall ,<113,90>, ,2,0xaa7700 |
|
- | 176 | mcall , ,<54,27>,1,0x777777 |
|
- | 177 | mcall ,<16,90> , ,3,0x007700 |
|
- | 178 | ||
- | 179 | push dword check1 |
|
- | 180 | call [check_box_draw2] |
|
- | 181 | ||
- | 182 | mcall 4,<27,24> ,0x90ffffff,label2 ;eax=4 - write text |
|
- | 183 | mcall ,<23,58> , ,label3 |
|
106 | mcall |
184 | mcall ,<47,37> ,0x90ffffff,label5 |
107 | 185 | mcall ,<44,71> , ,label6 |
|
Line 108... | Line -... | ||
108 | run_rdsave: |
- | |
109 | mov al,70 |
- | |
110 | mcall ,rdsave |
- | |
111 | jmp still |
186 | |
- | 187 | mov al,12 |
|
- | 188 | mcall ,2 |
|
- | 189 | ret |
|
- | 190 | ||
- | 191 | data |
|
- | 192 | include 'data.inc' |
|
- | 193 | ||
- | 194 | ;--------------------------------------------------------------------- |
|
- | 195 | IM_END: |
|
- | 196 | ;--------------------------------------------------------------------- |
|
- | 197 | align 4 |
|
- | 198 | ||
- | 199 | proc_info rb 1024 |
|
- | 200 | ||
- | 201 | autosave rd 1 |
|
- | 202 | ;--------------------------------------------------------------------- |
|
- | 203 | cur_dir_path: |
|
- | 204 | rb 4096 |
|
- | 205 | ;--------------------------------------------------------------------- |
|
112 | 206 | library_path: |