Subversion Repositories Kolibri OS

Rev

Rev 7519 | Rev 8561 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7519 Rev 8533
Line 11... Line 11...
11
        dd START                ; start of code
11
        dd START                ; start of code
12
        dd IM_END               ; size of image
12
        dd IM_END               ; size of image
13
        dd U_END                ; memory for app
13
        dd U_END                ; memory for app
14
        dd stack_area           ; esp
14
        dd stack_area           ; esp
15
        dd 0x0                  ; boot parameters
15
        dd 0x0                  ; boot parameters
16
        dd 0x0                  ; path
16
        dd cur_dir_path         ; path
17
;------------------------------------------------------------------------------
17
;------------------------------------------------------------------------------
18
include 'lang.inc'
18
include 'lang.inc'
19
include '../../../macros.inc'
19
include '../../../macros.inc'
20
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
20
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
-
 
21
include '../../../KOSfuncs.inc'
21
include '../../../develop/libraries/box_lib/load_lib.mac'
22
include '../../../load_lib.mac'
22
;------------------------------------------------------------------------------
23
;------------------------------------------------------------------------------
23
display_processes=24    ;32             ; number of processes to show
24
display_processes=24    ;32             ; number of processes to show
24
window_x_size=524
25
window_x_size=524
25
window_y_size=430
26
window_y_size=430
26
;------------------------------------------------------------------------------
27
;------------------------------------------------------------------------------
27
@use_library    ;use load lib macros
28
@use_library    ;use load lib macros
28
;------------------------------------------------------------------------------
29
;------------------------------------------------------------------------------
29
START:                          ; start of execution
30
START:                          ; start of execution
30
        mcall   68,11
31
        mcall   SF_SYS_MISC,SSF_HEAP_INIT
31
sys_load_library  library_name, cur_dir_path, library_path, system_path, \
32
sys_load_library  library_name, library_path, system_path, myimport
32
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
-
 
33
        inc     eax
33
        inc     eax
34
        jz      close
34
        jz      close
35
;------------------------------------------------------------------------------
35
;------------------------------------------------------------------------------
36
        mcall   40,0x80000027 ;set event
36
        mcall   SF_SET_EVENTS_MASK,0x80000027 ;set event
37
;------------------------------------------------------------------------------
37
;------------------------------------------------------------------------------
38
;set window size and position for 0 function
38
;set window size and position for 0 function
39
;to [winxpos] and [winypos] variables
39
;to [winxpos] and [winypos] variables
40
;get screen size
40
;get screen size
41
        mcall   14
41
        mcall   SF_GET_SCREEN_SIZE
42
        mov     ebx,eax
42
        mov     ebx,eax
43
;calculate (x_screen-window_x_size)/2
43
;calculate (x_screen-window_x_size)/2
44
        shr     ebx,16+1
44
        shr     ebx,16+1
45
        sub     ebx,window_x_size/2
45
        sub     ebx,window_x_size/2
46
        shl     ebx,16
46
        shl     ebx,16
Line 55... Line 55...
55
        mov     ax,window_y_size
55
        mov     ax,window_y_size
56
;winypos=ycoord*65536+ysize
56
;winypos=ycoord*65536+ysize
57
        mov     [winypos],eax
57
        mov     [winypos],eax
58
;------------------------------------------------------------------------------
58
;------------------------------------------------------------------------------
59
        init_checkboxes2 check1,check1_end
59
        init_checkboxes2 check1,check1_end
60
        mcall   48,3,sc,40
60
        mcall   SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,40
61
        edit_boxes_set_sys_color edit1,edit1_end,sc             ;set color
61
        edit_boxes_set_sys_color edit1,edit1_end,sc             ;set color
62
        ;check_boxes_set_sys_color2 check1,check1_end,sc ;set color
62
        ;check_boxes_set_sys_color2 check1,check1_end,sc ;set color
