Rev 497 | Rev 521 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
488 | spraid | 1 | ;------------------------------------------------------------------------- |
2 | ; |
||
3 | ; Файл конфигурации |
||
4 | ; |
||
5 | ; |
||
6 | ; SPraid |
||
7 | ; |
||
8 | ;------------------------------------------------------------------------- |
||
9 | |||
10 | conf_file_loaded: db 0 ; флаг загрузки конфига |
||
512 | spraid | 11 | conf_path_sect: db 'path',0 |
488 | spraid | 12 | |
512 | spraid | 13 | conf_fname db '%sys%/sys.conf',0 |
494 | spraid | 14 | |
15 | |||
512 | spraid | 16 | |
497 | spraid | 17 | proc set_kernel_conf |
494 | spraid | 18 | locals |
19 | par db 30 dup(?) |
||
20 | endl |
||
497 | spraid | 21 | pushad |
494 | spraid | 22 | ;[gui] |
23 | ;mouse_speed |
||
512 | spraid | 24 | lea eax,[par] |
494 | spraid | 25 | push eax |
512 | spraid | 26 | invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def |
497 | spraid | 27 | pop eax |
28 | stdcall strtoint,eax |
||
29 | push eax |
||
494 | spraid | 30 | pop edx |
31 | call _mouse_speed |
||
497 | spraid | 32 | |
33 | popad |
||
34 | ret |
||
494 | spraid | 35 | |
36 | ;mouse_delay |
||
512 | spraid | 37 | lea eax,[par] |
497 | spraid | 38 | push eax |
512 | spraid | 39 | invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def |
497 | spraid | 40 | pop eax |
494 | spraid | 41 | stdcall strtoint,eax |
42 | push eax |
||
43 | pop edx |
||
44 | call _mouse_delay |
||
45 | |||
46 | ;[dev] |
||
47 | ;sb16 |
||
512 | spraid | 48 | lea eax,[par] |
497 | spraid | 49 | push eax |
512 | spraid | 50 | invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def |
497 | spraid | 51 | pop eax |
494 | spraid | 52 | stdcall strtoint,eax |
53 | push eax |
||
54 | pop ecx |
||
55 | call _sb16 |
||
56 | |||
57 | ;sound_dma |
||
512 | spraid | 58 | lea eax,[par] |
497 | spraid | 59 | push eax |
512 | spraid | 60 | invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def |
497 | spraid | 61 | pop eax |
494 | spraid | 62 | stdcall strtoint,eax |
63 | push eax |
||
64 | pop ecx |
||
65 | call _sound_dma |
||
66 | |||
67 | |||
68 | ;midibase |
||
512 | spraid | 69 | lea eax,[par] |
497 | spraid | 70 | push eax |
512 | spraid | 71 | invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def |
497 | spraid | 72 | pop eax |
494 | spraid | 73 | stdcall strtoint,eax |
74 | push eax |
||
75 | pop ecx |
||
76 | call _midibase |
||
512 | spraid | 77 | |
78 | |||
497 | spraid | 79 | popad |
80 | ret |
||
494 | spraid | 81 | endp |
82 | |||
83 | ugui db 'gui',0 |
||
84 | ugui_mouse_speed db 'mouse_speed',0 |
||
497 | spraid | 85 | ugui_mouse_speed_def db '2',0 |
494 | spraid | 86 | ugui_mouse_delay db 'mouse_delay',0 |
497 | spraid | 87 | ugui_mouse_delay_def db '0x00A',0 |
494 | spraid | 88 | |
89 | udev db 'dev',0 |
||
90 | udev_sb16 db 'sb16',0 |
||
497 | spraid | 91 | udev_sb16_def db '0x220',0 |
494 | spraid | 92 | udev_sound_dma db 'sound_dma',0 |
497 | spraid | 93 | udev_sound_dma_def db '1',0 |
494 | spraid | 94 | udev_midibase db 'midibase',0 |
497 | spraid | 95 | udev_midibase_def db '0x320',0 |
494 | spraid | 96 | |
512 | spraid | 97 | proc set_network_conf |
98 | locals |
||
99 | par db 30 dup(?) |
||
100 | endl |
||
101 | pushad |
||
102 | |||
103 | ;[net] |
||
104 | ;active |
||
105 | lea eax,[par] |
||
106 | invoke ini.get_int,conf_fname, unet, unet_active, 0 |
||
107 | or eax,eax |
||
108 | jz .do_not_set_net |
||
109 | call _net_up |
||
110 | |||
111 | ;addr |
||
112 | lea eax,[par] |
||
113 | push eax |
||
114 | invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def |
||
115 | pop eax |
||
116 | stdcall do_inet_adr,eax |
||
117 | push eax |
||
118 | pop ecx |
||
119 | call _net_addr |
||
120 | |||
121 | ;mask |
||
122 | lea eax,[par] |
||
123 | push eax |
||
124 | invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def |
||
125 | pop eax |
||
126 | stdcall do_inet_adr,eax |
||
127 | push eax |
||
128 | pop ecx |
||
129 | call _net_mask |
||
130 | |||
131 | ;gate |
||
132 | lea eax,[par] |
||
133 | push eax |
||
134 | invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def |
||
135 | pop eax |
||
136 | stdcall do_inet_adr,eax |
||
137 | push eax |
||
138 | pop ecx |
||
139 | call _net_gate |
||
140 | .do_not_set_net: |
||
141 | popad |
||
142 | ret |
||
143 | |||
144 | |||
145 | endp |
||
146 | |||
147 | unet db 'net',0 |
||
148 | unet_active db 'active',0 |
||
149 | unet_addr db 'addr',0 |
||
150 | unet_mask db 'mask',0 |
||
151 | unet_gate db 'gate',0 |
||
152 | unet_def db 0 |
||
153 | |||
494 | spraid | 154 | ; конверчение строки в DWord в eax (по второму символу определяет систему счисления) |
497 | spraid | 155 | |
494 | spraid | 156 | proc strtoint stdcall,strs |
157 | pushad |
||
158 | |||
159 | mov eax,[strs] |
||
160 | inc eax |
||
161 | mov bl,[eax] |
||
162 | cmp bl,'x' |
||
163 | je .hex |
||
164 | cmp bl,'X' |
||
165 | je .hex |
||
166 | jmp .dec |
||
167 | .hex: |
||
168 | inc eax |
||
169 | stdcall strtoint_hex,eax |
||
170 | jmp .exit |
||
171 | .dec: |
||
172 | dec eax |
||
173 | stdcall strtoint_dec,eax |
||
174 | .exit: |
||
497 | spraid | 175 | mov [esp+28],eax |
494 | spraid | 176 | popad |
177 | ret |
||
178 | endp |
||
179 | |||
180 | ; конверчение строки в DWord в eax для десятичного |
||
181 | proc strtoint_dec stdcall,strs |
||
182 | pushad |
||
497 | spraid | 183 | xor edx,edx |
184 | ; поиск конца |
||
185 | mov esi,[strs] |
||
186 | @@: |
||
187 | lodsb |
||
188 | or al,al |
||
189 | jnz @b |
||
190 | mov ebx,esi |
||
191 | mov esi,[strs] |
||
192 | dec ebx |
||
193 | sub ebx,esi |
||
194 | mov ecx,1 |
||
195 | |||
196 | @@: |
||
197 | dec ebx |
||
198 | or ebx,ebx |
||
199 | jz @f |
||
200 | imul ecx,ecx,10 ; порядок |
||
201 | jmp @b |
||
202 | @@: |
||
203 | |||
204 | xchg ebx,ecx |
||
205 | |||
494 | spraid | 206 | |
207 | xor ecx,ecx |
||
497 | spraid | 208 | |
494 | spraid | 209 | |
210 | @@: |
||
211 | xor eax,eax |
||
212 | lodsb |
||
213 | cmp al,0 |
||
497 | spraid | 214 | je .eend |
494 | spraid | 215 | |
216 | sub al,30h |
||
217 | imul ebx |
||
218 | add ecx,eax |
||
497 | spraid | 219 | push ecx |
220 | xchg eax,ebx |
||
221 | mov ecx,10 |
||
222 | div ecx |
||
223 | xchg eax,ebx |
||
224 | pop ecx |
||
494 | spraid | 225 | jmp @b |
226 | |||
497 | spraid | 227 | .eend: |
228 | mov [esp+28],ecx |
||
494 | spraid | 229 | popad |
230 | ret |
||
231 | endp |
||
232 | |||
233 | ; конверчение строки в DWord в eax для шеснадцатиричного |
||
234 | proc strtoint_hex stdcall,strs |
||
235 | pushad |
||
497 | spraid | 236 | xor edx,edx |
237 | |||
238 | mov esi,[strs] |
||
239 | mov ebx,1 |
||
240 | add esi,1 |
||
241 | |||
242 | @@: |
||
243 | lodsb |
||
244 | or al,al |
||
245 | jz @f |
||
246 | shl ebx,4 |
||
247 | jmp @b |
||
248 | @@: |
||
494 | spraid | 249 | xor ecx,ecx |
250 | mov esi,[strs] |
||
251 | |||
252 | @@: |
||
253 | xor eax,eax |
||
254 | lodsb |
||
255 | cmp al,0 |
||
497 | spraid | 256 | je .eend |
494 | spraid | 257 | |
258 | cmp al,'a' |
||
259 | jae .bm |
||
260 | cmp al,'A' |
||
261 | jae .bb |
||
262 | jmp .cc |
||
497 | spraid | 263 | .bm: ; 57h |
494 | spraid | 264 | sub al,57h |
265 | jmp .do |
||
266 | |||
497 | spraid | 267 | .bb: ; 37h |
494 | spraid | 268 | sub al,37h |
269 | jmp .do |
||
270 | |||
497 | spraid | 271 | .cc: ; 30h |
494 | spraid | 272 | sub al,30h |
273 | |||
274 | .do: |
||
275 | imul ebx |
||
276 | add ecx,eax |
||
497 | spraid | 277 | shr ebx,4 |
494 | spraid | 278 | |
279 | jmp @b |
||
497 | spraid | 280 | |
281 | .eend: |
||
282 | mov [esp+28],ecx |
||
494 | spraid | 283 | popad |
284 | ret |
||
497 | spraid | 285 | endp |
494 | spraid | 286 | |
287 | |||
512 | spraid | 288 | ; преобразовать адрес в то что нада, если пусто то вернуть 0 |
289 | proc do_inet_adr stdcall,strs |
||
290 | pushad |
||
291 | |||
292 | mov esi,[strs] |
||
293 | mov ebx,0 |
||
294 | .next: |
||
295 | push esi |
||
296 | @@: |
||
297 | lodsb |
||
298 | or al,al |
||
299 | jz @f |
||
300 | cmp al,'.' |
||
301 | jz @f |
||
302 | jmp @b |
||
303 | @@: |
||
304 | mov cl, al |
||
305 | mov [esi-1],byte 0 |
||
306 | ;pop eax |
||
307 | call strtoint_dec |
||
308 | rol eax,24 |
||
309 | ror ebx,8 |
||
310 | add ebx,eax |
||
311 | or cl,cl |
||
312 | jz @f |
||
313 | jmp .next |
||
314 | @@: |
||
315 | mov [esp+28],ebx |
||
316 | popad |
||
317 | ret |
||
318 | endp |
||
319 | |||
320 | |||
494 | spraid | 321 | ; установки из setup |
322 | |||
323 | _mouse_speed: |
||
324 | mov eax,18 |
||
325 | mov ebx,19 |
||
326 | mov ecx,1 |
||
327 | int 0x40 |
||
328 | ret |
||
329 | |||
330 | _mouse_delay: |
||
331 | mov eax,18 |
||
332 | mov ebx,19 |
||
333 | mov ecx,3 |
||
334 | int 0x40 |
||
335 | ret |
||
336 | |||
337 | _sb16: |
||
338 | mov eax,21 |
||
339 | mov ebx,4 |
||
340 | int 0x40 |
||
341 | ret |
||
342 | |||
343 | _sound_dma: |
||
344 | mov eax,21 |
||
345 | mov ebx,10 |
||
346 | int 0x40 |
||
347 | ret |
||
348 | |||
349 | |||
350 | _midibase: |
||
351 | mov eax,21 |
||
352 | mov ebx,1 |
||
353 | int 0x40 |
||
512 | spraid | 354 | ret |
355 | |||
356 | _net_addr: |
||
357 | mov eax,52 |
||
358 | mov ebx,3 |
||
359 | int 0x40 |
||
360 | ret |
||
361 | |||
362 | _net_mask: |
||
363 | mov eax,52 |
||
364 | mov ebx,12 |
||
365 | int 0x40 |
||
366 | ret |
||
367 | |||
368 | _net_gate: |
||
369 | mov eax,52 |
||
370 | mov ebx,11 |
||
371 | int 0x40 |
||
372 | ret |
||
373 | |||
374 | _net_up: |
||
375 | mov eax,52 |
||
376 | mov ebx,0 |
||
377 | int 0x40 |
||
378 | and eax,0xFFFFFF80 |
||
379 | add eax,3 |
||
380 | mov ecx,eax |
||
381 | |||
382 | mov eax,52 |
||
383 | mov ebx,2 |
||
384 | int 0x40 |
||
494 | spraid | 385 | ret |