Subversion Repositories Kolibri OS

Rev

Rev 593 | Rev 802 | 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: 750 $
14
 
15
 
512 spraid 16
conf_path_sect: db 'path',0
488 spraid 17
 
525 diamond 18
conf_fname db '/sys/sys.conf',0
494 spraid 19
 
535 spraid 20
; set soke kernel configuration
497 spraid 21
proc set_kernel_conf
494 spraid 22
locals
23
  par db 30 dup(?)
24
endl
497 spraid 25
  pushad
494 spraid 26
  ;[gui]
27
  ;mouse_speed
512 spraid 28
  lea eax,[par]
494 spraid 29
  push eax
512 spraid 30
  invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def
497 spraid 31
  pop eax
536 diamond 32
  stdcall strtoint,eax
33
        mov     [mouse_speed_factor], ax
494 spraid 34
 
35
  ;mouse_delay
512 spraid 36
  lea eax,[par]
497 spraid 37
  push eax
512 spraid 38
  invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def
497 spraid 39
  pop eax
494 spraid 40
  stdcall strtoint,eax
536 diamond 41
        mov     [mouse_delay], eax
494 spraid 42
 
43
  ;[dev]
44
  ;sb16
512 spraid 45
  lea eax,[par]
497 spraid 46
  push eax
512 spraid 47
  invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def
497 spraid 48
  pop eax
494 spraid 49
  stdcall strtoint,eax
536 diamond 50
        cmp     eax, 0x100
51
        jb      @f
52
        cmp     eax, 0x10000
53
        jae     @f
54
        mov     [sb16], eax
55
@@:
494 spraid 56
 
57
  ;sound_dma
512 spraid 58
  lea eax,[par]
497 spraid 59
  push eax
512 spraid 60
  invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def
497 spraid 61
  pop eax
494 spraid 62
  stdcall strtoint,eax
536 diamond 63
        cmp     eax, 3
64
        ja      @f
65
        mov     [sound_dma], eax
66
@@:
494 spraid 67
 
68
  ;midibase
512 spraid 69
  lea eax,[par]
497 spraid 70
  push eax
512 spraid 71
  invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
497 spraid 72
  pop eax
494 spraid 73
  stdcall strtoint,eax
536 diamond 74
        cmp     eax, 0x100
75
        jb      @f
76
        cmp     eax, 0x10000
77
        jae     @f
78
        mov     [midi_base], ax
79
        mov     [mididp], eax
80
        inc     eax
81
        mov     [midisp], eax
82
@@:
512 spraid 83
 
497 spraid 84
  popad
85
  ret
494 spraid 86
endp
87
 
88
ugui db 'gui',0
89
ugui_mouse_speed db 'mouse_speed',0
497 spraid 90
ugui_mouse_speed_def db '2',0
494 spraid 91
ugui_mouse_delay db 'mouse_delay',0
497 spraid 92
ugui_mouse_delay_def db '0x00A',0
494 spraid 93
 
94
udev db 'dev',0
95
udev_sb16 db 'sb16',0
497 spraid 96
udev_sb16_def db '0x220',0
494 spraid 97
udev_sound_dma db 'sound_dma',0
497 spraid 98
udev_sound_dma_def db '1',0
494 spraid 99
udev_midibase db 'midibase',0
497 spraid 100
udev_midibase_def db '0x320',0
494 spraid 101
 
535 spraid 102
;set up netvork configuration
512 spraid 103
proc set_network_conf
104
locals
105
  par db 30 dup(?)
106
endl
107
  pushad
108
 
109
  ;[net]
110
  ;active
111
  lea eax,[par]
112
  invoke ini.get_int,conf_fname, unet, unet_active, 0
113
  or eax,eax
114
  jz .do_not_set_net
536 diamond 115
        mov     eax, [stack_config]
116
        and     eax, 0xFFFFFF80
117
        add     eax, 3
118
        mov     [stack_config], eax
119
        call    ash_eth_enable
512 spraid 120
 
121
  ;addr
122
  lea eax,[par]
123
  push eax
124
  invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def
125
  pop eax
126
  stdcall do_inet_adr,eax
536 diamond 127
        mov     [stack_ip], eax
512 spraid 128
 
129
  ;mask
130
  lea eax,[par]
131
  push eax
132
  invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def
133
  pop eax
134
  stdcall do_inet_adr,eax
536 diamond 135
        mov     [subnet_mask], eax
512 spraid 136
 
137
  ;gate
138
  lea eax,[par]
139
  push eax
140
  invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def
141
  pop eax
142
  stdcall do_inet_adr,eax
536 diamond 143
        mov     [gateway_ip], eax
512 spraid 144
.do_not_set_net:
145
  popad
146
  ret
147
 
148
 
149
endp
150
 
151
unet db 'net',0
152
unet_active db 'active',0
153
unet_addr db 'addr',0
154
unet_mask db 'mask',0
155
unet_gate db 'gate',0
156
unet_def db 0
157
 
535 spraid 158
; convert string to DWord
494 spraid 159
proc strtoint stdcall,strs
160
  pushad
161
 
162
  mov eax,[strs]
163
  inc eax
164
  mov bl,[eax]
165
  cmp bl,'x'
166
  je .hex
167
  cmp bl,'X'
168
  je .hex
169
  jmp .dec
170
.hex:
171
  inc eax
172
  stdcall strtoint_hex,eax
173
  jmp .exit
174
.dec:
175
  dec eax
176
  stdcall strtoint_dec,eax
177
.exit:
497 spraid 178
  mov [esp+28],eax
494 spraid 179
  popad
180
  ret
181
endp
182
 
535 spraid 183
; convert string to DWord for decimal value
494 spraid 184
proc strtoint_dec stdcall,strs
185
  pushad
497 spraid 186
  xor edx,edx
187
  ; поиск конца
188
  mov esi,[strs]
189
@@:
190
  lodsb
191
  or al,al
192
  jnz @b
193
  mov ebx,esi
194
  mov esi,[strs]
195
  dec ebx
196
  sub ebx,esi
197
  mov ecx,1
198
 
199
@@:
200
  dec ebx
201
  or ebx,ebx
202
  jz @f
203
  imul ecx,ecx,10  ; порядок
204
  jmp @b
205
@@:
206
 
207
 xchg ebx,ecx
208
 
494 spraid 209
 
210
  xor ecx,ecx
497 spraid 211
 
494 spraid 212
 
213
@@:
214
  xor eax,eax
215
  lodsb
216
  cmp al,0