63
;------------------------------------------------------------------------------
63
;------------------------------------------------------------------------------
64
align 4
64
align 4
65
;main loop when process name isn't edited.
65
;main loop when process name isn't edited.
66
red:
66
red:
67
        call    draw_window             ; redraw all window
67
        call    draw_window             ; redraw all window
68
;------------------------------------------------------------------------------
68
;------------------------------------------------------------------------------
69
align 4
69
align 4
70
still:
70
still:
71
        mcall   23,100          ; wait here for event 1 sec.
71
        mcall   SF_WAIT_EVENT_TIMEOUT,100          ; wait here for event 1 sec.
Line 72... Line 72...
72
 
72
 
73
	test	eax,eax
73
	test	eax,eax
Line 74... Line 74...
74
	jz	still_end
74
	jz	still_end
Line 98... Line 98...
98
        push    dword check1
98
        push    dword check1
99
        call    [check_box_draw]
99
        call    [check_box_draw]
100
;--------------------------------------
100
;--------------------------------------
101
align 4
101
align 4
102
show_process_info_1:
102
show_process_info_1:
103
        mcall   26,9
103
        mcall   SF_SYSTEM_GET,SSF_TIME_COUNT
104
        add     eax,100
104
        add     eax,100
105
        mov     [time_counter],eax
105
        mov     [time_counter],eax
Line 106... Line 106...
106
 
106
 
107
        call    show_process_info       ; draw new state of processes
107
        call    show_process_info       ; draw new state of processes
108
        jmp     still
108
        jmp     still
109
;------------------------------------------------------------------------------
109
;------------------------------------------------------------------------------
110
align 4
110
align 4
111
still_end:
111
still_end:
112
        mcall   26,9
112
        mcall   SF_SYSTEM_GET,SSF_TIME_COUNT
113
        cmp     [time_counter],eax
113
        cmp     [time_counter],eax
Line 114... Line 114...
114
        ja      still
114
        ja      still
115
 
115
 
Line 119... Line 119...
119
        call    show_process_info       ; draw new state of processes
119
        call    show_process_info       ; draw new state of processes
120
        jmp     still
120
        jmp     still
121
;------------------------------------------------------------------------------
121
;------------------------------------------------------------------------------
122
align 4
122
align 4
123
key:                            ; key
123
key:                            ; key
124
        mcall   2
124
        mcall   SF_GET_KEY
Line 125... Line 125...
125
 
125
 
126
        cmp     ah,184          ; PageUp
126
        cmp     ah,184          ; PageUp
Line 127... Line 127...
127
        jz      pgdn
127
        jz      pgdn
Line 145... Line 145...
145
        jmp     still
145
        jmp     still
146
;------------------------------------------------------------------------------
146
;------------------------------------------------------------------------------
147
align 4
147
align 4
148
button:
148
button:
149
; get button id
149
; get button id
150
        mcall   17
150
        mcall   SF_GET_BUTTON
151
        mov     bl, al ; save mouse button to bl
151
        mov     bl, al ; save mouse button to bl
152
        shr     eax,8
152
        shr     eax,8
153
;id in [10,50] corresponds to terminate buttons.
153
;id in [10,50] corresponds to terminate buttons.
154
        cmp     eax,10
154
        cmp     eax,10
155
        jb      noterm
155
        jb      noterm
Line 184... Line 184...
184
        stosb
184
        stosb
185
        test   eax, eax
185
        test   eax, eax
186
        jnz    .pop
186
        jnz    .pop
187
; launch tinfo app
187
; launch tinfo app
188
        mov     ebx, tinfo
188
        mov     ebx, tinfo
189
        mov     eax, 70
189
        mov     eax, SF_FILE
190
        int     64
190
        int     64
191
        jmp     show_process_info_1
191
        jmp     show_process_info_1
192
.terminate:
192
.terminate:
193
;terminate application
193
;terminate application
194
        mcall   18,2
