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