Subversion Repositories Kolibri OS

Rev

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

Rev 2385 Rev 2540
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 2385 $
8
$Revision $
9
 
9
 
10
 
10
 
Line 24... Line 24...
24
        XPelsPerMeter           dd ?
24
        XPelsPerMeter           dd ?
25
        YPelsPerMeter           dd ?
25
        YPelsPerMeter           dd ?
26
        ClrUsed                 dd ?
26
        ClrUsed                 dd ?
27
        ClrImportant            dd ?
27
        ClrImportant            dd ?
28
ends
28
ends
29
 
-
 
-
 
29
;------------------------------------------------------------------------------
30
align 4
30
align 4
31
proc init_cursor stdcall, dst:dword, src:dword
31
proc init_cursor stdcall, dst:dword, src:dword
32
           locals
32
           locals
33
             rBase    dd ?
33
             rBase    dd ?
34
             pQuad    dd ?
34
             pQuad    dd ?
Line 47... Line 47...
47
        je      .img_24
47
        je      .img_24
48
        cmp     [esi+BITMAPINFOHEADER.BitCount], 8
48
        cmp     [esi+BITMAPINFOHEADER.BitCount], 8
49
        je      .img_8
49
        je      .img_8
50
        cmp     [esi+BITMAPINFOHEADER.BitCount], 4
50
        cmp     [esi+BITMAPINFOHEADER.BitCount], 4
51
        je      .img_4
51
        je      .img_4
-
 
52
;--------------------------------------
52
 
53
align 4
53
.img_2:
54
.img_2:
54
        add     eax, [esi]
55
        add     eax, [esi]
55
        mov     [pQuad], eax
56
        mov     [pQuad], eax
56
        add     eax, 8
57
        add     eax, 8
57
        mov     [pBits], eax
58
        mov     [pBits], eax
Line 66... Line 67...
66
        mov     edi, [dst]
67
        mov     edi, [dst]
67
        add     edi, 32*31*4
68
        add     edi, 32*31*4
68
        mov     [rBase], edi
69
        mov     [rBase], edi
Line 69... Line 70...
69
 
70
 
-
 
71
        mov     esi, [pQuad]
-
 
72
;--------------------------------------
70
        mov     esi, [pQuad]
73
align 4
71
.l21:
74
.l21:
72
        mov     ebx, [pBits]
75
        mov     ebx, [pBits]
73
        mov     ebx, [ebx]
76
        mov     ebx, [ebx]
74
        bswap   ebx
77
        bswap   ebx
75
        mov     eax, [pAnd]
78
        mov     eax, [pAnd]
76
        mov     eax, [eax]
79
        mov     eax, [eax]
77
        bswap   eax
80
        bswap   eax
-
 
81
        mov     [counter], 32
-
 
82
;--------------------------------------
78
        mov     [counter], 32
83
align 4
79
@@:
84
@@:
80
        xor     edx, edx
85
        xor     edx, edx
81
        shl     eax, 1
86
        shl     eax, 1
82
        setc    dl
87
        setc    dl
Line 101... Line 106...
101
        sub     edi, 128
106
        sub     edi, 128
102
        mov     [rBase], edi
107
        mov     [rBase], edi
103
        sub     [height], 1
108
        sub     [height], 1
104
        jnz     .l21
109
        jnz     .l21
105
        ret
110
        ret
-
 
111
;--------------------------------------
106
 
112
align 4
107
.img_4:
113
.img_4:
108
        add     eax, [esi]
114
        add     eax, [esi]
109
        mov     [pQuad], eax
115
        mov     [pQuad], eax
110
        add     eax, 64
116
        add     eax, 64
111
        mov     [pBits], eax
117
        mov     [pBits], eax
Line 121... Line 127...
121
        add     edi, 32*31*4
127
        add     edi, 32*31*4
122
        mov     [rBase], edi
128
        mov     [rBase], edi
Line 123... Line 129...
123
 
129
 
124
        mov     esi, [pQuad]
130
        mov     esi, [pQuad]
-
 
131
        mov     ebx, [pBits]
-
 
132
;--------------------------------------
125
        mov     ebx, [pBits]
133
align 4
126
.l4:
134
.l4:
127
        mov     eax, [pAnd]
135
        mov     eax, [pAnd]
128
        mov     eax, [eax]
136
        mov     eax, [eax]
129
        bswap   eax
137
        bswap   eax
-
 
138
        mov     [counter], 16
-
 
139
;--------------------------------------
130
        mov     [counter], 16
140
align 4
131
@@:
141
@@:
132
        xor     edx, edx
142
        xor     edx, edx
133
        shl     eax, 1
143
        shl     eax, 1
134
        setc    dl
144
        setc    dl
Line 166... Line 176...
166
        sub     edi, 128
