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