194
        mcall   SF_SYSTEM,SSF_TERMINATE_THREAD
195
        jmp     show_process_info_1
195
        jmp     show_process_info_1
196
;--------------------------------------
196
;--------------------------------------
197
align 4
197
align 4
198
noterm:
198
noterm:
199
;special buttons
199
;special buttons
Line 228... Line 228...
228
        mov     [list_start],eax
228
        mov     [list_start],eax
229
        jmp     show_process_info_1
229
        jmp     show_process_info_1
230
;------------------------------------------------------------------------------
230
;------------------------------------------------------------------------------
231
align 4
231
align 4
232
program_start:
232
program_start:
233
        mcall   70,file_start
233
        mcall   SF_FILE,file_start
234
        jmp     show_process_info_1
234
        jmp     show_process_info_1
235
;------------------------------------------------------------------------------
235
;------------------------------------------------------------------------------
236
align 4
236
align 4
237
reboot:
237
reboot:
238
        mcall   70,sys_reboot
238
        mcall   SF_FILE,sys_reboot
239
;close program if we going to reboot
239
;close program if we going to reboot
240
;------------------------------------------------------------------------------
240
;------------------------------------------------------------------------------
241
align 4
241
align 4
242
close:
242
close:
243
        or      eax,-1          ; close this program
243
        or      eax,SF_TERMINATE_PROCESS ; close this program
244
        mcall
244
        mcall
245
;------------------------------------------------------------------------------
245
;------------------------------------------------------------------------------
246
align 4
246
align 4
247
draw_empty_slot:
247
draw_empty_slot:
248
        cmp     [draw_window_flag],1
248
        cmp     [draw_window_flag],1
249
        je      @f
249
        je      @f
250
        mov     ecx,[curposy]
250
        mov     ecx,[curposy]
251
        shl     ecx,16
251
        shl     ecx,16
252
        mov     cx,10   ; button height
252
        mov     cx,10   ; button height
253
        mcall   13,<111,393>,,[bar_bacground_color]
253
        mcall   SF_DRAW_RECT,<111,393>,,[bar_bacground_color]
254
@@:
254
@@:
255
        ret
255
        ret
256
;------------------------------------------------------------------------------
256
;------------------------------------------------------------------------------
257
align 4
257
align 4
258
draw_next_process:
258
draw_next_process:
Line 272... Line 272...
272
        test    dword [index],1
272
        test    dword [index],1
273
        jz      @f
273
        jz      @f
274
        mov     esi,0xaabbcc
274
        mov     esi,0xaabbcc
275
@@:
275
@@:
276
		add     edx,0x80000000 ; delete a button
276
		add     edx,0x80000000 ; delete a button
277
		mcall   8              ; before create
277
		mcall   SF_DEFINE_BUTTON ; before create
278
		sub     edx,0x80000000 ; a new one below
278
		sub     edx,0x80000000 ; a new one below
279
        mcall   8,<10,99>
279
        mcall   SF_DEFINE_BUTTON,<10,99>
280
        mov     [btn_bacground_color],esi
280
        mov     [btn_bacground_color],esi
281
;draw background for proccess information
281
;draw background for proccess information
282
        mov     edx,0xddffdd
282
        mov     edx,0xddffdd
283
        test    dword [index],1
283
        test    dword [index],1
284
        jz      @f
284
        jz      @f
285
        mov     edx,0xffffff
285
        mov     edx,0xffffff
286
@@:
286
@@:
287
        inc     cx
287
        inc     cx
288
        cmp     [draw_window_flag],0
288
        cmp     [draw_window_flag],0
289
        je      @f
289
        je      @f
290
        mcall   13,<110,395>
290
        mcall   SF_DRAW_RECT,<110,395>
291
@@:
291
@@:
292
        mov     [bar_bacground_color],edx
292
        mov     [bar_bacground_color],edx
293
;nothing else should be done if there is no process for this button
293
;nothing else should be done if there is no process for this button
294
        cmp     edi,-1