176
        sub     edi, 128
167
        mov     [rBase], edi
177
        mov     [rBase], edi
168
        sub     [height], 1
178
        sub     [height], 1
169
        jnz     .l4
179
        jnz     .l4
170
        ret
180
        ret
-
 
181
;--------------------------------------
-
 
182
align 4
171
.img_8:
183
.img_8:
172
        add     eax, [esi]
184
        add     eax, [esi]
173
        mov     [pQuad], eax
185
        mov     [pQuad], eax
174
        add     eax, 1024
186
        add     eax, 1024
175
        mov     [pBits], eax
187
        mov     [pBits], eax
Line 185... Line 197...
185
        add     edi, 32*31*4
197
        add     edi, 32*31*4
186
        mov     [rBase], edi
198
        mov     [rBase], edi
Line 187... Line 199...
187
 
199
 
188
        mov     esi, [pQuad]
200
        mov     esi, [pQuad]
-
 
201
        mov     ebx, [pBits]
-
 
202
;--------------------------------------
189
        mov     ebx, [pBits]
203
align 4
190
.l81:
204
.l81:
191
        mov     eax, [pAnd]
205
        mov     eax, [pAnd]
192
        mov     eax, [eax]
206
        mov     eax, [eax]
193
        bswap   eax
207
        bswap   eax
-
 
208
        mov     [counter], 32
-
 
209
;--------------------------------------
194
        mov     [counter], 32
210
align 4
195
@@:
211
@@:
196
        xor     edx, edx
212
        xor     edx, edx
197
        shl     eax, 1
213
        shl     eax, 1
198
        setc    dl
214
        setc    dl
Line 215... Line 231...
215
        sub     edi, 128
231
        sub     edi, 128
216
        mov     [rBase], edi
232
        mov     [rBase], edi
217
        sub     [height], 1
233
        sub     [height], 1
218
        jnz     .l81
234
        jnz     .l81
219
        ret
235
        ret
-
 
236
;--------------------------------------
-
 
237
align 4
220
.img_24:
238
.img_24:
221
        add     eax, [esi]
239
        add     eax, [esi]
222
        mov     [pQuad], eax
240
        mov     [pQuad], eax
223
        add     eax, 0xC00
241
        add     eax, 0xC00
224
        mov     [pAnd], eax
242
        mov     [pAnd], eax
Line 232... Line 250...
232
        add     edi, 32*31*4
250
        add     edi, 32*31*4
233
        mov     [rBase], edi
251
        mov     [rBase], edi
Line 234... Line 252...
234
 
252
 
235
        mov     esi, [pAnd]
253
        mov     esi, [pAnd]
-
 
254
        mov     ebx, [pQuad]
-
 
255
;--------------------------------------
236
        mov     ebx, [pQuad]
256
align 4
237
.row_24:
257
.row_24:
238
        mov     eax, [esi]
258
        mov     eax, [esi]
239
        bswap   eax
259
        bswap   eax
-
 
260
        mov     [counter], 32
-
 
261
;--------------------------------------
240
        mov     [counter], 32
262
align 4
241
@@:
263
@@:
242
        xor     edx, edx
264
        xor     edx, edx
243
        shl     eax, 1
265
        shl     eax, 1
244
        setc    dl
266
        setc    dl
Line 261... Line 283...
261
        mov     [rBase], edi
283
        mov     [rBase], edi
262
        sub     [height], 1
284
        sub     [height], 1
263
        jnz     .row_24
285
        jnz     .row_24
264
        ret
286
        ret
265
endp
287
endp
266
 
-
 
-
 
288
;------------------------------------------------------------------------------
267
align 4
289
align 4
268
proc set_cursor stdcall, hcursor:dword
290
proc set_cursor stdcall, hcursor:dword
269
        mov     eax, [hcursor]
291
        mov     eax, [hcursor]
270
        cmp     [eax+CURSOR.magic], 'CURS'
292
        cmp     [eax+CURSOR.magic], 'CURS'
271
        jne     .fail
293
        jne     .fail
272
;           cmp [eax+CURSOR.size], CURSOR_SIZE
294
;           cmp [eax+CURSOR.size], CURSOR_SIZE
273
;           jne .fail
295
;           jne .fail
274
        mov     ebx, [current_slot]
296
        mov     ebx, [current_slot]
275
        xchg    eax, [ebx+APPDATA.cursor]
297
        xchg    eax, [ebx+APPDATA.cursor]
276
        ret
298
        ret
-
 
299
;--------------------------------------
-
 
300
align 4
277
.fail:
301
.fail:
278
        mov     eax, [def_cursor]
302
        mov     eax, [def_cursor]
279
        mov     ebx, [current_slot]
303
        mov     ebx, [current_slot]
