Subversion Repositories Kolibri OS

Rev

Rev 2382 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
750 victor 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2540 hidnplayr 3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
750 victor 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
488 spraid 8
;-------------------------------------------------------------------------
535 spraid 9
;Loading configuration from ini file
10
;    {SPraid.simba}
488 spraid 11
;-------------------------------------------------------------------------
12
 
2540 hidnplayr 13
$Revision $
593 mikedld 14
 
1276 Lrz 15
iglobal
2382 hidnplayr 16
conf_path_sect:
17
                db 'path',0
488 spraid 18
 
525 diamond 19
conf_fname db '/sys/sys.conf',0
1276 Lrz 20
endg
535 spraid 21
; set soke kernel configuration
497 spraid 22
proc set_kernel_conf
802 serge 23
        locals
24
          par db 30 dup(?)
25
        endl
26
 
27
        pushad
28
;[gui]
29
;mouse_speed
30
 
2382 hidnplayr 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
536 diamond 37
        mov     [mouse_speed_factor], ax
802 serge 38
 
39
;mouse_delay
2382 hidnplayr 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
536 diamond 46
        mov     [mouse_delay], eax
494 spraid 47
 
802 serge 48
 
49
;midibase
2382 hidnplayr 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
802 serge 55
 
536 diamond 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
@@:
802 serge 65
        popad
66
        ret
494 spraid 67
endp
1276 Lrz 68
iglobal
494 spraid 69
ugui db 'gui',0
70
ugui_mouse_speed db 'mouse_speed',0
497 spraid 71
ugui_mouse_speed_def db '2',0
494 spraid 72
ugui_mouse_delay db 'mouse_delay',0
497 spraid 73
ugui_mouse_delay_def db '0x00A',0
494 spraid 74
 
75
udev db 'dev',0
76
udev_midibase db 'midibase',0
497 spraid 77
udev_midibase_def db '0x320',0
1276 Lrz 78
endg
802 serge 79
 
535 spraid 80
; convert string to DWord
494 spraid 81
proc strtoint stdcall,strs
2382 hidnplayr 82
        pushad
802 serge 83
 
2382 hidnplayr 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
494 spraid 92
.hex:
2382 hidnplayr 93
        inc     eax
94
        stdcall strtoint_hex, eax
95
        jmp     .exit
494 spraid 96
.dec:
2382 hidnplayr 97
        dec     eax
98
        stdcall strtoint_dec, eax
494 spraid 99
.exit:
2382 hidnplayr 100
        mov     [esp+28], eax
101
        popad
102
        ret
494 spraid 103
endp
104
 
535 spraid 105
; convert string to DWord for decimal value
494 spraid 106
proc strtoint_dec stdcall,strs
2382 hidnplayr 107
        pushad
108
        xor     edx, edx
497 spraid 109
  ; поиск конца
2382 hidnplayr 110
        mov     esi, [strs]
497 spraid 111
@@:
2382 hidnplayr 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
497 spraid 120
 
121
@@:
2382 hidnplayr 122
        dec     ebx
123
        or      ebx, ebx
124
        jz      @f
125
        imul    ecx, ecx, 10; порядок
126
        jmp     @b
497 spraid 127
@@:
128
 
2382 hidnplayr 129
        xchg    ebx, ecx
497 spraid 130
 
802 serge 131
 
2382 hidnplayr 132
        xor     ecx, ecx
494 spraid 133
 
802 serge 134
 
135
@@:
2382 hidnplayr 136
        xor     eax, eax
137
        lodsb
138
        cmp     al, 0
139
        je      .eend
802 serge 140
 
2382 hidnplayr 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
802 serge 151
 
497 spraid 152
.eend:
2382 hidnplayr 153
        mov     [esp+28], ecx
154
        popad
155
        ret
494 spraid 156
endp
157
 
535 spraid 158
;convert string to DWord for hex value
494 spraid 159
proc strtoint_hex stdcall,strs
2382 hidnplayr 160
        pushad
161
        xor     edx, edx
497 spraid 162
 
2382 hidnplayr 163
        mov     esi, [strs]
164
        mov     ebx, 1
165
        add     esi, 1
497 spraid 166
 
167
@@:
2382 hidnplayr 168
        lodsb
169
        or      al, al
170
        jz      @f
171
        shl     ebx, 4
172
        jmp     @b
497 spraid 173
@@:
2382 hidnplayr 174
        xor     ecx, ecx
175
        mov     esi, [strs]
494 spraid 176
 
802 serge 177
@@:
2382 hidnplayr 178
        xor     eax, eax
179
        lodsb
180
        cmp     al, 0
181
        je      .eend
802 serge 182
 
2382 hidnplayr 183
        cmp     al, 'a'
184
        jae     .bm
185
        cmp     al, 'A'
186
        jae     .bb
187
        jmp     .cc
497 spraid 188
.bm:    ; 57h
2382 hidnplayr 189
        sub     al, 57h
190
        jmp     .do
802 serge 191
 
497 spraid 192
.bb:    ; 37h
2382 hidnplayr 193
        sub     al, 37h
194
        jmp     .do
494 spraid 195
 
497 spraid 196
.cc:    ; 30h
2382 hidnplayr 197
        sub     al, 30h
802 serge 198
 
199
.do:
2382 hidnplayr 200
        imul    ebx
201
        add     ecx, eax
202
        shr     ebx, 4
494 spraid 203
 
2382 hidnplayr 204
        jmp     @b
497 spraid 205
 
206
.eend:
2382 hidnplayr 207
        mov     [esp+28], ecx
208
        popad
209
        ret
802 serge 210
endp