Rev 593 | Rev 802 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 593 | Rev 750 | ||
---|---|---|---|
- | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
- | 2 | ;; ;; |
|
- | 3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
|
- | 4 | ;; Distributed under terms of the GNU General Public License ;; |
|
- | 5 | ;; ;; |
|
- | 6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
|
- | 7 | ||
1 | ;------------------------------------------------------------------------- |
8 | ;------------------------------------------------------------------------- |
2 | ;Loading configuration from ini file |
9 | ;Loading configuration from ini file |
3 | ; {SPraid.simba} |
10 | ; {SPraid.simba} |
4 | ;------------------------------------------------------------------------- |
11 | ;------------------------------------------------------------------------- |
5 | 12 | ||
6 | $Revision: 593 $ |
13 | $Revision: 750 $ |
7 | 14 | ||
8 | 15 | ||
9 | conf_path_sect: db 'path',0 |
16 | conf_path_sect: db 'path',0 |
10 | 17 | ||
11 | conf_fname db '/sys/sys.conf',0 |
18 | conf_fname db '/sys/sys.conf',0 |
12 | 19 | ||
13 | ; set soke kernel configuration |
20 | ; set soke kernel configuration |
14 | proc set_kernel_conf |
21 | proc set_kernel_conf |
15 | locals |
22 | locals |
16 | par db 30 dup(?) |
23 | par db 30 dup(?) |
17 | endl |
24 | endl |
18 | pushad |
25 | pushad |
19 | ;[gui] |
26 | ;[gui] |
20 | ;mouse_speed |
27 | ;mouse_speed |
21 | lea eax,[par] |
28 | lea eax,[par] |
22 | push eax |
29 | push eax |
23 | invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def |
30 | invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def |
24 | pop eax |
31 | pop eax |
25 | stdcall strtoint,eax |
32 | stdcall strtoint,eax |
26 | mov [mouse_speed_factor], ax |
33 | mov [mouse_speed_factor], ax |
27 | 34 | ||
28 | ;mouse_delay |
35 | ;mouse_delay |
29 | lea eax,[par] |
36 | lea eax,[par] |
30 | push eax |
37 | push eax |
31 | invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def |
38 | invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def |
32 | pop eax |
39 | pop eax |
33 | stdcall strtoint,eax |
40 | stdcall strtoint,eax |
34 | mov [mouse_delay], eax |
41 | mov [mouse_delay], eax |
35 | 42 | ||
36 | ;[dev] |
43 | ;[dev] |
37 | ;sb16 |
44 | ;sb16 |
38 | lea eax,[par] |
45 | lea eax,[par] |
39 | push eax |
46 | push eax |
40 | invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def |
47 | invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def |
41 | pop eax |
48 | pop eax |
42 | stdcall strtoint,eax |
49 | stdcall strtoint,eax |
43 | cmp eax, 0x100 |
50 | cmp eax, 0x100 |
44 | jb @f |
51 | jb @f |
45 | cmp eax, 0x10000 |
52 | cmp eax, 0x10000 |
46 | jae @f |
53 | jae @f |
47 | mov [sb16], eax |
54 | mov [sb16], eax |
48 | @@: |
55 | @@: |
49 | 56 | ||
50 | ;sound_dma |
57 | ;sound_dma |
51 | lea eax,[par] |
58 | lea eax,[par] |
52 | push eax |
59 | push eax |
53 | invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def |
60 | invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def |
54 | pop eax |
61 | pop eax |
55 | stdcall strtoint,eax |
62 | stdcall strtoint,eax |
56 | cmp eax, 3 |
63 | cmp eax, 3 |
57 | ja @f |
64 | ja @f |
58 | mov [sound_dma], eax |
65 | mov [sound_dma], eax |
59 | @@: |
66 | @@: |
60 | 67 | ||
61 | ;midibase |
68 | ;midibase |
62 | lea eax,[par] |
69 | lea eax,[par] |
63 | push eax |
70 | push eax |
64 | invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def |
71 | invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def |
65 | pop eax |
72 | pop eax |
66 | stdcall strtoint,eax |
73 | stdcall strtoint,eax |
67 | cmp eax, 0x100 |
74 | cmp eax, 0x100 |
68 | jb @f |
75 | jb @f |
69 | cmp eax, 0x10000 |
76 | cmp eax, 0x10000 |
70 | jae @f |
77 | jae @f |
71 | mov [midi_base], ax |
78 | mov [midi_base], ax |
72 | mov [mididp], eax |
79 | mov [mididp], eax |
73 | inc eax |
80 | inc eax |
74 | mov [midisp], eax |
81 | mov [midisp], eax |
75 | @@: |
82 | @@: |
76 | 83 | ||
77 | popad |
84 | popad |
78 | ret |
85 | ret |
79 | endp |
86 | endp |
80 | 87 | ||
81 | ugui db 'gui',0 |
88 | ugui db 'gui',0 |
82 | ugui_mouse_speed db 'mouse_speed',0 |
89 | ugui_mouse_speed db 'mouse_speed',0 |
83 | ugui_mouse_speed_def db '2',0 |
90 | ugui_mouse_speed_def db '2',0 |
84 | ugui_mouse_delay db 'mouse_delay',0 |
91 | ugui_mouse_delay db 'mouse_delay',0 |
85 | ugui_mouse_delay_def db '0x00A',0 |
92 | ugui_mouse_delay_def db '0x00A',0 |
86 | 93 | ||
87 | udev db 'dev',0 |
94 | udev db 'dev',0 |
88 | udev_sb16 db 'sb16',0 |
95 | udev_sb16 db 'sb16',0 |
89 | udev_sb16_def db '0x220',0 |
96 | udev_sb16_def db '0x220',0 |
90 | udev_sound_dma db 'sound_dma',0 |
97 | udev_sound_dma db 'sound_dma',0 |
91 | udev_sound_dma_def db '1',0 |
98 | udev_sound_dma_def db '1',0 |
92 | udev_midibase db 'midibase',0 |
99 | udev_midibase db 'midibase',0 |
93 | udev_midibase_def db '0x320',0 |
100 | udev_midibase_def db '0x320',0 |
94 | 101 | ||
95 | ;set up netvork configuration |
102 | ;set up netvork configuration |
96 | proc set_network_conf |
103 | proc set_network_conf |
97 | locals |
104 | locals |
98 | par db 30 dup(?) |
105 | par db 30 dup(?) |
99 | endl |
106 | endl |
100 | pushad |
107 | pushad |
101 | 108 | ||
102 | ;[net] |
109 | ;[net] |
103 | ;active |
110 | ;active |
104 | lea eax,[par] |
111 | lea eax,[par] |
105 | invoke ini.get_int,conf_fname, unet, unet_active, 0 |
112 | invoke ini.get_int,conf_fname, unet, unet_active, 0 |
106 | or eax,eax |
113 | or eax,eax |
107 | jz .do_not_set_net |
114 | jz .do_not_set_net |
108 | mov eax, [stack_config] |
115 | mov eax, [stack_config] |
109 | and eax, 0xFFFFFF80 |
116 | and eax, 0xFFFFFF80 |
110 | add eax, 3 |
117 | add eax, 3 |
111 | mov [stack_config], eax |
118 | mov [stack_config], eax |
112 | call ash_eth_enable |
119 | call ash_eth_enable |
113 | 120 | ||
114 | ;addr |
121 | ;addr |
115 | lea eax,[par] |
122 | lea eax,[par] |
116 | push eax |
123 | push eax |
117 | invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def |
124 | invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def |
118 | pop eax |
125 | pop eax |
119 | stdcall do_inet_adr,eax |
126 | stdcall do_inet_adr,eax |
120 | mov [stack_ip], eax |
127 | mov [stack_ip], eax |
121 | 128 | ||
122 | ;mask |
129 | ;mask |
123 | lea eax,[par] |
130 | lea eax,[par] |
124 | push eax |
131 | push eax |
125 | invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def |
132 | invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def |
126 | pop eax |
133 | pop eax |
127 | stdcall do_inet_adr,eax |
134 | stdcall do_inet_adr,eax |
128 | mov [subnet_mask], eax |
135 | mov [subnet_mask], eax |
129 | 136 | ||
130 | ;gate |
137 | ;gate |
131 | lea eax,[par] |
138 | lea eax,[par] |
132 | push eax |
139 | push eax |
133 | invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def |
140 | invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def |
134 | pop eax |
141 | pop eax |
135 | stdcall do_inet_adr,eax |
142 | stdcall do_inet_adr,eax |
136 | mov [gateway_ip], eax |
143 | mov [gateway_ip], eax |
137 | .do_not_set_net: |
144 | .do_not_set_net: |
138 | popad |
145 | popad |
139 | ret |
146 | ret |
140 | 147 | ||
141 | 148 | ||
142 | endp |
149 | endp |
143 | 150 | ||
144 | unet db 'net',0 |
151 | unet db 'net',0 |
145 | unet_active db 'active',0 |
152 | unet_active db 'active',0 |
146 | unet_addr db 'addr',0 |
153 | unet_addr db 'addr',0 |
147 | unet_mask db 'mask',0 |
154 | unet_mask db 'mask',0 |
148 | unet_gate db 'gate',0 |
155 | unet_gate db 'gate',0 |
149 | unet_def db 0 |
156 | unet_def db 0 |
150 | 157 | ||
151 | ; convert string to DWord |
158 | ; convert string to DWord |
152 | proc strtoint stdcall,strs |
159 | proc strtoint stdcall,strs |
153 | pushad |
160 | pushad |
154 | 161 | ||
155 | mov eax,[strs] |
162 | mov eax,[strs] |
156 | inc eax |
163 | inc eax |
157 | mov bl,[eax] |
164 | mov bl,[eax] |
158 | cmp bl,'x' |
165 | cmp bl,'x' |
159 | je .hex |
166 | je .hex |
160 | cmp bl,'X' |
167 | cmp bl,'X' |
161 | je .hex |
168 | je .hex |
162 | jmp .dec |
169 | jmp .dec |
163 | .hex: |
170 | .hex: |
164 | inc eax |
171 | inc eax |
165 | stdcall strtoint_hex,eax |
172 | stdcall strtoint_hex,eax |
166 | jmp .exit |
173 | jmp .exit |
167 | .dec: |
174 | .dec: |
168 | dec eax |
175 | dec eax |
169 | stdcall strtoint_dec,eax |
176 | stdcall strtoint_dec,eax |
170 | .exit: |
177 | .exit: |
171 | mov [esp+28],eax |
178 | mov [esp+28],eax |
172 | popad |
179 | popad |
173 | ret |
180 | ret |
174 | endp |
181 | endp |
175 | 182 | ||
176 | ; convert string to DWord for decimal value |
183 | ; convert string to DWord for decimal value |
177 | proc strtoint_dec stdcall,strs |
184 | proc strtoint_dec stdcall,strs |
178 | pushad |
185 | pushad |
179 | xor edx,edx |
186 | xor edx,edx |
180 | ; ¯®¨áª ª®æ |
187 | ; ¯®¨áª ª®æ |
181 | mov esi,[strs] |
188 | mov esi,[strs] |
182 | @@: |
189 | @@: |
183 | lodsb |
190 | lodsb |
184 | or al,al |
191 | or al,al |
185 | jnz @b |
192 | jnz @b |
186 | mov ebx,esi |
193 | mov ebx,esi |
187 | mov esi,[strs] |
194 | mov esi,[strs] |
188 | dec ebx |
195 | dec ebx |
189 | sub ebx,esi |
196 | sub ebx,esi |
190 | mov ecx,1 |
197 | mov ecx,1 |
191 | 198 | ||
192 | @@: |
199 | @@: |
193 | dec ebx |
200 | dec ebx |
194 | or ebx,ebx |
201 | or ebx,ebx |
195 | jz @f |
202 | jz @f |
196 | imul ecx,ecx,10 ; ¯®à冷ª |
203 | imul ecx,ecx,10 ; ¯®à冷ª |
197 | jmp @b |
204 | jmp @b |
198 | @@: |
205 | @@: |
199 | 206 | ||
200 | xchg ebx,ecx |
207 | xchg ebx,ecx |
201 | 208 | ||
202 | 209 | ||
203 | xor ecx,ecx |
210 | xor ecx,ecx |
204 | 211 | ||
205 | 212 | ||
206 | @@: |
213 | @@: |
207 | xor eax,eax |
214 | xor eax,eax |
208 | lodsb |
215 | lodsb |
209 | cmp al,0 |
216 | cmp al,0 |
210 | je .eend |
217 | je .eend |
211 | 218 | ||
212 | sub al,30h |
219 | sub al,30h |
213 | imul ebx |
220 | imul ebx |
214 | add ecx,eax |
221 | add ecx,eax |
215 | push ecx |
222 | push ecx |
216 | xchg eax,ebx |
223 | xchg eax,ebx |
217 | mov ecx,10 |
224 | mov ecx,10 |
218 | div ecx |
225 | div ecx |
219 | xchg eax,ebx |
226 | xchg eax,ebx |
220 | pop ecx |
227 | pop ecx |
221 | jmp @b |
228 | jmp @b |
222 | 229 | ||
223 | .eend: |
230 | .eend: |
224 | mov [esp+28],ecx |
231 | mov [esp+28],ecx |
225 | popad |
232 | popad |
226 | ret |
233 | ret |
227 | endp |
234 | endp |
228 | 235 | ||
229 | ;convert string to DWord for hex value |
236 | ;convert string to DWord for hex value |
230 | proc strtoint_hex stdcall,strs |
237 | proc strtoint_hex stdcall,strs |
231 | pushad |
238 | pushad |
232 | xor edx,edx |
239 | xor edx,edx |
233 | 240 | ||
234 | mov esi,[strs] |
241 | mov esi,[strs] |
235 | mov ebx,1 |
242 | mov ebx,1 |
236 | add esi,1 |
243 | add esi,1 |
237 | 244 | ||
238 | @@: |
245 | @@: |
239 | lodsb |
246 | lodsb |
240 | or al,al |
247 | or al,al |
241 | jz @f |
248 | jz @f |
242 | shl ebx,4 |
249 | shl ebx,4 |
243 | jmp @b |
250 | jmp @b |
244 | @@: |
251 | @@: |
245 | xor ecx,ecx |
252 | xor ecx,ecx |
246 | mov esi,[strs] |
253 | mov esi,[strs] |
247 | 254 | ||
248 | @@: |
255 | @@: |
249 | xor eax,eax |
256 | xor eax,eax |
250 | lodsb |
257 | lodsb |
251 | cmp al,0 |
258 | cmp al,0 |
252 | je .eend |
259 | je .eend |
253 | 260 | ||
254 | cmp al,'a' |
261 | cmp al,'a' |
255 | jae .bm |
262 | jae .bm |
256 | cmp al,'A' |
263 | cmp al,'A' |
257 | jae .bb |
264 | jae .bb |
258 | jmp .cc |
265 | jmp .cc |
259 | .bm: ; 57h |
266 | .bm: ; 57h |
260 | sub al,57h |
267 | sub al,57h |
261 | jmp .do |
268 | jmp .do |
262 | 269 | ||
263 | .bb: ; 37h |
270 | .bb: ; 37h |
264 | sub al,37h |
271 | sub al,37h |
265 | jmp .do |
272 | jmp .do |
266 | 273 | ||
267 | .cc: ; 30h |
274 | .cc: ; 30h |
268 | sub al,30h |
275 | sub al,30h |
269 | 276 | ||
270 | .do: |
277 | .do: |
271 | imul ebx |
278 | imul ebx |
272 | add ecx,eax |
279 | add ecx,eax |
273 | shr ebx,4 |
280 | shr ebx,4 |
274 | 281 | ||
275 | jmp @b |
282 | jmp @b |
276 | 283 | ||
277 | .eend: |
284 | .eend: |
278 | mov [esp+28],ecx |
285 | mov [esp+28],ecx |
279 | popad |
286 | popad |
280 | ret |
287 | ret |
281 | endp |
288 | endp |
282 | 289 | ||
283 | 290 | ||
284 | ; convert string to DWord for IP addres |
291 | ; convert string to DWord for IP addres |
285 | proc do_inet_adr stdcall,strs |
292 | proc do_inet_adr stdcall,strs |
286 | pushad |
293 | pushad |
287 | 294 | ||
288 | mov esi,[strs] |
295 | mov esi,[strs] |
289 | mov ebx,0 |
296 | mov ebx,0 |
290 | .next: |
297 | .next: |
291 | push esi |
298 | push esi |
292 | @@: |
299 | @@: |
293 | lodsb |
300 | lodsb |
294 | or al,al |
301 | or al,al |
295 | jz @f |
302 | jz @f |
296 | cmp al,'.' |
303 | cmp al,'.' |
297 | jz @f |
304 | jz @f |
298 | jmp @b |
305 | jmp @b |
299 | @@: |
306 | @@: |
300 | mov cl, al |
307 | mov cl, al |
301 | mov [esi-1],byte 0 |
308 | mov [esi-1],byte 0 |
302 | ;pop eax |
309 | ;pop eax |
303 | call strtoint_dec |
310 | call strtoint_dec |
304 | rol eax,24 |
311 | rol eax,24 |
305 | ror ebx,8 |
312 | ror ebx,8 |
306 | add ebx,eax |
313 | add ebx,eax |
307 | or cl,cl |
314 | or cl,cl |
308 | jz @f |
315 | jz @f |
309 | jmp .next |
316 | jmp .next |
310 | @@: |
317 | @@: |
311 | mov [esp+28],ebx |
318 | mov [esp+28],ebx |
312 | popad |
319 | popad |
313 | ret |
320 | ret |
314 | endp |
321 | endp |