280
        xchg    eax, [ebx+APPDATA.cursor]
304
        xchg    eax, [ebx+APPDATA.cursor]
281
        ret
305
        ret
282
endp
306
endp
-
 
307
;------------------------------------------------------------------------------
283
 
308
align 4
284
; param
309
; param
285
;  eax= pid
310
;  eax= pid
286
;  ebx= src
311
;  ebx= src
287
;  ecx= flags
312
;  ecx= flags
Line 326... Line 351...
326
        mov     [edi+CURSOR.hot_x], ecx
351
        mov     [edi+CURSOR.hot_x], ecx
327
        mov     [edi+CURSOR.hot_y], edx
352
        mov     [edi+CURSOR.hot_y], edx
Line 328... Line 353...
328
 
353
 
Line -... Line 354...
-
 
354
        stdcall init_cursor, eax, esi
-
 
355
 
329
        stdcall init_cursor, eax, esi
356
align 4
330
 
357
.add_cursor:
331
        mov     ecx, [.hcursor]
358
        mov     ecx, [.hcursor]
Line 332... Line 359...
332
        lea     ecx, [ecx+CURSOR.list_next]
359
        lea     ecx, [ecx+CURSOR.list_next]
333
        lea     edx, [_display.cr_list.next]
360
        lea     edx, [_display.cr_list.next]
334
 
361
 
335
        pushfd
362
        pushfd
Line 336... Line 363...
336
        cli
363
        cli
337
        list_add ecx, edx   ;list_add_tail(new, head)
-
 
338
        popfd
364
        list_add ecx, edx   ;list_add_tail(new, head)
339
 
365
        popfd
Line 340... Line 366...
340
        mov     eax, [.hcursor]
366
 
341
.check_hw:
367
        mov     eax, [.hcursor]
342
        cmp     [_display.init_cursor], 0
368
        cmp     [_display.init_cursor], 0
Line 343... Line 369...
343
        je      .fail
369
        je      .fail
-
 
370
 
-
 
371
        push    eax
344
 
372
        call    [_display.init_cursor]
345
        push    eax
373
        add     esp, 4
346
        call    [_display.init_cursor]
374
 
-
 
375
        mov     eax, [.hcursor]
-
 
376
;--------------------------------------
347
        add     esp, 4
377
align 4
348
 
378
.fail:
349
        mov     eax, [.hcursor]
379
        add     esp, 12
350
.fail:
380
        ret
351
        add     esp, 12
381
;--------------------------------------
352
        ret
382
align 4
Line 353... Line 383...
353
.indirect:
383
.indirect:
354
        shr     ebx, 16
384
        shr     ebx, 16
355
        movzx   ecx, bh
385
        movzx   ecx, bh
356
        movzx   edx, bl
386
        movzx   edx, bl
357
        mov     [eax+CURSOR.hot_x], ecx
387
        mov     [edi+CURSOR.hot_x], ecx
358
        mov     [eax+CURSOR.hot_y], edx
-
 
-
 
388
        mov     [edi+CURSOR.hot_y], edx
359
 
389
 
360
        xchg    edi, eax
390
        xchg    edi, eax
361
        mov     ecx, 1024
391
        mov     ecx, 1024
362
        cld
392
        cld
363
        rep movsd
393
        rep movsd
Line 379... Line 409...
379
 
409
 
380
        stdcall load_file, [src]
410
        stdcall load_file, [src]
381
        test    eax, eax
411
        test    eax, eax
382
        jz      .fail
412
        jz      .fail
-
 
413
        mov     [src], eax
-
 
414
;--------------------------------------
383
        mov     [src], eax
415
align 4
384
@@:
416
@@:
385
        push    ebx
417
        push    ebx
386
        push    esi
418
        push    esi
Line 395... Line 427...
395
        mov     [handle], eax
427
        mov     [handle], eax
Line 396... Line 428...
396
 
428
 
397
        cmp     word [flags], LOAD_FROM_FILE
429
        cmp     word [flags], LOAD_FROM_FILE
398
        jne     .exit
430
        jne     .exit
-
 
431
        stdcall kernel_free, [src]
-
 
432
;--------------------------------------
399
        stdcall kernel_free, [src]
433
align 4
400
.exit:
434
.exit:
401
        pop     edi
435
        pop     edi
402
        pop     esi
436
        pop     esi
-
 
437
        pop     ebx
-
 
438
;--------------------------------------
403
        pop     ebx
439
align 4
404
.fail:
440
.fail:
-
 
441
        mov     eax, [handle]
-
 
442
;--------------------------------------
405
        mov     eax, [handle]
443
align 4
406
.fail2:
444
.fail2:
407
        ret
445
        ret
408
endp
-
 
-
 
446
endp
409
 
