Rev 1209 | Rev 1214 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1209 | Rev 1212 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | include '../../../macros.inc' |
24 | include '../../../macros.inc' |
25 | include '../../../develop/libraries/box_lib/asm/trunk/editbox_ex.mac' |
25 | include '../../../develop/libraries/box_lib/asm/trunk/editbox_ex.mac' |
26 | include '../../../develop/libraries/box_lib/load_lib.mac' |
26 | include '../../../develop/libraries/box_lib/load_lib.mac' |
27 | display_processes=32 ; number of processes to show |
27 | display_processes=32 ; number of processes to show |
28 | @use_library ;use load lib macros |
28 | @use_library ;use load lib macros |
29 | align 4 |
- | |
30 | START: ; start of execution |
29 | START: ; start of execution |
Line 31... | Line 30... | ||
31 | 30 | ||
32 | sys_load_library library_name, cur_dir_path, library_path, system_path, \ |
31 | sys_load_library library_name, cur_dir_path, library_path, system_path, \ |
33 | err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
32 | err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i |
Line 36... | Line 35... | ||
36 | ; calculate window position |
35 | ; calculate window position |
37 | ; at the center of the screen |
36 | ; at the center of the screen |
38 | call calculate_window_pos |
37 | call calculate_window_pos |
Line 39... | Line 38... | ||
39 | 38 | ||
40 | ;main loop when process name isn't edited. |
- | |
41 | align 4 |
39 | ;main loop when process name isn't edited. |
42 | red: |
40 | red: |
43 | xor ebp,ebp |
41 | xor ebp,ebp |
44 | inc ebp |
42 | inc ebp |
45 | ; mov ebp,1 |
43 | ; mov ebp,1 |
46 | call draw_window ; redraw all window |
44 | call draw_window ; redraw all window |
47 | align 4 |
45 | align 16 |
48 | still: |
46 | still: |
49 | mov eax,23 ; wait here for event |
47 | mov eax,23 ; wait here for event |
50 | mov ebx,100 ; 2 sec. |
48 | mov ebx,100 ; 2 sec. |
Line 58... | Line 56... | ||
58 | jz button |
56 | jz button |
Line 59... | Line 57... | ||
59 | 57 | ||
60 | push dword edit1 |
58 | push dword edit1 |
Line 61... | Line 59... | ||
61 | call [edit_box_mouse] |
59 | call [edit_box_mouse] |
62 | 60 | ||
63 | align 4 |
61 | |
64 | still_end: |
62 | still_end: |
65 | xor ebp,ebp ; draw new state of processes |
63 | xor ebp,ebp ; draw new state of processes |
Line 66... | Line 64... | ||
66 | call draw_window |
64 | call draw_window |
67 | jmp still |
65 | jmp still |
68 | 66 | ||
69 | align 4 |
67 | |
Line 70... | Line 68... | ||
70 | key: ; key |
68 | key: ; key |
Line 80... | Line 78... | ||
80 | 78 | ||
81 | push dword edit1 |
79 | push dword edit1 |
Line 82... | Line 80... | ||
82 | call [edit_box_key] |
80 | call [edit_box_key] |
83 | 81 | ||
84 | jmp still_end |
82 | jmp still_end |
85 | align 4 |
83 | |
86 | button: |
84 | button: |
87 | ; get button id |
85 | ; get button id |
88 | mov eax,17 |
86 | mov eax,17 |
Line 107... | Line 105... | ||
107 | ;terminate application |
105 | ;terminate application |
108 | mov eax,18 |
106 | mov eax,18 |
109 | mov ebx,2 |
107 | mov ebx,2 |
110 | mcall |
108 | mcall |
111 | jmp still_end |
109 | jmp still_end |
112 | align 4 |
110 | |
113 | noterm: |
111 | noterm: |
Line 114... | Line 112... | ||
114 | 112 | ||
115 | ;special buttons |
113 | ;special buttons |
116 | dec eax |
114 | dec eax |
Line 127... | Line 125... | ||
127 | dec eax |
125 | dec eax |
128 | jz reboot ;54 |
126 | jz reboot ;54 |
129 | jmp still_end |
127 | jmp still_end |
Line 130... | Line 128... | ||
130 | 128 | ||
131 | ;buttons handlers |
129 | ;buttons handlers |
132 | align 4 |
130 | |
133 | pgdn: |
131 | pgdn: |
134 | sub [list_start],display_processes |
132 | sub [list_start],display_processes |
135 | ; cmp [list_start],0 |
133 | ; cmp [list_start],0 |
136 | jge still_end |
134 | jge still_end |
137 | mov [list_start],0 |
135 | mov [list_start],0 |
138 | jmp still_end |
136 | jmp still_end |
139 | align 4 |
137 | |
140 | pgup: |
138 | pgup: |
141 | mov eax,[list_add] ;maximal displayed process slot |
139 | mov eax,[list_add] ;maximal displayed process slot |
142 | mov [list_start],eax |
140 | mov [list_start],eax |
143 | jmp still_end |
141 | jmp still_end |
144 | align 4 |
142 | |
145 | program_start: |
143 | program_start: |
146 | mov eax,70 |
144 | mov eax,70 |
147 | mov ebx,file_start |
145 | mov ebx,file_start |
148 | mcall |
146 | mcall |
149 | jmp still_end |
147 | jmp still_end |
150 | align 4 |
148 | |
151 | reboot: |
149 | reboot: |
152 | mov eax,70 |
150 | mov eax,70 |
153 | mov ebx,sys_reboot |
151 | mov ebx,sys_reboot |
154 | mcall |
152 | mcall |
155 | ;close program if we going to reboot |
153 | ;close program if we going to reboot |
156 | align 4 |
154 | |
157 | close: |
155 | close: |
158 | or eax,-1 ; close this program |
156 | or eax,-1 ; close this program |
159 | mcall |
157 | mcall |
160 | align 4 |
158 | |
161 | draw_next_process: |
159 | draw_next_process: |
162 | ;input: |
160 | ;input: |
163 | ; edi - current slot |
161 | ; edi - current slot |
164 | ; [curposy] - y position |
162 | ; [curposy] - y position |
Line 172... | Line 170... | ||
172 | ;delete old button |
170 | ;delete old button |
173 | mov eax,8 |
171 | mov eax,8 |
174 | mov edx,[index] |
172 | mov edx,[index] |
175 | add edx,(1 shl 31)+11 |
173 | add edx,(1 shl 31)+11 |
176 | mcall |
174 | mcall |
177 | align 4 |
175 | |
178 | .nodelete: |
176 | .nodelete: |
179 | ;create terminate process button |
177 | ;create terminate process button |
180 | mov eax,8 |
178 | mov eax,8 |
181 | mov ebx,(15-offset_x)*65536+100-offset_y |
179 | mov ebx,(15-offset_x)*65536+100-offset_y |
182 | mov ecx,[curposy] |
180 | mov ecx,[curposy] |
Line 187... | Line 185... | ||
187 | mov esi,0xaabbcc |
185 | mov esi,0xaabbcc |
188 | ;contrast |
186 | ;contrast |
189 | test dword [index],1 |
187 | test dword [index],1 |
190 | jz .change_color_button |
188 | jz .change_color_button |
191 | mov esi,0x8899aa |
189 | mov esi,0x8899aa |
192 | align 4 |
190 | |
193 | .change_color_button: |
191 | .change_color_button: |
194 | mcall |
192 | mcall |
Line 195... | Line 193... | ||
195 | 193 | ||
196 | ;draw background for proccess information |
194 | ;draw background for proccess information |
Line 200... | Line 198... | ||
200 | mov edx,0x88ff88 |
198 | mov edx,0x88ff88 |
201 | ;contrast |
199 | ;contrast |
202 | test dword [index],1 |
200 | test dword [index],1 |
203 | jz .change_color_info |
201 | jz .change_color_info |
204 | mov edx,0xddffdd |
202 | mov edx,0xddffdd |
205 | align 4 |
203 | |
206 | .change_color_info: |
204 | .change_color_info: |
207 | mcall |
205 | mcall |
Line 208... | Line 206... | ||
208 | 206 | ||
209 | ;nothing else should be done |
207 | ;nothing else should be done |
Line 217... | Line 215... | ||
217 | mov ecx,edi |
215 | mov ecx,edi |
218 | ;precacluate pointer to process buffer |
216 | ;precacluate pointer to process buffer |
219 | mov ebx,process_info_buffer |
217 | mov ebx,process_info_buffer |
Line 220... | Line 218... | ||
220 | 218 | ||
221 | ;find process loop |
219 | ;find process loop |
222 | align 4 |
220 | |
223 | .find_loop: |
221 | .find_loop: |
224 | cmp ecx,256 |
222 | cmp ecx,256 |
Line 225... | Line 223... | ||
225 | jge .no_processes |
223 | jge .no_processes |
Line 238... | Line 236... | ||
238 | cmp [process_info_buffer+process_information.slot_state],9 |
236 | cmp [process_info_buffer+process_information.slot_state],9 |
239 | jnz .process_found |
237 | jnz .process_found |
Line 240... | Line 238... | ||
240 | 238 | ||
241 | inc ecx |
239 | inc ecx |
242 | jmp .find_loop |
240 | jmp .find_loop |
243 | align 4 |
241 | |
244 | .no_processes: |
242 | .no_processes: |
245 | or edi,-1 |
243 | or edi,-1 |
246 | ret |
244 | ret |
247 | align 4 |
245 | |
248 | .process_found: |
246 | .process_found: |
249 | mov edi,ecx |
247 | mov edi,ecx |
Line 250... | Line 248... | ||
250 | mov [list_add],ecx |
248 | mov [list_add],ecx |
Line 276... | Line 274... | ||
276 | ;81-100% : red |
274 | ;81-100% : red |
277 | test eax,eax |
275 | test eax,eax |
278 | jg .no_black |
276 | jg .no_black |
279 | mov [tcolor],eax |
277 | mov [tcolor],eax |
280 | jmp .color_set |
278 | jmp .color_set |
281 | align 4 |
279 | |
282 | .no_black: |
280 | .no_black: |
283 | cmp eax,80 |
281 | cmp eax,80 |
284 | ja .no_green |
282 | ja .no_green |
285 | mov dword [tcolor],0x107a30 |
283 | mov dword [tcolor],0x107a30 |
286 | jmp .color_set |
284 | jmp .color_set |
287 | align 4 |
285 | |
288 | .no_green: |
286 | .no_green: |
289 | mov dword [tcolor],0xac0000 |
287 | mov dword [tcolor],0xac0000 |
290 | .color_set: |
288 | .color_set: |
Line 291... | Line 289... | ||
291 | 289 | ||
Line 349... | Line 347... | ||
349 | mov ecx,[process_info_buffer.box.left] |
347 | mov ecx,[process_info_buffer.box.left] |
350 | shl ecx,16 |
348 | shl ecx,16 |
351 | add ecx,[process_info_buffer.box.top] |
349 | add ecx,[process_info_buffer.box.top] |
352 | add edx,60*65536 |
350 | add edx,60*65536 |
353 | mcall |
351 | mcall |
354 | align 4 |
352 | |
355 | .ret: |
353 | .ret: |
356 | ;build index->slot map for terminating processes. |
354 | ;build index->slot map for terminating processes. |
357 | mov eax,[index] |
355 | mov eax,[index] |
358 | mov [tasklist+4*eax],edi |
356 | mov [tasklist+4*eax],edi |
359 | ret |
357 | ret |
360 | align 4 |
358 | |
361 | ;read_string: |
359 | ;read_string: |
362 | ;clean string |
360 | ;clean string |
363 | ; mov edi,start_application |
361 | ; mov edi,start_application |
364 | ; xor eax,eax |
362 | ; xor eax,eax |
365 | ; mov ecx,60 |
363 | ; mov ecx,60 |
Line 370... | Line 368... | ||
370 | ; mov edi,start_application |
368 | ; mov edi,start_application |
371 | ;edi now contains pointer to last symbol |
369 | ;edi now contains pointer to last symbol |
372 | ; jmp still1 |
370 | ; jmp still1 |
Line 373... | Line 371... | ||
373 | 371 | ||
374 | ;read string main loop |
372 | ;read string main loop |
375 | align 4 |
373 | |
376 | f11: |
374 | f11: |
377 | ;full update |
375 | ;full update |
378 | push edi |
376 | push edi |
379 | xor ebp,ebp |
377 | xor ebp,ebp |
380 | inc ebp |
378 | inc ebp |
381 | ; mov ebp,1 |
379 | ; mov ebp,1 |
382 | call draw_window |
380 | call draw_window |
383 | pop edi |
381 | pop edi |
384 | ;align 4 |
382 | ; |
385 | ; still1: |
383 | ; still1: |
386 | ;wait for message |
384 | ;wait for message |
387 | ; mov eax,23 |
385 | ; mov eax,23 |
388 | ; mov ebx,100 |
386 | ; mov ebx,100 |
Line 395... | Line 393... | ||
395 | ; push edi ;edi should be saved since draw_window |
393 | ; push edi ;edi should be saved since draw_window |
396 | ; xor ebp,ebp ;corrupt registers |
394 | ; xor ebp,ebp ;corrupt registers |
397 | ; call draw_window |
395 | ; call draw_window |
398 | ; pop edi |
396 | ; pop edi |
399 | ; jmp still1 |
397 | ; jmp still1 |
400 | ;align 4 |
398 | ; |
401 | ;.message_received: |
399 | ;.message_received: |
402 | ; cmp eax,2 |
400 | ; cmp eax,2 |
403 | ; jne read_done ;buttons message |
401 | ; jne read_done ;buttons message |
404 | ;read char |
402 | ;read char |
405 | ; mov eax,2 |
403 | ; mov eax,2 |
Line 419... | Line 417... | ||
419 | ;fill last symbol with space because |
417 | ;fill last symbol with space because |
420 | ;print_text show all symbols |
418 | ;print_text show all symbols |
421 | ; mov [edi],byte 32 |
419 | ; mov [edi],byte 32 |
422 | ; call print_text |
420 | ; call print_text |
423 | ; jmp still1 |
421 | ; jmp still1 |
424 | ;align 4 |
422 | ; |
425 | ; nobsl: |
423 | ; nobsl: |
426 | ;write new symbol |
424 | ;write new symbol |
427 | ; mov [edi],al |
425 | ; mov [edi],al |
428 | ;display new text |
426 | ;display new text |
429 | ; call print_text |
427 | ; call print_text |
Line 434... | Line 432... | ||
434 | ; add esi,60 |
432 | ; add esi,60 |
435 | ; cmp esi,edi |
433 | ; cmp esi,edi |
436 | ; jnz still1 |
434 | ; jnz still1 |
Line 437... | Line 435... | ||
437 | 435 | ||
438 | ;exiting from read string loop |
436 | ;exiting from read string loop |
439 | ;align 4 |
437 | ; |
440 | ; read_done: |
438 | ; read_done: |
441 | ;terminate string for file functions |
439 | ;terminate string for file functions |
Line 442... | Line 440... | ||
442 | ; mov [edi],byte 0 |
440 | ; mov [edi],byte 0 |
443 | 441 | ||
Line 444... | Line 442... | ||
444 | ; call print_text |
442 | ; call print_text |
445 | ; jmp still |
443 | ; jmp still |
446 | 444 | ||
Line 447... | Line 445... | ||
447 | ;align 4 |
445 | ; |
Line 468... | Line 466... | ||
468 | ; popad |
466 | ; popad |
469 | ; ret |
467 | ; ret |
Line 470... | Line 468... | ||
470 | 468 | ||
471 | window_x_size=524 |
469 | window_x_size=524 |
472 | window_y_size=430 |
470 | window_y_size=430 |
473 | align 4 |
471 | |
474 | calculate_window_pos: |
472 | calculate_window_pos: |
475 | ;set window size and position for 0 function |
473 | ;set window size and position for 0 function |
Line 476... | Line 474... | ||
476 | ;to [winxpos] and [winypos] variables |
474 | ;to [winxpos] and [winypos] variables |
Line 501... | Line 499... | ||
501 | 499 | ||
502 | ; ********************************************* |
500 | ; ********************************************* |
503 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
501 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
Line 504... | Line 502... | ||
504 | ; ********************************************* |
502 | ; ********************************************* |
505 | 503 | ||
506 | align 4 |
504 | align 16 |
507 | draw_window: |
505 | draw_window: |
Line 508... | Line 506... | ||
508 | ;ebp=1 - redraw all |
506 | ;ebp=1 - redraw all |
Line 534... | Line 532... | ||
534 | mcall |
532 | mcall |
Line 535... | Line 533... | ||
535 | 533 | ||
536 | push dword edit1 |
534 | push dword edit1 |
Line 537... | Line 535... | ||
537 | call [edit_box_draw] |
535 | call [edit_box_draw] |
538 | 536 | ||
539 | align 4 |
537 | align 16 |
540 | .show_process_info: |
538 | .show_process_info: |
541 | mov edi,[list_start] |
539 | mov edi,[list_start] |
542 | mov [list_add],edi |
540 | mov [list_add],edi |
543 | mov dword [index],0 |
541 | mov dword [index],0 |
544 | mov dword [curposy],54-offset_y |
542 | mov dword [curposy],54-offset_y |
545 | align 4 |
543 | |
546 | .loop_draw: |
544 | .loop_draw: |
547 | call draw_next_process |
545 | call draw_next_process |
548 | inc dword [index] |
546 | inc dword [index] |
Line 612... | Line 610... | ||
612 | ; call print_text |
610 | ; call print_text |
Line 613... | Line 611... | ||
613 | 611 | ||
614 | mov eax,12 ; function 12:tell os about windowdraw |
612 | mov eax,12 ; function 12:tell os about windowdraw |
615 | mov ebx,2 ; 2, end of draw |
613 | mov ebx,2 ; 2, end of draw |
616 | mcall |
614 | mcall |
617 | align 4 |
615 | |
618 | .end_redraw: |
616 | .end_redraw: |
Line 619... | Line 617... | ||
619 | ret |
617 | ret |
Line 720... | Line 718... | ||
720 | start_application: db '/sys/LAUNCHER',0 |
718 | start_application: db '/sys/LAUNCHER',0 |
721 | start_application_e=$-start_application-1 |
719 | start_application_e=$-start_application-1 |
722 | ; times 60 db 0 |
720 | ; times 60 db 0 |
723 | rb 60 |
721 | rb 60 |
724 | start_application_c=$-start_application-1 |
722 | start_application_c=$-start_application-1 |
725 | align 4 |
723 | |
726 | I_END: |
724 | I_END: |
727 | winxpos rd 1 |
725 | winxpos rd 1 |
728 | winypos rd 1 |
726 | winypos rd 1 |
Line 729... | Line 727... | ||
729 | 727 | ||
Line 734... | Line 732... | ||
734 | index rd 1 |
732 | index rd 1 |
735 | tasklist rd display_processes |
733 | tasklist rd display_processes |
736 | process_info_buffer process_information |
734 | process_info_buffer process_information |
737 | cur_dir_path rb 1024 |
735 | cur_dir_path rb 1024 |
738 | library_path rb 1024 |
736 | library_path rb 1024 |
739 | align 4 |
737 | |
740 | U_END: |
738 | U_END: |