Subversion Repositories Kolibri OS

Rev

Rev 9715 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
9715 Doczom 3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
2288 clevermous 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: 9977 $
14
 
3343 yogev_ezra 15
iglobal
2288 clevermous 16
conf_path_sect:
9977 rgimad 17
           db 'path',0
2288 clevermous 18
 
19
conf_fname db '/sys/sys.conf',0
20
endg
9977 rgimad 21
; set kernel configuration
2288 clevermous 22
proc set_kernel_conf
23
        locals
24
          par db 30 dup(?)
25
        endl
26
 
27
        pushad
9977 rgimad 28
; [gui]
29
; mouse_speed
2288 clevermous 30
 
31
        lea     eax, [par]
32
        push    eax
33
        invoke  ini.get_str, conf_fname, ugui, ugui_mouse_speed, \
9977 rgimad 34
                eax, 30, ugui_mouse_speed_def
2288 clevermous 35
        pop     eax
36
        stdcall strtoint, eax
37
        mov     [mouse_speed_factor], ax
38
 
9977 rgimad 39
; mouse_delay
2288 clevermous 40
        lea     eax, [par]
41
        push    eax
42
        invoke  ini.get_str, conf_fname, ugui, ugui_mouse_delay, \
9977 rgimad 43
                eax, 30, ugui_mouse_delay_def
2288 clevermous 44
        pop     eax
45
        stdcall strtoint, eax
46
        mov     [mouse_delay], eax
47
 
48
 
9977 rgimad 49
; midibase
2288 clevermous 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_def db '2',0
71
ugui_mouse_delay_def db '0x00A',0
72
udev_midibase db 'midibase',0
73
udev_midibase_def db '0x320',0
74
endg
75
 
76
iglobal
3345 yogev_ezra 77
if lang eq sp
78
  include 'core/conf_lib-sp.inc'
79
else
80
  ugui_mouse_speed db 'mouse_speed',0
81
  ugui_mouse_delay db 'mouse_delay',0
82
  udev db 'dev',0
83
  unet db 'net',0
84
  unet_active db 'active',0
85
  unet_addr db 'addr',0
86
  unet_mask db 'mask',0
87
  unet_gate db 'gate',0
3309 esevece 88
end if
2288 clevermous 89
unet_def db 0
90
endg
9977 rgimad 91
; convert string to dword
2288 clevermous 92
proc strtoint stdcall,strs
93
        pushad
94
 
95
        mov     eax, [strs]
96
        inc     eax
97
        mov     bl, [eax]
98
        cmp     bl, 'x'
99
        je      .hex
100
        cmp     bl, 'X'
101
        je      .hex
102
        jmp     .dec
103
.hex:
104
        inc     eax
105
        stdcall strtoint_hex, eax
106
        jmp     .exit
107
.dec:
108
        dec     eax
109
        stdcall strtoint_dec, eax
110
.exit:
111
        mov     [esp+28], eax
112
        popad
113
        ret
114
endp
115
 
9977 rgimad 116
; convert string to dword for decimal value
2288 clevermous 117
proc strtoint_dec stdcall,strs
118
        pushad
119
        xor     edx, edx
9977 rgimad 120
        ; search for the end
2288 clevermous 121
        mov     esi, [strs]
122
@@:
123
        lodsb
124
        or      al, al
125
        jnz     @b
126
        mov     ebx, esi
127
        mov     esi, [strs]
128
        dec     ebx
129
        sub     ebx, esi
130
        mov     ecx, 1
131
 
132
@@:
133
        dec     ebx
134
        or      ebx, ebx
135
        jz      @f
9977 rgimad 136
        imul    ecx, ecx, 10 ; order
2288 clevermous 137
        jmp     @b
138
@@:
139
        xchg    ebx, ecx
140
 
141
        xor     ecx, ecx
142
 
143
@@:
144
        xor     eax, eax
145
        lodsb
146
        cmp     al, 0
147
        je      .eend
148
 
149
        sub     al, 30h
150
        imul    ebx
151
        add     ecx, eax
152
        push    ecx
153
        xchg    eax, ebx
154
        mov     ecx, 10
155
        div     ecx
156
        xchg    eax, ebx
157
        pop     ecx
158
        jmp     @b
159
 
160
.eend:
161
        mov     [esp+28], ecx
162
        popad
163
        ret
164
endp
165
 
9977 rgimad 166
; convert string to dword for hex value
167
proc strtoint_hex stdcall, strs
2288 clevermous 168
        pushad
169
        xor     edx, edx
170
 
171
        mov     esi, [strs]
172
        mov     ebx, 1
173
        add     esi, 1
174
 
175
@@:
176
        lodsb
177
        or      al, al
178
        jz      @f
179
        shl     ebx, 4
180
        jmp     @b
181
@@:
182
        xor     ecx, ecx
183
        mov     esi, [strs]
184
 
185
@@:
186
        xor     eax, eax
187
        lodsb
188
        cmp     al, 0
189
        je      .eend
190
 
191
        cmp     al, 'a'
192
        jae     .bm
193
        cmp     al, 'A'
194
        jae     .bb
195
        jmp     .cc
196
.bm:    ; 57h
197
        sub     al, 57h
198
        jmp     .do
199
 
200
.bb:    ; 37h
201
        sub     al, 37h
202
        jmp     .do
203
 
204
.cc:    ; 30h
205
        sub     al, 30h
206
 
207
.do:
208
        imul    ebx
209
        add     ecx, eax
210
        shr     ebx, 4
211
 
212
        jmp     @b
213
 
214
.eend:
215
        mov     [esp+28], ecx
216
        popad
217
        ret
218
endp
219
 
220
 
9977 rgimad 221
; convert string to dword for IP address
222
proc do_inet_adr stdcall, strs
2288 clevermous 223
        pushad
224
 
225
        mov     esi, [strs]
9977 rgimad 226
        xor     ebx, ebx
2288 clevermous 227
.next:
228
        push    esi
229
@@:
230
        lodsb
231
        or      al, al
232
        jz      @f
233
        cmp     al, '.'
234
        jz      @f
235
        jmp     @b
236
@@:
237
        mov     cl, al
238
        mov     [esi-1], byte 0
239
  ;pop eax
240
        call    strtoint_dec
241
        rol     eax, 24
242
        ror     ebx, 8
243
        add     ebx, eax
244
        or      cl, cl
245
        jz      @f
246
        jmp     .next
247
@@:
248
        mov     [esp+28], ebx
249
        popad
250
        ret
251
endp