447
;------------------------------------------------------------------------------
410
align 4
448
align 4
411
proc delete_cursor stdcall, hcursor:dword
449
proc delete_cursor stdcall, hcursor:dword
412
           locals
450
           locals
413
             hsrv       dd ?
451
             hsrv       dd ?
Line 431... Line 469...
431
        mov     ebx, [current_slot]
469
        mov     ebx, [current_slot]
432
        cmp     esi, [ebx+APPDATA.cursor]
470
        cmp     esi, [ebx+APPDATA.cursor]
433
        jne     @F
471
        jne     @F
434
        mov     eax, [def_cursor]
472
        mov     eax, [def_cursor]
435
        mov     [ebx+APPDATA.cursor], eax
473
        mov     [ebx+APPDATA.cursor], eax
-
 
474
;--------------------------------------
-
 
475
align 4
436
@@:
476
@@:
437
        mov     eax, [hcursor]
477
        mov     eax, [hcursor]
438
        call    [eax+APPOBJ.destroy]
478
        call    [eax+APPOBJ.destroy]
-
 
479
;--------------------------------------
-
 
480
align 4
439
.fail:
481
.fail:
440
        ret
482
        ret
441
endp
483
endp
-
 
484
;------------------------------------------------------------------------------
442
 
485
align 4
443
; param
486
; param
444
;  eax= cursor
487
;  eax= cursor
445
 
-
 
446
align 4
-
 
447
destroy_cursor:
488
destroy_cursor:
Line 448... Line 489...
448
 
489
 
449
        push    eax
490
        push    eax
Line 458... Line 499...
458
        popfd
499
        popfd
Line 459... Line 500...
459
 
500
 
460
        pop     eax
501
        pop     eax
461
        call    destroy_kernel_object
502
        call    destroy_kernel_object
462
        ret
-
 
-
 
503
        ret
463
 
504
;------------------------------------------------------------------------------
464
align 4
505
align 4
465
select_cursor:
506
select_cursor:
466
        mov     eax, [esp+4]
507
        mov     eax, [esp+4]
467
        mov     [_display.cursor], eax
508
        mov     [_display.cursor], eax
468
        ret     4
-
 
-
 
509
        ret     4
469
 
510
;------------------------------------------------------------------------------
470
align 4
511
align 4
Line 471... Line 512...
471
proc restore_24 stdcall, x:dword, y:dword
512
proc restore_24 stdcall, x:dword, y:dword
Line 482... Line 523...
482
 
523
 
483
        mov     esi, cur_saved_data
524
        mov     esi, cur_saved_data
484
        mov     ecx, [cur.w]
525
        mov     ecx, [cur.w]
485
        lea     ecx, [ecx+ecx*2]
526
        lea     ecx, [ecx+ecx*2]
-
 
527
        push    ecx
-
 
528
;--------------------------------------
486
        push    ecx
529
align 4
487
@@:
530
@@:
488
        mov     edi, ebx
531
        mov     edi, ebx
Line 489... Line 532...
489
        add     ebx, [BytesPerScanLine]
532
        add     ebx, [BytesPerScanLine]
Line 494... Line 537...
494
        jnz     @B
537
        jnz     @B
Line 495... Line 538...
495
 
538
 
496
        pop     ecx
539
        pop     ecx
497
        pop     edi
540
        pop     edi
-
 
541
        pop     esi
-
 
542
;--------------------------------------
498
        pop     esi
543
align 4
499
.ret:
544
.ret:
500
        pop     ebx
545
        pop     ebx
501
        ret
546
        ret
502
endp
-
 
-
 
547
endp
503
 
548
;------------------------------------------------------------------------------
504
align 4
549
align 4
Line 505... Line 550...
505
proc restore_32 stdcall, x:dword, y:dword
550
proc restore_32 stdcall, x:dword, y:dword
Line 513... Line 558...
513
 
558
 
514
        push    esi
559
        push    esi
Line 515... Line 560...
515
        push    edi
560
        push    edi
-
 
561
 
-
 
562
        mov     esi, cur_saved_data
516
 
563
;--------------------------------------
517
        mov     esi, cur_saved_data
564
align 4
518
@@:
565
@@:
Line 519... Line 566...
519
        mov     edi, ebx
566
        mov     edi, ebx
520
        add     ebx, [BytesPerScanLine]
567
        add     ebx, [BytesPerScanLine]
521
 
568
 
522
        mov     ecx, [cur.w]
569
        mov     ecx, [cur.w]
Line 523... Line 570...
523
        rep movsd
570
        rep movsd
-
 
571
        dec     edx
-
 
572
        jnz     @B
524
        dec     edx
573
 
525
        jnz     @B
574
        pop     edi
526
 
575
;--------------------------------------
527
        pop     edi
