Subversion Repositories Kolibri OS

Rev

Rev 1161 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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.  
  8. ;-------------------------------------------------------------------------
  9. ;Loading configuration from ini file
  10. ;    {SPraid.simba}
  11. ;-------------------------------------------------------------------------
  12.  
  13. $Revision: 1206 $
  14.  
  15.  
  16. conf_path_sect: db 'path',0
  17.  
  18. conf_fname db '/sys/sys.conf',0
  19.  
  20. ; set soke kernel configuration
  21. proc set_kernel_conf
  22.         locals
  23.           par db 30 dup(?)
  24.         endl
  25.  
  26.         pushad
  27. ;[gui]
  28. ;mouse_speed
  29.  
  30.         lea eax,[par]
  31.         push eax
  32.         invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed,\
  33.               eax,30, ugui_mouse_speed_def
  34.         pop eax
  35.         stdcall strtoint,eax
  36.         mov     [mouse_speed_factor], ax
  37.  
  38. ;mouse_delay
  39.         lea eax,[par]
  40.         push eax
  41.         invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay,\
  42.                eax,30, ugui_mouse_delay_def
  43.         pop eax
  44.         stdcall strtoint,eax
  45.         mov     [mouse_delay], eax
  46.  
  47.  
  48. ;midibase
  49.         lea eax,[par]
  50.         push eax
  51.         invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
  52.         pop eax
  53.         stdcall strtoint,eax
  54.  
  55.         cmp     eax, 0x100
  56.         jb      @f
  57.         cmp     eax, 0x10000
  58.         jae     @f
  59.         mov     [midi_base], ax
  60.         mov     [mididp], eax
  61.         inc     eax
  62.         mov     [midisp], eax
  63. @@:
  64.         popad
  65.         ret
  66. endp
  67.  
  68. ugui db 'gui',0
  69. ugui_mouse_speed db 'mouse_speed',0
  70. ugui_mouse_speed_def db '2',0
  71. ugui_mouse_delay db 'mouse_delay',0
  72. ugui_mouse_delay_def db '0x00A',0
  73.  
  74. udev db 'dev',0
  75. udev_midibase db 'midibase',0
  76. udev_midibase_def db '0x320',0
  77.  
  78.  
  79. ; convert string to DWord
  80. proc strtoint stdcall,strs
  81.   pushad
  82.  
  83.   mov eax,[strs]
  84.   inc eax
  85.   mov bl,[eax]
  86.   cmp bl,'x'
  87.   je .hex
  88.   cmp bl,'X'
  89.   je .hex
  90.   jmp .dec
  91. .hex:
  92.   inc eax
  93.   stdcall strtoint_hex,eax
  94.   jmp .exit
  95. .dec:
  96.   dec eax
  97.   stdcall strtoint_dec,eax
  98. .exit:
  99.   mov [esp+28],eax
  100.   popad
  101.   ret
  102. endp
  103.  
  104. ; convert string to DWord for decimal value
  105. proc strtoint_dec stdcall,strs
  106.   pushad
  107.   xor edx,edx
  108.   ; ¯®¨áª ª®­æ 
  109.   mov esi,[strs]
  110. @@:
  111.   lodsb
  112.   or al,al
  113.   jnz @b
  114.   mov ebx,esi
  115.   mov esi,[strs]
  116.   dec ebx
  117.   sub ebx,esi
  118.   mov ecx,1
  119.  
  120. @@:
  121.   dec ebx
  122.   or ebx,ebx
  123.   jz @f
  124.   imul ecx,ecx,10  ; ¯®à冷ª
  125.   jmp @b
  126. @@:
  127.  
  128.  xchg ebx,ecx
  129.  
  130.  
  131.   xor ecx,ecx
  132.  
  133.  
  134. @@:
  135.   xor eax,eax
  136.   lodsb
  137.   cmp al,0
  138.   je .eend
  139.  
  140.   sub al,30h
  141.   imul ebx
  142.   add ecx,eax
  143.   push ecx
  144.   xchg eax,ebx
  145.   mov ecx,10
  146.   div ecx
  147.   xchg eax,ebx
  148.   pop ecx
  149.   jmp @b
  150.  
  151. .eend:
  152.   mov [esp+28],ecx
  153.   popad
  154.   ret
  155. endp
  156.  
  157. ;convert string to DWord for hex value
  158. proc strtoint_hex stdcall,strs
  159.   pushad
  160.   xor edx,edx
  161.  
  162.   mov esi,[strs]
  163.   mov ebx,1
  164.   add esi,1
  165.  
  166. @@:
  167.   lodsb
  168.   or al,al
  169.   jz @f
  170.   shl ebx,4
  171.   jmp @b
  172. @@:
  173.   xor ecx,ecx
  174.   mov esi,[strs]
  175.  
  176. @@:
  177.   xor eax,eax
  178.   lodsb
  179.   cmp al,0
  180.   je .eend
  181.  
  182.   cmp al,'a'
  183.   jae .bm
  184.   cmp al,'A'
  185.   jae .bb
  186.   jmp .cc
  187. .bm:    ; 57h
  188.   sub al,57h
  189.   jmp .do
  190.  
  191. .bb:    ; 37h
  192.   sub al,37h
  193.   jmp .do
  194.  
  195. .cc:    ; 30h
  196.   sub al,30h
  197.  
  198. .do:
  199.   imul ebx
  200.   add ecx,eax
  201.   shr ebx,4
  202.  
  203.   jmp @b
  204.  
  205. .eend:
  206.   mov [esp+28],ecx
  207.   popad
  208.   ret
  209. endp
  210.  
  211.  
  212. ; convert string to DWord for IP addres
  213. proc do_inet_adr stdcall,strs
  214.   pushad
  215.  
  216.   mov esi,[strs]
  217.   mov ebx,0
  218. .next:
  219.   push esi
  220. @@:
  221.   lodsb
  222.   or al,al
  223.   jz @f
  224.   cmp al,'.'
  225.   jz @f
  226.   jmp @b
  227. @@:
  228.   mov cl, al
  229.   mov [esi-1],byte 0
  230.   ;pop eax
  231.   call strtoint_dec
  232.   rol eax,24
  233.   ror ebx,8
  234.   add ebx,eax
  235.   or cl,cl
  236.   jz @f
  237.   jmp .next
  238. @@:
  239.   mov [esp+28],ebx
  240.   popad
  241.   ret
  242. endp
  243.