Subversion Repositories Kolibri OS

Rev

Rev 525 | Rev 530 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. $Revision$
  2. ;-------------------------------------------------------------------------
  3. ;
  4. ;    ” ©« ª®­ä¨£ãà æ¨¨
  5. ;
  6. ;
  7. ;     SPraid
  8. ;
  9. ;-------------------------------------------------------------------------
  10.  
  11. conf_file_loaded: db 0                  ; ä« £ § £à㧪¨ ª®­ä¨£ 
  12. conf_path_sect: db 'path',0
  13.  
  14. conf_fname db '/sys/sys.conf',0
  15.  
  16.  
  17.  
  18. proc set_kernel_conf
  19. locals
  20.   par db 30 dup(?)
  21. endl
  22.   pushad
  23.   ;[gui]
  24.   ;mouse_speed
  25.   lea eax,[par]
  26.   push eax
  27.   invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def        
  28.   pop eax
  29.   stdcall strtoint,eax
  30.   push eax
  31.   pop edx
  32.   call _mouse_speed
  33.  
  34.   popad
  35.   ret
  36.  
  37.   ;mouse_delay
  38.   lea eax,[par]
  39.   push eax
  40.   invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def
  41.   pop eax
  42.   stdcall strtoint,eax
  43.   push eax
  44.   pop edx
  45.   call _mouse_delay
  46.  
  47.   ;[dev]
  48.   ;sb16
  49.   lea eax,[par]
  50.   push eax
  51.   invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def
  52.   pop eax
  53.   stdcall strtoint,eax
  54.   push eax
  55.   pop ecx
  56.   call _sb16
  57.  
  58.   ;sound_dma
  59.   lea eax,[par]
  60.   push eax
  61.   invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def
  62.   pop eax
  63.   stdcall strtoint,eax
  64.   push eax
  65.   pop ecx
  66.   call _sound_dma  
  67.  
  68.  
  69.   ;midibase
  70.   lea eax,[par]
  71.   push eax
  72.   invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
  73.   pop eax
  74.   stdcall strtoint,eax
  75.   push eax
  76.   pop ecx
  77.   call _midibase
  78.  
  79.  
  80.   popad
  81.   ret
  82. endp
  83.  
  84. ugui db 'gui',0
  85. ugui_mouse_speed db 'mouse_speed',0
  86. ugui_mouse_speed_def db '2',0
  87. ugui_mouse_delay db 'mouse_delay',0
  88. ugui_mouse_delay_def db '0x00A',0
  89.  
  90. udev db 'dev',0
  91. udev_sb16 db 'sb16',0
  92. udev_sb16_def db '0x220',0
  93. udev_sound_dma db 'sound_dma',0
  94. udev_sound_dma_def db '1',0
  95. udev_midibase db 'midibase',0
  96. udev_midibase_def db '0x320',0
  97.  
  98. proc set_network_conf
  99. locals
  100.   par db 30 dup(?)
  101. endl
  102.   pushad
  103.  
  104.   ;[net]
  105.   ;active
  106.   lea eax,[par]
  107.   invoke ini.get_int,conf_fname, unet, unet_active, 0
  108.   or eax,eax
  109.   jz .do_not_set_net
  110.   call _net_up  
  111.  
  112.   ;addr
  113.   lea eax,[par]
  114.   push eax
  115.   invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def
  116.   pop eax
  117.   stdcall do_inet_adr,eax
  118.   push eax
  119.   pop ecx
  120.   call _net_addr
  121.  
  122.   ;mask
  123.   lea eax,[par]
  124.   push eax
  125.   invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def
  126.   pop eax
  127.   stdcall do_inet_adr,eax
  128.   push eax
  129.   pop ecx
  130.   call _net_mask  
  131.  
  132.   ;gate
  133.   lea eax,[par]
  134.   push eax
  135.   invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def
  136.   pop eax
  137.   stdcall do_inet_adr,eax
  138.   push eax
  139.   pop ecx
  140.   call _net_gate
  141. .do_not_set_net:
  142.   popad
  143.   ret
  144.  
  145.  
  146. endp
  147.  
  148. unet db 'net',0
  149. unet_active db 'active',0
  150. unet_addr db 'addr',0
  151. unet_mask db 'mask',0
  152. unet_gate db 'gate',0
  153. unet_def db 0
  154.  
  155. ; ª®­¢¥à祭¨¥ áâப¨ ¢ DWord ¢ eax (¯® ¢â®à®¬ã ᨬ¢®«ã ®¯à¥¤¥«ï¥â á¨á⥬ã áç¨á«¥­¨ï)
  156.      
  157. proc strtoint stdcall,strs
  158.   pushad
  159.  
  160.   mov eax,[strs]
  161.   inc eax
  162.   mov bl,[eax]
  163.   cmp bl,'x'
  164.   je .hex
  165.   cmp bl,'X'
  166.   je .hex
  167.   jmp .dec
  168. .hex:
  169.   inc eax
  170.   stdcall strtoint_hex,eax
  171.   jmp .exit
  172. .dec:
  173.   dec eax
  174.   stdcall strtoint_dec,eax
  175. .exit:
  176.   mov [esp+28],eax
  177.   popad
  178.   ret  
  179. endp
  180.  
  181. ; ª®­¢¥à祭¨¥ áâப¨ ¢ DWord ¢ eax ¤«ï ¤¥áïâ¨ç­®£®
  182. proc strtoint_dec stdcall,strs
  183.   pushad
  184.   xor edx,edx
  185.   ; ¯®¨áª ª®­æ 
  186.   mov esi,[strs]
  187. @@:
  188.   lodsb
  189.   or al,al
  190.   jnz @b
  191.   mov ebx,esi
  192.   mov esi,[strs]
  193.   dec ebx
  194.   sub ebx,esi
  195.   mov ecx,1
  196.  
  197. @@:
  198.   dec ebx
  199.   or ebx,ebx
  200.   jz @f
  201.   imul ecx,ecx,10  ; ¯®à冷ª
  202.   jmp @b
  203. @@:
  204.  
  205.  xchg ebx,ecx
  206.  
  207.  
  208.   xor ecx,ecx
  209.  
  210.  
  211. @@:  
  212.   xor eax,eax
  213.   lodsb
  214.   cmp al,0
  215.   je .eend
  216.  
  217.   sub al,30h
  218.   imul ebx
  219.   add ecx,eax
  220.   push ecx
  221.   xchg eax,ebx
  222.   mov ecx,10
  223.   div ecx
  224.   xchg eax,ebx
  225.   pop ecx
  226.   jmp @b
  227.  
  228. .eend:
  229.   mov [esp+28],ecx
  230.   popad
  231.   ret
  232. endp
  233.  
  234. ; ª®­¢¥à祭¨¥ áâப¨ ¢ DWord ¢ eax ¤«ï è¥á­ ¤æ â¨à¨ç­®£®
  235. proc strtoint_hex stdcall,strs
  236.   pushad
  237.   xor edx,edx
  238.  
  239.   mov esi,[strs]
  240.   mov ebx,1
  241.   add esi,1
  242.  
  243. @@:
  244.   lodsb
  245.   or al,al
  246.   jz @f
  247.   shl ebx,4
  248.   jmp @b
  249. @@:
  250.   xor ecx,ecx
  251.   mov esi,[strs]
  252.  
  253. @@:  
  254.   xor eax,eax
  255.   lodsb
  256.   cmp al,0
  257.   je .eend
  258.  
  259.   cmp al,'a'
  260.   jae .bm
  261.   cmp al,'A'
  262.   jae .bb
  263.   jmp .cc
  264. .bm:    ; 57h
  265.   sub al,57h
  266.   jmp .do
  267.  
  268. .bb:    ; 37h
  269.   sub al,37h
  270.   jmp .do
  271.  
  272. .cc:    ; 30h
  273.   sub al,30h
  274.  
  275. .do:  
  276.   imul ebx
  277.   add ecx,eax
  278.   shr ebx,4
  279.  
  280.   jmp @b
  281.  
  282. .eend:
  283.   mov [esp+28],ecx
  284.   popad
  285.   ret
  286. endp    
  287.  
  288.  
  289.  ; ¯à¥®¡à §®¢ âì  ¤à¥á ¢ â® çâ® ­ ¤ , ¥á«¨ ¯ãáâ® â® ¢¥à­ãâì 0
  290. proc do_inet_adr stdcall,strs
  291.   pushad
  292.  
  293.   mov esi,[strs]
  294.   mov ebx,0
  295. .next:
  296.   push esi
  297. @@:
  298.   lodsb
  299.   or al,al
  300.   jz @f
  301.   cmp al,'.'
  302.   jz @f
  303.   jmp @b
  304. @@:
  305.   mov cl, al
  306.   mov [esi-1],byte 0
  307.   ;pop eax
  308.   call strtoint_dec
  309.   rol eax,24
  310.   ror ebx,8
  311.   add ebx,eax
  312.   or cl,cl
  313.   jz @f
  314.   jmp .next
  315. @@:
  316.   mov [esp+28],ebx
  317.   popad
  318.   ret
  319. endp
  320.  
  321.  
  322. ; ãáâ ­®¢ª¨ ¨§ setup
  323.  
  324. _mouse_speed:
  325.     mov  eax,18
  326.     mov  ebx,19
  327.     mov  ecx,1
  328.     int 0x40
  329.  ret
  330.  
  331. _mouse_delay:
  332.     mov  eax,18
  333.     mov  ebx,19
  334.     mov  ecx,3
  335.     int 0x40
  336.  ret
  337.  
  338. _sb16:
  339.     mov  eax,21
  340.     mov  ebx,4
  341.     int 0x40
  342.  ret
  343.    
  344. _sound_dma:
  345.     mov  eax,21
  346.     mov  ebx,10
  347.     int 0x40
  348.  ret
  349.  
  350.  
  351. _midibase:
  352.     mov  eax,21
  353.     mov  ebx,1
  354.     int 0x40
  355.  ret
  356.  
  357. _net_addr:
  358.     mov eax,52
  359.     mov ebx,3
  360.     int 0x40
  361.  ret
  362.  
  363. _net_mask:
  364.     mov eax,52
  365.     mov ebx,12
  366.     int 0x40
  367.  ret
  368.  
  369. _net_gate:
  370.     mov eax,52
  371.     mov ebx,11
  372.     int 0x40
  373.  ret
  374.  
  375. _net_up:
  376.     mov eax,52
  377.     mov ebx,0
  378.     int 0x40
  379.     and eax,0xFFFFFF80
  380.     add eax,3
  381.     mov ecx,eax
  382.    
  383.     mov eax,52
  384.     mov ebx,2
  385.     int 0x40
  386.  ret