576
align 4
528
.ret:
577
.ret:
529
        pop     esi
-
 
-
 
578
        pop     esi
530
        pop     ebx
579
        pop     ebx
531
        ret
580
        ret
532
endp
581
endp
533
 
582
;------------------------------------------------------------------------------
534
align 4
583
align 4
Line 540... Line 589...
540
           endl
589
           endl
Line 541... Line 590...
541
 
590
 
542
        mov     esi, [hcursor]
591
        mov     esi, [hcursor]
543
        mov     ecx, [x]
592
        mov     ecx, [x]
544
        mov     eax, [y]
593
        mov     eax, [y]
Line 545... Line 594...
545
        mov     ebx, [BytesPerScanLine]
594
;        mov     ebx, [BytesPerScanLine]
546
 
595
 
547
        xor     edx, edx
596
        xor     edx, edx
548
        sub     ecx, [esi+CURSOR.hot_x]
597
        sub     ecx, [esi+CURSOR.hot_x]
Line 566... Line 615...
566
        mov     [cur.top], eax
615
        mov     [cur.top], eax
567
        mov     edx, eax
616
        mov     edx, eax
568
        sub     edx, [y]
617
        sub     edx, [y]
569
        mov     [_dy], edx
618
        mov     [_dy], edx
Line 570... Line 619...
570
 
619
 
-
 
620
;        mul     dword [BytesPerScanLine]
571
        mul     dword [BytesPerScanLine]
621
        mov     eax, [BPSLine_calc_area+eax*4]
572
        lea     edx, [LFB_BASE+ecx*3]
622
        lea     edx, [LFB_BASE+ecx*3]
573
        add     edx, eax
623
        add     edx, eax
Line 574... Line 624...
574
        mov     [cur_saved_base], edx
624
        mov     [cur_saved_base], edx
575
 
625
 
576
        cmp     ebx, [Screen_Max_X]
626
        cmp     ebx, [Screen_Max_X]
-
 
627
        jbe     @F
-
 
628
        mov     ebx, [Screen_Max_X]
577
        jbe     @F
629
;--------------------------------------
578
        mov     ebx, [Screen_Max_X]
630
align 4
579
@@:
631
@@:
580
        cmp     edi, [Screen_Max_Y]
632
        cmp     edi, [Screen_Max_Y]
-
 
633
        jbe     @F
-
 
634
        mov     edi, [Screen_Max_Y]
581
        jbe     @F
635
;--------------------------------------
582
        mov     edi, [Screen_Max_Y]
636
align 4
583
@@:
637
@@:
Line 584... Line 638...
584
        mov     [cur.right], ebx
638
        mov     [cur.right], ebx
Line 593... Line 647...
593
        mov     [cur.h], edi
647
        mov     [cur.h], edi
594
        mov     [h], edi
648
        mov     [h], edi
Line 595... Line 649...
595
 
649
 
596
        mov     eax, edi
650
        mov     eax, edi
-
 
651
        mov     edi, cur_saved_data
-
 
652
;--------------------------------------
597
        mov     edi, cur_saved_data
653
align 4
598
@@:
654
@@:
599
        mov     esi, edx
655
        mov     esi, edx
600
        add     edx, [BytesPerScanLine]
656
        add     edx, [BytesPerScanLine]
601
        mov     ecx, [cur.w]
657
        mov     ecx, [cur.w]
Line 611... Line 667...
611
        add     eax, [_dx]
667
        add     eax, [_dx]
Line 612... Line 668...
612
 
668
 
613
        mov     esi, [hcursor]
669
        mov     esi, [hcursor]
614
        mov     esi, [esi+CURSOR.base]
670
        mov     esi, [esi+CURSOR.base]
-
 
671
        lea     edx, [esi+eax*4]
-
 
672
;--------------------------------------
615
        lea     edx, [esi+eax*4]
673
align 4
616
.row:
674
.row:
617
        mov     ecx, [cur.w]
675
        mov     ecx, [cur.w]
618
        mov     esi, edx
676
        mov     esi, edx
619
        mov     edi, ebx
677
        mov     edi, ebx
620
        add     edx, 32*4
678
        add     edx, 32*4
-
 
679
        add     ebx, [BytesPerScanLine]
-
 
680
;--------------------------------------
621
        add     ebx, [BytesPerScanLine]
681
align 4
622
.pix:
682
.pix:
623
        lodsd
683
        lodsd
624
        test    eax, 0xFF000000
684
        test    eax, 0xFF000000
625
        jz      @F
685
        jz      @F
626
        mov     [edi], ax
686
        mov     [edi], ax
627
        shr     eax, 16
687
        shr     eax, 16
-
 
688
        mov     [edi+2], al
-
 
