Rev 6799 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6617 | IgorA | 1 | |
2 | include '../../../../macros.inc' |
||
3 | include '../../../../KOSfuncs.inc' |
||
4 | |||
5 | |||
6799 | IgorA | 6 | GEN_TREES_H equ 0 |
6617 | IgorA | 7 | DEBUG equ 0 |
8 | DYNAMIC_CRC_TABLE equ 1 |
||
9 | Z_SOLO equ 0 |
||
6639 | IgorA | 10 | |
6617 | IgorA | 11 | |
12 | ; trailer creation by deflate(). NO_GZIP would be used to avoid linking in |
||
13 | ; the crc code when it is not needed. For shared libraries, gzip encoding |
||
14 | ; should be left enabled. |
||
15 | GZIP equ 1 |
||
16 | |||
17 | |||
18 | { |
||
19 | if DEBUG eq 1 |
||
6639 | IgorA | 20 | zlib_assert fmt,p1 |
21 | end if |
||
22 | } |
||
23 | |||
24 | |||
25 | { |
||
26 | local .end_t |
||
27 | local .m_fmt |
||
28 | pushf |
||
6847 | IgorA | 29 | jmp .end_t |
6639 | IgorA | 30 | .m_fmt db fmt,13,10,0 |
6617 | IgorA | 31 | align 4 |
32 | .end_t: |
||
6639 | IgorA | 33 | if p1 eq |
6617 | IgorA | 34 | stdcall dbg_print,0,.m_fmt |
35 | else |
||
36 | stdcall str_format_dbg, buf_param,.m_fmt,p1 |
||
37 | end if |
||
38 | popf |
||
6847 | IgorA | 39 | } |
6617 | IgorA | 40 | |
41 | |||
42 | include 'deflate.inc' |
||
43 | include 'zutil.asm' |
||
44 | ;include '../kfar_arc/crc.inc' |
||
6673 | IgorA | 45 | include 'crc32.asm' |
6617 | IgorA | 46 | include 'adler32.asm' |
47 | include 'trees.asm' |
||
48 | include 'deflate.asm' |
||
49 | |||
50 | |||
51 | buf_param rb 80 |
||
52 | |||
53 | |||
54 | proc dbg_print, fun:dword, mes:dword |
||
55 | pushad |
||
56 | mov eax,SF_BOARD |
||
57 | mov ebx,SSF_DEBUG_WRITE |
||
58 | |||
59 | |||
60 | cmp esi,0 |
||
61 | je .end0 |
||
62 | @@: |
||
63 | mov cl,byte[esi] |
||
64 | int 0x40 |
||
65 | inc esi |
||
66 | cmp byte[esi],0 |
||
67 | jne @b |
||
68 | mov cl,':' |
||
69 | int 0x40 |
||
70 | mov cl,' ' |
||
71 | int 0x40 |
||
72 | .end0: |
||
73 | mov esi,[mes] |
||
74 | cmp esi,0 |
||
75 | je .end_f |
||
76 | @@: |
||
77 | mov cl,byte[esi] |
||
78 | cmp cl,0 |
||
79 | je .end_f |
||
80 | int 0x40 |
||
81 | inc esi |
||
82 | jmp @b |
||
83 | .end_f: |
||
84 | popad |
||
85 | ret |
||
86 | endp |
||
87 | |||
88 | |||
89 | proc str_format_dbg, buf:dword, fmt:dword, p1:dword |
||
90 | pushad |
||
91 | mov esi,[fmt] |
||
92 | mov edi,[buf] |
||
93 | mov ecx,80-1 |
||
94 | .cycle0: |
||
95 | lodsb |
||
96 | cmp al,'%' |
||
97 | jne .no_param |
||
98 | lodsb |
||
99 | dec ecx |
||
100 | cmp al,0 |
||
101 | je .cycle0end |
||
102 | cmp al,'d' |
||
103 | je @f |
||
104 | cmp al,'u' |
||
105 | je @f |
||
106 | cmp al,'l' |
||
107 | je .end1 |
||
108 | jmp .end0 |
||
109 | .end1: ;%lu %lx |
||
110 | lodsb |
||
111 | dec ecx |
||
112 | cmp al,'u' |
||
113 | jne .end0 |
||
114 | @@: |
||
115 | mov eax,[p1] |
||
116 | stdcall convert_int_to_str,ecx |
||
117 | xor al,al |
||
118 | repne scasb |
||
119 | dec edi |
||
120 | .end0: |
||
121 | loop .cycle0 |
||
122 | .no_param: |
||
123 | stosb |
||
124 | cmp al,0 |
||
125 | je .cycle0end |
||
126 | loop .cycle0 |
||
127 | .cycle0end: |
||
128 | xor al,al |
||
129 | stosb |
||
130 | stdcall dbg_print,0,[buf] |
||
131 | popad |
||
132 | ret |
||
133 | endp |
||
134 | |||
135 | |||
136 | ; eax - число |
||
137 | ; edi - буфер для строки |
||
138 | ; len - длинна буфера |
||
139 | ;output: |
||
140 | align 4 |
||
141 | proc convert_int_to_str, len:dword |
||
142 | pushad |
||
143 | mov esi,[len] |
||
144 | add esi,edi |
||
145 | dec esi |
||
146 | call .str |
||
147 | popad |
||
148 | ret |
||
149 | endp |
||
150 | |||
151 | |||
152 | .str: |
||
153 | mov ecx,0x0a |
||
154 | cmp eax,ecx |
||
155 | jb @f |
||
156 | xor edx,edx |
||
157 | div ecx |
||
158 | push edx |
||
159 | call .str |
||
160 | pop eax |
||
161 | @@: |
||
162 | cmp edi,esi |
||
163 | jge @f |
||
164 | or al,0x30 |
||
165 | stosb |
||
166 | mov byte[edi],0 |
||
167 | @@: |
||
168 | ret |
||
169 |