Subversion Repositories Kolibri OS

Rev

Rev 230 | Rev 254 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 230 Rev 233
Line 1... Line 1...
1
LOAD_FROM_FILE  equ 0
1
LOAD_FROM_FILE  equ 0
2
LOAD_FROM_MEM   equ 1
2
LOAD_FROM_MEM   equ 1
3
LOAD_INDIRECT   equ 2
3
LOAD_INDIRECT   equ 2
4
LOAD_SYSTEM     equ 3
4
LOAD_SYSTEM     equ 3
-
 
5
VIDEO_FREE      equ 2
Line 5... Line 6...
5
 
6
 
6
struc BITMAPINFOHEADER {
7
struc BITMAPINFOHEADER {
7
  .biSize          dd ? ; DWORD
8
  .biSize          dd ? ; DWORD
8
  .biWidth         dd ? ; LONG
9
  .biWidth         dd ? ; LONG
Line 38... Line 39...
38
           mov eax,esi
39
           mov eax,esi
39
 
40
 
Line 40... Line 41...
40
           cmp [esi+BI.biBitCount], 24
41
           cmp [esi+BI.biBitCount], 24
41
           je .img_24
42
           je .img_24
-
 
43
           cmp [esi+BI.biBitCount], 8
-
 
44
           je .img_8
-
 
45
           cmp [esi+BI.biBitCount], 4
-
 
46
           je .img_4
-
 
47
 
-
 
48
.img_2:
-
 
49
           add eax, [esi]
-
 
50
           mov [pQuad],eax
-
 
51
           add eax,8
-
 
52
           mov [pBits],eax
-
 
53
           add eax, 128
-
 
54
           mov [pAnd],eax
-
 
55
           mov eax,[esi+4]
-
 
56
           mov [width],eax
-
 
57
           mov ebx,[esi+8]
-
 
58
           shr ebx,1
-
 
59
           mov [height],ebx
-
 
60
 
-
 
61
           mov edi, [dst]
-
 
62
           add edi, 32*31*4
-
 
63
           mov [rBase],edi
-
 
64
 
-
 
65
           mov esi,[pQuad]
-
 
66
.l21:
-
 
67
           mov ebx, [pBits]
-
 
68
           mov ebx, [ebx]
-
 
69
           bswap ebx
-
 
70
           mov eax, [pAnd]
-
 
71
           mov eax, [eax]
-
 
72
           bswap eax
-
 
73
           mov [counter], 32
-
 
74
@@:
-
 
75
           xor edx, edx
-
 
76
           shl eax,1
-
 
77
           setc dl
-
 
78
           dec edx
-
 
79
 
-
 
80
           xor ecx, ecx
-
 
81
           shl ebx,1
-
 
82
           setc cl
-
 
83
           mov ecx, [esi+ecx*4]
-
 
84
           and ecx, edx
-
 
85
           and edx, 0xFF000000
-
 
86
           or edx, ecx
-
 
87
           mov [edi], edx
-
 
88
 
-
 
89
           add edi, 4
-
 
90
           dec [counter]
-
 
91
           jnz @B
-
 
92
 
-
 
93
           add [pBits], 4
-
 
94
           add [pAnd], 4
-
 
95
           mov edi,[rBase]
-
 
96
           sub edi,128
-
 
97
           mov [rBase],edi
-
 
98
           sub [height],1
-
 
99
           jnz .l21
-
 
100
           ret
-
 
101
 
42
.img_4:
102
.img_4:
43
           add eax, [esi]
103
           add eax, [esi]
44
           mov [pQuad],eax
104
           mov [pQuad],eax
45
           add eax,64
105
           add eax,64
46
           mov [pBits],eax
106
           mov [pBits],eax
Line 55... Line 115...
55
           mov edi, [dst]
115
           mov edi, [dst]
56
           add edi, 32*31*4
116
           add edi, 32*31*4
57
           mov [rBase],edi
117
           mov [rBase],edi
Line 58... Line 118...
58
 
118
 
59
           mov esi,[pAnd]
119
           mov esi,[pQuad]
60
           mov ebx, [pBits]
120
           mov ebx, [pBits]
-
 
121
.l4:
61
.l1:
122
           mov eax, [pAnd]
62
           mov eax, [esi]
123
           mov eax, [eax]
63
           bswap eax
124
           bswap eax
64
           mov [counter], 16
125
           mov [counter], 16
65
@@:
126
@@:
66
           xor edx, edx
127
           xor edx, edx
67
           shl eax,1
128
           shl eax,1
68
           setc dl
129
           setc dl
Line 69... Line 130...
69
           dec edx
130
           dec edx
70
 
131
 
71
           mov ecx, [ebx]
132
           movzx ecx, byte [ebx]
72
           and ecx, 0xF0
-
 
73
           shr ecx, 2
133
           and cl, 0xF0
74
           add ecx, [pQuad]
134
           shr ecx, 2
75
           mov ecx, [ecx]
135
           mov ecx, [esi+ecx]
76
           and ecx, edx
136
           and ecx, edx
77
           and edx, 0xFF000000
137
           and edx, 0xFF000000
Line 78... Line 138...
78
           or edx, ecx
138
           or edx, ecx
79
           mov [edi], edx
139
           mov [edi], edx
80
 
140
 
81
           xor edx, edx
141
           xor edx, edx
Line 82... Line 142...
82
           shl eax,1
142
           shl eax,1
83
           setc dl
143
           setc dl
84
           dec edx
-
 
85
 
-
 
86
           mov ecx, [ebx]
144
           dec edx
87
           and ecx, 0x0F
145
 
88
           shl ecx, 2
146
           movzx ecx, byte [ebx]
89
           add ecx, [pQuad]
147
           and cl, 0x0F
90
           mov ecx, [ecx]
148
           mov ecx, [esi+ecx*4]
Line 91... Line 149...
91
           and ecx, edx
149
           and ecx, edx
92
           and edx, 0xFF000000
150
           and edx, 0xFF000000
93
           or edx, ecx
151
           or edx, ecx
94
           mov [edi+4], edx
152
           mov [edi+4], edx
Line -... Line 153...
-
 
153
 
-
 
154
           inc ebx
-
 
155
           add edi, 8
-
 
156
           dec [counter]
-
 
157
           jnz @B
-
 
158
 
-
 
159
           add [pAnd], 4
-
 
160
           mov edi,[rBase]
-
 
161
           sub edi,128
-
 
162
           mov [rBase],edi
-
 
163
           sub [height],1
-
 
164
           jnz .l4
-
 
165
           ret
-
 
166
.img_8:
-
 
167
           add eax, [esi]
-
 
168
           mov [pQuad],eax
-
 
169
           add eax,1024
-
 
170
           mov [pBits],eax
-
 
171
           add eax, 1024
-
 
172
           mov [pAnd],eax
-
 
173
           mov eax,[esi+4]
-
 
174
           mov [width],eax
-
 
175
           mov ebx,[esi+8]
-
 
176
           shr ebx,1
-
 
177
           mov [height],ebx
-
 
178
 
-
 
179
           mov edi, [dst]
-
 
180
           add edi, 32*31*4
-
 
181
           mov [rBase],edi
-
 
182
 
-
 
183
           mov esi,[pQuad]
-
 
184
           mov ebx, [pBits]
-
 
185
.l81:
-
 
186
           mov eax, [pAnd]
-
 
187
           mov eax, [eax]
-
 
188
           bswap eax
-
 
189
           mov [counter], 32
-
 
190
@@:
-
 
191
           xor edx, edx
-
 
192
           shl eax,1
-
 
193
           setc dl
-
 
194
           dec edx
-
 
195
 
-
 
196
           movzx ecx,  byte [ebx]
-
 
197
           mov ecx, [esi+ecx*4]
95
 
198
           and ecx, edx
-
 
199
           and edx, 0xFF000000
-
 
200
           or edx, ecx
-
 
201
           mov [edi], edx
-
 
202
 
96
           inc ebx
203
           inc ebx
97
           add edi, 8
204
           add edi, 4
98
           dec [counter]
205
           dec [counter]
99
           jnz @B
206
           jnz @B
100
 
207
 
101
           add esi, 4
208
           add [pAnd], 4
102
           mov edi,[rBase]
209
           mov edi,[rBase]
103
           sub edi,128
210
           sub edi,128
104
           mov [rBase],edi
211
           mov [rBase],edi
105
           sub [height],1
212
           sub [height],1
Line 188... Line 295...
188
           ret
295
           ret
189
endp
296
endp
190
 
297
 
Line 191... Line 298...
191
align 4
298
align 4
-
 
299
proc free_cursor
-
 
300
           pushfd
-
 
301
           cli
-
 
302
           xor edx, edx
-
 
303
           mov ecx, CURSOR_SIZE
-
 
304
           sub eax, cursors
-
 
305
           div ecx
-
 
306
           test edx, edx
-
 
307
           jnz .exit
-
 
308
 
-
 
309
           mov ebx, cursor_map
-
 
310
           bts [ebx], eax
-
 
311
           shr eax, 3
-
 
312
           and eax, not 3
-
 
313
           add eax, ebx
-
 
314
           cmp [cursor_start], eax
-
 
315
           ja @f
-
 
316
.exit:
-
 
317
           popfd
-
 
318
           ret
-
 
319
@@:
-
 
320
           mov [cursor_start], eax
-
 
321
           popfd
-
 
322
           ret
-
 
323
endp
-
 
324
 
-
 
325
 
-
 
326
align 4
192
proc set_cursor stdcall, hcursor:dword
327
proc set_cursor stdcall, hcursor:dword
193
           mov eax, [hcursor]
328
           mov eax, [hcursor]
194
           cmp [eax+CURSOR.magic], 'CURS'
329
           cmp [eax+CURSOR.magic], 'CURS'
195
           jne .fail
330
           jne .fail
196
           cmp [eax+CURSOR.size], CURSOR_SIZE
331
           cmp [eax+CURSOR.size], CURSOR_SIZE
Line 280... Line 415...
280
           ret
415
           ret
281
endp
416
endp
282
 
417
 
Line 283... Line 418...
283
align 4
418
align 4
-
 
419
proc delete_cursor stdcall, hcursor:dword
-
 
420
           locals
-
 
421
             hsrv       dd ?
-
 
422
             io_code    dd ?
-
 
423
             input      dd ?
-
 
424
             inp_size   dd ?
-
 
425
             output     dd ?
-
 
426
             out_size   dd ?
-
 
427
           endl
-
 
428
 
-
 
429
           mov esi, [hcursor]
-
 
430
           cmp [esi+CURSOR.magic], 'CURS'
-
 
431
           jne .fail
-
 
432
           cmp [esi+CURSOR.size], CURSOR_SIZE
-
 
433
           jne .fail
-
 
434
 
-
 
435
           mov ebx, [CURRENT_TASK]
-
 
436
           shl ebx, 5
-
 
437
           mov ebx, [0x3000+ebx+4]
-
 
438
           cmp ebx, [esi+CURSOR.pid]
-
 
439
           jne .fail
-
 
440
 
-
 
441
           mov ebx, [CURRENT_TASK]
-
 
442
           shl ebx, 8
-
 
443
           cmp esi, [ebx+PROC_BASE+APPDATA.cursor]
-
 
444
           jne @F
-
 
445
           mov eax, [def_cursor]
-
 
446
           mov [ebx+PROC_BASE+APPDATA.cursor], eax
-
 
447
@@:
-
 
448
           mov eax, [hw_cursor]
-
 
449
           test eax, eax
-
 
450
           jz @F
-
 
451
 
-
 
452
           xor ebx, ebx
-
 
453
           mov ecx, [esi+CURSOR.base]
-
 
454
           mov [hsrv], eax
-
 
455
           mov [io_code], VIDEO_FREE
-
 
456
           mov [input], ecx
-
 
457
           mov [inp_size], 4
-
 
458
           mov [output], ebx
-
 
459
           mov [out_size], ebx
-
 
460
 
-
 
461
           lea eax, [hsrv]
-
 
462
           stdcall srv_handler, eax
-
 
463
           jmp .exit
-
 
464
@@:
-
 
465
           stdcall kernel_free, [esi+CURSOR.base]
-
 
466
.exit:
-
 
467
           mov eax, [hcursor]
-
 
468
           call free_cursor
-
 
469
           ret
-
 
470
.fail:
-
 
471
           ret
-
 
472
endp
-
 
473
 
-
 
474
align 4
284
proc init_cursors
475
proc init_cursors
-
 
476
           cmp [0xfe0c],word 0x13
-
 
477
           jbe .fail
-
 
478
 
285
           movzx eax, byte [ScreenBPP]
479
           movzx eax, byte [ScreenBPP]
286
           mov ebx, [SCR_BYTES_PER_LINE]
480
           mov ebx, [SCR_BYTES_PER_LINE]
287
           cmp eax, 32
481
           cmp eax, 32
288
           jne @F
482
           jne @F
289
           sub ebx, 128
483
           sub ebx, 128
Line 309... Line 503...
309
           add edx, 8
503
           add edx, 8
310
           mov [cursor_end], edx
504
           mov [cursor_end], edx
311
 
505
 
Line 312... Line 506...
312
           stdcall load_driver, drv_hw_mouse
506
           stdcall load_driver, drv_hw_mouse
-
 
507
           mov [hw_cursor], eax
313
           test eax, eax
508
           test eax, eax
314
           jz .sw_mouse
509
           jz .sw_mouse
Line 315... Line 510...
315
 
510
 
316
           stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
511
           stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM