Rev 4250 | Rev 4267 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1742 | mario79 | 1 | ; |
2 | ; END |
||
3443 | leency | 3 | ; KolibriOS Team 2005-2013 |
1742 | mario79 | 4 | ; |
4051 | heavyiron | 5 | ; |
6 | ; and if we know that high 24 bits of eax are zero, we can use 1st form |
||
7 | ; the same about ebx,ecx,edx |
||
4266 | heavyiron | 8 | fade equ 0 |
1742 | mario79 | 9 | |
4266 | heavyiron | 10 | use32 ; включить 32-битный режим ассемблера |
11 | org 0x0 ; адресация с нуля |
||
1742 | mario79 | 12 | |
4266 | heavyiron | 13 | db 'MENUET01' ; 8-байтный идентификатор MenuetOS |
14 | dd 0x01 ; версия заголовка (всегда 1) |
||
15 | dd START ; адрес первой команды |
||
16 | dd IM_END ; размер программы |
||
17 | dd I_END ; количество памяти |
||
18 | dd stacktop ; адрес вершины стека |
||
19 | dd 0x0 ; адрес буфера для параметров |
||
4213 | heavyiron | 20 | dd cur_dir_path |
1742 | mario79 | 21 | |
4213 | heavyiron | 22 | include 'lang.inc' |
23 | include '../../../macros.inc' |
||
24 | include '../../../proc32.inc' |
||
25 | include '../../../dll.inc' |
||
26 | include '../../../develop/libraries/box_lib/load_lib.mac' |
||
27 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
||
1742 | mario79 | 28 | |
4213 | heavyiron | 29 | @use_library |
1742 | mario79 | 30 | |
4213 | heavyiron | 31 | align 4 |
32 | START: |
||
1742 | mario79 | 33 | |
4213 | heavyiron | 34 | load_libraries l_libs_start,end_l_libs |
35 | inc eax |
||
36 | test eax,eax |
||
37 | jz close |
||
1742 | mario79 | 38 | |
4213 | heavyiron | 39 | push dword check1 |
40 | call [init_checkbox2] |
||
1742 | mario79 | 41 | |
4213 | heavyiron | 42 | stdcall dll.Init,[init_lib] |
43 | |||
44 | invoke ini_get_int,ini_file,asettings,aautosave,0 |
||
45 | mov [autosave],eax |
||
4215 | heavyiron | 46 | dec eax |
47 | jnz @f |
||
4213 | heavyiron | 48 | bts dword [check1.flags],1 |
49 | @@: |
||
4215 | heavyiron | 50 | mcall 40,0x80000027 |
4213 | heavyiron | 51 | redraw: |
52 | call draw_window |
||
1742 | mario79 | 53 | still: |
4051 | heavyiron | 54 | mov al,10 |
55 | mcall ;wait here for event |
||
1742 | mario79 | 56 | dec eax |
4213 | heavyiron | 57 | jz redraw |
1742 | mario79 | 58 | dec eax |
4213 | heavyiron | 59 | jz key |
60 | dec eax |
||
61 | jz button |
||
4044 | heavyiron | 62 | |
4213 | heavyiron | 63 | push dword check1 |
64 | call [check_box_mouse2] |
||
65 | bt dword [check1.flags],1 |
||
66 | jnc @f |
||
67 | mov [autosave],1 |
||
68 | jmp still |
||
69 | @@: |
||
70 | mov [autosave],0 |
||
71 | jmp still |
||
4266 | heavyiron | 72 | |
4213 | heavyiron | 73 | key: |
4051 | heavyiron | 74 | mov al,2 |
75 | mcall ;eax=2 - get key code |
||
1742 | mario79 | 76 | mov al,ah |
77 | cmp al,13 |
||
4215 | heavyiron | 78 | je restart |
1742 | mario79 | 79 | cmp al,19 |
4215 | heavyiron | 80 | je checkbox |
1742 | mario79 | 81 | cmp al,180 |
4215 | heavyiron | 82 | je restart_kernel |
1742 | mario79 | 83 | cmp al,181 |
4215 | heavyiron | 84 | je power_off |
85 | cmp al,27 |
||
86 | jne still |
||
1742 | mario79 | 87 | |
4215 | heavyiron | 88 | close: |
89 | mcall -1 |
||
90 | |||
4044 | heavyiron | 91 | button: |
4213 | heavyiron | 92 | mcall 17 ;eax=17 - get pressed button id |
1742 | mario79 | 93 | xchg al,ah |
94 | dec eax |
||
4213 | heavyiron | 95 | jz close |
1742 | mario79 | 96 | dec eax |
97 | jz restart_kernel |
||
98 | dec eax |
||
99 | jz restart |
||
100 | dec eax |
||
4213 | heavyiron | 101 | jnz checkbox |
4044 | heavyiron | 102 | |
2676 | leency | 103 | power_off: |
104 | push 2 |
||
105 | jmp mcall_and_close |
||
4213 | heavyiron | 106 | |
2676 | leency | 107 | restart: |
1742 | mario79 | 108 | push 3 |
109 | jmp mcall_and_close |
||
4213 | heavyiron | 110 | |
4044 | heavyiron | 111 | restart_kernel: |
1742 | mario79 | 112 | push 4 |
4213 | heavyiron | 113 | |
1742 | mario79 | 114 | mcall_and_close: |
4266 | heavyiron | 115 | if fade=1 |
116 | ; === FADE IN === |
||
117 | mov eax, color1 |
||
118 | @@: |
||
119 | mov ebx, [eax + 32] |
||
120 | mov [eax], ebx |
||
121 | add eax, 4 |
||
122 | cmp eax, color21 |
||
123 | jne @b |
||
124 | |||
125 | call draw_window |
||
126 | else |
||
127 | mov al,4 |
||
128 | mcall ,<50,110> ,0x80000000,label7 ;eax=4 - write text |
||
129 | end if |
||
130 | |||
4213 | heavyiron | 131 | invoke ini_set_int,ini_file,asettings,aautosave,[autosave] |
132 | cmp [autosave],1 |
||
133 | jne no_save |
||
134 | mcall 70,rdsave |
||
135 | test eax,eax |
||
136 | js no_save |
||
137 | mov ecx,eax |
||
138 | mcall 18,21 |
||
139 | mov ecx,eax |
||
140 | @@: |
||
141 | push ecx |
||
4215 | heavyiron | 142 | mcall 23,100 |
4213 | heavyiron | 143 | dec eax |
144 | jnz no_red |
||
145 | call draw_window |
||
4266 | heavyiron | 146 | no_red: |
4213 | heavyiron | 147 | pop ecx |
148 | mcall 9,proc_info |
||
149 | cmp [proc_info+50],9 |
||
150 | je no_save |
||
151 | jmp @b |
||
152 | no_save: |
||
1742 | mario79 | 153 | pop ecx |
4266 | heavyiron | 154 | mcall 18,9 |
1742 | mario79 | 155 | |
4213 | heavyiron | 156 | checkbox: |
157 | btc dword [check1.flags],1 |
||
158 | jc .1 |
||
159 | mov [autosave],1 |
||
160 | jmp .draw |
||
161 | .1: |
||
162 | mov [autosave],0 |
||
163 | .draw: |
||
164 | push dword check1 |
||
165 | call [check_box_draw2] |
||
166 | jmp still |
||
4266 | heavyiron | 167 | |
4213 | heavyiron | 168 | draw_window: |
169 | mov al,12 |
||
4215 | heavyiron | 170 | mcall ,1 |
1742 | mario79 | 171 | |
4215 | heavyiron | 172 | mov al,14 |
173 | mcall ;eax=14 - get screen max x & max y |
||
4213 | heavyiron | 174 | movzx ecx,ax |
4215 | heavyiron | 175 | shr eax,17 |
176 | shl eax,16 |
||
177 | lea ebx,[eax-110 shl 16+222] |
||
178 | shr ecx,1 |
||
179 | shl ecx,16 |
||
4266 | heavyiron | 180 | lea ecx,[ecx-70 shl 16+122] |
4213 | heavyiron | 181 | |
4215 | heavyiron | 182 | xor eax,eax |
4266 | heavyiron | 183 | mcall , , ,[color1],0x01000000 ;define and draw window |
4213 | heavyiron | 184 | |
185 | mov al,13 |
||
4266 | heavyiron | 186 | mcall ,<0,223> ,<0,123> |
187 | mcall ,<1,221>,<1,121>,[color2] |
||
188 | mcall ,<2,220>,<2,120>, [color3] |
||
4213 | heavyiron | 189 | |
4215 | heavyiron | 190 | mov al,8 |
4266 | heavyiron | 191 | mcall ,<16,90> ,<20,27>,4,[color4] ;eax=8 - draw buttons |
192 | mcall ,<113,90>, ,2,[color5] |
||
193 | mcall , ,<54,27>,1,[color6] |
||
194 | mcall ,<16,90> , ,3,[color7] |
||
4213 | heavyiron | 195 | |
4215 | heavyiron | 196 | mov al,4 |
4266 | heavyiron | 197 | mcall ,<27,24> ,[color8],label2 ;eax=4 - write text |
198 | mcall ,<23,58> , ,label3 |
||
199 | mcall ,<47,37> , ,label5 |
||
200 | mcall ,<41,71> , ,label6 |
||
4215 | heavyiron | 201 | |
4213 | heavyiron | 202 | push dword check1 |
203 | call [check_box_draw2] |
||
204 | |||
205 | mov al,12 |
||
206 | mcall ,2 |
||
207 | ret |
||
4215 | heavyiron | 208 | ;--------------------------------------------------------------------- |
209 | ;data |
||
4044 | heavyiron | 210 | include 'data.inc' |
4213 | heavyiron | 211 | ;--------------------------------------------------------------------- |
212 | IM_END: |
||
213 | ;--------------------------------------------------------------------- |
||
214 | align 4 |
||
1742 | mario79 | 215 | |
4213 | heavyiron | 216 | proc_info rb 1024 |
217 | |||
218 | autosave rd 1 |
||
219 | ;--------------------------------------------------------------------- |
||
220 | cur_dir_path: |
||
221 | rb 4096 |
||
222 | ;--------------------------------------------------------------------- |
||
223 | library_path: |
||
224 | rb 4096 |
||
225 | ;--------------------------------------------------------------------- |
||
226 | align 32 |
||
227 | rb 4096 |
||
228 | stacktop: |
||
4266 | heavyiron | 229 | I_END: ; метка конца программы41,71>47,37>23,58>27,24>16,90>54,27>113,90>20,27>16,90>2,120>2,220>1,121>1,221>0,123>0,223>50,110> |