Subversion Repositories Kolibri OS

Rev

Rev 1385 | Rev 2559 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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