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