Subversion Repositories Kolibri OS

Rev

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