Subversion Repositories Kolibri OS

Rev

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

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