Rev 2288 | Rev 2384 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2288 | clevermous | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
||
4 | ;; Distributed under terms of the GNU General Public License ;; |
||
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
8 | $Revision: 2337 $ |
||
9 | |||
10 | |||
11 | LOAD_FROM_FILE equ 0 |
||
12 | LOAD_FROM_MEM equ 1 |
||
13 | LOAD_INDIRECT equ 2 |
||
14 | LOAD_SYSTEM equ 3 |
||
15 | |||
16 | struc BITMAPINFOHEADER { |
||
17 | .biSize dd ? ; DWORD |
||
18 | .biWidth dd ? ; LONG |
||
19 | .biHeight dd ? ; LONG |
||
20 | .biPlanes dw ? ; WORD |
||
21 | .biBitCount dw ? ; WORD |
||
22 | .biCompression dd ? ; DWORD |
||
23 | .biSizeImage dd ? ; DWORD |
||
24 | .biXPelsPerMeter dd ? ; LONG |
||
25 | .biYPelsPerMeter dd ? ; LONG |
||
26 | .biClrUsed dd ? ; DWORD |
||
27 | .biClrImportant dd ? ; DWORD |
||
28 | } |
||
29 | |||
30 | virtual at 0 |
||
31 | BI BITMAPINFOHEADER |
||
32 | end virtual |
||
33 | |||
34 | align 4 |
||
35 | proc init_cursor stdcall, dst:dword, src:dword |
||
36 | locals |
||
37 | rBase dd ? |
||
38 | pQuad dd ? |
||
39 | pBits dd ? |
||
40 | pAnd dd ? |
||
41 | width dd ? |
||
42 | height dd ? |
||
43 | counter dd ? |
||
44 | endl |
||
45 | |||
46 | mov esi, [src] |
||
47 | add esi, [esi+18] |
||
48 | mov eax, esi |
||
49 | |||
50 | cmp [esi+BI.biBitCount], 24 |
||
51 | je .img_24 |
||
52 | cmp [esi+BI.biBitCount], 8 |
||
53 | je .img_8 |
||
54 | cmp [esi+BI.biBitCount], 4 |
||
55 | je .img_4 |
||
56 | |||
57 | .img_2: |
||
58 | add eax, [esi] |
||
59 | mov [pQuad], eax |
||
60 | add eax, 8 |
||
61 | mov [pBits], eax |
||
62 | add eax, 128 |
||
63 | mov [pAnd], eax |
||
64 | mov eax, [esi+4] |
||
65 | mov [width], eax |
||
66 | mov ebx, [esi+8] |
||
67 | shr ebx, 1 |
||
68 | mov [height], ebx |
||
69 | |||
70 | mov edi, [dst] |
||
71 | add edi, 32*31*4 |
||
72 | mov [rBase], edi |
||
73 | |||
74 | mov esi, [pQuad] |
||
75 | .l21: |
||
76 | mov ebx, [pBits] |
||
77 | mov ebx, [ebx] |
||
78 | bswap ebx |
||
79 | mov eax, [pAnd] |
||
80 | mov eax, [eax] |
||
81 | bswap eax |
||
82 | mov [counter], 32 |
||
83 | @@: |
||
84 | xor edx, edx |
||
85 | shl eax, 1 |
||
86 | setc dl |
||
87 | dec edx |
||
88 | |||
89 | xor ecx, ecx |
||
90 | shl ebx, 1 |
||
91 | setc cl |
||
92 | mov ecx, [esi+ecx*4] |
||
93 | and ecx, edx |
||
94 | and edx, 0xFF000000 |
||
95 | or edx, ecx |
||
96 | mov [edi], edx |
||
97 | |||
98 | add edi, 4 |
||
99 | dec [counter] |
||
100 | jnz @B |
||
101 | |||
102 | add [pBits], 4 |
||
103 | add [pAnd], 4 |
||
104 | mov edi, [rBase] |
||
105 | sub edi, 128 |
||
106 | mov [rBase], edi |
||
107 | sub [height], 1 |
||
108 | jnz .l21 |
||
109 | ret |
||
110 | |||
111 | .img_4: |
||
112 | add eax, [esi] |
||
113 | mov [pQuad], eax |
||
114 | add eax, 64 |
||
115 | mov [pBits], eax |
||
116 | add eax, 0x200 |
||
117 | mov [pAnd], eax |
||
118 | mov eax, [esi+4] |
||
119 | mov [width], eax |
||
120 | mov ebx, [esi+8] |
||
121 | shr ebx, 1 |
||
122 | mov [height], ebx |
||
123 | |||
124 | mov edi, [dst] |
||
125 | add edi, 32*31*4 |
||
126 | mov [rBase], edi |
||
127 | |||
128 | mov esi, [pQuad] |
||
129 | mov ebx, [pBits] |
||
130 | .l4: |
||
131 | mov eax, [pAnd] |
||
132 | mov eax, [eax] |
||
133 | bswap eax |
||
134 | mov [counter], 16 |
||
135 | @@: |
||
136 | xor edx, edx |
||
137 | shl eax, 1 |
||
138 | setc dl |
||
139 | dec edx |
||
140 | |||
141 | movzx ecx, byte [ebx] |
||
142 | and cl, 0xF0 |
||
143 | shr ecx, 2 |
||
144 | mov ecx, [esi+ecx] |
||
145 | and ecx, edx |
||
146 | and edx, 0xFF000000 |
||
147 | or edx, ecx |
||
148 | mov [edi], edx |
||
149 | |||
150 | xor edx, edx |
||
151 | shl eax, 1 |
||
152 | setc dl |
||
153 | dec edx |
||
154 | |||
155 | movzx ecx, byte [ebx] |
||
156 | and cl, 0x0F |
||
157 | mov ecx, [esi+ecx*4] |
||
158 | and ecx, edx |
||
159 | and edx, 0xFF000000 |
||
160 | or edx, ecx |
||
161 | mov [edi+4], edx |
||
162 | |||
163 | inc ebx |
||
164 | add edi, 8 |
||
165 | dec [counter] |
||
166 | jnz @B |
||
167 | |||
168 | add [pAnd], 4 |
||
169 | mov edi, [rBase] |
||
170 | sub edi, 128 |
||
171 | mov [rBase], edi |
||
172 | sub [height], 1 |
||
173 | jnz .l4 |
||
174 | ret |
||
175 | .img_8: |
||
176 | add eax, [esi] |
||
177 | mov [pQuad], eax |
||
178 | add eax, 1024 |
||
179 | mov [pBits], eax |
||
180 | add eax, 1024 |
||
181 | mov [pAnd], eax |
||
182 | mov eax, [esi+4] |
||
183 | mov [width], eax |
||
184 | mov ebx, [esi+8] |
||
185 | shr ebx, 1 |
||
186 | mov [height], ebx |
||
187 | |||
188 | mov edi, [dst] |
||
189 | add edi, 32*31*4 |
||
190 | mov [rBase], edi |
||
191 | |||
192 | mov esi, [pQuad] |
||
193 | mov ebx, [pBits] |
||
194 | .l81: |
||
195 | mov eax, [pAnd] |
||
196 | mov eax, [eax] |
||
197 | bswap eax |
||
198 | mov [counter], 32 |
||
199 | @@: |
||
200 | xor edx, edx |
||
201 | shl eax, 1 |
||
202 | setc dl |
||
203 | dec edx |
||
204 | |||
205 | movzx ecx, byte [ebx] |
||
206 | mov ecx, [esi+ecx*4] |
||
207 | and ecx, edx |
||
208 | and edx, 0xFF000000 |
||
209 | or edx, ecx |
||
210 | mov [edi], edx |
||
211 | |||
212 | inc ebx |
||
213 | add edi, 4 |
||
214 | dec [counter] |
||
215 | jnz @B |
||
216 | |||
217 | add [pAnd], 4 |
||
218 | mov edi, [rBase] |
||
219 | sub edi, 128 |
||
220 | mov [rBase], edi |
||
221 | sub [height], 1 |
||
222 | jnz .l81 |
||
223 | ret |
||
224 | .img_24: |
||
225 | add eax, [esi] |
||
226 | mov [pQuad], eax |
||
227 | add eax, 0xC00 |
||
228 | mov [pAnd], eax |
||
229 | mov eax, [esi+BI.biWidth] |
||
230 | mov [width], eax |
||
231 | mov ebx, [esi+BI.biHeight] |
||
232 | shr ebx, 1 |
||
233 | mov [height], ebx |
||
234 | |||
235 | mov edi, [dst] |
||
236 | add edi, 32*31*4 |
||
237 | mov [rBase], edi |
||
238 | |||
239 | mov esi, [pAnd] |
||
240 | mov ebx, [pQuad] |
||
241 | .row_24: |
||
242 | mov eax, [esi] |
||
243 | bswap eax |
||
244 | mov [counter], 32 |
||
245 | @@: |
||
246 | xor edx, edx |
||
247 | shl eax, 1 |
||
248 | setc dl |
||
249 | dec edx |
||
250 | |||
251 | mov ecx, [ebx] |
||
252 | and ecx, 0x00FFFFFF |
||
253 | and ecx, edx |
||
254 | and edx, 0xFF000000 |
||
255 | or edx, ecx |
||
256 | mov [edi], edx |
||
257 | add ebx, 3 |
||
258 | add edi, 4 |
||
259 | dec [counter] |
||
260 | jnz @B |
||
261 | |||
262 | add esi, 4 |
||
263 | mov edi, [rBase] |
||
264 | sub edi, 128 |
||
265 | mov [rBase], edi |
||
266 | sub [height], 1 |
||
267 | jnz .row_24 |
||
268 | ret |
||
269 | endp |
||
270 | |||
271 | align 4 |
||
272 | proc set_cursor stdcall, hcursor:dword |
||
273 | mov eax, [hcursor] |
||
274 | cmp [eax+CURSOR.magic], 'CURS' |
||
275 | jne .fail |
||
276 | ; cmp [eax+CURSOR.size], CURSOR_SIZE |
||
277 | ; jne .fail |
||
278 | mov ebx, [current_slot] |
||
279 | xchg eax, [ebx+APPDATA.cursor] |
||
280 | ret |
||
281 | .fail: |
||
282 | mov eax, [def_cursor] |
||
283 | mov ebx, [current_slot] |
||
284 | xchg eax, [ebx+APPDATA.cursor] |
||
285 | ret |
||
286 | endp |
||
287 | |||
288 | ; param |
||
289 | ; eax= pid |
||
290 | ; ebx= src |
||
291 | ; ecx= flags |
||
292 | |||
293 | create_cursor: |
||
294 | .src equ esp |
||
295 | .flags equ esp+4 |
||
296 | .hcursor equ esp+8 |
||
297 | |||
298 | sub esp, 4 ;space for .hcursor |
||
299 | push ecx |
||
300 | push ebx |
||
301 | |||
302 | mov ebx, eax |
||
303 | mov eax, CURSOR.sizeof |
||
304 | call create_kernel_object |
||
305 | test eax, eax |
||
306 | jz .fail |
||
307 | |||
308 | mov [.hcursor], eax |
||
309 | |||
310 | xor ebx, ebx |
||
311 | mov [eax+CURSOR.magic], 'CURS' |
||
312 | mov [eax+CURSOR.destroy], destroy_cursor |
||
313 | mov [eax+CURSOR.hot_x], ebx |
||
314 | mov [eax+CURSOR.hot_y], ebx |
||
315 | |||
316 | stdcall kernel_alloc, 0x1000 |
||
317 | test eax, eax |
||
318 | jz .fail |
||
319 | |||
320 | mov edi, [.hcursor] |
||
321 | mov [edi+CURSOR.base], eax |
||
322 | |||
323 | mov esi, [.src] |
||
324 | mov ebx, [.flags] |
||
325 | cmp bx, LOAD_INDIRECT |
||
326 | je .indirect |
||
327 | |||
328 | movzx ecx, word [esi+10] |
||
329 | movzx edx, word [esi+12] |
||
330 | mov [edi+CURSOR.hot_x], ecx |
||
331 | mov [edi+CURSOR.hot_y], edx |
||
332 | |||
333 | stdcall init_cursor, eax, esi |
||
334 | |||
2337 | Serge | 335 | mov ecx, [.hcursor] |
336 | lea ecx, [ecx+CURSOR.list_next] |
||
2288 | clevermous | 337 | lea edx, [_display.cr_list.next] |
338 | |||
339 | pushfd |
||
340 | cli |
||
2337 | Serge | 341 | list_add ecx, edx ;list_add_tail(new, head) |
2288 | clevermous | 342 | popfd |
343 | |||
344 | mov eax, [.hcursor] |
||
345 | .check_hw: |
||
346 | cmp [_display.init_cursor], 0 |
||
347 | je .fail |
||
348 | |||
349 | push eax |
||
350 | call [_display.init_cursor] |
||
351 | add esp, 4 |
||
352 | |||
353 | mov eax, [.hcursor] |
||
354 | .fail: |
||
355 | add esp, 12 |
||
356 | ret |
||
357 | .indirect: |
||
358 | shr ebx, 16 |
||
359 | movzx ecx, bh |
||
360 | movzx edx, bl |
||
361 | mov [eax+CURSOR.hot_x], ecx |
||
362 | mov [eax+CURSOR.hot_y], edx |
||
363 | |||
364 | xchg edi, eax |
||
365 | mov ecx, 1024 |
||
366 | cld |
||
367 | rep movsd |
||
368 | jmp .check_hw |
||
369 | |||
370 | align 4 |
||
371 | proc load_cursor stdcall, src:dword, flags:dword |
||
372 | locals |
||
373 | handle dd ? |
||
374 | endl |
||
375 | |||
376 | xor eax, eax |
||
377 | cmp [create_cursor], eax |
||
378 | je .fail2 |
||
379 | |||
380 | mov [handle], eax |
||
381 | cmp word [flags], LOAD_FROM_FILE |
||
382 | jne @F |
||
383 | |||
384 | stdcall load_file, [src] |
||
385 | test eax, eax |
||
386 | jz .fail |
||
387 | mov [src], eax |
||
388 | @@: |
||
389 | push ebx |
||
390 | push esi |
||
391 | push edi |
||
392 | |||
393 | mov eax, [CURRENT_TASK] |
||
394 | shl eax, 5 |
||
395 | mov eax, [CURRENT_TASK+eax+4] |
||
396 | mov ebx, [src] |
||
397 | mov ecx, [flags] |
||
398 | call create_cursor ;eax, ebx, ecx |
||
399 | mov [handle], eax |
||
400 | |||
401 | cmp word [flags], LOAD_FROM_FILE |
||
402 | jne .exit |
||
403 | stdcall kernel_free, [src] |
||
404 | .exit: |
||
405 | pop edi |
||
406 | pop esi |
||
407 | pop ebx |
||
408 | .fail: |
||
409 | mov eax, [handle] |
||
410 | .fail2: |
||
411 | ret |
||
412 | endp |
||
413 | |||
414 | align 4 |
||
415 | proc delete_cursor stdcall, hcursor:dword |
||
416 | locals |
||
417 | hsrv dd ? |
||
418 | io_code dd ? |
||
419 | input dd ? |
||
420 | inp_size dd ? |
||
421 | output dd ? |
||
422 | out_size dd ? |
||
423 | endl |
||
424 | |||
425 | mov esi, [hcursor] |
||
426 | cmp [esi+CURSOR.magic], 'CURS' |
||
427 | jne .fail |
||
428 | |||
429 | mov ebx, [CURRENT_TASK] |
||
430 | shl ebx, 5 |
||
431 | mov ebx, [CURRENT_TASK+ebx+4] |
||
432 | cmp ebx, [esi+CURSOR.pid] |
||
433 | jne .fail |
||
434 | |||
435 | mov ebx, [current_slot] |
||
436 | cmp esi, [ebx+APPDATA.cursor] |
||
437 | jne @F |
||
438 | mov eax, [def_cursor] |
||
439 | mov [ebx+APPDATA.cursor], eax |
||
440 | @@: |
||
441 | mov eax, [hcursor] |
||
442 | call [eax+APPOBJ.destroy] |
||
443 | .fail: |
||
444 | ret |
||
445 | endp |
||
446 | |||
447 | ; param |
||
448 | ; eax= cursor |
||
449 | |||
450 | align 4 |
||
451 | destroy_cursor: |
||
452 | |||
453 | push eax |
||
454 | stdcall kernel_free, [eax+CURSOR.base] |
||
2337 | Serge | 455 | |
456 | mov eax, [esp] |
||
457 | lea eax, [eax+CURSOR.list_next] |
||
458 | |||
459 | pushfd |
||
460 | cli |
||
461 | list_del eax |
||
462 | popfd |
||
463 | |||
2288 | clevermous | 464 | pop eax |
465 | call destroy_kernel_object |
||
466 | ret |
||
467 | |||
468 | align 4 |
||
469 | select_cursor: |
||
470 | mov eax, [esp+4] |
||
471 | mov [_display.cursor], eax |
||
472 | ret 4 |
||
473 | |||
474 | align 4 |
||
475 | proc restore_24 stdcall, x:dword, y:dword |
||
476 | |||
477 | push ebx |
||
478 | |||
479 | mov ebx, [cur_saved_base] |
||
480 | mov edx, [cur.h] |
||
481 | test edx, edx |
||
482 | jz .ret |
||
483 | |||
484 | push esi |
||
485 | push edi |
||
486 | |||
487 | mov esi, cur_saved_data |
||
488 | mov ecx, [cur.w] |
||
489 | lea ecx, [ecx+ecx*2] |
||
490 | push ecx |
||
491 | @@: |
||
492 | mov edi, ebx |
||
493 | add ebx, [BytesPerScanLine] |
||
494 | |||
495 | mov ecx, [esp] |
||
496 | rep movsb |
||
497 | dec edx |
||
498 | jnz @B |
||
499 | |||
500 | pop ecx |
||
501 | pop edi |
||
502 | pop esi |
||
503 | .ret: |
||
504 | pop ebx |
||
505 | ret |
||
506 | endp |
||
507 | |||
508 | align 4 |
||
509 | proc restore_32 stdcall, x:dword, y:dword |
||
510 | |||
511 | push ebx |
||
512 | |||
513 | mov ebx, [cur_saved_base] |
||
514 | mov edx, [cur.h] |
||
515 | test edx, edx |
||
516 | jz .ret |
||
517 | |||
518 | push esi |
||
519 | push edi |
||
520 | |||
521 | mov esi, cur_saved_data |
||
522 | @@: |
||
523 | mov edi, ebx |
||
524 | add ebx, [BytesPerScanLine] |
||
525 | |||
526 | mov ecx, [cur.w] |
||
527 | rep movsd |
||
528 | dec edx |
||
529 | jnz @B |
||
530 | |||
531 | pop edi |
||
532 | .ret: |
||
533 | pop esi |
||
534 | pop ebx |
||
535 | ret |
||
536 | endp |
||
537 | |||
538 | align 4 |
||
539 | proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword |
||
540 | locals |
||
541 | h dd ? |
||
542 | _dx dd ? |
||
543 | _dy dd ? |
||
544 | endl |
||
545 | |||
546 | mov esi, [hcursor] |
||
547 | mov ecx, [x] |
||
548 | mov eax, [y] |
||
549 | mov ebx, [BytesPerScanLine] |
||
550 | |||
551 | xor edx, edx |
||
552 | sub ecx, [esi+CURSOR.hot_x] |
||
553 | lea ebx, [ecx+32-1] |
||
554 | mov [x], ecx |
||
555 | sets dl |
||
556 | dec edx |
||
557 | and ecx, edx ;clip x to 0<=x |
||
558 | mov [cur.left], ecx |
||
559 | mov edi, ecx |
||
560 | sub edi, [x] |
||
561 | mov [_dx], edi |
||
562 | |||
563 | xor edx, edx |
||
564 | sub eax, [esi+CURSOR.hot_y] |
||
565 | lea edi, [eax+32-1] |
||
566 | mov [y], eax |
||
567 | sets dl |
||
568 | dec edx |
||
569 | and eax, edx ;clip y to 0<=y |
||
570 | mov [cur.top], eax |
||
571 | mov edx, eax |
||
572 | sub edx, [y] |
||
573 | mov [_dy], edx |
||
574 | |||
575 | mul dword [BytesPerScanLine] |
||
576 | lea edx, [LFB_BASE+ecx*3] |
||
577 | add edx, eax |
||
578 | mov [cur_saved_base], edx |
||
579 | |||
580 | cmp ebx, [Screen_Max_X] |
||
581 | jbe @F |
||
582 | mov ebx, [Screen_Max_X] |
||
583 | @@: |
||
584 | cmp edi, [Screen_Max_Y] |
||
585 | jbe @F |
||
586 | mov edi, [Screen_Max_Y] |
||
587 | @@: |
||
588 | mov [cur.right], ebx |
||
589 | mov [cur.bottom], edi |
||
590 | |||
591 | sub ebx, [x] |
||
592 | sub edi, [y] |
||
593 | inc ebx |
||
594 | inc edi |
||
595 | |||
596 | mov [cur.w], ebx |
||
597 | mov [cur.h], edi |
||
598 | mov [h], edi |
||
599 | |||
600 | mov eax, edi |
||
601 | mov edi, cur_saved_data |
||
602 | @@: |
||
603 | mov esi, edx |
||
604 | add edx, [BytesPerScanLine] |
||
605 | mov ecx, [cur.w] |
||
606 | lea ecx, [ecx+ecx*2] |
||
607 | rep movsb |
||
608 | dec eax |
||
609 | jnz @B |
||
610 | |||
611 | ;draw cursor |
||
612 | mov ebx, [cur_saved_base] |
||
613 | mov eax, [_dy] |
||
614 | shl eax, 5 |
||
615 | add eax, [_dx] |
||
616 | |||
617 | mov esi, [hcursor] |
||
618 | mov esi, [esi+CURSOR.base] |
||
619 | lea edx, [esi+eax*4] |
||
620 | .row: |
||
621 | mov ecx, [cur.w] |
||
622 | mov esi, edx |
||
623 | mov edi, ebx |
||
624 | add edx, 32*4 |
||
625 | add ebx, [BytesPerScanLine] |
||
626 | .pix: |
||
627 | lodsd |
||
628 | test eax, 0xFF000000 |
||
629 | jz @F |
||
630 | mov [edi], ax |
||
631 | shr eax, 16 |
||
632 | mov [edi+2], al |
||
633 | @@: |
||
634 | add edi, 3 |
||
635 | dec ecx |
||
636 | jnz .pix |
||
637 | |||
638 | dec [h] |
||
639 | jnz .row |
||
640 | ret |
||
641 | endp |
||
642 | |||
643 | |||
644 | align 4 |
||
645 | proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword |
||
646 | locals |
||
647 | h dd ? |
||
648 | _dx dd ? |
||
649 | _dy dd ? |
||
650 | endl |
||
651 | |||
652 | mov esi, [hcursor] |
||
653 | mov ecx, [x] |
||
654 | mov eax, [y] |
||
655 | |||
656 | xor edx, edx |
||
657 | sub ecx, [esi+CURSOR.hot_x] |
||
658 | lea ebx, [ecx+32-1] |
||
659 | mov [x], ecx |
||
660 | sets dl |
||
661 | dec edx |
||
662 | and ecx, edx ;clip x to 0<=x |
||
663 | mov [cur.left], ecx |
||
664 | mov edi, ecx |
||
665 | sub edi, [x] |
||
666 | mov [_dx], edi |
||
667 | |||
668 | xor edx, edx |
||
669 | sub eax, [esi+CURSOR.hot_y] |
||
670 | lea edi, [eax+32-1] |
||
671 | mov [y], eax |
||
672 | sets dl |
||
673 | dec edx |
||
674 | and eax, edx ;clip y to 0<=y |
||
675 | mov [cur.top], eax |
||
676 | mov edx, eax |
||
677 | sub edx, [y] |
||
678 | mov [_dy], edx |
||
679 | |||
680 | mul dword [BytesPerScanLine] |
||
681 | lea edx, [LFB_BASE+eax+ecx*4] |
||
682 | mov [cur_saved_base], edx |
||
683 | |||
684 | cmp ebx, [Screen_Max_X] |
||
685 | jbe @F |
||
686 | mov ebx, [Screen_Max_X] |
||
687 | @@: |
||
688 | cmp edi, [Screen_Max_Y] |
||
689 | jbe @F |
||
690 | mov edi, [Screen_Max_Y] |
||
691 | @@: |
||
692 | mov [cur.right], ebx |
||
693 | mov [cur.bottom], edi |
||
694 | |||
695 | sub ebx, [x] |
||
696 | sub edi, [y] |
||
697 | inc ebx |
||
698 | inc edi |
||
699 | |||
700 | mov [cur.w], ebx |
||
701 | mov [cur.h], edi |
||
702 | mov [h], edi |
||
703 | |||
704 | mov eax, edi |
||
705 | mov edi, cur_saved_data |
||
706 | @@: |
||
707 | mov esi, edx |
||
708 | add edx, [BytesPerScanLine] |
||
709 | mov ecx, [cur.w] |
||
710 | rep movsd |
||
711 | dec eax |
||
712 | jnz @B |
||
713 | |||
714 | ;draw cursor |
||
715 | mov ebx, [cur_saved_base] |
||
716 | mov eax, [_dy] |
||
717 | shl eax, 5 |
||
718 | add eax, [_dx] |
||
719 | |||
720 | mov esi, [hcursor] |
||
721 | mov esi, [esi+CURSOR.base] |
||
722 | lea edx, [esi+eax*4] |
||
723 | .row: |
||
724 | mov ecx, [cur.w] |
||
725 | mov esi, edx |
||
726 | mov edi, ebx |
||
727 | add edx, 32*4 |
||
728 | add ebx, [BytesPerScanLine] |
||
729 | .pix: |
||
730 | lodsd |
||
731 | test eax, 0xFF000000 |
||
732 | jz @F |
||
733 | mov [edi], eax |
||
734 | @@: |
||
735 | add edi, 4 |
||
736 | dec ecx |
||
737 | jnz .pix |
||
738 | |||
739 | dec [h] |
||
740 | jnz .row |
||
741 | ret |
||
742 | endp |
||
743 | |||
744 | |||
745 | align 4 |
||
746 | get_display: |
||
747 | mov eax, _display |
||
748 | ret |
||
749 | |||
750 | align 4 |
||
751 | init_display: |
||
752 | |||
753 | xor eax, eax |
||
754 | mov edi, _display |
||
755 | |||
756 | mov [edi+display_t.init_cursor], eax |
||
757 | mov [edi+display_t.select_cursor], eax |
||
758 | mov [edi+display_t.show_cursor], eax |
||
759 | mov [edi+display_t.move_cursor], eax |
||
760 | mov [edi+display_t.restore_cursor], eax |
||
761 | |||
762 | lea ecx, [edi+display_t.cr_list.next] |
||
763 | mov [edi+display_t.cr_list.next], ecx |
||
764 | mov [edi+display_t.cr_list.prev], ecx |
||
765 | |||
766 | cmp [SCR_MODE], word 0x13 |
||
767 | jbe .fail |
||
768 | |||
769 | test word [SCR_MODE], 0x4000 |
||
770 | jz .fail |
||
771 | |||
772 | mov ebx, restore_32 |
||
773 | mov ecx, move_cursor_32 |
||
774 | movzx eax, byte [ScreenBPP] |
||
775 | cmp eax, 32 |
||
776 | je @F |
||
777 | |||
778 | mov ebx, restore_24 |
||
779 | mov ecx, move_cursor_24 |
||
780 | cmp eax, 24 |
||
781 | jne .fail |
||
782 | @@: |
||
783 | mov [_display.select_cursor], select_cursor |
||
784 | mov [_display.move_cursor], ecx |
||
785 | mov [_display.restore_cursor], ebx |
||
786 | |||
787 | stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM |
||
788 | mov [def_cursor], eax |
||
789 | ret |
||
790 | .fail: |
||
791 | xor eax, eax |
||
792 | mov [_display.select_cursor], eax |
||
793 | mov [_display.move_cursor], eax |
||
794 | ret |
||
795 | |||
796 | |||
797 | align 4 |
||
798 | def_arrow: |
||
799 | file 'arrow.cur'=y |
||
800 |