Subversion Repositories Kolibri OS

Rev

Rev 6617 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6617 IgorA 1
 
2
txt_sp db ' ',0
3
txt_buf db '1234',0
4
	rd 1
5
6
 
7
8
 
9
{
10
local .end_t
11
local .m_txt
12
jmp .end_t
13
align 4
14
	.m_txt db txt,0
15
align 4
16
.end_t:
17
if dest eq
18
	mov eax,.m_txt
19
else
20
	mov dest,.m_txt
21
end if
22
}
23
24
 
25
tz1 db 'next_in',13,10,0
26
tz2 db 'avail_in',13,10,0
27
tz3 db 'total_in',13,10,0
28
tz4 db 'next_out',13,10,0
29
tz5 db 'avail_out',13,10,0
30
tz6 db 'total_out',13,10,0
31
tz7 db 'msg',13,10,0
32
tz8 db 'state',13,10,0
33
tz9 db 'zalloc',13,10,0
34
tz10 db 'zfree',13,10,0
35
tz11 db 'opaque',13,10,0
36
tz12 db 'data_type',13,10,0
37
tz13 db 'adler',13,10,0
38
tz14 db 'reserved',13,10,0
39
40
 
41
dd z_stream.next_in,4,tz1
42
dd z_stream.avail_in,2,tz2
43
dd z_stream.total_in,4,tz3
44
dd z_stream.next_out,4,tz4
45
dd z_stream.avail_out,2,tz5
46
dd z_stream.total_out,4,tz6
47
dd z_stream.msg,4,tz7
48
dd z_stream.state,4,tz8
49
dd z_stream.zalloc,4,tz9
50
dd z_stream.zfree,4,tz10
51
dd z_stream.opaque,4,tz11
52
dd z_stream.data_type,2,tz12
53
dd z_stream.adler,4,tz13
54
dd z_stream.reserved,4,tz14
55
dd 0,0
56
57
 
58
ta2 db 'status',13,10,0
59
ta3 db 'pending_buf',13,10,0
60
ta4 db 'pending_buf_size',13,10,0
61
ta5 db 'pending_out',13,10,0
62
ta6 db 'pending',13,10,0
63
ta7 db 'wrap',13,10,0
64
ta8 db 'gzhead',13,10,0
65
ta9 db 'gzindex',13,10,0
66
ta10 db 'method',13,10,0
67
ta11 db 'last_flush',13,10,0
68
ta12 db 'w_size',13,10,0
69
ta13 db 'w_bits',13,10,0
70
ta14 db 'w_mask',13,10,0
71
ta15 db 'window',13,10,0
72
ta16 db 'window_size',13,10,0
73
ta17 db 'prev',13,10,0
74
ta18 db 'head',13,10,0
75
ta19 db 'ins_h',13,10,0
76
ta20 db 'hash_size',13,10,0
77
ta21 db 'hash_bits',13,10,0
78
ta22 db 'hash_mask',13,10,0
79
ta23 db 'hash_shift',13,10,0
80
ta24 db 'block_start',13,10,0
81
ta25 db 'match_length',13,10,0
82
ta26 db 'prev_match',13,10,0
83
ta27 db 'match_available',13,10,0
84
ta28 db 'strstart',13,10,0
85
ta29 db 'match_start',13,10,0
86
ta30 db 'lookahead',13,10,0
87
ta31 db 'prev_length',13,10,0
88
ta32 db 'max_chain_length',13,10,0
89
ta33 db 'max_lazy_match',13,10,0
90
ta34 db 'level',13,10,0
91
ta35 db 'strategy',13,10,0
92
ta36 db 'good_match',13,10,0
93
ta37 db 'nice_match',13,10,0
94
ta38 db 'dyn_ltree',13,10,0
95
ta39 db 'dyn_dtree',13,10,0
96
ta40 db 'bl_tree',13,10,0
97
ta41 db 'l_desc',13,10,0
98
ta42 db 'd_desc',13,10,0
99
ta43 db 'bl_desc',13,10,0
100
ta44 db 'bl_count',13,10,0
101
ta45 db 'heap',13,10,0
102
ta46 db 'heap_len',13,10,0
103
ta47 db 'heap_max',13,10,0
104
ta48 db 'depth',13,10,0
105
ta49 db 'l_buf',13,10,0
106
ta50 db 'lit_bufsize',13,10,0
107
ta51 db 'last_lit',13,10,0
108
ta52 db 'd_buf',13,10,0
109
ta53 db 'opt_len',13,10,0
110
ta54 db 'static_len',13,10,0
111
ta55 db 'matches',13,10,0
112
ta56 db 'insert',13,10,0
113
; db 'compressed_len',13,10,0
114
; db 'bits_sent',13,10,0
115
ta59 db 'bi_buf',13,10,0
116
ta60 db 'bi_valid',13,10,0
117
ta61 db 'high_water',13,10,0
118
119
 