689
;--------------------------------------
628
        mov     [edi+2], al
690
align 4
629
@@:
691
@@:
630
        add     edi, 3
692
        add     edi, 3
631
        dec     ecx
693
        dec     ecx
Line 632... Line 694...
632
        jnz     .pix
694
        jnz     .pix
633
 
695
 
634
        dec     [h]
696
        dec     [h]
635
        jnz     .row
697
        jnz     .row
636
        ret
-
 
637
endp
-
 
-
 
698
        ret
638
 
699
endp
639
 
700
;------------------------------------------------------------------------------
640
align 4
701
align 4
641
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
702
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
642
           locals
703
           locals
Line 671... Line 732...
671
        mov     [cur.top], eax
732
        mov     [cur.top], eax
672
        mov     edx, eax
733
        mov     edx, eax
673
        sub     edx, [y]
734
        sub     edx, [y]
674
        mov     [_dy], edx
735
        mov     [_dy], edx
Line 675... Line 736...
675
 
736
 
-
 
737
;        mul     dword [BytesPerScanLine]
676
        mul     dword [BytesPerScanLine]
738
        mov     eax, [BPSLine_calc_area+eax*4]
677
        lea     edx, [LFB_BASE+eax+ecx*4]
739
        lea     edx, [LFB_BASE+eax+ecx*4]
Line 678... Line 740...
678
        mov     [cur_saved_base], edx
740
        mov     [cur_saved_base], edx
679
 
741
 
680
        cmp     ebx, [Screen_Max_X]
742
        cmp     ebx, [Screen_Max_X]
-
 
743
        jbe     @F
-
 
744
        mov     ebx, [Screen_Max_X]
681
        jbe     @F
745
;--------------------------------------
682
        mov     ebx, [Screen_Max_X]
746
align 4
683
@@:
747
@@:
684
        cmp     edi, [Screen_Max_Y]
748
        cmp     edi, [Screen_Max_Y]
-
 
749
        jbe     @F
-
 
750
        mov     edi, [Screen_Max_Y]
685
        jbe     @F
751
;--------------------------------------
686
        mov     edi, [Screen_Max_Y]
752
align 4
687
@@:
753
@@:
Line 688... Line 754...
688
        mov     [cur.right], ebx
754
        mov     [cur.right], ebx
Line 697... Line 763...
697
        mov     [cur.h], edi
763
        mov     [cur.h], edi
698
        mov     [h], edi
764
        mov     [h], edi
Line 699... Line 765...
699
 
765
 
700
        mov     eax, edi
766
        mov     eax, edi
-
 
767
        mov     edi, cur_saved_data
-
 
768
;--------------------------------------
701
        mov     edi, cur_saved_data
769
align 4
702
@@:
770
@@:
703
        mov     esi, edx
771
        mov     esi, edx
704
        add     edx, [BytesPerScanLine]
772
        add     edx, [BytesPerScanLine]
705
        mov     ecx, [cur.w]
773
        mov     ecx, [cur.w]
Line 714... Line 782...
714
        add     eax, [_dx]
782
        add     eax, [_dx]
Line 715... Line 783...
715
 
783
 
716
        mov     esi, [hcursor]
784
        mov     esi, [hcursor]
717
        mov     esi, [esi+CURSOR.base]
785
        mov     esi, [esi+CURSOR.base]
-
 
786
        lea     edx, [esi+eax*4]
-
 
787
;--------------------------------------
718
        lea     edx, [esi+eax*4]
788
align 4
719
.row:
789
.row:
720
        mov     ecx, [cur.w]
790
        mov     ecx, [cur.w]
721
        mov     esi, edx
791
        mov     esi, edx
722
        mov     edi, ebx
792
        mov     edi, ebx
723
        add     edx, 32*4
793
        add     edx, 32*4
-
 
794
        add     ebx, [BytesPerScanLine]
-
 
795
;--------------------------------------
724
        add     ebx, [BytesPerScanLine]
796
align 4
725
.pix:
797
.pix:
726
        lodsd
798
        lodsd
727
        test    eax, 0xFF000000
799
        test    eax, 0xFF000000
728
        jz      @F
800
        jz      @F
-
 
801
        mov     [edi], eax
-
 
802
;--------------------------------------
729
        mov     [edi], eax
803
align 4
730
@@:
804
@@:
731
        add     edi, 4
805
        add     edi, 4
732
        dec     ecx
806
        dec     ecx
Line 733... Line 807...
733
        jnz     .pix
807
        jnz     .pix
734
 
808
 
735
        dec     [h]
809
        dec     [h]
736
        jnz     .row
810
        jnz     .row
-
 
811
        ret
-
 
812
endp
-
 
813
;------------------------------------------------------------------------------
-
 
814
align 4
-
 
