Subversion Repositories Kolibri OS

Rev

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

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