294
        cmp     edi,-1
295
        jne     .return_1
295
        jne     .return_1
Line 310... Line 310...
310
align 4
310
align 4
311
.find_loop:
311
.find_loop:
312
        cmp     ecx,256
312
        cmp     ecx,256
313
        jge     .no_processes
313
        jge     .no_processes
314
;load process information in buffer
314
;load process information in buffer
315
        mcall   9
315
        mcall   SF_THREAD_INFO
316
;if current slot greater than maximal slot,
316
;if current slot greater than maximal slot,
317
;there is no more proccesses.
317
;there is no more proccesses.
318
        cmp     ecx,eax
318
        cmp     ecx,eax
319
        jg      .no_processes
319
        jg      .no_processes
320
;if slot state is equal to 9, it is empty.
320
;if slot state is equal to 9, it is empty.
Line 361... Line 361...
361
.no_filter:
361
.no_filter:
362
        mov     edi,ecx
362
        mov     edi,ecx
363
        mov     [list_add],ecx
363
        mov     [list_add],ecx
364
;get processor cpeed
364
;get processor cpeed
365
;for percent calculating
365
;for percent calculating
366
        mcall   18,5
366
        mcall   SF_SYSTEM,SSF_GET_CPU_FREQUENCY
367
        xor     edx,edx
367
        xor     edx,edx
368
        mov     ebx,100
368
        mov     ebx,100
369
        div     ebx
369
        div     ebx
370
;eax = number of operation for 1% now
370
;eax = number of operation for 1% now
371
;calculate process cpu usage percent
371
;calculate process cpu usage percent
Line 402... Line 402...
402
;show slot number
402
;show slot number
403
;ecx haven't changed since .process_found
403
;ecx haven't changed since .process_found
404
        push    edi
404
        push    edi
405
        mov     edx,[curposy]
405
        mov     edx,[curposy]
406
        add     edx,15*65536+3
406
        add     edx,15*65536+3
407
        mcall   47,<2,256>
407
        mcall   SF_DRAW_NUMBER,<2,256>
408
;show process name
408
;show process name
409
        mov     ebx,[curposy]
409
        mov     ebx,[curposy]
410
        add     ebx,40*65536+3
410
        add     ebx,40*65536+3
411
        mov     ecx,esi
411
        mov     ecx,esi
412
        mcall   4,,,process_info_buffer.process_name,11
412
        mcall   SF_DRAW_TEXT,,,process_info_buffer.process_name,11
413
;show pid
413
;show pid
414
        mov     edx,[curposy]
414
        mov     edx,[curposy]
415
        add     edx,125*65536+3
415
        add     edx,125*65536+3
416
        mov     esi,ecx
416
        mov     esi,ecx
417
        or      esi,0x40000000
417
        or      esi,0x40000000
418
        mcall   47,<8,256>,[process_info_buffer.PID],,,[bar_bacground_color]
418
        mcall   SF_DRAW_NUMBER,<8,256>,[process_info_buffer.PID],,,[bar_bacground_color]
419
;show cpu usage
419
;show cpu usage
420
        add     edx,60*65536
420
        add     edx,60*65536
421
        mcall   ,,[process_info_buffer.cpu_usage]
421
        mcall   ,,[process_info_buffer.cpu_usage]
422
;show cpu percent
422
;show cpu percent
423
        add     edx,60*65536
423
        add     edx,60*65536
Line 458... Line 458...
458
;   *********************************************
458
;   *********************************************
459
;   *******  WINDOW DEFINITIONS AND DRAW ********
459
;   *******  WINDOW DEFINITIONS AND DRAW ********
460
;   *********************************************
460
;   *********************************************
461
align 4
461
align 4
462
draw_window:
462
draw_window:
463
        mcall   12, 1
463
        mcall   SF_REDRAW, SSF_BEGIN_DRAW
