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