Subversion Repositories Kolibri OS

Rev

Rev 4840 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4840 Rev 4857
Line 40... Line 40...
40
include	'lang.inc'
40
include	'lang.inc'
41
include	'../../macros.inc'
41
include	'../../macros.inc'
42
define __DEBUG__ 1
42
define __DEBUG__ 1
43
define __DEBUG_LEVEL__ 1
43
define __DEBUG_LEVEL__ 1
44
include	'../../debug-fdo.inc'
44
include	'../../debug-fdo.inc'
-
 
45
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
45
include '../../develop/libraries/box_lib/load_lib.mac'
46
include '../../develop/libraries/box_lib/load_lib.mac'
46
	@use_library
47
	@use_library
47
;-----------------------------------------------------------------------------
48
;-----------------------------------------------------------------------------
-
 
49
struct  RESULT_SLOT
-
 
50
        text            dd ?
-
 
51
        read_speed      dd ?
-
 
52
        write_speed     dd ?
-
 
53
        chunk_size      dd ?
-
 
54
ends
-
 
55
;-----------------------------------------------------------------------------
48
START:
56
START:
49
        DEBUGF 1,'FSPEED: start of programm\n'
57
        DEBUGF 1,'FSPEED: start of programm\n'
50
;-----------------------------------------------------------------------------	
58
;-----------------------------------------------------------------------------	
51
	mcall	68,11
59
	mcall	68,11
52
	test	eax,eax
60
	test	eax,eax
Line 59... Line 67...
59
	jz	exit
67
	jz	exit
60
;-----------------------------------------------------------------------------
68
;-----------------------------------------------------------------------------
61
;OpenDialog	initialisation
69
;OpenDialog	initialisation
62
	push	dword OpenDialog_data
70
	push	dword OpenDialog_data
63
	call	[OpenDialog_Init]
71
	call	[OpenDialog_Init]
-
 
72
 
-
 
73
	push	check1
-
 
74
	call	[init_checkbox]
-
 
75
 
-
 
76
	mcall	40,0x27
64
;-----------------------------------------------------------------------------
77
;-----------------------------------------------------------------------------
65
red:
78
red:
66
	call	draw_window
79
	call	draw_window
67
;-----------------------------------------------------------------------------
80
;-----------------------------------------------------------------------------
68
still:
81
still:
Line 74... Line 87...
74
	je	key
87
	je	key
Line 75... Line 88...
75
 
88
 
76
	cmp	eax,3
89
	cmp	eax,3
Line -... Line 90...
-
 
90
	je	button
-
 
91
 
-
 
92
	push	dword check1
77
	je	button
93
	call	[check_box_mouse]
78
 
94
 
79
	jmp	still
95
	jmp	still
80
;-----------------------------------------------------------------------------
96
;-----------------------------------------------------------------------------
81
key:
97
key:
Line 124... Line 140...
124
	mcall	12,1
140
	mcall	12,1
125
	xor	esi,esi
141
	xor	esi,esi
126
	xor	ebp,ebp
142
	xor	ebp,ebp
127
	mov	edx,[w_work]	; color of work area RRGGBB,8->color
143
	mov	edx,[w_work]	; color of work area RRGGBB,8->color
128
	or	edx,0x34000000
144
	or	edx,0x34000000
129
	mcall	0,<100,400>,<100,270>,,,title
145
	mcall	0,<100,400>,<100,300>,,,title
-
 
146
 
130
	call	draw_PathShow
147
	call	draw_PathShow
-
 
148
	mov	eax,[w_work_text]
-
 
149
	or	eax,0x80000000
-
 
150
	mov	[check1.text_color],eax
-
 
151
	push	dword check1
-
 
152
	call	[check_box_draw]
-
 
153
	
131
	mcall	8,<5,80>,<25,15>,2,[w_work_button]
154
	mcall	8,<5,80>,<25,15>,2,[w_work_button]
-
 
155
	mcall	,<400-65,50>,,3
-
 
156
	mov	ecx,[w_work_button_text]
-
 
157
	or	ecx,0x80000000
132
	mcall	4,<5+10,25+4>,[w_work_button_text],s_text,s_text.size
158
	mcall	4,<5+10,25+4>,,s_text
133
	mcall	8,<400-65,50>,<25,15>,3,[w_work_button]
159
	mcall	,<400-65+10,25+4>,,r_text
-
 
160
	mov	ecx,[w_work_text]
-
 
161
	or	ecx,0x80000000
134
	mcall	4,<400-65+10,25+4>,[w_work_button_text],r_text,r_text.size
162
	mcall	,<10,47>,,check_box_warning_text
-
 
163
	mcall	,<10,65>,,result_table_text
Line -... Line 164...
-
 
164
	
-
 
165
	mov	edx,ecx
-
 
166
	and	edx,0xffffff
-
 
167
	mcall	38,<5,400-15>,<59,59>
135
	
168
; draw result table	
136
	mov	ebx,5 shl 16+47
169
	mov	ebx,10 shl 16+77
137
	mov	ebp,result_table
170
	mov	ebp,result_table
