Subversion Repositories Kolibri OS

Rev

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

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