Rev 4268 | Rev 5665 | 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 | end if |
||
127 | |||
4213 | heavyiron | 128 | invoke ini_set_int,ini_file,asettings,aautosave,[autosave] |
129 | cmp [autosave],1 |
||
130 | jne no_save |
||
4284 | heavyiron | 131 | |
132 | if fade=0 |
||
133 | mov al,4 |
||
134 | mcall ,<50,110> ,0x800000cc,label7 ;eax=4 - write text |
||
135 | end if |
||
136 | |||
4213 | heavyiron | 137 | mcall 70,rdsave |
138 | test eax,eax |
||
139 | js no_save |
||
140 | mov ecx,eax |
||
141 | mcall 18,21 |
||
142 | mov ecx,eax |
||
143 | @@: |
||
144 | push ecx |
||
4215 | heavyiron | 145 | mcall 23,100 |
4213 | heavyiron | 146 | dec eax |
147 | jnz no_red |
||
148 | call draw_window |
||
4266 | heavyiron | 149 | no_red: |
4213 | heavyiron | 150 | pop ecx |
151 | mcall 9,proc_info |
||
152 | cmp [proc_info+50],9 |
||
153 | je no_save |
||
154 | jmp @b |
||
155 | no_save: |
||
1742 | mario79 | 156 | pop ecx |
4266 | heavyiron | 157 | mcall 18,9 |
4268 | heavyiron | 158 | ret |
1742 | mario79 | 159 | |
4213 | heavyiron | 160 | checkbox: |
161 | btc dword [check1.flags],1 |
||
162 | jc .1 |
||
163 | mov [autosave],1 |
||
164 | jmp .draw |
||
165 | .1: |
||
166 | mov [autosave],0 |
||
167 | .draw: |
||
168 | push dword check1 |
||
169 | call [check_box_draw2] |
||
170 | jmp still |
||
4266 | heavyiron | 171 | |
4213 | heavyiron | 172 | draw_window: |
173 | mov al,12 |
||
4215 | heavyiron | 174 | mcall ,1 |
1742 | mario79 | 175 | |
4215 | heavyiron | 176 | mov al,14 |
177 | mcall ;eax=14 - get screen max x & max y |
||
4213 | heavyiron | 178 | movzx ecx,ax |
4215 | heavyiron | 179 | shr eax,17 |
180 | shl eax,16 |
||
181 | lea ebx,[eax-110 shl 16+222] |
||
182 | shr ecx,1 |
||
183 | shl ecx,16 |
||
4266 | heavyiron | 184 | lea ecx,[ecx-70 shl 16+122] |
4213 | heavyiron | 185 | |
4215 | heavyiron | 186 | xor eax,eax |
4266 | heavyiron | 187 | mcall , , ,[color1],0x01000000 ;define and draw window |
4213 | heavyiron | 188 | |
189 | mov al,13 |
||
4266 | heavyiron | 190 | mcall ,<0,223> ,<0,123> |
191 | mcall ,<1,221>,<1,121>,[color2] |
||
192 | mcall ,<2,220>,<2,120>, [color3] |
||
4213 | heavyiron | 193 | |
4215 | heavyiron | 194 | mov al,8 |
4266 | heavyiron | 195 | mcall ,<16,90> ,<20,27>,4,[color4] ;eax=8 - draw buttons |
196 | mcall ,<113,90>, ,2,[color5] |
||
197 | mcall , ,<54,27>,1,[color6] |
||
198 | mcall ,<16,90> , ,3,[color7] |
||
4213 | heavyiron | 199 | |
4215 | heavyiron | 200 | mov al,4 |
4266 | heavyiron | 201 | mcall ,<27,24> ,[color8],label2 ;eax=4 - write text |
202 | mcall ,<23,58> , ,label3 |
||
203 | mcall ,<47,37> , ,label5 |
||
204 | mcall ,<41,71> , ,label6 |
||
4215 | heavyiron | 205 | |
4213 | heavyiron | 206 | push dword check1 |
207 | call [check_box_draw2] |
||
208 | |||
209 | mov al,12 |
||
210 | mcall ,2 |
||
211 | ret |
||
4215 | heavyiron | 212 | ;--------------------------------------------------------------------- |
213 | ;data |
||
4044 | heavyiron | 214 | include 'data.inc' |
4213 | heavyiron | 215 | ;--------------------------------------------------------------------- |
216 | IM_END: |
||
217 | ;--------------------------------------------------------------------- |
||
218 | align 4 |
||
1742 | mario79 | 219 | |
4213 | heavyiron | 220 | proc_info rb 1024 |
221 | |||
222 | autosave rd 1 |
||
223 | ;--------------------------------------------------------------------- |
||
224 | cur_dir_path: |
||
225 | rb 4096 |
||
226 | ;--------------------------------------------------------------------- |
||
227 | library_path: |
||
228 | rb 4096 |
||
229 | ;--------------------------------------------------------------------- |
||
230 | align 32 |
||
231 | rb 4096 |
||
232 | stacktop: |
||
4266 | heavyiron | 233 | 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> |