464
; DRAW WINDOW
464
; DRAW WINDOW
465
        xor     eax,eax                         ; function 0 : define and draw window
465
        xor     eax,eax                         ; function 0 : define and draw window
466
        xor     esi,esi
466
        xor     esi,esi
467
        mcall   ,[winxpos],[winypos],0x74ffffff,,title  ;0x34ddffdd
467
        mcall   ,[winxpos],[winypos],0x74ffffff,,title  ;0x34ddffdd
Line 468... Line 468...
468
 
468
 
Line 469... Line 469...
469
        mcall   9,process_info_buffer,-1
469
        mcall   SF_THREAD_INFO,process_info_buffer,-1
470
 
470
 
471
        mov     eax,[ebx+70]
471
        mov     eax,[ebx+70]
472
        mov     [window_status],eax
472
        mov     [window_status],eax
Line 482... Line 482...
482
        mov     eax,[ebx+66]
482
        mov     eax,[ebx+66]
483
        inc     eax
483
        inc     eax
484
        mov     [client_area_y_size],eax
484
        mov     [client_area_y_size],eax
Line 485... Line 485...
485
 
485
 
486
        mov     ebx,[client_area_x_size]
486
        mov     ebx,[client_area_x_size]
487
        mcall   13,,<0,20>,0xffffff
487
        mcall   SF_DRAW_RECT,,<0,20>,0xffffff
488
; function 4 : write text to window
488
; function 4 : write text to window
489
        xor     ecx,ecx
489
        xor     ecx,ecx
Line 490... Line 490...
490
        mcall   4,<17,8>,,text,text_len
490
        mcall   SF_DRAW_TEXT,<17,8>,,text,text_len
Line 491... Line 491...
491
 
491
 
492
        mcall   13,<0,10>,<20,336>,0xffffff
492
        mcall   SF_DRAW_RECT,<0,10>,<20,336>,0xffffff
493
 
493
 
494
        mov     ebx,[client_area_x_size]
494
        mov     ebx,[client_area_x_size]
Line 495... Line 495...
495
        sub     ebx,10+100+395
495
        sub     ebx,10+100+395
496
        add     ebx,(10+100+395) shl 16
496
        add     ebx,(10+100+395) shl 16
497
        mcall
497
        mcall
Line 498... Line 498...
498
 
498
 
499
        mcall   26,9
499
        mcall   SF_SYSTEM_GET,SSF_TIME_COUNT
Line 506... Line 506...
506
 
506
 
507
        mov     ebx,[client_area_x_size]
507
        mov     ebx,[client_area_x_size]
508
        mov     ecx,[client_area_y_size]
508
        mov     ecx,[client_area_y_size]
509
        sub     ecx,20+336
509
        sub     ecx,20+336
510
        add     ecx,(20+336) shl 16
510
        add     ecx,(20+336) shl 16
Line 511... Line 511...
511
        mcall   13,,,0xffffff
511
        mcall   SF_DRAW_RECT,,,0xffffff
512
 
512
 
Line 513... Line 513...
513
        push    dword edit1
513
        push    dword edit1
514
        call    [edit_box_draw]
514
        call    [edit_box_draw]
Line 515... Line 515...
515
 
515
 
516
        push    dword check1
516
        push    dword check1
517
        call    [check_box_draw]
517
        call    [check_box_draw]
518
 
518
 
519
; previous page button
519
; previous page button
520
        mcall   8,<25,96>,<361,14>,51,0xccddee  ;0xaabbcc
520
        mcall   SF_DEFINE_BUTTON,<25,96>,<361,14>,51,0xccddee  ;0xaabbcc
521
; next page button  52
521
; next page button  52
Line 532... Line 532...
532
        sub     ecx,20 shl 16
532
        sub     ecx,20 shl 16
533
        inc     edx
533
        inc     edx
534
        mcall
534
        mcall
