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