Rev 1385 | Rev 2559 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; PROCESS MANAGEMENT |
||
3 | ; |
||
4 | ; VTurjanmaa |
||
5 | ; additions by M.Lisovin lisovin@26.ru |
||
1205 | Lrz | 6 | ; integrated with load_lib.obj by |
31 | halyavin | 7 | ; Compile with FASM for Menuet |
8 | ; |
||
9 | |||
10 | use32 |
||
1373 | IgorA | 11 | org 0x0 |
1266 | Lrz | 12 | STACK_SIZE=1024 |
13 | offset_y=22 ; Correction for skin |
||
14 | offset_x=5 |
||
2128 | leency | 15 | db 'MENUET01' ; 8 byte id |
16 | dd 0x01 ; header version |
||
17 | dd START ; start of code |
||
18 | dd I_END ; size of image |
||
19 | dd U_END+STACK_SIZE ; memory for app |
||
20 | dd U_END+STACK_SIZE ; esp |
||
21 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
31 | halyavin | 22 | |
23 | include 'lang.inc' |
||
1209 | diamond | 24 | include '../../../macros.inc' |
1373 | IgorA | 25 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
1209 | diamond | 26 | include '../../../develop/libraries/box_lib/load_lib.mac' |
1373 | IgorA | 27 | display_processes=32 ; number of processes to show |
1205 | Lrz | 28 | @use_library ;use load lib macros |
1373 | IgorA | 29 | START: ; start of execution |
1205 | Lrz | 30 | |
31 | sys_load_library library_name, cur_dir_path, library_path, system_path, \ |
||
32 | err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
||
1373 | IgorA | 33 | inc eax |
34 | jz close |
||
31 | halyavin | 35 | ; calculate window position |
36 | ; at the center of the screen |
||
1266 | Lrz | 37 | mcall 40,0x27 ;set event |
31 | halyavin | 38 | call calculate_window_pos |
39 | |||
40 | ;main loop when process name isn't edited. |
||
1373 | IgorA | 41 | red: |
42 | mcall 48,3,sc,40 |
||
2128 | leency | 43 | edit_boxes_set_sys_color edit1,edit1_end,sc ;set color |
1373 | IgorA | 44 | check_boxes_set_sys_color check1,check1_end,sc ;set color |
1203 | Lrz | 45 | xor ebp,ebp |
46 | inc ebp |
||
47 | ; mov ebp,1 |
||
1373 | IgorA | 48 | call draw_window ; redraw all window |
31 | halyavin | 49 | still: |
2128 | leency | 50 | mcall 23,100 ; wait here for event 1 sec. |
31 | halyavin | 51 | |
1373 | IgorA | 52 | dec eax ; redraw request ? |
53 | jz red |
||
54 | dec eax ; key in buffer ? |
||
55 | jz key |
||
56 | dec eax ; button in buffer ? |
||
57 | jz button |
||
1205 | Lrz | 58 | |
1373 | IgorA | 59 | sub eax,3 ; If not use mouse - show |
1266 | Lrz | 60 | jnz still_end |
1373 | IgorA | 61 | push dword edit1 |
62 | call [edit_box_mouse] |
||
1385 | diamond | 63 | push dword[check1+32] |
1266 | Lrz | 64 | push dword check1 |
65 | call [check_box_mouse] |
||
1385 | diamond | 66 | pop eax |
67 | cmp eax, dword[check1+32] |
||
68 | jnz still_end |
||
1266 | Lrz | 69 | jmp still |
1205 | Lrz | 70 | |
31 | halyavin | 71 | still_end: |
1373 | IgorA | 72 | xor ebp,ebp ; draw new state of processes |
31 | halyavin | 73 | call draw_window |
74 | jmp still |
||
75 | |||
1212 | Lrz | 76 | |
1373 | IgorA | 77 | key: ; key |
2128 | leency | 78 | mcall 2 |
1205 | Lrz | 79 | |
1373 | IgorA | 80 | cmp ah,184 ; PageUp |
81 | jz pgdn |
||
31 | halyavin | 82 | cmp ah,183 |
1373 | IgorA | 83 | jz pgup ; PageDown |
31 | halyavin | 84 | cmp ah,27 |
1373 | IgorA | 85 | jz close ; Esc |
1205 | Lrz | 86 | |
1373 | IgorA | 87 | push dword edit1 |
88 | call [edit_box_key] |
||
1266 | Lrz | 89 | ; Check ENTER with ed_focus edit_box |
90 | lea edi,[edit1] |
||
91 | test word ed_flags,ed_focus |
||
1373 | IgorA | 92 | jz still_end |
93 | sub ah,13 ; ENTER? |
||
94 | jz program_start ; RUN a program |
||
1205 | Lrz | 95 | |
1266 | Lrz | 96 | jmp still |
1212 | Lrz | 97 | |
1373 | IgorA | 98 | button: |
31 | halyavin | 99 | ; get button id |
1373 | IgorA | 100 | mov eax,17 |
1203 | Lrz | 101 | mcall |
1373 | IgorA | 102 | shr eax,8 |
31 | halyavin | 103 | |
104 | ;id in [10,50] corresponds to terminate buttons. |
||
105 | cmp eax,10 |
||
1373 | IgorA | 106 | jb noterm |
31 | halyavin | 107 | cmp eax,50 |
1373 | IgorA | 108 | jg noterm |
31 | halyavin | 109 | |
110 | ;calculate button index |
||
111 | sub eax,11 |
||
112 | |||
113 | ;calculate process slot |
||
114 | mov ecx,[tasklist+4*eax] |
||
115 | |||
116 | ;ignore empty buttons |
||
117 | test ecx,ecx |
||
118 | jle still_end |
||
119 | ;terminate application |
||
120 | mov eax,18 |
||
121 | mov ebx,2 |
||
1203 | Lrz | 122 | mcall |
31 | halyavin | 123 | jmp still_end |
1212 | Lrz | 124 | |
31 | halyavin | 125 | noterm: |
126 | |||
127 | ;special buttons |
||
1203 | Lrz | 128 | dec eax |
1373 | IgorA | 129 | jz close |
1203 | Lrz | 130 | |
131 | sub eax,50 |
||
1373 | IgorA | 132 | jz pgdn ;51 |
1203 | Lrz | 133 | dec eax |
1373 | IgorA | 134 | jz pgup ;52 |
1207 | Lrz | 135 | ; dec eax |
1205 | Lrz | 136 | ; jz read_string |
1203 | Lrz | 137 | dec eax |
1373 | IgorA | 138 | jz program_start ;53 |
1207 | Lrz | 139 | dec eax |
1373 | IgorA | 140 | jz reboot ;54 |
31 | halyavin | 141 | jmp still_end |
142 | |||
143 | ;buttons handlers |
||
1212 | Lrz | 144 | |
31 | halyavin | 145 | pgdn: |
146 | sub [list_start],display_processes |
||
205 | heavyiron | 147 | ; cmp [list_start],0 |
31 | halyavin | 148 | jge still_end |
149 | mov [list_start],0 |
||
150 | jmp still_end |
||
1212 | Lrz | 151 | |
31 | halyavin | 152 | pgup: |
153 | mov eax,[list_add] ;maximal displayed process slot |
||
154 | mov [list_start],eax |
||
155 | jmp still_end |
||
1212 | Lrz | 156 | |
31 | halyavin | 157 | program_start: |
205 | heavyiron | 158 | mov eax,70 |
31 | halyavin | 159 | mov ebx,file_start |
1203 | Lrz | 160 | mcall |
31 | halyavin | 161 | jmp still_end |
1212 | Lrz | 162 | |
31 | halyavin | 163 | reboot: |
748 | heavyiron | 164 | mov eax,70 |
165 | mov ebx,sys_reboot |
||
1203 | Lrz | 166 | mcall |
31 | halyavin | 167 | ;close program if we going to reboot |
1212 | Lrz | 168 | |
31 | halyavin | 169 | close: |
1373 | IgorA | 170 | or eax,-1 ; close this program |
1203 | Lrz | 171 | mcall |
1212 | Lrz | 172 | |
31 | halyavin | 173 | draw_next_process: |
174 | ;input: |
||
175 | ; edi - current slot |
||
176 | ; [curposy] - y position |
||
177 | ;output: |
||
178 | ; edi - next slot (or -1 if no next slot) |
||
179 | ;registers corrupted! |
||
180 | |||
181 | ;create button |
||
182 | test ebp,ebp |
||
183 | jnz .nodelete |
||
184 | ;delete old button |
||
185 | mov eax,8 |
||
186 | mov edx,[index] |
||
187 | add edx,(1 shl 31)+11 |
||
1203 | Lrz | 188 | mcall |
1212 | Lrz | 189 | |
31 | halyavin | 190 | .nodelete: |
191 | ;create terminate process button |
||
192 | mov eax,8 |
||
2128 | leency | 193 | mov ebx,(15-offset_x)*65536+121-offset_y |
31 | halyavin | 194 | mov ecx,[curposy] |
2128 | leency | 195 | ;sub ecx,1 |
31 | halyavin | 196 | shl ecx,16 |
197 | mov cx,10 |
||
198 | mov edx,[index] |
||
199 | add edx,11 |
||
200 | mov esi,0xaabbcc |
||
201 | ;contrast |
||
202 | test dword [index],1 |
||
1373 | IgorA | 203 | jz .change_color_button |
31 | halyavin | 204 | mov esi,0x8899aa |
1212 | Lrz | 205 | |
31 | halyavin | 206 | .change_color_button: |
1203 | Lrz | 207 | mcall |
31 | halyavin | 208 | |
209 | ;draw background for proccess information |
||
210 | mov eax,13 |
||
1205 | Lrz | 211 | mov ebx,(115-offset_x)*65536+395 |
31 | halyavin | 212 | ;ecx was already set |
213 | mov edx,0x88ff88 |
||
214 | ;contrast |
||
215 | test dword [index],1 |
||
1373 | IgorA | 216 | jz .change_color_info |
31 | halyavin | 217 | mov edx,0xddffdd |
1212 | Lrz | 218 | |
31 | halyavin | 219 | .change_color_info: |
1203 | Lrz | 220 | mcall |
31 | halyavin | 221 | |
222 | ;nothing else should be done |
||
223 | ;if there is no process for this button |
||
224 | test edi,edi |
||
1373 | IgorA | 225 | jl .ret |
31 | halyavin | 226 | |
227 | ;find process |
||
1266 | Lrz | 228 | .return_1: |
31 | halyavin | 229 | inc edi |
230 | ;more comfortable register for next loop |
||
231 | mov ecx,edi |
||
232 | ;precacluate pointer to process buffer |
||
233 | mov ebx,process_info_buffer |
||
234 | |||
235 | ;find process loop |
||
1212 | Lrz | 236 | |
31 | halyavin | 237 | .find_loop: |
238 | cmp ecx,256 |
||
239 | jge .no_processes |
||
240 | |||
241 | ;load process information in buffer |
||
242 | mov eax,9 |
||
243 | ; mov ebx,process_info_buffer |
||
1203 | Lrz | 244 | mcall |
31 | halyavin | 245 | |
246 | ;if current slot greater than maximal slot, |
||
247 | ;there is no more proccesses. |
||
248 | cmp ecx,eax |
||
1373 | IgorA | 249 | jg .no_processes |
31 | halyavin | 250 | |
251 | ;if slot state is equal to 9, it is empty. |
||
252 | cmp [process_info_buffer+process_information.slot_state],9 |
||
253 | jnz .process_found |
||
254 | |||
255 | inc ecx |
||
256 | jmp .find_loop |
||
1212 | Lrz | 257 | |
31 | halyavin | 258 | .no_processes: |
1373 | IgorA | 259 | or edi,-1 |
31 | halyavin | 260 | ret |
1212 | Lrz | 261 | |
31 | halyavin | 262 | .process_found: |
1266 | Lrz | 263 | ;check on/off check box |
264 | push edi |
||
265 | lea edi,[check1] |
||
266 | test dword ch_flags,ch_flag_en |
||
267 | pop edi |
||
268 | jnz @f |
||
269 | cmp dword [process_info_buffer+10],'ICON' |
||
1373 | IgorA | 270 | jz .return_1 |
1266 | Lrz | 271 | cmp dword [process_info_buffer+10],'OS/I' |
1373 | IgorA | 272 | jz .return_1 |
1266 | Lrz | 273 | cmp byte [process_info_buffer+10],'@' |
1373 | IgorA | 274 | jz .return_1 |
1266 | Lrz | 275 | |
276 | |||
277 | @@: mov edi,ecx |
||
31 | halyavin | 278 | mov [list_add],ecx |
279 | |||
280 | ;get processor cpeed |
||
281 | ;for percent calculating |
||
282 | mov eax,18 |
||
283 | mov ebx,5 |
||
1203 | Lrz | 284 | mcall |
31 | halyavin | 285 | |
286 | xor edx,edx |
||
287 | mov ebx,100 |
||
1266 | Lrz | 288 | div ebx |
31 | halyavin | 289 | |
290 | ;eax = number of operation for 1% now |
||
291 | ;calculate process cpu usage percent |
||
292 | mov ebx,eax |
||
293 | mov eax,[process_info_buffer+process_information.cpu_usage] |
||
294 | ; cdq |
||
1203 | Lrz | 295 | xor edx,edx ; for CPU more 2 GHz - mike.dld |
31 | halyavin | 296 | |
297 | div ebx |
||
298 | mov [cpu_percent],eax |
||
299 | |||
300 | ;set text color to display process information |
||
301 | ;([tcolor] variable) |
||
302 | ;0% : black |
||
303 | ;1-80% : green |
||
304 | ;81-100% : red |
||
305 | test eax,eax |
||
1266 | Lrz | 306 | jnz .no_black |
31 | halyavin | 307 | mov [tcolor],eax |
308 | jmp .color_set |
||
1212 | Lrz | 309 | |
31 | halyavin | 310 | .no_black: |
311 | cmp eax,80 |
||
1373 | IgorA | 312 | ja .no_green |
31 | halyavin | 313 | mov dword [tcolor],0x107a30 |
314 | jmp .color_set |
||
1212 | Lrz | 315 | |
31 | halyavin | 316 | .no_green: |
317 | mov dword [tcolor],0xac0000 |
||
318 | .color_set: |
||
319 | |||
320 | ;show slot number |
||
1373 | IgorA | 321 | mov eax,47 |
31 | halyavin | 322 | mov ebx,2*65536+1*256 |
323 | ;ecx haven't changed since .process_found |
||
324 | ; mov ecx,edi |
||
325 | mov edx,[curposy] |
||
1205 | Lrz | 326 | add edx,(20-offset_x)*65536+1 |
31 | halyavin | 327 | mov esi,[tcolor] |
1203 | Lrz | 328 | mcall |
31 | halyavin | 329 | |
330 | ;show process name |
||
331 | mov eax,4 |
||
332 | mov ebx,[curposy] |
||
1205 | Lrz | 333 | add ebx,(50-offset_x)*65536+1 |
31 | halyavin | 334 | mov ecx,[tcolor] |
335 | mov edx,process_info_buffer.process_name |
||
336 | mov esi,11 |
||
1203 | Lrz | 337 | mcall |
31 | halyavin | 338 | |
339 | ;show pid |
||
340 | mov eax,47 |
||
341 | mov ebx,8*65536+1*256 |
||
342 | mov ecx,[process_info_buffer.PID] |
||
343 | mov edx,[curposy] |
||
1205 | Lrz | 344 | add edx,(130-offset_x)*65536+1 |
31 | halyavin | 345 | mov esi,[tcolor] |
1203 | Lrz | 346 | mcall |
31 | halyavin | 347 | |
348 | ;show cpu usage |
||
349 | mov ecx,[process_info_buffer.cpu_usage] |
||
350 | add edx,60*65536 |
||
1203 | Lrz | 351 | mcall |
31 | halyavin | 352 | |
353 | ;show cpu percent |
||
354 | mov ebx,3*65536+0*256 |
||
355 | mov ecx,[cpu_percent] |
||
356 | add edx,60*65536 |
||
1203 | Lrz | 357 | mcall |
31 | halyavin | 358 | |
359 | ;show memory start - obsolete |
||
360 | mov ebx,8*65536+1*256 |
||
361 | mov ecx,[process_info_buffer.memory_start] |
||
362 | add edx,30*65536 |
||
1203 | Lrz | 363 | mcall |
31 | halyavin | 364 | |
365 | ;show memory usage |
||
366 | mov ecx,[process_info_buffer.used_memory] |
||
367 | inc ecx |
||
368 | add edx,60*65536 |
||
1203 | Lrz | 369 | mcall |
31 | halyavin | 370 | |
371 | ;show window stack and value |
||
372 | mov ecx,dword [process_info_buffer.window_stack_position] |
||
373 | add edx,60*65536 |
||
1203 | Lrz | 374 | mcall |
31 | halyavin | 375 | |
376 | ;show window xy size |
||
485 | heavyiron | 377 | mov ecx,[process_info_buffer.box.left] |
31 | halyavin | 378 | shl ecx,16 |
485 | heavyiron | 379 | add ecx,[process_info_buffer.box.top] |
31 | halyavin | 380 | add edx,60*65536 |
1203 | Lrz | 381 | mcall |
1373 | IgorA | 382 | |
31 | halyavin | 383 | .ret: |
384 | ;build index->slot map for terminating processes. |
||
385 | mov eax,[index] |
||
1373 | IgorA | 386 | mov [tasklist+4*eax],edi |
31 | halyavin | 387 | ret |
1212 | Lrz | 388 | |
1205 | Lrz | 389 | ;read_string: |
31 | halyavin | 390 | ;clean string |
1205 | Lrz | 391 | ; mov edi,start_application |
392 | ; xor eax,eax |
||
393 | ; mov ecx,60 |
||
394 | ; cld |
||
395 | ; rep stosb |
||
396 | ; call print_text |
||
31 | halyavin | 397 | |
1205 | Lrz | 398 | ; mov edi,start_application |
31 | halyavin | 399 | ;edi now contains pointer to last symbol |
1205 | Lrz | 400 | ; jmp still1 |
31 | halyavin | 401 | |
402 | ;read string main loop |
||
1212 | Lrz | 403 | |
31 | halyavin | 404 | f11: |
405 | ;full update |
||
406 | push edi |
||
1205 | Lrz | 407 | xor ebp,ebp |
408 | inc ebp |
||
409 | ; mov ebp,1 |
||
31 | halyavin | 410 | call draw_window |
411 | pop edi |
||
1212 | Lrz | 412 | ; |
1205 | Lrz | 413 | ; still1: |
31 | halyavin | 414 | ;wait for message |
1205 | Lrz | 415 | ; mov eax,23 |
416 | ; mov ebx,100 |
||
417 | ; mcall |
||
418 | ; cmp eax,1 |
||
419 | ; je f11 |
||
31 | halyavin | 420 | ;if no message - update process information |
1205 | Lrz | 421 | ; cmp eax,0 |
422 | ; jnz .message_received |
||
423 | ; push edi ;edi should be saved since draw_window |
||
424 | ; xor ebp,ebp ;corrupt registers |
||
425 | ; call draw_window |
||
426 | ; pop edi |
||
427 | ; jmp still1 |
||
1212 | Lrz | 428 | ; |
1205 | Lrz | 429 | ;.message_received: |
430 | ; cmp eax,2 |
||
431 | ; jne read_done ;buttons message |
||
31 | halyavin | 432 | ;read char |
1205 | Lrz | 433 | ; mov eax,2 |
434 | ; mcall |
||
435 | ; shr eax,8 |
||
31 | halyavin | 436 | |
437 | ;if enter pressed, exit read string loop |
||
1205 | Lrz | 438 | ; cmp eax,13 |
439 | ; je read_done |
||
31 | halyavin | 440 | ;if backslash pressed? |
1205 | Lrz | 441 | ; cmp eax,8 |
442 | ; jnz nobsl |
||
31 | halyavin | 443 | ;decrease pointer to last symbol |
1205 | Lrz | 444 | ; cmp edi,start_application |
445 | ; jz still1 |
||
446 | ; dec edi |
||
31 | halyavin | 447 | ;fill last symbol with space because |
448 | ;print_text show all symbols |
||
1205 | Lrz | 449 | ; mov [edi],byte 32 |
450 | ; call print_text |
||
451 | ; jmp still1 |
||
1212 | Lrz | 452 | ; |
1205 | Lrz | 453 | ; nobsl: |
31 | halyavin | 454 | ;write new symbol |
1205 | Lrz | 455 | ; mov [edi],al |
31 | halyavin | 456 | ;display new text |
1205 | Lrz | 457 | ; call print_text |
31 | halyavin | 458 | ;increment pointer to last symbol |
1205 | Lrz | 459 | ; inc edi |
31 | halyavin | 460 | ;compare with end of string |
1205 | Lrz | 461 | ; mov esi,start_application |
462 | ; add esi,60 |
||
463 | ; cmp esi,edi |
||
464 | ; jnz still1 |
||
31 | halyavin | 465 | |
466 | ;exiting from read string loop |
||
1212 | Lrz | 467 | ; |
1205 | Lrz | 468 | ; read_done: |
31 | halyavin | 469 | ;terminate string for file functions |
1205 | Lrz | 470 | ; mov [edi],byte 0 |
31 | halyavin | 471 | |
1205 | Lrz | 472 | ; call print_text |
473 | ; jmp still |
||
31 | halyavin | 474 | |
1212 | Lrz | 475 | ; |
1205 | Lrz | 476 | ;print_text: |
31 | halyavin | 477 | ;display start_application string |
478 | |||
1205 | Lrz | 479 | ; pushad |
31 | halyavin | 480 | |
481 | ;display text background |
||
1205 | Lrz | 482 | ; mov eax,13 |
483 | ; mov ebx,64*65536+62*6 |
||
484 | ; mov ecx,400*65536+12 |
||
485 | ; mov edx,0xffffcc ;0xeeeeee |
||
486 | ; mcall |
||
31 | halyavin | 487 | |
488 | ;display text |
||
1205 | Lrz | 489 | ; mov eax,4 |
490 | ; mov edx,start_application ;from start_application string |
||
491 | ; mov ebx,70*65536+402 ;text center-aligned |
||
492 | ; xor ecx,ecx ;black text |
||
493 | ; mov esi,60 ;60 symbols |
||
494 | ; mcall |
||
31 | halyavin | 495 | |
1205 | Lrz | 496 | ; popad |
497 | ; ret |
||
31 | halyavin | 498 | |
499 | window_x_size=524 |
||
500 | window_y_size=430 |
||
1212 | Lrz | 501 | |
31 | halyavin | 502 | calculate_window_pos: |
503 | ;set window size and position for 0 function |
||
504 | ;to [winxpos] and [winypos] variables |
||
505 | |||
506 | ;get screen size |
||
507 | mov eax,14 |
||
1203 | Lrz | 508 | mcall |
31 | halyavin | 509 | mov ebx,eax |
510 | |||
511 | ;calculate (x_screen-window_x_size)/2 |
||
512 | shr ebx,16+1 |
||
513 | sub ebx,window_x_size/2 |
||
514 | shl ebx,16 |
||
515 | mov bx,window_x_size |
||
516 | ;winxpos=xcoord*65536+xsize |
||
517 | mov [winxpos],ebx |
||
518 | |||
519 | ;calculate (y_screen-window_y_size)/2 |
||
520 | and eax,0xffff |
||
521 | shr eax,1 |
||
522 | sub eax,window_y_size/2 |
||
523 | shl eax,16 |
||
524 | mov ax,window_y_size |
||
525 | ;winypos=ycoord*65536+ysize |
||
526 | mov [winypos],eax |
||
527 | |||
528 | ret |
||
529 | |||
530 | ; ********************************************* |
||
531 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
532 | ; ********************************************* |
||
533 | |||
1212 | Lrz | 534 | align 16 |
31 | halyavin | 535 | draw_window: |
536 | ;ebp=1 - redraw all |
||
537 | ;ebp=0 - redraw only process information |
||
538 | |||
539 | test ebp,ebp |
||
1373 | IgorA | 540 | jz .show_process_info |
31 | halyavin | 541 | |
2128 | leency | 542 | mcall 12, 1 |
31 | halyavin | 543 | |
2128 | leency | 544 | ; DRAW WINDOW |
545 | xor eax,eax ; function 0 : define and draw window |
||
546 | mov ebx,[winxpos] ; [x start] *65536 + [x size] |
||
547 | mov ecx,[winypos] ; [y start] *65536 + [y size] |
||
548 | mov edx,0x34ddffdd ; color of work area RRGGBB,8->color |
||
549 | mov edi,title ; WINDOW CAPTION; |
||
1203 | Lrz | 550 | mcall |
31 | halyavin | 551 | |
1373 | IgorA | 552 | |
2128 | leency | 553 | add eax,4 ; function 4 : write text to window |
554 | mov ebx,(22-offset_x)*65536+35-offset_y |
||
31 | halyavin | 555 | xor ecx,ecx |
556 | mov edx,text |
||
205 | heavyiron | 557 | mov esi,text_len |
1203 | Lrz | 558 | mcall |
1205 | Lrz | 559 | |
1373 | IgorA | 560 | push dword edit1 |
561 | call [edit_box_draw] |
||
562 | push dword check1 |
||
1266 | Lrz | 563 | call [check_box_draw] |
1205 | Lrz | 564 | |
1212 | Lrz | 565 | align 16 |
31 | halyavin | 566 | .show_process_info: |
567 | mov edi,[list_start] |
||
568 | mov [list_add],edi |
||
569 | mov dword [index],0 |
||
1205 | Lrz | 570 | mov dword [curposy],54-offset_y |
1212 | Lrz | 571 | |
31 | halyavin | 572 | .loop_draw: |
573 | call draw_next_process |
||
574 | inc dword [index] |
||
575 | add dword [curposy],10 |
||
576 | cmp [index],display_processes |
||
1373 | IgorA | 577 | jl .loop_draw |
31 | halyavin | 578 | |
579 | test ebp,ebp |
||
1373 | IgorA | 580 | jz .end_redraw |
31 | halyavin | 581 | mov eax,8 |
582 | mov esi,0xaabbcc |
||
1373 | IgorA | 583 | |
31 | halyavin | 584 | ; previous page button |
1205 | Lrz | 585 | mov ebx,(30-offset_x)*65536+96 |
586 | mov ecx,(380-offset_y)*65536+10 |
||
31 | halyavin | 587 | mov edx,51 |
1203 | Lrz | 588 | mcall |
1373 | IgorA | 589 | |
1207 | Lrz | 590 | ; next page button 52 |
1205 | Lrz | 591 | mov ebx,(130-offset_x)*65536+96 |
31 | halyavin | 592 | inc edx |
1203 | Lrz | 593 | mcall |
1373 | IgorA | 594 | |
31 | halyavin | 595 | ; ">" (text enter) button |
1205 | Lrz | 596 | ; mov ebx,30*65536+20 |
31 | halyavin | 597 | add ecx,20 shl 16 |
1205 | Lrz | 598 | ; inc edx |
599 | ; mcall |
||
1373 | IgorA | 600 | |
1207 | Lrz | 601 | ; run button 53 |
1205 | Lrz | 602 | mov ebx,(456-offset_x)*65536+50 |
31 | halyavin | 603 | inc edx |
1203 | Lrz | 604 | mcall |
31 | halyavin | 605 | |
606 | ; reboot button |
||
1373 | IgorA | 607 | sub ebx,120*65536 |
31 | halyavin | 608 | add ebx,60 |
609 | sub ecx,20 shl 16 |
||
610 | inc edx |
||
1203 | Lrz | 611 | mcall |
31 | halyavin | 612 | |
613 | ;"PREV PAGE", "NEXT PAGE" and "REBOOT" labels |
||
614 | mov eax,4 |
||
1205 | Lrz | 615 | mov ebx,(50-offset_x)*65536+382-offset_y |
31 | halyavin | 616 | xor ecx,ecx |
617 | mov edx,tbts |
||
618 | mov esi,tbte-tbts |
||
1203 | Lrz | 619 | mcall |
31 | halyavin | 620 | |
621 | ;">" labels |
||
1205 | Lrz | 622 | ; mov eax,4 |
623 | ; mov ebx,40*65536+402 |
||
624 | ; xor ecx,ecx |
||
625 | ; mov edx,tbts_2 |
||
626 | ; mov esi,1 |
||
627 | ; mcall |
||
31 | halyavin | 628 | |
629 | ;"RUN" labels |
||
1205 | Lrz | 630 | ; mov eax,4 |
631 | mov ebx,(475-offset_x)*65536+402-offset_y |
||
31 | halyavin | 632 | xor ecx,ecx |
633 | mov edx,tbts_3 |
||
634 | mov esi,tbte_2-tbts_3 |
||
1203 | Lrz | 635 | mcall |
31 | halyavin | 636 | |
637 | ;print application name in text box |
||
1205 | Lrz | 638 | ; call print_text |
31 | halyavin | 639 | |
2128 | leency | 640 | mcall 12, 2 |
1212 | Lrz | 641 | |
31 | halyavin | 642 | .end_redraw: |
643 | ret |
||
644 | |||
645 | |||
646 | ; DATA AREA |
||
1373 | IgorA | 647 | system_path db '/sys/lib/' |
648 | library_name db 'box_lib.obj',0 |
||
1205 | Lrz | 649 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
650 | |||
1373 | IgorA | 651 | err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0 |
1205 | Lrz | 652 | head_f_i: |
1373 | IgorA | 653 | head_f_l db 'System error',0 |
654 | err_message_import db 'Error on load import library box_lib.obj',0 |
||
1205 | Lrz | 655 | |
656 | myimport: |
||
657 | |||
1373 | IgorA | 658 | edit_box_draw dd aEdit_box_draw |
659 | edit_box_key dd aEdit_box_key |
||
660 | edit_box_mouse dd aEdit_box_mouse |
||
1205 | Lrz | 661 | ;version_ed dd aVersion_ed |
662 | |||
1373 | IgorA | 663 | check_box_draw dd aCheck_box_draw |
664 | check_box_mouse dd aCheck_box_mouse |
||
1205 | Lrz | 665 | ;version_ch dd aVersion_ch |
666 | |||
667 | ;option_box_draw dd aOption_box_draw |
||
668 | ;option_box_mouse dd aOption_box_mouse |
||
669 | ;version_op dd aVersion_op |
||
670 | |||
1373 | IgorA | 671 | dd 0 |
672 | dd 0 |
||
1205 | Lrz | 673 | |
1373 | IgorA | 674 | aEdit_box_draw db 'edit_box',0 |
675 | aEdit_box_key db 'edit_box_key',0 |
||
1205 | Lrz | 676 | aEdit_box_mouse db 'edit_box_mouse',0 |
677 | ;aVersion_ed db 'version_ed',0 |
||
678 | |||
1266 | Lrz | 679 | aCheck_box_draw db 'check_box_draw',0 |
680 | aCheck_box_mouse db 'check_box_mouse',0 |
||
1205 | Lrz | 681 | ;aVersion_ch db 'version_ch',0 |
682 | |||
683 | ;aOption_box_draw db 'option_box_draw',0 |
||
684 | ;aOption_box_mouse db 'option_box_mouse',0 |
||
685 | ;aVersion_op db 'version_op',0 |
||
1383 | diamond | 686 | check1 check_box 10,(400-offset_y),6,11,0x80AABBCC,0,0,check_text,check_t_e,0;ch_flag_en |
1266 | Lrz | 687 | check1_end: |
688 | edit1 edit_box 350,(100-offset_x),(398-offset_y),0xffffff,0x6f9480,0,0xAABBCC,0,start_application_c,start_application,mouse_dd,ed_focus,start_application_e,start_application_e |
||
1228 | Lrz | 689 | edit1_end: |
31 | halyavin | 690 | list_start dd 0 |
691 | |||
748 | heavyiron | 692 | sys_reboot: |
1373 | IgorA | 693 | dd 7 |
694 | dd 0 |
||
695 | dd 0 |
||
696 | dd 0 |
||
697 | dd 0 |
||
698 | db '/sys/end',0 |
||
748 | heavyiron | 699 | |
340 | heavyiron | 700 | if lang eq de |
31 | halyavin | 701 | text: |
1205 | Lrz | 702 | db 'NAME/BEENDEN PID CPU-LAST % ' |
2128 | leency | 703 | db 'SPEICHER START/NUTZUNG W-STACK W-SIZE' |
205 | heavyiron | 704 | text_len = $-text |
31 | halyavin | 705 | |
1373 | IgorA | 706 | tbts: db 'SEITE ZURUECK SEITE VOR REBOOT SYSTEM' |
135 | diamond | 707 | tbte: |
1205 | Lrz | 708 | ;tbts_2 db '>' |
1373 | IgorA | 709 | tbts_3 db 'START' |
135 | diamond | 710 | tbte_2: |
1266 | Lrz | 711 | check_text db '@ gehoren/aus' |
712 | check_t_e=$-check_text |
||
485 | heavyiron | 713 | title db 'Prozesse - Ctrl/Alt/Del',0 |
340 | heavyiron | 714 | |
268 | kaitz | 715 | else if lang eq et |
716 | text: |
||
1205 | Lrz | 717 | db 'NIMI/LÕPETA PID CPU-KASUTUS % ' |
268 | kaitz | 718 | db 'MÄLU ALGUS/KASUTUS W-PUHVER W-SUURUS' |
719 | text_len = $-text |
||
720 | |||
721 | tbts: db 'EELMINE LEHT JÄRGMINE LEHT REBOODI SÜSTEEM' |
||
722 | tbte: |
||
1373 | IgorA | 723 | ;tbts_2 db '>' |
268 | kaitz | 724 | tbts_3 db 'START' |
725 | tbte_2: |
||
1266 | Lrz | 726 | check_text db '@ on/off' |
727 | check_t_e=$-check_text |
||
728 | title db 'Protsessid - Ctrl/Alt/Del' |
||
268 | kaitz | 729 | |
340 | heavyiron | 730 | else |
731 | text: |
||
1205 | Lrz | 732 | db 'NAME/TERMINATE PID CPU-USAGE % ' |
2128 | leency | 733 | db 'MEMORY START/USAGE W-STACK W-SIZE' |
340 | heavyiron | 734 | text_len = $-text |
735 | |||
1373 | IgorA | 736 | tbts: db 'PREV PAGE NEXT PAGE REBOOT SYSTEM' |
340 | heavyiron | 737 | tbte: |
1205 | Lrz | 738 | ;tbts_2 db '>' |
1373 | IgorA | 739 | tbts_3 db 'RUN' |
340 | heavyiron | 740 | tbte_2: |
1266 | Lrz | 741 | check_text db '@ on/off' |
742 | check_t_e=$-check_text |
||
485 | heavyiron | 743 | title db 'Processes - Ctrl/Alt/Del',0 |
340 | heavyiron | 744 | |
135 | diamond | 745 | end if |
1207 | Lrz | 746 | file_start: dd 7 |
1373 | IgorA | 747 | dd 0,0,0,0 |
1205 | Lrz | 748 | start_application: db '/sys/LAUNCHER',0 |
749 | start_application_e=$-start_application-1 |
||
750 | ; times 60 db 0 |
||
751 | rb 60 |
||
752 | start_application_c=$-start_application-1 |
||
1212 | Lrz | 753 | |
31 | halyavin | 754 | I_END: |
1228 | Lrz | 755 | sc system_colors |
31 | halyavin | 756 | winxpos rd 1 |
757 | winypos rd 1 |
||
1214 | Lrz | 758 | mouse_dd rd 1 |
31 | halyavin | 759 | cpu_percent rd 1 |
1373 | IgorA | 760 | tcolor rd 1 |
31 | halyavin | 761 | list_add rd 1 |
762 | curposy rd 1 |
||
1373 | IgorA | 763 | index rd 1 |
31 | halyavin | 764 | tasklist rd display_processes |
765 | process_info_buffer process_information |
||
1373 | IgorA | 766 | cur_dir_path rb 1024 |
767 | library_path rb 1024 |
||
1212 | Lrz | 768 | |
31 | halyavin | 769 | U_END: |