535
;"PREV PAGE", "NEXT PAGE" and "REBOOT" labels
535
;"PREV PAGE", "NEXT PAGE" and "REBOOT" labels
536
        xor     ecx,ecx
536
        xor     ecx,ecx
537
        mcall   4,<45,365>,,tbts,tbte-tbts
537
        mcall   SF_DRAW_TEXT,<45,365>,,tbts,tbte-tbts
538
;"RUN" labels
538
;"RUN" labels
539
        mcall   ,<464,385>,,tbts_3,tbte_2-tbts_3
539
        mcall   ,<464,385>,,tbts_3,tbte_2-tbts_3
540
;print application name in text box
540
;print application name in text box
541
;--------------------------------------
541
;--------------------------------------
542
align 4
542
align 4
543
.exit:
543
.exit:
544
        mcall   12, 2
544
        mcall   SF_REDRAW, SSF_END_DRAW
545
        ret
545
        ret
546
;------------------------------------------------------------------------------
546
;------------------------------------------------------------------------------
547
align 4
547
align 4
548
show_process_info:
548
show_process_info:
549
        test    [window_status],100b            ; window is rolled up
549
        test    [window_status],100b            ; window is rolled up
Line 577... Line 577...
577
;------------------------------------------------------------------------------
577
;------------------------------------------------------------------------------
578
; DATA AREA
578
; DATA AREA
579
;------------------------------------------------------------------------------
579
;------------------------------------------------------------------------------
580
system_path      db '/sys/lib/'
580
system_path      db '/sys/lib/'
581
library_name     db 'box_lib.obj',0
581
library_name     db 'box_lib.obj',0
582
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
Line 583... Line -...
583
 
-
 
584
err_message_found_lib   db 'Sorry I cannot load library box_lib.obj',0
-
 
585
head_f_i:
-
 
586
head_f_l        db 'System error',0
-
 
587
err_message_import      db 'Error on load import library box_lib.obj',0
582
 
588
;------------------------------------------------------------------------------
583
;------------------------------------------------------------------------------
589
align 4
584
align 4
590
myimport:
585
myimport:
591
edit_box_draw           dd aEdit_box_draw
586
edit_box_draw           dd aEdit_box_draw
Line 627... Line 622...
627
edit1_end:
622
edit1_end:
628
list_start  dd 0
623
list_start  dd 0
629
;------------------------------------------------------------------------------
624
;------------------------------------------------------------------------------
630
align 4
625
align 4
631
sys_reboot:
626
sys_reboot:
632
            dd 7
627
            dd SSF_START_APP
633
            dd 0
628
            dd 0
634
            dd 0
629
            dd 0
635
            dd 0
630
            dd 0
636
            dd 0
631
            dd 0
637
            db '/sys/end',0
632
            db '/sys/end',0
Line 703... Line 698...
703
 
698
 
704
end if
699
end if
705
; ---------------------------------------------------------------------------- ;
700
; ---------------------------------------------------------------------------- ;
706
align 4
701
align 4
707
tinfo:
702
tinfo:
708
                    dd 7
703
                    dd SSF_START_APP
709
                    dd 0
704
                    dd 0
710
.params             dd .params_buf
705
.params             dd .params_buf
711
                    dd 0
706
                    dd 0
712
                    dd 0
707
                    dd 0
Line 718... Line 713...
718
align 4
713
align 4
719
sz_tinfo_file_path  db "/sys/tinfo",0
714
sz_tinfo_file_path  db "/sys/tinfo",0
720
; ---------------------------------------------------------------------------- ;
715
; ---------------------------------------------------------------------------- ;
721
align 4
716
align 4
722
file_start:
717
file_start:
723
        dd 7
718
        dd SSF_START_APP
724
        dd 0
719
        dd 0
725
        dd 0
720
        dd 0
726
        dd 0
721
        dd 0
727
        dd 0
722
        dd 0
728
start_application: db '/sys/LAUNCHER',0
723
start_application: db '/sys/LAUNCHER',0