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