Subversion Repositories Kolibri OS

Rev

Rev 3555 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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