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