Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1 ha 1
max_buttons=4095
2
dececx:
3
 
4
    push eax
5
    push edx
6
    push ecx
7
 
8
    mov  edx,1
9
  dececl:
10
 
11
    movzx eax,byte [esp+edx]
12
    cmp   eax,0x20
13
    jge   @f
14
    mov   [esp+edx],byte 0x20
15
   @@:
16
    sub   [esp+edx],byte 0x20
17
 
18
    add  edx,1
19
    cmp  edx,4
20
    jbe  dececl
21
 
22
    pop  ecx
23
    pop  edx
24
    pop  eax
25
    ret
26
 
27
 
28
drawbuttonframes:
29
 
30
        push  esi
31
        push  edi
32
        push  eax
33
        push  ebx
34
        push  ecx
35
        push  edx
36
 
37
        shr   eax,16
38
        shr   ebx,16
39
        mov   edx,[0x3010]
40
 
41
        add   eax,[edx-twdw]
42
        add   ebx,[edx-twdw+4]
43
        mov   cx,ax
44
        mov   dx,bx
45
        shl   eax,16
46
        shl   ebx,16
47
        mov   ax,cx
48
        mov   bx,dx
49
        add   ax,word [esp+12]
50
        mov   esi,ebx
51
        mov   edi,0
52
        mov   ecx,[esp+0]
53
        add   ecx,0x202020
54
        call  [draw_line]
55
 
56
        movzx edx,word [esp+8]
57
        add   ebx,edx
58
        shl   edx,16
59
        add   ebx,edx
60
        mov   ecx,[esp+0]
61
        call  dececx
62
        call  [draw_line]
63
 
64
        mov   ebx,esi
65
        push  edx
66
        mov   edx,eax
67
        shr   edx,16
68
        mov   ax,dx
69
        mov   edx,ebx
70
        shr   edx,16
71
        mov   bx,dx
72
        mov   dx,[esp+8+4]
73
        add   bx,dx
74
        pop   edx
75
        mov   edi,0
76
        mov   ecx,[esp+0]
77
        add   ecx,0x202020
78
        call  [draw_line]
79
 
80
        mov   esi,edx
81
        mov   dx,[esp+12]
82
        add   ax,dx
83
        shl   edx,16
84
        add   eax,edx
85
        add   ebx,1*65536
86
        mov   edx,esi
87
        mov   ecx,[esp+0]
88
        call  dececx
89
        call  [draw_line]
90
 
91
        pop   edx
92
        pop   ecx
93
        pop   ebx
94
        pop   eax
95
        pop   edi
96
        pop   esi
97
 
98
        ret
99
 
100
button_dececx:
101
 
102
        cmp   [buttontype],dword 1
103
        jne   .finish
104
;        je    bdece
105
;        ret
106
;      bdece:
107
        push  eax
108
        mov   eax,0x01
109
        cmp   edi,20
110
        jg    @f
111
        mov   eax,0x02
112
      @@:
113
        test  ecx,0xff
114
        jz    @f
115
        sub   ecx,eax
116
      @@:
117
        shl   eax,8
118
        test  ecx,0xff00
119
        jz    @f
120
        sub   ecx,eax
121
      @@:
122
        shl   eax,8
123
        test  ecx,0xff0000
124
        jz    @f
125
        sub   ecx,eax
126
      @@:
127
        pop    eax
128
      .finish:
129
        ret
130
 
131
 
132
sys_button:
133
 
134
        test  ecx,0x80000000
135
        jnz   remove_button
136
 
137
        push  esi
138
        push  edi
139
        push  eax
140
        push  ebx
141
        push  ecx
142
        push  edx
143
 
144
        test  ecx,0x40000000
145
        jnz   button_no_draw
146
 
147
        pushad                       ; button body
148
        push  ebx
149
        shr   eax,16
150
        shr   ebx,16
151
        mov   edx,[0x3010]
152
        mov   esi,[edx-twdw]
153
        mov   edi,[edx-twdw+4]
154
        add   eax,esi
155
        add   ebx,edi
156
        mov   cx,ax
157
        mov   dx,bx
158
        shl   eax,16
159
        shl   ebx,16
160
        mov   ax,cx
161
        mov   bx,dx
162
        movzx ecx,word [4+32+esp+12]
163
        add   eax,ecx
164
        mov   ecx,[4+32+esp+0]
165
        cmp   [buttontype],dword 0
166
        je    @f
167
        add   ecx,0x141414
168
       @@:
169
        movzx edi,word [esp]
170
 
171
; 
172
        pop   edx
173
        and   edx, 0xFFFF
174
   ;;cli
175
     .newline:
176
        call  button_dececx
177
        push  edi
178
        xor   edi, edi
179
        call  [draw_line]
180
        pop   edi
181
        add   ebx,1*65536+1   ; [ y start | y end ]
182
        dec   edx
183
        jnz   .newline
184
   ;;sti
185
;;        pop   ebx
186
; 
187
        popad
188
 
189
        call  drawbuttonframes
190
 
191
      button_no_draw:
192
 
193
        and   ecx,0xffff
194
 
195
        mov   edi,[0x3010]
196
        sub   edi,twdw
197
 
198
        mov   edi,[0xfe88]
199
        movzx eax,word [edi]
200
        cmp   eax,max_buttons
201
        jge   noaddbutt
202
        inc   eax
203
        mov   [edi],ax
204
 
205
        shl   eax,4
206
        add   eax,edi
207
 
208
        mov   bx,[0x3000]
209
        mov   [eax],bx
210
 
211
        add   eax,2         ; save button id number
212
        mov   ebx,[esp+4]
213
        mov   [eax],bx      ; bits 0-15
214
        shr   ebx,16
215
        mov   [eax-2+0xc],bx; bits 16-31
216
        add   eax,2         ; x start
217
        mov   bx,[esp+12+2]
218
        mov   [eax],bx
219
        add   eax,2         ; x size
220
        mov   bx,[esp+12+0]
221
        mov   [eax],bx
222
        add   eax,2         ; y start
223
        mov   bx,[esp+8+2]
224
        mov   [eax],bx
225
        add   eax,2         ; y size
226
        mov   bx,[esp+8+0]
227
        mov   [eax],bx
228
 
229
     noaddbutt:
230
 
231
        pop   edx
232
        pop   ecx
233
        pop   ebx
234
        pop   eax
235
        pop   edi
236
        pop   esi
237
 
238
        ret
239
 
240
 
241
remove_button:
242
 
243
    and  ecx,0x7fffffff
244
 
245
  rnewba2:
246
 
247
    mov   edi,[0xfe88]
248
    mov   eax,edi
249
    movzx ebx,word [edi]
250
    inc   bx
251
 
252
  rnewba:
253
 
254
    dec   bx
255
    jz    rnmba
256
 
257
    add   eax,0x10
258
 
259
    mov   dx,[0x3000]
260
    cmp   dx,[eax]
261
    jnz   rnewba
262
 
263
    cmp   cx,[eax+2]
264
    jnz   rnewba
265
 
266
    pushad
267
    mov   ecx,ebx
268
    inc   ecx
269
    shl   ecx,4
270
    mov   ebx,eax
271
    add   eax,0x10
272
    call  memmove
273
    dec   dword [edi]
274
    popad
275
 
276
    jmp   rnewba2
277
 
278
  rnmba:
279
 
280
    ret
281
 
282
find_pressed_button_frames:
283
 
284
        pushad