Subversion Repositories Kolibri OS

Rev

Rev 3545 | Rev 9715 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. 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: 5363 $
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
 
76
iglobal
3345 yogev_ezra 77
if lang eq sp
78
  include 'core/conf_lib-sp.inc'
79
else
80
  ugui_mouse_speed db 'mouse_speed',0
81
  ugui_mouse_delay db 'mouse_delay',0
82
  udev db 'dev',0
83
  unet db 'net',0
84
  unet_active db 'active',0
85
  unet_addr db 'addr',0
86
  unet_mask db 'mask',0
87
  unet_gate db 'gate',0
3309 esevece 88
end if
2288 clevermous 89
unet_def db 0
90
endg
91
; convert string to DWord
92
proc strtoint stdcall,strs
93
        pushad
94
 
95
        mov     eax, [strs]
96
        inc     eax
97
        mov     bl, [eax]
98
        cmp     bl, 'x'
99
        je      .hex
100
        cmp     bl, 'X'
101
        je      .hex
102
        jmp     .dec
103
.hex:
104
        inc     eax
105
        stdcall strtoint_hex, eax
106
        jmp     .exit
107
.dec:
108
        dec     eax
109
        stdcall strtoint_dec, eax
110
.exit:
111
        mov     [esp+28], eax
112
        popad
113
        ret
114
endp
115
 
116
; convert string to DWord for decimal value
117
proc strtoint_dec stdcall,strs
118
        pushad
119
        xor     edx, edx
3539 clevermous 120
  ; поиск конца
2288 clevermous 121
        mov     esi, [strs]
122
@@:
123
        lodsb
124
        or      al, al
125
        jnz     @b
126
        mov     ebx, esi
127
        mov     esi, [strs]
128
        dec     ebx
129
        sub     ebx, esi
130
        mov     ecx, 1
131
 
132
@@:
133
        dec     ebx
134
        or      ebx, ebx
135
        jz      @f
3539 clevermous 136
        imul    ecx, ecx, 10; порядок
2288 clevermous 137
        jmp     @b
138
@@:
139
 
140
        xchg    ebx, ecx
141
 
142
 
143
        xor     ecx, ecx
144
 
145
 
146
@@:
147
        xor     eax, eax
148
        lodsb
149
        cmp     al, 0
150
        je      .eend
151
 
152
        sub     al, 30h
153
        imul    ebx
154
        add     ecx, eax
155
        push    ecx
156
        xchg    eax, ebx
157
        mov     ecx, 10
158
        div     ecx
159
        xchg    eax, ebx
160
        pop     ecx
161
        jmp     @b
162
 
163
.eend:
164
        mov     [esp+28], ecx
165
        popad
166
        ret
167
endp
168
 
169
;convert string to DWord for hex value
170
proc strtoint_hex stdcall,strs
171
        pushad
172
        xor     edx, edx
173
 
174
        mov     esi, [strs]
175
        mov     ebx, 1
176
        add     esi, 1
177
 
178
@@:
179
        lodsb
180
        or      al, al
181
        jz      @f
182
        shl     ebx, 4
183
        jmp     @b
184
@@:
185
        xor     ecx, ecx
186
        mov     esi, [strs]
187
 
188
@@:
189
        xor     eax, eax
190
        lodsb
191
        cmp     al, 0
192
        je      .eend
193
 
194
        cmp     al, 'a'
195
        jae     .bm
196
        cmp     al, 'A'
197
        jae     .bb
198
        jmp     .cc
199
.bm:    ; 57h
200
        sub     al, 57h
201
        jmp     .do
202
 
203
.bb:    ; 37h
204
        sub     al, 37h
205
        jmp     .do
206
 
207
.cc:    ; 30h
208
        sub     al, 30h
209
 
210
.do:
211
        imul    ebx
212
        add     ecx, eax
213
        shr     ebx, 4
214
 
215
        jmp     @b
216
 
217
.eend:
218
        mov     [esp+28], ecx
219
        popad
220
        ret
221
endp
222
 
223
 
224
; convert string to DWord for IP addres
225
proc do_inet_adr stdcall,strs
226
        pushad
227
 
228
        mov     esi, [strs]
229
        mov     ebx, 0
230
.next:
231
        push    esi
232
@@:
233
        lodsb
234
        or      al, al
235
        jz      @f
236
        cmp     al, '.'
237
        jz      @f
238
        jmp     @b
239
@@:
240
        mov     cl, al
241
        mov     [esi-1], byte 0
242
  ;pop eax
243
        call    strtoint_dec
244
        rol     eax, 24
245
        ror     ebx, 8
246
        add     ebx, eax
247
        or      cl, cl
248
        jz      @f
249
        jmp     .next
250
@@:
251
        mov     [esp+28], ebx
252
        popad
253
        ret
254
endp