Subversion Repositories Kolibri OS

Rev

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

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