2008-02-19 10:14:38 +03:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
2007-05-11 23:38:23 +04:00
|
|
|
|
;-------------------------------------------------------------------------
|
2007-06-07 16:56:40 +04:00
|
|
|
|
;Loading configuration from ini file
|
|
|
|
|
; {SPraid.simba}
|
2007-05-11 23:38:23 +04:00
|
|
|
|
;-------------------------------------------------------------------------
|
|
|
|
|
|
2007-07-27 17:52:03 +04:00
|
|
|
|
$Revision$
|
|
|
|
|
|
2009-11-20 05:36:08 +03:00
|
|
|
|
iglobal
|
2007-05-20 13:04:59 +04:00
|
|
|
|
conf_path_sect: db 'path',0
|
|
|
|
|
|
2007-05-29 12:32:11 +04:00
|
|
|
|
conf_fname db '/sys/sys.conf',0
|
2009-11-20 05:36:08 +03:00
|
|
|
|
endg
|
2007-06-07 16:56:40 +04:00
|
|
|
|
; set soke kernel configuration
|
2007-05-15 22:05:31 +04:00
|
|
|
|
proc set_kernel_conf
|
2008-06-09 16:12:09 +04:00
|
|
|
|
locals
|
|
|
|
|
par db 30 dup(?)
|
|
|
|
|
endl
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
;[gui]
|
|
|
|
|
;mouse_speed
|
|
|
|
|
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
push eax
|
|
|
|
|
invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed,\
|
|
|
|
|
eax,30, ugui_mouse_speed_def
|
|
|
|
|
pop eax
|
|
|
|
|
stdcall strtoint,eax
|
2007-06-07 17:34:43 +04:00
|
|
|
|
mov [mouse_speed_factor], ax
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
|
|
|
|
;mouse_delay
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
push eax
|
|
|
|
|
invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay,\
|
|
|
|
|
eax,30, ugui_mouse_delay_def
|
|
|
|
|
pop eax
|
|
|
|
|
stdcall strtoint,eax
|
2007-06-07 17:34:43 +04:00
|
|
|
|
mov [mouse_delay], eax
|
2007-05-15 16:03:26 +04:00
|
|
|
|
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
|
|
|
|
;midibase
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
push eax
|
|
|
|
|
invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
|
|
|
|
|
pop eax
|
|
|
|
|
stdcall strtoint,eax
|
|
|
|
|
|
2007-06-07 17:34:43 +04:00
|
|
|
|
cmp eax, 0x100
|
|
|
|
|
jb @f
|
|
|
|
|
cmp eax, 0x10000
|
|
|
|
|
jae @f
|
|
|
|
|
mov [midi_base], ax
|
|
|
|
|
mov [mididp], eax
|
|
|
|
|
inc eax
|
|
|
|
|
mov [midisp], eax
|
|
|
|
|
@@:
|
2008-06-09 16:12:09 +04:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2007-05-15 16:03:26 +04:00
|
|
|
|
endp
|
2009-11-20 05:36:08 +03:00
|
|
|
|
iglobal
|
2007-05-15 16:03:26 +04:00
|
|
|
|
ugui db 'gui',0
|
|
|
|
|
ugui_mouse_speed db 'mouse_speed',0
|
2007-05-15 22:05:31 +04:00
|
|
|
|
ugui_mouse_speed_def db '2',0
|
2007-05-15 16:03:26 +04:00
|
|
|
|
ugui_mouse_delay db 'mouse_delay',0
|
2007-05-15 22:05:31 +04:00
|
|
|
|
ugui_mouse_delay_def db '0x00A',0
|
2007-05-15 16:03:26 +04:00
|
|
|
|
|
|
|
|
|
udev db 'dev',0
|
|
|
|
|
udev_midibase db 'midibase',0
|
2007-05-15 22:05:31 +04:00
|
|
|
|
udev_midibase_def db '0x320',0
|
2009-11-20 05:36:08 +03:00
|
|
|
|
endg
|
2007-06-07 16:56:40 +04:00
|
|
|
|
;set up netvork configuration
|
2007-05-20 13:04:59 +04:00
|
|
|
|
proc set_network_conf
|
|
|
|
|
locals
|
|
|
|
|
par db 30 dup(?)
|
|
|
|
|
endl
|
|
|
|
|
pushad
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-20 13:04:59 +04:00
|
|
|
|
;[net]
|
|
|
|
|
;active
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
invoke ini.get_int,conf_fname, unet, unet_active, 0
|
|
|
|
|
or eax,eax
|
|
|
|
|
jz .do_not_set_net
|
2007-06-07 17:34:43 +04:00
|
|
|
|
mov eax, [stack_config]
|
|
|
|
|
and eax, 0xFFFFFF80
|
|
|
|
|
add eax, 3
|
|
|
|
|
mov [stack_config], eax
|
|
|
|
|
call ash_eth_enable
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-20 13:04:59 +04:00
|
|
|
|
;addr
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
push eax
|
|
|
|
|
invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def
|
|
|
|
|
pop eax
|
|
|
|
|
stdcall do_inet_adr,eax
|
2007-06-07 17:34:43 +04:00
|
|
|
|
mov [stack_ip], eax
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-20 13:04:59 +04:00
|
|
|
|
;mask
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
push eax
|
|
|
|
|
invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def
|
|
|
|
|
pop eax
|
|
|
|
|
stdcall do_inet_adr,eax
|
2007-06-07 17:34:43 +04:00
|
|
|
|
mov [subnet_mask], eax
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-20 13:04:59 +04:00
|
|
|
|
;gate
|
|
|
|
|
lea eax,[par]
|
|
|
|
|
push eax
|
|
|
|
|
invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def
|
|
|
|
|
pop eax
|
|
|
|
|
stdcall do_inet_adr,eax
|
2007-06-07 17:34:43 +04:00
|
|
|
|
mov [gateway_ip], eax
|
2008-06-09 16:12:09 +04:00
|
|
|
|
.do_not_set_net:
|
2007-05-20 13:04:59 +04:00
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
endp
|
2009-11-20 05:36:08 +03:00
|
|
|
|
iglobal
|
2007-05-20 13:04:59 +04:00
|
|
|
|
unet db 'net',0
|
|
|
|
|
unet_active db 'active',0
|
|
|
|
|
unet_addr db 'addr',0
|
|
|
|
|
unet_mask db 'mask',0
|
|
|
|
|
unet_gate db 'gate',0
|
|
|
|
|
unet_def db 0
|
2009-11-20 05:36:08 +03:00
|
|
|
|
endg
|
2007-06-07 16:56:40 +04:00
|
|
|
|
; convert string to DWord
|
2007-05-15 16:03:26 +04:00
|
|
|
|
proc strtoint stdcall,strs
|
|
|
|
|
pushad
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-15 16:03:26 +04:00
|
|
|
|
mov eax,[strs]
|
|
|
|
|
inc eax
|
|
|
|
|
mov bl,[eax]
|
|
|
|
|
cmp bl,'x'
|
|
|
|
|
je .hex
|
|
|
|
|
cmp bl,'X'
|
|
|
|
|
je .hex
|
|
|
|
|
jmp .dec
|
|
|
|
|
.hex:
|
|
|
|
|
inc eax
|
|
|
|
|
stdcall strtoint_hex,eax
|
|
|
|
|
jmp .exit
|
|
|
|
|
.dec:
|
|
|
|
|
dec eax
|
|
|
|
|
stdcall strtoint_dec,eax
|
|
|
|
|
.exit:
|
2007-05-15 22:05:31 +04:00
|
|
|
|
mov [esp+28],eax
|
2007-05-15 16:03:26 +04:00
|
|
|
|
popad
|
2008-06-09 16:12:09 +04:00
|
|
|
|
ret
|
2007-05-15 16:03:26 +04:00
|
|
|
|
endp
|
|
|
|
|
|
2007-06-07 16:56:40 +04:00
|
|
|
|
; convert string to DWord for decimal value
|
2007-05-15 16:03:26 +04:00
|
|
|
|
proc strtoint_dec stdcall,strs
|
|
|
|
|
pushad
|
2007-05-15 22:05:31 +04:00
|
|
|
|
xor edx,edx
|
|
|
|
|
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov esi,[strs]
|
|
|
|
|
@@:
|
|
|
|
|
lodsb
|
|
|
|
|
or al,al
|
|
|
|
|
jnz @b
|
|
|
|
|
mov ebx,esi
|
|
|
|
|
mov esi,[strs]
|
|
|
|
|
dec ebx
|
|
|
|
|
sub ebx,esi
|
|
|
|
|
mov ecx,1
|
|
|
|
|
|
|
|
|
|
@@:
|
|
|
|
|
dec ebx
|
|
|
|
|
or ebx,ebx
|
|
|
|
|
jz @f
|
|
|
|
|
imul ecx,ecx,10 ; <EFBFBD><EFBFBD><EFBFBD>冷<EFBFBD>
|
|
|
|
|
jmp @b
|
|
|
|
|
@@:
|
|
|
|
|
|
|
|
|
|
xchg ebx,ecx
|
|
|
|
|
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-15 16:03:26 +04:00
|
|
|
|
xor ecx,ecx
|
|
|
|
|
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
|
|
|
|
@@:
|
2007-05-15 16:03:26 +04:00
|
|
|
|
xor eax,eax
|
|
|
|
|
lodsb
|
|
|
|
|
cmp al,0
|
2007-05-15 22:05:31 +04:00
|
|
|
|
je .eend
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-15 16:03:26 +04:00
|
|
|
|
sub al,30h
|
|
|
|
|
imul ebx
|
|
|
|
|
add ecx,eax
|
2007-05-15 22:05:31 +04:00
|
|
|
|
push ecx
|
|
|
|
|
xchg eax,ebx
|
|
|
|
|
mov ecx,10
|
|
|
|
|
div ecx
|
|
|
|
|
xchg eax,ebx
|
|
|
|
|
pop ecx
|
2007-05-15 16:03:26 +04:00
|
|
|
|
jmp @b
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-15 22:05:31 +04:00
|
|
|
|
.eend:
|
|
|
|
|
mov [esp+28],ecx
|
2007-05-15 16:03:26 +04:00
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
endp
|
|
|
|
|
|
2007-06-07 16:56:40 +04:00
|
|
|
|
;convert string to DWord for hex value
|
2007-05-15 16:03:26 +04:00
|
|
|
|
proc strtoint_hex stdcall,strs
|
|
|
|
|
pushad
|
2007-05-15 22:05:31 +04:00
|
|
|
|
xor edx,edx
|
|
|
|
|
|
|
|
|
|
mov esi,[strs]
|
|
|
|
|
mov ebx,1
|
|
|
|
|
add esi,1
|
|
|
|
|
|
|
|
|
|
@@:
|
|
|
|
|
lodsb
|
|
|
|
|
or al,al
|
|
|
|
|
jz @f
|
|
|
|
|
shl ebx,4
|
|
|
|
|
jmp @b
|
|
|
|
|
@@:
|
2007-05-15 16:03:26 +04:00
|
|
|
|
xor ecx,ecx
|
|
|
|
|
mov esi,[strs]
|
|
|
|
|
|
2008-06-09 16:12:09 +04:00
|
|
|
|
@@:
|
2007-05-15 16:03:26 +04:00
|
|
|
|
xor eax,eax
|
|
|
|
|
lodsb
|
|
|
|
|
cmp al,0
|
2007-05-15 22:05:31 +04:00
|
|
|
|
je .eend
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-15 16:03:26 +04:00
|
|
|
|
cmp al,'a'
|
|
|
|
|
jae .bm
|
|
|
|
|
cmp al,'A'
|
|
|
|
|
jae .bb
|
|
|
|
|
jmp .cc
|
2007-05-15 22:05:31 +04:00
|
|
|
|
.bm: ; 57h
|
2007-05-15 16:03:26 +04:00
|
|
|
|
sub al,57h
|
|
|
|
|
jmp .do
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-15 22:05:31 +04:00
|
|
|
|
.bb: ; 37h
|
2007-05-15 16:03:26 +04:00
|
|
|
|
sub al,37h
|
|
|
|
|
jmp .do
|
|
|
|
|
|
2007-05-15 22:05:31 +04:00
|
|
|
|
.cc: ; 30h
|
2007-05-15 16:03:26 +04:00
|
|
|
|
sub al,30h
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
|
|
|
|
.do:
|
2007-05-15 16:03:26 +04:00
|
|
|
|
imul ebx
|
|
|
|
|
add ecx,eax
|
2007-05-15 22:05:31 +04:00
|
|
|
|
shr ebx,4
|
2007-05-15 16:03:26 +04:00
|
|
|
|
|
|
|
|
|
jmp @b
|
2007-05-15 22:05:31 +04:00
|
|
|
|
|
|
|
|
|
.eend:
|
|
|
|
|
mov [esp+28],ecx
|
2007-05-15 16:03:26 +04:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2008-06-09 16:12:09 +04:00
|
|
|
|
endp
|
2007-05-15 16:03:26 +04:00
|
|
|
|
|
|
|
|
|
|
2007-06-07 16:56:40 +04:00
|
|
|
|
; convert string to DWord for IP addres
|
2007-05-20 13:04:59 +04:00
|
|
|
|
proc do_inet_adr stdcall,strs
|
|
|
|
|
pushad
|
2008-06-09 16:12:09 +04:00
|
|
|
|
|
2007-05-20 13:04:59 +04:00
|
|
|
|
mov esi,[strs]
|
|
|
|
|
mov ebx,0
|
|
|
|
|
.next:
|
|
|
|
|
push esi
|
|
|
|
|
@@:
|
|
|
|
|
lodsb
|
|
|
|
|
or al,al
|
|
|
|
|
jz @f
|
|
|
|
|
cmp al,'.'
|
|
|
|
|
jz @f
|
|
|
|
|
jmp @b
|
|
|
|
|
@@:
|
|
|
|
|
mov cl, al
|
|
|
|
|
mov [esi-1],byte 0
|
|
|
|
|
;pop eax
|
|
|
|
|
call strtoint_dec
|
|
|
|
|
rol eax,24
|
|
|
|
|
ror ebx,8
|
|
|
|
|
add ebx,eax
|
|
|
|
|
or cl,cl
|
|
|
|
|
jz @f
|
|
|
|
|
jmp .next
|
|
|
|
|
@@:
|
|
|
|
|
mov [esp+28],ebx
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
endp
|