120
dd deflate_state.strm,4,ta1
121
dd deflate_state.status,4,ta2
122
dd deflate_state.pending_buf,4,ta3
123
dd deflate_state.pending_buf_size,4,ta4
124
dd deflate_state.pending_out,4,ta5
125
dd deflate_state.pending,4,ta6
6741 IgorA 126
dd deflate_state.wrap,4,ta7
6617 IgorA 127
dd deflate_state.gzhead,4,ta8
128
dd deflate_state.gzindex,4,ta9
129
dd deflate_state.method,1,ta10
130
dd deflate_state.last_flush,4,ta11
131
dd deflate_state.w_size,4,ta12
132
dd deflate_state.w_bits,4,ta13
133
dd deflate_state.w_mask,4,ta14
134
dd deflate_state.window,4,ta15
135
dd deflate_state.window_size,4,ta16
136
dd deflate_state.prev,4,ta17
137
dd deflate_state.head,4,ta18
138
dd deflate_state.ins_h,4,ta19
139
dd deflate_state.hash_size,4,ta20
140
dd deflate_state.hash_bits,4,ta21
141
dd deflate_state.hash_mask,4,ta22
142
dd deflate_state.hash_shift,4,ta23
143
dd deflate_state.block_start,4,ta24
144
dd deflate_state.match_length,4,ta25
145
dd deflate_state.prev_match,4,ta26
146
dd deflate_state.match_available,4,ta27
147
dd deflate_state.strstart,4,ta28
148
dd deflate_state.match_start,4,ta29
149
dd deflate_state.lookahead,4,ta30
150
dd deflate_state.prev_length,4,ta31
151
dd deflate_state.max_chain_length,4,ta32
152
dd deflate_state.max_lazy_match,4,ta33
153
dd deflate_state.level,2,ta34
154
dd deflate_state.strategy,2,ta35
155
dd deflate_state.good_match,4,ta36
156
dd deflate_state.nice_match,4,ta37
157
dd deflate_state.dyn_ltree,((2*HEAP_SIZE) shl 16)+2,ta38
158
dd deflate_state.dyn_dtree,((2*(2*D_CODES+1)) shl 16)+2,ta39
159
dd deflate_state.bl_tree,((2*(2*BL_CODES+1)) shl 16)+2,ta40
160
dd deflate_state.l_desc,(3 shl 16)+4,ta41
161
dd deflate_state.d_desc,(3 shl 16)+4,ta42
162
dd deflate_state.bl_desc,(3 shl 16)+4,ta43
163
dd deflate_state.bl_count,((MAX_BITS+1) shl 16)+2,ta44
164
dd deflate_state.heap,((2*L_CODES+1) shl 16)+2,ta45
165
dd deflate_state.heap_len,4,ta46
166
dd deflate_state.heap_max,4,ta47
167
dd deflate_state.depth,((2*L_CODES+1) shl 16)+1,ta48
168
dd deflate_state.l_buf,4,ta49
169
dd deflate_state.lit_bufsize,4,ta50
170
dd deflate_state.last_lit,4,ta51
171
dd deflate_state.d_buf,4,ta52
172
dd deflate_state.opt_len,4,ta53
173
dd deflate_state.static_len,4,ta54
174
dd deflate_state.matches,4,ta55
175
dd deflate_state.insert,4,ta56
176
;if DEBUG eq 1
177
;dd deflate_state.compressed_len
178
;dd deflate_state.bits_sent
179
;end if
180
dd deflate_state.bi_buf,2,ta59
181
dd deflate_state.bi_valid,4,ta60
182
dd deflate_state.high_water,4,ta61
183
dd 0,0
184
185
 
186
proc dbg_print, fun:dword, mes:dword
187
pushad
188
	mov eax,SF_BOARD
189
	mov ebx,SSF_DEBUG_WRITE
190
191
 
192
	cmp esi,0
193
	je .end0
194
	@@:
195
		mov cl,byte[esi]
196
		int 0x40
197
		inc esi
198
		cmp byte[esi],0
199
		jne @b
200
	mov cl,':'
201
	int 0x40
202
	mov cl,' '
203
	int 0x40
204
	.end0:
205
	mov esi,[mes]
206
	cmp esi,0
207
	je .end_f
208
	@@:
209
		mov cl,byte[esi]
210
		cmp cl,0
211
		je .end_f
212
		int 0x40
213
		inc esi
214
		jmp @b
215
	.end_f:
216
popad
217
	ret
218
endp
219
220
 
221
; zif - 1...8
222
align 4
223
proc hex_in_str, buf:dword,val:dword,zif:dword
224
pushad
225
	mov edi,dword[buf]
226
	mov ecx,dword[zif]
227
	add edi,ecx
228
	dec edi
229
	mov ebx,dword[val]
230
231
 
232
		mov al,bl
233
		and al,0xf
234
		cmp al,10
235
		jl @f
236
			add al,'a'-'0'-10
237
		@@:
238
		add al,'0'
239
		mov byte[edi],al
240
		dec edi
241
		shr ebx,4
242
	loop .cycle
243
popad
244
	ret
245
endp
246
247
 