138
	mov	ecx,18
171
	mov	ecx,18
139
;--------------------------------------
172
;--------------------------------------
140
@@:
173
@@:
141
	push	ecx
174
	push	ecx
142
	mov	ecx,[w_work_text]
175
	mov	ecx,[w_work_text]
143
	or	ecx,0x80000000	
176
	or	ecx,0x80000000	
144
	mcall	4,,,[ebp]
177
	mcall	4,,,[ebp+RESULT_SLOT.text]
145
	push	ebx
178
	push	ebx
146
	mov	edx,ebx
179
	mov	edx,ebx
147
	add	edx,50 shl 16
180
	add	edx,(11*6) shl 16
148
	mov	ebx,0x800a0000
181
	mov	ebx,0x800a0000
-
 
182
	mcall	47,,[ebp+RESULT_SLOT.read_speed],,[w_work_text]
-
 
183
	add	edx,(16*6) shl 16
149
	mcall	47,,[ebp+4],,[w_work_text]
184
	mcall	,,[ebp+RESULT_SLOT.write_speed]
150
	pop	ebx
185
	pop	ebx
151
	add	ebx,6+5
186
	add	ebx,6+5
152
	add	ebp,12
187
	add	ebp,sizeof.RESULT_SLOT
153
	pop	ecx
188
	pop	ecx
154
	dec	ecx
189
	dec	ecx
Line 155... Line 190...
155
	jnz	@b
190
	jnz	@b
Line 171... Line 206...
171
	mov	ecx,18
206
	mov	ecx,18
172
;--------------------------------------
207
;--------------------------------------
173
@@:
208
@@:
174
	push	ecx
209
	push	ecx
175
	call	read_chunk
210
	call	read_chunk
-
 
211
 
-
 
212
	pusha
-
 
213
	call	draw_window
176
	pop	ecx
214
	popa
-
 
215
 
177
	add	ebp,12
216
	call	write_chunk
-
 
217
 
178
	pusha
218
	pusha
179
	call	draw_window
219
	call	draw_window
180
	popa
220
	popa
-
 
221
 
-
 
222
	pop	ecx
-
 
223
	add	ebp,sizeof.RESULT_SLOT
-
 
224
 
181
	dec	ecx
225
	dec	ecx
182
	jnz	@b
226
	jnz	@b
Line 183... Line 227...
183
 
227
 
184
	jmp	still
228
	jmp	still
185
;-----------------------------------------------------------------------------
229
;-----------------------------------------------------------------------------
186
read_chunk:
230
read_chunk:
187
	mov	eax,[file_info+32] ; file size
231
	mov	eax,[file_info+32] ; file size
188
	cmp	[ebp+8],eax ; chunk size
232
	cmp	[ebp+RESULT_SLOT.chunk_size],eax
Line 189... Line -...
189
	jb	@f
-
 
190
	
233
	jb	@f
-
 
234
	
191
	xor	eax,eax
235
	xor	eax,eax ; small file size for current chunk size
192
	mov	[ebp+4],eax ; small file size for current chunk size
236
	mov	[ebp+RESULT_SLOT.read_speed],eax
193
	ret
237
	ret
194
;--------------------------------------
238
;--------------------------------------
195
@@:
239
@@:
196
	mcall	68,12,[ebp+8] ; chunk size
240
	mcall	68,12,[ebp+RESULT_SLOT.chunk_size]
197
	mov	[fileread.return],eax
241
	mov	[fileread.return],eax
198
	xor	eax,eax
242
	xor	eax,eax
199
	mov	[fileread.offset],eax ; zero current offset
243
	mov	[fileread.offset],eax ; zero current offset
200
	mcall	26,9 ; get start time
244
	mcall	26,9 ; get start time
201
	add	eax,1600 ; 16 sec for iterations
245
	add	eax,1600 ; 16 sec for iterations
202
	mov	esi,eax
246
	mov	esi,eax
203
	mov	ecx,1
247
	mov	ecx,1
204
	mov	eax,[ebp+8] ; chunk size
248
	mov	eax,[ebp+RESULT_SLOT.chunk_size]
205
	mov	[fileread.size],eax
249
	mov	[fileread.size],eax
206
;--------------------------------------
250
;--------------------------------------
Line 207... Line 251...
207
.loop:
251
.loop:
208
	mcall	70,fileread
252
	mcall	70,fileread
209
	
253
	
210
	mcall	26,9 ; check current time
254
	mcall	26,9 ; check current time
211
	cmp	esi,eax
255
	cmp	esi,eax
212
	jbe	.end
256
	jbe	.end
213
; correct offset	
257
; correct offset	
214
	mov	edx,[ebp+8] ; chunk size
258
	mov	edx,[ebp+RESULT_SLOT.chunk_size]
215
	add	[fileread.offset],edx ; current offset
259
	add	[fileread.offset],edx ; current offset
216
; check offset and file size	
260
; check offset and file size	
217
	mov	edx,[file_info+32] ; file size
261
	mov	edx,[file_info+32] ; file size