815
check_mouse_area_for_getpixel_new:
-
 
816
; in:
-
 
817
; eax = x
-
 
818
; ebx = y
-
 
819
; out:
-
 
820
; ecx = new color
-
 
821
;--------------------------------------
-
 
822
; check for Y
-
 
823
        cmp     bx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
824
        jb      .no_mouse_area
-
 
825
 
-
 
826
        cmp     bx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
827
        jae     .no_mouse_area
-
 
828
;--------------------------------------
-
 
829
; check for X
-
 
830
        cmp     ax, [X_UNDER_subtraction_CUR_hot_x]
-
 
831
        jb      .no_mouse_area
-
 
832
 
-
 
833
        cmp     ax, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
834
        jae     .no_mouse_area
-
 
835
;--------------------------------------
-
 
836
        push    eax ebx
-
 
837
; offset X
-
 
838
        mov     ecx, [X_UNDER_subtraction_CUR_hot_x]
-
 
839
        sub     eax, ecx        ; x1
-
 
840
; offset Y
-
 
841
        mov     ecx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
842
        sub     ebx, ecx        ; y1
-
 
843
;--------------------------------------
-
 
844
; ebx = offset y
-
 
845
; eax = offset x
-
 
846
        imul    ebx, [cur.w]     ;y
-
 
847
        add     eax, ebx
-
 
848
        mov     ebx, eax
-
 
849
        shl     eax, 2
-
 
850
        cmp     [ScreenBPP], byte 32
-
 
851
        je      @f
-
 
852
        sub     eax, ebx
-
 
853
;--------------------------------------
-
 
854
align 4
-
 
855
@@:
-
 
856
        add     eax, cur_saved_data
-
 
857
        mov     ecx, [eax]
-
 
858
        and     ecx, 0xffffff
-
 
859
        add     ecx, 0xff000000
-
 
860
        pop     ebx eax
-
 
861
        ret
-
 
862
;--------------------------------------
-
 
863
align 4
-
 
864
.no_mouse_area:
-
 
865
        xor     ecx, ecx
-
 
866
        ret
-
 
867
;-----------------------------------------------------------------------------
-
 
868
align 4
-
 
869
check_mouse_area_for_putpixel_new:
-
 
870
; in:
-
 
871
; ecx = x shl 16 + y
-
 
872
; eax = color
-
 
873
; out:
-
 
874
; eax = new color
-
 
875
;--------------------------------------
-
 
876
; check for Y
-
 
877
        cmp     cx, [Y_UNDER_subtraction_CUR_hot_y]
-
 
878
        jb      .no_mouse_area
-
 
879
 
-
 
880
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
-
 
881
        jae     .no_mouse_area
-
 
882
 
-
 
883
        rol     ecx, 16
-
 
884
;--------------------------------------
-
 
885
; check for X
-
 
886
        cmp     cx, [X_UNDER_subtraction_CUR_hot_x]
-
 
887
        jb      .no_mouse_area
-
 
888
 
-
 
889
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
-
 
890
        jae     .no_mouse_area
-
 
891
;--------------------------------------
-
 
892
align 4
-
 
893
.1:
-
 
894
        push    eax
-
 
895
; offset X
-
 
896
        mov     ax, [X_UNDER_subtraction_CUR_hot_x]
-
 
897
        sub     cx, ax        ; x1
-
 
898
        ror     ecx, 16
-
 
899
; offset Y
-
 
900
        mov     ax, [Y_UNDER_subtraction_CUR_hot_y]
-
 
901
        sub     cx, ax        ; y1
-
 
902
;--------------------------------------
-
 
903
; ecx = (offset x) shl 16 + (offset y)
-
 
904
        push    ebx
-
 
905
        mov     ebx, ecx
-
 
906
        shr     ebx, 16        ; x
-
 
907
        and     ecx, 0xffff    ; y
-
 
908
; ecx = offset y
Line -... Line 909...
-
 
909
; ebx = offset x
-
 
910
        mov     eax, [esp + 4]
-
 
911
 
-
 
912
        push    ebx ecx
-
 
913
        imul    ecx, [cur.w]    ;y
-
 
914
        add     ecx, ebx
-
 
915
        mov     ebx, ecx
-
 
916
        shl     ecx, 2
-
 
917
        cmp     [ScreenBPP], byte 24
-
 
918
        je      .24
-
 
919
        and     eax, 0xFFFFFF
-
 
920
        mov     [ecx + cur_saved_data], eax   ;store new color  to
-
 
921
        jmp     @f
-
 
922
;--------------------------------------
-
 
923
align 4
-
 
924
.24:
-
 
925
        sub     ecx, ebx
-
 
926
        mov     [ecx + cur_saved_data], ax      ;store new color  to
-
 
