Subversion Repositories Kolibri OS

Rev

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

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