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