Line 218... Line 262...
218
	sub	edx,[ebp+8] ; chunk size
262
	sub	edx,[ebp+RESULT_SLOT.chunk_size]
219
	cmp	[fileread.offset],edx
263
	cmp	[fileread.offset],edx
Line 225... Line 269...
225
@@:
269
@@:
226
	inc	ecx
270
	inc	ecx
227
	jmp	.loop
271
	jmp	.loop
228
;--------------------------------------
272
;--------------------------------------
229
.end:	
273
.end:	
230
	mov	eax,[ebp+8]
274
	mov	eax,[ebp+RESULT_SLOT.chunk_size]
231
	xor	edx,edx
275
	xor	edx,edx
232
	mul	ecx
276
	mul	ecx
233
	shr	eax,10+4 ;div 1024 ; div 16
277
	shr	eax,10+4 ;div 1024 ; div 16
234
	shl	edx,18
278
	shl	edx,18
235
	add	eax,edx
279
	add	eax,edx
236
	mov	[ebp+4],eax ; speed KB/s	
280
	mov	[ebp+RESULT_SLOT.read_speed],eax ; speed KB/s	
237
        DEBUGF 1,'FSPEED: chunk size: %s iterations: %d speed: %d KB/s\n',[ebp],ecx,eax
281
        DEBUGF 1,'FSPEED: read chunk size: %s iterations: %d speed: %d KB/s\n',\
-
 
282
		[ebp+RESULT_SLOT.text],ecx,eax
238
	mcall	68,13,[fileread.return]
283
	mcall	68,13,[fileread.return]
239
	ret
284
	ret
240
;-----------------------------------------------------------------------------
285
;-----------------------------------------------------------------------------
-
 
286
write_chunk:
-
 
287
	test	[check1.flags],dword 10b
-
 
288
	jz	.exit
-
 
289
 
-
 
290
	mov	eax,[file_info+32] ; file size
-
 
291
	cmp	[ebp+RESULT_SLOT.chunk_size],eax
-
 
292
	jb	@f
-
 
293
;--------------------------------------
-
 
294
.exit:
-
 
295
	xor	eax,eax ; small file size for current chunk size
-
 
296
	mov	[ebp+RESULT_SLOT.write_speed],eax
-
 
297
	ret
-
 
298
;--------------------------------------
-
 
299
@@:
-
 
300
	mcall	68,12,[ebp+RESULT_SLOT.chunk_size]
-
 
301
	mov	[filewrite.data],eax
-
 
302
	xor	eax,eax
-
 
303
	mov	[filewrite.offset],eax ; zero current offset
-
 
304
	mcall	26,9 ; get start time
-
 
305
	add	eax,1600 ; 16 sec for iterations
-
 
306
	mov	esi,eax
-
 
307
	mov	ecx,1
-
 
308
	mov	eax,[ebp+RESULT_SLOT.chunk_size]
-
 
309
	mov	[filewrite.size],eax
-
 
310
;--------------------------------------
-
 
311
.loop:
-
 
312
	mcall	70,filewrite
-
 
313
	
-
 
314
	mcall	26,9 ; check current time
-
 
315
	cmp	esi,eax
-
 
316
	jbe	.end
-
 
317
; correct offset	
-
 
318
	mov	edx,[ebp+RESULT_SLOT.chunk_size]
-
 
319
	add	[filewrite.offset],edx ; current offset
-
 
320
; check offset and file size	
-
 
321
	mov	edx,[file_info+32] ; file size
-
 
322
	sub	edx,[ebp+RESULT_SLOT.chunk_size]
-
 
323
	cmp	[filewrite.offset],edx
-
 
324
	jbe	@f	
-
 
325
	
-
 
326
	xor	edx,edx
-
 
327
	mov	[filewrite.offset],edx ; zero current offset
-
 
328
;--------------------------------------
-
 
329
@@:
-
 
330
	inc	ecx
-
 
331
	jmp	.loop
-
 
332
;--------------------------------------
-
 
333
.end:	
-
 
334
	mov	eax,[ebp+RESULT_SLOT.chunk_size]
-
 
335
	xor	edx,edx
-
 
336
	mul	ecx
-
 
337
	shr	eax,10+4 ;div 1024 ; div 16
-
 
338
	shl	edx,18
-
 
339
	add	eax,edx
-
 
340
	mov	[ebp+RESULT_SLOT.write_speed],eax ; speed KB/s	
-
 
341
        DEBUGF 1,'FSPEED: write chunk size: %s iterations: %d speed: %d KB/s\n',\
-
 
342
		[ebp+RESULT_SLOT.text],ecx,eax
-
 
343
	mcall	68,13,[filewrite.data]
-
 
344
	ret
-
 
345
;-----------------------------------------------------------------------------
241
include 'idata.inc'
346
include 'idata.inc'
242
;-----------------------------------------------------------------------------
347
;-----------------------------------------------------------------------------
243
IM_END:
348
IM_END:
244
;-----------------------------------------------------------------------------
349
;-----------------------------------------------------------------------------
245
include 'udata.inc'
350
include 'udata.inc'