Subversion Repositories Kolibri OS

Rev

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

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