927
        shr     eax, 16
-
 
928
        mov     [ecx + cur_saved_data + 2], al  ;store new color  to
-
 
929
;--------------------------------------
Line -... Line 930...
-
 
930
align 4
-
 
931
@@:
-
 
932
        pop     ecx ebx
-
 
933
 
-
 
934
        shl     ecx, 5
-
 
935
        add     ecx, ebx
-
 
936
 
-
 
937
        mov     eax, [current_cursor]
-
 
938
        mov     eax, [eax+CURSOR.base]
-
 
939
        lea     eax, [eax+ecx*4]
-
 
940
        mov     eax, [eax]
-
 
941
 
-
 
942
        pop     ebx
-
 
943
 
-
 
944
        test    eax, 0xFF000000
-
 
945
        jz      @f
-
 
946
 
-
 
947
        pop     ecx
-
 
948
        ret
-
 
949
;--------------------------------------
-
 
950
align 4
-
 
951
@@:
-
 
952
        pop     eax
-
 
953
;--------------------------------------
737
        ret
954
align 4
738
endp
955
.no_mouse_area:
739
 
956
        ret
740
 
957
;------------------------------------------------------------------------------
741
align 4
-
 
-
 
958
align 4
742
get_display:
959
get_display:
743
        mov     eax, _display
960
        mov     eax, _display
744
        ret
-
 
745
 
961
        ret
746
align 4
962
;------------------------------------------------------------------------------
Line 747... Line 963...
747
init_display:
963
align 4
748
 
964
init_display:
Line 762... Line 978...
762
        cmp     [SCR_MODE], word 0x13
978
        cmp     [SCR_MODE], word 0x13
763
        jbe     .fail
979
        jbe     .fail
Line 764... Line 980...
764
 
980
 
765
        test    word [SCR_MODE], 0x4000
981
        test    word [SCR_MODE], 0x4000
-
 
982
        jz      .fail
Line 766... Line 983...
766
        jz      .fail
983
;        jmp      .fail
767
 
984
 
768
        mov     ebx, restore_32
985
        mov     ebx, restore_32
769
        mov     ecx, move_cursor_32
986
        mov     ecx, move_cursor_32
Line 773... Line 990...
773
 
990
 
774
        mov     ebx, restore_24
991
        mov     ebx, restore_24
775
        mov     ecx, move_cursor_24
992
        mov     ecx, move_cursor_24
776
        cmp     eax, 24
993
        cmp     eax, 24
-
 
994
        jne     .fail
-
 
995
;--------------------------------------
777
        jne     .fail
996
align 4
778
@@:
997
@@:
779
        mov     [_display.select_cursor], select_cursor
998
        mov     [_display.select_cursor], select_cursor
780
        mov     [_display.move_cursor], ecx
999
        mov     [_display.move_cursor], ecx
-
 
1000
        mov     [_display.restore_cursor], ebx
-
 
1001
        mov     [_display.check_mouse], check_mouse_area_for_putpixel_new
Line -... Line 1002...
-
 
1002
        mov     [_display.check_m_pixel], check_mouse_area_for_getpixel_new
-
 
1003
 
-
 
1004
        cmp     [PUTPIXEL], dword VGA_putpixel
-
 
1005
        je      @f
-
 
1006
        cmp     [ScreenBPP], byte 32
-
 
1007
        je      .32
-
 
1008
        mov     [PUTPIXEL], dword Vesa20_putpixel24_new
-
 
1009
        jmp     @f
-
 
1010
;--------------------------------------
-
 
1011
align 4
-
 
1012
.32:
-
 
1013
        mov     [PUTPIXEL], dword Vesa20_putpixel32_new
-
 
1014
;--------------------------------------
-
 
1015
align 4
-
 
1016
@@:
781
        mov     [_display.restore_cursor], ebx
1017
        stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM
782
 
1018
        mov     [def_cursor_clock], eax
783
        stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
1019
        stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
-
 
1020
        mov     [def_cursor], eax
-
 
1021
        ret
784
        mov     [def_cursor], eax
1022
;--------------------------------------
785
        ret
1023
align 4
786
.fail:
1024
.fail:
787
        xor     eax, eax
1025
        xor     eax, eax
788
        mov     [_display.select_cursor], eax
1026
        mov     [_display.select_cursor], eax
789
        mov     [_display.move_cursor], eax
-
 
790
        ret
-
 
-
 
1027
        mov     [_display.move_cursor], eax
791
 
1028
        ret
792
 
1029
;------------------------------------------------------------------------------
793
align 4
1030
align 4
-
 
1031
def_arrow:
-
 
1032
  file 'arrow.cur'
-
 
1033
;------------------------------------------------------------------------------
-
 
1034
align 4
-
 
1035
clock_arrow: