Subversion Repositories Kolibri OS

Rev

Rev 536 | Rev 750 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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