248
; eax = strlen
249
align 4
250
proc strlen, str1:dword
251
	mov eax,[str1]
252
	@@:
253
		cmp byte[eax],0
254
		je @f
255
		inc eax
256
		jmp @b
257
	@@:
258
	sub eax,[str1]
259
	ret
260
endp
261
262
 
263
proc str_format_dbg, buf:dword, fmt:dword, p1:dword
264
pushad
265
	mov esi,[fmt]
266
	mov edi,[buf]
267
	mov ecx,80-1
268
	.cycle0:
269
		lodsb
270
		cmp al,'%'
271
		jne .no_param
272
			lodsb
273
			dec ecx
274
			cmp al,0
275
			je .cycle0end
276
			cmp al,'d'
277
			je @f
278
			cmp al,'u'
279
			je @f
280
			cmp al,'l'
281
			je .end1
282
				jmp .end0
283
			.end1: ;%lu %lx
284
				lodsb
285
				dec ecx
286
				cmp al,'u'
287
				jne .end0
288
			@@:
289
				mov eax,[p1]
290
				stdcall convert_int_to_str,ecx
291
				xor al,al
292
				repne scasb
293
				dec edi
294
			.end0:
295
			loop .cycle0
296
		.no_param:
297
		stosb
298
		cmp al,0
299
		je .cycle0end
300
		loop .cycle0
301
	.cycle0end:
302
	xor al,al
303
	stosb
304
	stdcall dbg_print,txt_sp,[buf]
305
popad
306
	ret
307
endp
308
309
 
310
proc debug_fields, saddr:dword, form:dword
311
locals
312
	nl_array dd ?
313
endl
314
pushad
315
	mov edi,[saddr]
316
	cmp edi,0
317
	je .end_f
318
	mcall SF_BOARD,SSF_DEBUG_WRITE,13
319
	mcall ,,10
320
	mov eax,[form]
321
align 4
322
	.cycle0:
323
		mov ebx,[eax+4]
324
		mov ecx,ebx
325
		and ebx,0xffff
326
		cmp ebx,0
327
		je .end_f
328
		mov esi,ebx
329
		shl ebx,1
330
		shr ecx,16
331
		cmp ecx,0
332
		je .end0
333
			;if array
334
			stdcall dbg_print,0,[eax+8]
335
			mov edx,61 ;size text line
336
			mov dword[nl_array],0
337
			.cycle2:
338
				inc dword[nl_array]
339
				sub edx,ebx
340
				sub edx,2 ;': '
341
				cmp edx,3
342
				jg .cycle2
343
			mov edx,edi
344
			add edx,[eax]
345
			push eax
346
			.nl_i:
347
			mov eax,[nl_array]
348
			mov byte[ebx+txt_buf],0 ;конец числа
349
			.cycle1:
350
				stdcall hex_in_str,txt_buf,[edx],ebx
351
				add edx,esi ;move next value
352
353
 
354
				mov edi,txt_buf
355
				cmp byte[edi],'0'
356
				jne @f
357
					inc edi
358
				cmp byte[edi],'0'
359
				jne @f
360
					inc edi
361
				cmp byte[edi],'0'
362
				jne @f
363
					inc edi
364
				cmp byte[edi],'0'
365
				jne @f
366
					inc edi
367
				@@:
368
				cmp byte[edi],0
369
				jne @f
370
					dec edi
371
				@@:
372
				stdcall dbg_print,edi,0
373
				pop edi
374
375
 
376
				dec eax
377
				jz .nl
378
				loop .cycle1
379
			.nl:
380
			push ebx ecx
381
			mcall SF_BOARD,SSF_DEBUG_WRITE,13
382
			mcall ,,10
383
			pop ecx ebx
384
			dec ecx
385
			cmp ecx,0
386
			jg .nl_i
387
			pop eax
388
			add eax,12
389
			jmp .cycle0
390
		.end0:
391
		mov edx,edi
392
		add edx,[eax]
393
		stdcall hex_in_str,txt_buf,[edx],ebx
394
		mov byte[ebx+txt_buf],0 ;конец числа
395
		stdcall dbg_print,txt_buf,[eax+8]
396
		add eax,12
397
		jmp .cycle0
398
.end_f:
399
	mcall SF_BOARD,SSF_DEBUG_WRITE,13
400
	mcall ,,10
401
popad
402
	ret
403
endp
404
405
 
406
; eax - число
407
; edi - буфер для строки
408
; len - длинна буфера
409
;output:
410
align 4
411
proc convert_int_to_str, len:dword
412
pushad
413
	mov esi,[len]
414
	add esi,edi
415
	dec esi
416
	call .str
417
popad
418
	ret
419
endp
420
421
 
422
.str:
423
	mov ecx,0x0a
424
	cmp eax,ecx
425
	jb @f
426
		xor edx,edx
427
		div ecx
428
		push edx
429
		call .str
430
		pop eax
431
	@@:
432
	cmp edi,esi
433
	jge @f
434
		or al,0x30
435
		stosb
436
		mov byte[edi],0
437
	@@:
438
	ret
439