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