Subversion Repositories Kolibri OS

Rev

Rev 9941 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
9941 Doczom 3
;; Copyright (C) KolibriOS team 2004-2023. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 9958 $
9
 
10
 
7136 dunkaist 11
LOAD_FROM_FILE  = 0
12
LOAD_FROM_MEM   = 1
13
LOAD_INDIRECT   = 2
14
LOAD_SYSTEM     = 3
2288 clevermous 15
 
2384 hidnplayr 16
struct  BITMAPINFOHEADER
17
        Size                    dd ?
18
        Width                   dd ?
19
        Height                  dd ?
20
        Planes                  dw ?
21
        BitCount                dw ?
22
        Compression             dd ?
23
        SizeImage               dd ?
24
        XPelsPerMeter           dd ?
25
        YPelsPerMeter           dd ?
26
        ClrUsed                 dd ?
27
        ClrImportant            dd ?
28
ends
2430 mario79 29
;------------------------------------------------------------------------------
2288 clevermous 30
align 4
31
proc init_cursor stdcall, dst:dword, src:dword
32
           locals
33
             rBase    dd ?
34
             pQuad    dd ?
35
             pBits    dd ?
36
             pAnd     dd ?
37
             width    dd ?
38
             height   dd ?
39
             counter  dd ?
40
           endl
41
 
42
        mov     esi, [src]
43
        add     esi, [esi+18]
44
        mov     eax, esi
45
 
9715 Doczom 46
        cmp     [esi + BITMAPINFOHEADER.BitCount], 24
2288 clevermous 47
        je      .img_24
9715 Doczom 48
        cmp     [esi + BITMAPINFOHEADER.BitCount], 8
2288 clevermous 49
        je      .img_8
9715 Doczom 50
        cmp     [esi + BITMAPINFOHEADER.BitCount], 4
2288 clevermous 51
        je      .img_4
2430 mario79 52
;--------------------------------------
53
align 4
2288 clevermous 54
.img_2:
55
        add     eax, [esi]
56
        mov     [pQuad], eax
57
        add     eax, 8
58
        mov     [pBits], eax
59
        add     eax, 128
60
        mov     [pAnd], eax
61
        mov     eax, [esi+4]
62
        mov     [width], eax
63
        mov     ebx, [esi+8]
64
        shr     ebx, 1
65
        mov     [height], ebx
66
 
67
        mov     edi, [dst]
68
        add     edi, 32*31*4
69
        mov     [rBase], edi
70
 
71
        mov     esi, [pQuad]
2430 mario79 72
;--------------------------------------
73
align 4
2288 clevermous 74
.l21:
75
        mov     ebx, [pBits]
76
        mov     ebx, [ebx]
77
        bswap   ebx
78
        mov     eax, [pAnd]
79
        mov     eax, [eax]
80
        bswap   eax
81
        mov     [counter], 32
2430 mario79 82
;--------------------------------------
83
align 4
2288 clevermous 84
@@:
85
        xor     edx, edx
86
        shl     eax, 1
87
        setc    dl
88
        dec     edx
89
 
90
        xor     ecx, ecx
91
        shl     ebx, 1
92
        setc    cl
9715 Doczom 93
        mov     ecx, [esi + ecx*4]
2288 clevermous 94
        and     ecx, edx
95
        and     edx, 0xFF000000
96
        or      edx, ecx
97
        mov     [edi], edx
98
 
99
        add     edi, 4
100
        dec     [counter]
101
        jnz     @B
102
 
103
        add     [pBits], 4
104
        add     [pAnd], 4
105
        mov     edi, [rBase]
106
        sub     edi, 128
107
        mov     [rBase], edi
108
        sub     [height], 1
109
        jnz     .l21
110
        ret
2430 mario79 111
;--------------------------------------
112
align 4
2288 clevermous 113
.img_4:
114
        add     eax, [esi]
115
        mov     [pQuad], eax
116
        add     eax, 64
117
        mov     [pBits], eax
118
        add     eax, 0x200
119
        mov     [pAnd], eax
120
        mov     eax, [esi+4]
121
        mov     [width], eax
122
        mov     ebx, [esi+8]
123
        shr     ebx, 1
124
        mov     [height], ebx
125
 
126
        mov     edi, [dst]
127
        add     edi, 32*31*4
128
        mov     [rBase], edi
129
 
130
        mov     esi, [pQuad]
131
        mov     ebx, [pBits]
2430 mario79 132
;--------------------------------------
133
align 4
2288 clevermous 134
.l4:
135
        mov     eax, [pAnd]
136
        mov     eax, [eax]
137
        bswap   eax
138
        mov     [counter], 16
2430 mario79 139
;--------------------------------------
140
align 4
2288 clevermous 141
@@:
142
        xor     edx, edx
143
        shl     eax, 1
144
        setc    dl
145
        dec     edx
146
 
147
        movzx   ecx, byte [ebx]
148
        and     cl, 0xF0
149
        shr     ecx, 2
9715 Doczom 150
        mov     ecx, [esi + ecx]
2288 clevermous 151
        and     ecx, edx
152
        and     edx, 0xFF000000
153
        or      edx, ecx
154
        mov     [edi], edx
155
 
156
        xor     edx, edx
157
        shl     eax, 1
158
        setc    dl
159
        dec     edx
160
 
161
        movzx   ecx, byte [ebx]
162
        and     cl, 0x0F
9715 Doczom 163
        mov     ecx, [esi + ecx*4]
2288 clevermous 164
        and     ecx, edx
165
        and     edx, 0xFF000000
166
        or      edx, ecx
167
        mov     [edi+4], edx
168
 
169
        inc     ebx
170
        add     edi, 8
171
        dec     [counter]
172
        jnz     @B
173
 
174
        add     [pAnd], 4
175
        mov     edi, [rBase]
176
        sub     edi, 128
177
        mov     [rBase], edi
178
        sub     [height], 1
179
        jnz     .l4
180
        ret
2430 mario79 181
;--------------------------------------
182
align 4
2288 clevermous 183
.img_8:
184
        add     eax, [esi]
185
        mov     [pQuad], eax
186
        add     eax, 1024
187
        mov     [pBits], eax
188
        add     eax, 1024
189
        mov     [pAnd], eax
190
        mov     eax, [esi+4]
191
        mov     [width], eax
192
        mov     ebx, [esi+8]
193
        shr     ebx, 1
194
        mov     [height], ebx
195
 
196
        mov     edi, [dst]
197
        add     edi, 32*31*4
198
        mov     [rBase], edi
199
 
200
        mov     esi, [pQuad]
201
        mov     ebx, [pBits]
2430 mario79 202
;--------------------------------------
203
align 4
2288 clevermous 204
.l81:
205
        mov     eax, [pAnd]
206
        mov     eax, [eax]
207
        bswap   eax
208
        mov     [counter], 32
2430 mario79 209
;--------------------------------------
210
align 4
2288 clevermous 211
@@:
212
        xor     edx, edx
213
        shl     eax, 1
214
        setc    dl
215
        dec     edx
216
 
217
        movzx   ecx, byte [ebx]
9715 Doczom 218
        mov     ecx, [esi + ecx*4]
2288 clevermous 219
        and     ecx, edx
220
        and     edx, 0xFF000000
221
        or      edx, ecx
222
        mov     [edi], edx
223
 
224
        inc     ebx
225
        add     edi, 4
226
        dec     [counter]
227
        jnz     @B
228
 
229
        add     [pAnd], 4
230
        mov     edi, [rBase]
231
        sub     edi, 128
232
        mov     [rBase], edi
233
        sub     [height], 1
234
        jnz     .l81
235
        ret
2430 mario79 236
;--------------------------------------
237
align 4
2288 clevermous 238
.img_24:
239
        add     eax, [esi]
240
        mov     [pQuad], eax
241
        add     eax, 0xC00
242
        mov     [pAnd], eax
9715 Doczom 243
        mov     eax, [esi + BITMAPINFOHEADER.Width]
2288 clevermous 244
        mov     [width], eax
9715 Doczom 245
        mov     ebx, [esi + BITMAPINFOHEADER.Height]
2288 clevermous 246
        shr     ebx, 1
247
        mov     [height], ebx
248
 
249
        mov     edi, [dst]
250
        add     edi, 32*31*4
251
        mov     [rBase], edi
252
 
253
        mov     esi, [pAnd]
254
        mov     ebx, [pQuad]
2430 mario79 255
;--------------------------------------
256
align 4
2288 clevermous 257
.row_24:
258
        mov     eax, [esi]
259
        bswap   eax
260
        mov     [counter], 32
2430 mario79 261
;--------------------------------------
262
align 4
2288 clevermous 263
@@:
264
        xor     edx, edx
265
        shl     eax, 1
266
        setc    dl
267
        dec     edx
268
 
269
        mov     ecx, [ebx]
270
        and     ecx, 0x00FFFFFF
271
        and     ecx, edx
272
        and     edx, 0xFF000000
273
        or      edx, ecx
274
        mov     [edi], edx
275
        add     ebx, 3
276
        add     edi, 4
277
        dec     [counter]
278
        jnz     @B
279
 
280
        add     esi, 4
281
        mov     edi, [rBase]
282
        sub     edi, 128
283
        mov     [rBase], edi
284
        sub     [height], 1
285
        jnz     .row_24
286
        ret
287
endp
2430 mario79 288
;------------------------------------------------------------------------------
2288 clevermous 289
align 4
290
proc set_cursor stdcall, hcursor:dword
291
        mov     eax, [hcursor]
9715 Doczom 292
        cmp     [eax + CURSOR.magic], 'CURS'
2288 clevermous 293
        jne     .fail
294
;           cmp [eax+CURSOR.size], CURSOR_SIZE
295
;           jne .fail
296
        mov     ebx, [current_slot]
9930 Doczom 297
        mov     ebx, [ebx + APPDATA.window]
298
        xchg    eax, [ebx + WDATA.cursor]
4507 lev 299
        jmp     .end
2430 mario79 300
;--------------------------------------
301
align 4
2288 clevermous 302
.fail:
303
        mov     eax, [def_cursor]
304
        mov     ebx, [current_slot]
9930 Doczom 305
        mov     ebx, [ebx + APPDATA.window]
306
        xchg    eax, [ebx + WDATA.cursor]
4507 lev 307
align 4
308
.end:
309
        mov     [redrawmouse_unconditional], 1
5350 serge 310
        call    __sys_draw_pointer
2288 clevermous 311
        ret
312
endp
2430 mario79 313
;------------------------------------------------------------------------------
314
align 4
2288 clevermous 315
; param
316
;  eax= pid
317
;  ebx= src
318
;  ecx= flags
319
 
320
create_cursor:
321
.src     equ esp
322
.flags   equ esp+4
323
.hcursor equ esp+8
324
 
325
        sub     esp, 4         ;space for .hcursor
326
        push    ecx
327
        push    ebx
328
 
329
        mov     ebx, eax
2384 hidnplayr 330
        mov     eax, sizeof.CURSOR
2288 clevermous 331
        call    create_kernel_object
332
        test    eax, eax
333
        jz      .fail
334
 
335
        mov     [.hcursor], eax
336
 
337
        xor     ebx, ebx
9715 Doczom 338
        mov     [eax + CURSOR.magic], 'CURS'
339
        mov     [eax + CURSOR.destroy], destroy_cursor
340
        mov     [eax + CURSOR.hot_x], ebx
341
        mov     [eax + CURSOR.hot_y], ebx
2288 clevermous 342
 
9926 Doczom 343
        stdcall kernel_alloc, PAGE_SIZE
2288 clevermous 344
        test    eax, eax
345
        jz      .fail
346
 
347
        mov     edi, [.hcursor]
9715 Doczom 348
        mov     [edi + CURSOR.base], eax
2288 clevermous 349
 
350
        mov     esi, [.src]
351
        mov     ebx, [.flags]
352
        cmp     bx, LOAD_INDIRECT
353
        je      .indirect
354
 
355
        movzx   ecx, word [esi+10]
356
        movzx   edx, word [esi+12]
9715 Doczom 357
        mov     [edi + CURSOR.hot_x], ecx
358
        mov     [edi + CURSOR.hot_y], edx
2288 clevermous 359
 
360
        stdcall init_cursor, eax, esi
361
 
2473 Serge 362
align 4
363
.add_cursor:
2337 Serge 364
        mov     ecx, [.hcursor]
9715 Doczom 365
        lea     ecx, [ecx + CURSOR.list_next]
2288 clevermous 366
        lea     edx, [_display.cr_list.next]
367
 
368
        pushfd
369
        cli
2337 Serge 370
        list_add ecx, edx   ;list_add_tail(new, head)
2288 clevermous 371
        popfd
372
 
373
        mov     eax, [.hcursor]
374
        cmp     [_display.init_cursor], 0
375
        je      .fail
376
 
377
        push    eax
378
        call    [_display.init_cursor]
379
        add     esp, 4
380
 
381
        mov     eax, [.hcursor]
2430 mario79 382
;--------------------------------------
383
align 4
2288 clevermous 384
.fail:
385
        add     esp, 12
386
        ret
2430 mario79 387
;--------------------------------------
388
align 4
2288 clevermous 389
.indirect:
390
        shr     ebx, 16
391
        movzx   ecx, bh
392
        movzx   edx, bl
9715 Doczom 393
        mov     [edi + CURSOR.hot_x], ecx
394
        mov     [edi + CURSOR.hot_y], edx
2288 clevermous 395
 
396
        xchg    edi, eax
9926 Doczom 397
        mov     ecx, PAGE_SIZE/4
2288 clevermous 398
        cld
399
        rep movsd
2473 Serge 400
        jmp     .add_cursor
2430 mario79 401
;------------------------------------------------------------------------------
2288 clevermous 402
align 4
403
proc load_cursor stdcall, src:dword, flags:dword
404
           locals
405
             handle  dd ?
406
           endl
407
 
408
        xor     eax, eax
409
        cmp     [create_cursor], eax
410
        je      .fail2
411
 
412
        mov     [handle], eax
413
        cmp     word [flags], LOAD_FROM_FILE
414
        jne     @F
415
 
416
        stdcall load_file, [src]
417
        test    eax, eax
418
        jz      .fail
419
        mov     [src], eax
2430 mario79 420
;--------------------------------------
421
align 4
2288 clevermous 422
@@:
423
        push    ebx
424
        push    esi
425
        push    edi
426
 
9828 Doczom 427
        mov     eax, [current_slot]
428
        mov     eax, [eax + APPDATA.tid]
2288 clevermous 429
        mov     ebx, [src]
430
        mov     ecx, [flags]
431
        call    create_cursor    ;eax, ebx, ecx
432
        mov     [handle], eax
433
 
434
        cmp     word [flags], LOAD_FROM_FILE
435
        jne     .exit
436
        stdcall kernel_free, [src]
2430 mario79 437
;--------------------------------------
438
align 4
2288 clevermous 439
.exit:
440
        pop     edi
441
        pop     esi
442
        pop     ebx
2430 mario79 443
;--------------------------------------
444
align 4
2288 clevermous 445
.fail:
446
        mov     eax, [handle]
2430 mario79 447
;--------------------------------------
448
align 4
2288 clevermous 449
.fail2:
450
        ret
451
endp
2430 mario79 452
;------------------------------------------------------------------------------
2288 clevermous 453
align 4
454
proc delete_cursor stdcall, hcursor:dword
455
 
3069 serge 456
;        DEBUGF 1,'K : delete_cursor %x\n', [hcursor]
457
 
2288 clevermous 458
        mov     esi, [hcursor]
3069 serge 459
 
9715 Doczom 460
        cmp     [esi + CURSOR.magic], 'CURS'
2288 clevermous 461
        jne     .fail
462
 
9828 Doczom 463
        mov     ebx, [current_slot]
464
        mov     ebx, [ebx + APPDATA.tid]
465
        cmp     ebx, [esi + CURSOR.pid]
2288 clevermous 466
        jne     .fail
467
 
468
        mov     ebx, [current_slot]
9930 Doczom 469
        mov     ebx, [ebx + APPDATA.window]
470
        cmp     esi, [ebx + WDATA.cursor]
2288 clevermous 471
        jne     @F
472
        mov     eax, [def_cursor]
9930 Doczom 473
        mov     [ebx + WDATA.cursor], eax
2430 mario79 474
;--------------------------------------
475
align 4
2288 clevermous 476
@@:
477
        mov     eax, [hcursor]
9715 Doczom 478
        call    [eax + APPOBJ.destroy]
2430 mario79 479
;--------------------------------------
480
align 4
2288 clevermous 481
.fail:
482
        ret
483
endp
2430 mario79 484
;------------------------------------------------------------------------------
485
align 4
2288 clevermous 486
; param
487
;  eax= cursor
488
destroy_cursor:
489
 
490
        push    eax
9715 Doczom 491
        stdcall kernel_free, [eax + CURSOR.base]
2337 Serge 492
 
493
        mov     eax, [esp]
9715 Doczom 494
        lea     eax, [eax + CURSOR.list_next]
2337 Serge 495
 
496
        pushfd
497
        cli
498
        list_del eax
499
        popfd
500
 
2288 clevermous 501
        pop     eax
502
        call    destroy_kernel_object
503
        ret
2430 mario79 504
;------------------------------------------------------------------------------
2288 clevermous 505
align 4
506
select_cursor:
9828 Doczom 507
        mov     eax, [esp + 4]
2288 clevermous 508
        mov     [_display.cursor], eax
509
        ret     4
2430 mario79 510
;------------------------------------------------------------------------------
2288 clevermous 511
align 4
512
proc restore_24 stdcall, x:dword, y:dword
513
 
514
        push    ebx
515
 
516
        mov     ebx, [cur_saved_base]
517
        mov     edx, [cur.h]
518
        test    edx, edx
519
        jz      .ret
520
 
521
        push    esi
522
        push    edi
523
 
524
        mov     esi, cur_saved_data
525
        mov     ecx, [cur.w]
9828 Doczom 526
        lea     ecx, [ecx + ecx*2]
2288 clevermous 527
        push    ecx
2430 mario79 528
;--------------------------------------
529
align 4
2288 clevermous 530
@@:
531
        mov     edi, ebx
5351 serge 532
        add     ebx, [_display.lfb_pitch]
2288 clevermous 533
 
534
        mov     ecx, [esp]
535
        rep movsb
536
        dec     edx
537
        jnz     @B
538
 
539
        pop     ecx
540
        pop     edi
541
        pop     esi
2430 mario79 542
;--------------------------------------
543
align 4
2288 clevermous 544
.ret:
545
        pop     ebx
546
        ret
547
endp
2430 mario79 548
;------------------------------------------------------------------------------
2288 clevermous 549
align 4
550
proc restore_32 stdcall, x:dword, y:dword
551
 
552
        push    ebx
553
 
554
        mov     ebx, [cur_saved_base]
555
        mov     edx, [cur.h]
556
        test    edx, edx
557
        jz      .ret
558
 
559
        push    esi
560
        push    edi
561
 
562
        mov     esi, cur_saved_data
2430 mario79 563
;--------------------------------------
564
align 4
2288 clevermous 565
@@:
566
        mov     edi, ebx
5351 serge 567
        add     ebx, [_display.lfb_pitch]
2288 clevermous 568
 
569
        mov     ecx, [cur.w]
570
        rep movsd
571
        dec     edx
572
        jnz     @B
573
 
574
        pop     edi
6127 serge 575
        pop     esi
576
 
2430 mario79 577
;--------------------------------------
578
align 4
2288 clevermous 579
.ret:
580
        pop     ebx
581
        ret
582
endp
2430 mario79 583
;------------------------------------------------------------------------------
2288 clevermous 584
align 4
5154 hidnplayr 585
proc restore_16 stdcall, x:dword, y:dword
586
 
587
        push    ebx
588
 
589
        mov     ebx, [cur_saved_base]
590
        mov     edx, [cur.h]
591
        test    edx, edx
592
        jz      .ret
593
 
594
        push    esi
595
        push    edi
596
 
597
        mov     esi, cur_saved_data
598
;--------------------------------------
599
align 4
600
@@:
601
        mov     edi, ebx
5351 serge 602
        add     ebx, [_display.lfb_pitch]
5154 hidnplayr 603
 
604
        mov     ecx, [cur.w]
605
        rep movsw
606
        dec     edx
607
        jnz     @B
608
 
609
        pop     edi
6127 serge 610
        pop     esi
611
 
5154 hidnplayr 612
;--------------------------------------
613
align 4
614
.ret:
615
        pop     ebx
616
        ret
617
endp
618
;------------------------------------------------------------------------------
619
align 4
9941 Doczom 620
proc VGA_restore_32 stdcall, x:dword, y:dword
621
 
622
        push    ebx
623
 
624
        mov     ebx, [cur_saved_base]
625
        mov     edx, [cur.h]
626
        test    edx, edx
627
        jz      .ret
628
 
629
        push    esi
630
        push    edi
631
 
632
        mov     esi, cur_saved_data
633
        mov     edi, ebx
634
        push    [cur.w]
635
        push    [cur.top];[y]
636
        push    [cur.left];[x]
637
        ;mov     eax, [cur.top]
638
        ;add     [esp + 4], eax
639
        ;mov     eax, [cur.left]
640
        ;add     [esp], eax
641
;--------------------------------------
642
align 4
643
@@:
644
        mov     ecx, [esi]
645
        add     esi, 4
646
 
647
        ;mov     eax, [esp]
648
        ;sub     eax, [x]
649
        ;shl     eax, 2 ; *4
650
        ;mov     [edi + eax], ecx
651
 
652
        mov     eax, [esp]
653
        mov     ebx, [esp + 4]
654
 
655
        push    edx  edi
656
        mov     edi, 1
657
        or      ecx, 0x04000000
658
        call    __sys_putpixel
659
        pop     edi edx
660
        add     dword[esp], 1
661
        dec     dword[esp + 8]
662
        jnz     @b
663
 
664
        mov     eax, [cur.w]
665
        mov     ecx, [cur.left];[x]
666
        ;add     ecx, [cur.left]
667
        mov     [esp + 8], eax
668
 
669
        mov     dword[esp], ecx
670
 
671
        inc     dword[esp + 4]
672
        ;add     edi, [_display.lfb_pitch]
673
        dec     edx
674
        jnz     @b
675
 
676
        add     esp, 4*3
677
 
678
        pop     edi
679
        pop     esi
680
;--------------------------------------
681
align 4
682
.ret:
683
        pop     ebx
684
        ret
685
endp
686
;------------------------------------------------------------------------------
687
align 4
2288 clevermous 688
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
689
           locals
690
             h      dd ?
691
             _dx     dd ?
692
             _dy     dd ?
693
           endl
694
 
695
        mov     esi, [hcursor]
696
        mov     ecx, [x]
697
        mov     eax, [y]
2446 mario79 698
;        mov     ebx, [BytesPerScanLine]
2288 clevermous 699
 
700
        xor     edx, edx
9715 Doczom 701
        sub     ecx, [esi + CURSOR.hot_x]
702
        lea     ebx, [ecx + 32-1]
2288 clevermous 703
        mov     [x], ecx
704
        sets    dl
705
        dec     edx
706
        and     ecx, edx      ;clip x to 0<=x
707
        mov     [cur.left], ecx
708
        mov     edi, ecx
709
        sub     edi, [x]
710
        mov     [_dx], edi
711
 
712
        xor     edx, edx
9715 Doczom 713
        sub     eax, [esi + CURSOR.hot_y]
2288 clevermous 714
        lea     edi, [eax+32-1]
715
        mov     [y], eax
716
        sets    dl
717
        dec     edx
718
        and     eax, edx      ;clip y to 0<=y
719
        mov     [cur.top], eax
720
        mov     edx, eax
721
        sub     edx, [y]
722
        mov     [_dy], edx
723
 
2446 mario79 724
;        mul     dword [BytesPerScanLine]
9715 Doczom 725
        mov     eax, [BPSLine_calc_area + eax*4]
726
        lea     edx, [LFB_BASE + ecx*3]
2288 clevermous 727
        add     edx, eax
728
        mov     [cur_saved_base], edx
729
 
5350 serge 730
        cmp     ebx, [_display.width]
731
        jb      @F
732
        mov     ebx, [_display.width]
2430 mario79 733
;--------------------------------------
734
align 4
2288 clevermous 735
@@:
5350 serge 736
        cmp     edi, [_display.height]
737
        jb      @F
738
        mov     edi, [_display.height]
2430 mario79 739
;--------------------------------------
740
align 4
2288 clevermous 741
@@:
742
 
743
        sub     ebx, [x]
744
        sub     edi, [y]
2576 mario79 745
        sub     ebx, [_dx]
746
        sub     edi, [_dy]
2288 clevermous 747
 
748
        mov     [cur.w], ebx
749
        mov     [cur.h], edi
750
        mov     [h], edi
751
 
752
        mov     eax, edi
753
        mov     edi, cur_saved_data
2430 mario79 754
;--------------------------------------
755
align 4
2288 clevermous 756
@@:
757
        mov     esi, edx
5351 serge 758
        add     edx, [_display.lfb_pitch]
2288 clevermous 759
        mov     ecx, [cur.w]
9715 Doczom 760
        lea     ecx, [ecx + ecx*2]
2288 clevermous 761
        rep movsb
762
        dec     eax
763
        jnz     @B
764
 
765
;draw cursor
766
        mov     ebx, [cur_saved_base]
767
        mov     eax, [_dy]
768
        shl     eax, 5
769
        add     eax, [_dx]
770
 
771
        mov     esi, [hcursor]
9715 Doczom 772
        mov     esi, [esi + CURSOR.base]
773
        lea     edx, [esi + eax*4]
2430 mario79 774
;--------------------------------------
775
align 4
2288 clevermous 776
.row:
777
        mov     ecx, [cur.w]
778
        mov     esi, edx
779
        mov     edi, ebx
780
        add     edx, 32*4
5351 serge 781
        add     ebx, [_display.lfb_pitch]
2430 mario79 782
;--------------------------------------
783
align 4
2288 clevermous 784
.pix:
785
        lodsd
786
        test    eax, 0xFF000000
787
        jz      @F
788
        mov     [edi], ax
789
        shr     eax, 16
790
        mov     [edi+2], al
2430 mario79 791
;--------------------------------------
792
align 4
2288 clevermous 793
@@:
794
        add     edi, 3
795
        dec     ecx
796
        jnz     .pix
797
 
798
        dec     [h]
799
        jnz     .row
800
        ret
801
endp
2430 mario79 802
;------------------------------------------------------------------------------
2288 clevermous 803
align 4
804
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
805
           locals
806
             h      dd ?
807
             _dx     dd ?
808
             _dy     dd ?
809
           endl
810
 
811
        mov     esi, [hcursor]
812
        mov     ecx, [x]
813
        mov     eax, [y]
814
 
815
        xor     edx, edx
9715 Doczom 816
        sub     ecx, [esi + CURSOR.hot_x]
2288 clevermous 817
        lea     ebx, [ecx+32-1]
818
        mov     [x], ecx
819
        sets    dl
820
        dec     edx
821
        and     ecx, edx      ;clip x to 0<=x
822
        mov     [cur.left], ecx
823
        mov     edi, ecx
824
        sub     edi, [x]
825
        mov     [_dx], edi
826
 
827
        xor     edx, edx
9715 Doczom 828
        sub     eax, [esi + CURSOR.hot_y]
2288 clevermous 829
        lea     edi, [eax+32-1]
830
        mov     [y], eax
831
        sets    dl
832
        dec     edx
833
        and     eax, edx      ;clip y to 0<=y
834
        mov     [cur.top], eax
835
        mov     edx, eax
836
        sub     edx, [y]
837
        mov     [_dy], edx
838
 
2446 mario79 839
;        mul     dword [BytesPerScanLine]
2480 mario79 840
        mov     eax, [BPSLine_calc_area+eax*4]
9715 Doczom 841
        lea     edx, [LFB_BASE + eax + ecx*4]
2288 clevermous 842
        mov     [cur_saved_base], edx
843
 
5350 serge 844
        cmp     ebx, [_display.width]
845
        jb      @F
846
        mov     ebx, [_display.width]
2430 mario79 847
;--------------------------------------
848
align 4
2288 clevermous 849
@@:
5350 serge 850
        cmp     edi, [_display.height]
851
        jb      @F
852
        mov     edi, [_display.height]
2430 mario79 853
;--------------------------------------
854
align 4
2288 clevermous 855
@@:
856
        sub     ebx, [x]
857
        sub     edi, [y]
2576 mario79 858
        sub     ebx, [_dx]
859
        sub     edi, [_dy]
2288 clevermous 860
 
861
        mov     [cur.w], ebx
862
        mov     [cur.h], edi
863
        mov     [h], edi
864
 
865
        mov     eax, edi
866
        mov     edi, cur_saved_data
2430 mario79 867
;--------------------------------------
868
align 4
2288 clevermous 869
@@:
870
        mov     esi, edx
5351 serge 871
        add     edx, [_display.lfb_pitch]
2288 clevermous 872
        mov     ecx, [cur.w]
873
        rep movsd
874
        dec     eax
875
        jnz     @B
876
 
877
;draw cursor
878
        mov     ebx, [cur_saved_base]
879
        mov     eax, [_dy]
880
        shl     eax, 5
881
        add     eax, [_dx]
882
 
883
        mov     esi, [hcursor]
9715 Doczom 884
        mov     esi, [esi + CURSOR.base]
2288 clevermous 885
        lea     edx, [esi+eax*4]
2430 mario79 886
;--------------------------------------
887
align 4
2288 clevermous 888
.row:
889
        mov     ecx, [cur.w]
890
        mov     esi, edx
891
        mov     edi, ebx
892
        add     edx, 32*4
5351 serge 893
        add     ebx, [_display.lfb_pitch]
2430 mario79 894
;--------------------------------------
895
align 4
2288 clevermous 896
.pix:
897
        lodsd
898
        test    eax, 0xFF000000
899
        jz      @F
900
        mov     [edi], eax
2430 mario79 901
;--------------------------------------
902
align 4
2288 clevermous 903
@@:
904
        add     edi, 4
905
        dec     ecx
906
        jnz     .pix
907
 
908
        dec     [h]
909
        jnz     .row
910
        ret
911
endp
2430 mario79 912
;------------------------------------------------------------------------------
913
align 4
5154 hidnplayr 914
proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
915
           locals
916
             h      dd ?
917
             _dx     dd ?
918
             _dy     dd ?
919
           endl
920
 
921
        mov     esi, [hcursor]
922
        mov     ecx, [x]
923
        mov     eax, [y]
924
 
925
        xor     edx, edx
9715 Doczom 926
        sub     ecx, [esi + CURSOR.hot_x]
927
        lea     ebx, [ecx + 32-1]
5154 hidnplayr 928
        mov     [x], ecx
929
        sets    dl
930
        dec     edx
931
        and     ecx, edx      ;clip x to 0<=x
932
        mov     [cur.left], ecx
933
        mov     edi, ecx
934
        sub     edi, [x]
935
        mov     [_dx], edi
936
 
937
        xor     edx, edx
9715 Doczom 938
        sub     eax, [esi + CURSOR.hot_y]
939
        lea     edi, [eax + 32-1]
5154 hidnplayr 940
        mov     [y], eax
941
        sets    dl
942
        dec     edx
943
        and     eax, edx      ;clip y to 0<=y
944
        mov     [cur.top], eax
945
        mov     edx, eax
946
        sub     edx, [y]
947
        mov     [_dy], edx
948
 
949
;        mul     dword [BytesPerScanLine]
9715 Doczom 950
        mov     eax, [BPSLine_calc_area + eax*4]
951
        lea     edx, [LFB_BASE + eax + ecx*2]
5154 hidnplayr 952
        mov     [cur_saved_base], edx
953
 
5350 serge 954
        cmp     ebx, [_display.width]
955
        jb      @F
956
        mov     ebx, [_display.width]
5154 hidnplayr 957
;--------------------------------------
958
align 4
959
@@:
5350 serge 960
        cmp     edi, [_display.height]
961
        jb      @F
962
        mov     edi, [_display.height]
5154 hidnplayr 963
;--------------------------------------
964
align 4
965
@@:
966
        sub     ebx, [x]
967
        sub     edi, [y]
968
        sub     ebx, [_dx]
969
        sub     edi, [_dy]
970
 
971
        mov     [cur.w], ebx
972
        mov     [cur.h], edi
973
        mov     [h], edi
974
 
975
        mov     eax, edi
976
        mov     edi, cur_saved_data
977
;--------------------------------------
978
align 4
979
@@:
980
        mov     esi, edx
5351 serge 981
        add     edx, [_display.lfb_pitch]
5154 hidnplayr 982
        mov     ecx, [cur.w]
983
 
984
        rep movsw
985
        dec     eax
986
        jnz     @B
987
 
988
;draw cursor
989
        mov     ebx, [cur_saved_base]
990
        mov     eax, [_dy]
991
        shl     eax, 5
992
        add     eax, [_dx]
993
 
994
        mov     esi, [hcursor]
9715 Doczom 995
        mov     esi, [esi + CURSOR.base]
996
        lea     edx, [esi + eax*4]
5154 hidnplayr 997
;--------------------------------------
998
align 4
999
.row:
1000
        mov     ecx, [cur.w]
1001
        mov     esi, edx
1002
        mov     edi, ebx
1003
        add     edx, 32*4
5351 serge 1004
        add     ebx, [_display.lfb_pitch]
5154 hidnplayr 1005
;--------------------------------------
1006
align 4
1007
.pix:
1008
        lodsd
1009
        test    eax, 0xFF000000
1010
        jz      @F
1011
; convert to 16 bpp and store to real LFB
1012
        and     eax, 00000000111110001111110011111000b
1013
        shr     ah, 2
1014
        shr     ax, 3
1015
        ror     eax, 8
1016
        add     al, ah
1017
        rol     eax, 8
1018
        mov     [edi], ax
1019
;--------------------------------------
1020
align 4
1021
@@:
1022
        add     edi, 2
1023
        dec     ecx
1024
        jnz     .pix
1025
 
1026
        dec     [h]
1027
        jnz     .row
1028
        ret
1029
endp
9941 Doczom 1030
 
5154 hidnplayr 1031
;------------------------------------------------------------------------------
1032
align 4
9941 Doczom 1033
proc VGA_move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
1034
           locals
1035
             h      dd ?
1036
             _dx     dd ?
1037
             _dy     dd ?
1038
             bg_ptr dd ?
1039
             tmp_x  dd ?
1040
             tmp_y  dd ?
1041
           endl
1042
 
1043
        mov     esi, [hcursor]
1044
        mov     ecx, [x]
1045
        mov     eax, [y]
1046
 
1047
        xor     edx, edx
1048
        sub     ecx, [esi + CURSOR.hot_x]
1049
        lea     ebx, [ecx+32-1]
1050
        mov     [x], ecx
1051
        sets    dl
1052
        dec     edx
1053
        and     ecx, edx      ;clip x to 0<=x
1054
        mov     [cur.left], ecx
1055
        mov     edi, ecx
1056
        sub     edi, [x]
1057
        mov     [_dx], edi
1058
 
1059
        xor     edx, edx
1060
        sub     eax, [esi + CURSOR.hot_y]
1061
        lea     edi, [eax+32-1]
1062
        mov     [y], eax
1063
        sets    dl
1064
        dec     edx
1065
        and     eax, edx      ;clip y to 0<=y
1066
        mov     [cur.top], eax
1067
        mov     edx, eax
1068
        sub     edx, [y]
1069
        mov     [_dy], edx
1070
 
1071
        mov     [tmp_x], ecx
1072
        mov     [tmp_y], eax
1073
        mov     eax, [BPSLine_calc_area+eax*4]
1074
        lea     edx, [LFB_BASE + eax + ecx*4]
1075
        mov     [cur_saved_base], edx
1076
 
1077
        cmp     ebx, [_display.width]
1078
        jb      @F
1079
        mov     ebx, [_display.width]
1080
;--------------------------------------
1081
align 4
1082
@@:
1083
        cmp     edi, [_display.height]
1084
        jb      @F
1085
        mov     edi, [_display.height]
1086
;--------------------------------------
1087
align 4
1088
@@:
1089
        sub     ebx, [x]
1090
        sub     edi, [y]
1091
        sub     ebx, [_dx]
1092
        sub     edi, [_dy]
1093
 
1094
        mov     [cur.w], ebx
1095
        mov     [cur.h], edi
1096
        mov     [h], edi
1097
 
1098
        mov     eax, edi
1099
        mov     edi, cur_saved_data
1100
 
1101
        xor     ecx, ecx
1102
        mov     eax, ecx
1103
;--------------------------------------
1104
align 4
1105
@@:
1106
        ; get and save pixel background
1107
        push    eax ecx ebx edx
1108
        add     eax, [tmp_x]
1109
        mov     ebx, ecx
1110
        add     ebx, [tmp_y]
1111
        push    edi
1112
 
1113
        or      ecx, 0x04000000
1114
        call    [GETPIXEL]
1115
 
1116
        pop     edi
1117
        ;and     ecx, 0x00ffffff
1118
        mov     [edi], ecx
1119
        add     edi, 4
1120
 
1121
        pop     edx ebx ecx eax
1122
        inc     eax
1123
        cmp     eax, [cur.w]
1124
        jb      @b
1125
        xor     eax, eax
1126
        inc     ecx
1127
        cmp     ecx, [h]
1128
        jb      @B
1129
 
1130
;draw cursor
1131
        mov     ebx, [cur_saved_base]
1132
        mov     eax, [_dy]
1133
        shl     eax, 5
1134
        add     eax, [_dx]
1135
 
1136
        mov     esi, [hcursor]
1137
        mov     esi, [esi + CURSOR.base]
1138
        lea     edx, [esi+eax*4]
1139
        mov     [bg_ptr], cur_saved_data
1140
 
1141
        mov     [_dy], 0
1142
;--------------------------------------
1143
align 4
1144
.row:
1145
        mov     [_dx], 0
1146
        mov     ecx, [cur.w]
1147
        mov     esi, edx  ; cursor image base
1148
        mov     edi, ebx
1149
        add     edx, 32*4
1150
        add     ebx, [_display.lfb_pitch]
1151
;--------------------------------------
1152
align 4
1153
.pix:
1154
        ; get pixel cursor
1155
        lodsd
1156
        test    eax, 0xFF000000
1157
        jz      @F
1158
        mov     [edi], eax
1159
 
1160
        pusha
1161
        mov     edi, 1 ; force
1162
        mov     ecx, eax ; color
1163
        and     ecx, 0x00ffffff
1164
        or      ecx, 0x04000000
1165
        mov     eax, [x]
1166
        mov     ebx, [y]
1167
        add     eax, [_dx]
1168
        add     ebx, [_dy]
1169
        call    __sys_putpixel
1170
        popa
1171
;--------------------------------------
1172
align 4
1173
@@:
1174
        inc     [_dx]
1175
        add     edi, 4
1176
        dec     ecx
1177
        jnz     .pix
1178
 
1179
        inc     [_dy]
1180
        dec     [h]
1181
        jnz     .row
1182
        ret
1183
endp
1184
 
1185
;------------------------------------------------------------------------------
1186
align 4
2430 mario79 1187
check_mouse_area_for_getpixel_new:
1188
; in:
1189
; eax = x
1190
; ebx = y
1191
; out:
1192
; ecx = new color
1193
;--------------------------------------
1194
; check for Y
1195
        cmp     bx, [Y_UNDER_subtraction_CUR_hot_y]
1196
        jb      .no_mouse_area
2288 clevermous 1197
 
2430 mario79 1198
        cmp     bx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1199
        jae     .no_mouse_area
1200
;--------------------------------------
1201
; check for X
1202
        cmp     ax, [X_UNDER_subtraction_CUR_hot_x]
1203
        jb      .no_mouse_area
2288 clevermous 1204
 
2430 mario79 1205
        cmp     ax, [X_UNDER_sub_CUR_hot_x_add_curh]
1206
        jae     .no_mouse_area
1207
;--------------------------------------
1208
        push    eax ebx
1209
; offset X
2575 mario79 1210
        movzx   ecx, word [X_UNDER_subtraction_CUR_hot_x]
2430 mario79 1211
        sub     eax, ecx        ; x1
1212
; offset Y
2575 mario79 1213
        movzx   ecx, word [Y_UNDER_subtraction_CUR_hot_y]
2430 mario79 1214
        sub     ebx, ecx        ; y1
1215
;--------------------------------------
1216
; ebx = offset y
1217
; eax = offset x
1218
        imul    ebx, [cur.w]     ;y
1219
        add     eax, ebx
1220
        mov     ebx, eax
1221
        shl     eax, 2
5154 hidnplayr 1222
        cmp     byte [_display.bits_per_pixel], 32
2430 mario79 1223
        je      @f
1224
        sub     eax, ebx
5154 hidnplayr 1225
        cmp     byte [_display.bits_per_pixel], 24
1226
        je      @f
1227
        sub     eax, ebx
7510 hidnplayr 1228
        add     eax, cur_saved_data
1229
        mov     ecx, [eax]
1230
        shl     ecx, 3
1231
        ror     ecx, 8
1232
        shl     cx, 2
1233
        ror     ecx, 8
1234
        shl     cl, 3
1235
        rol     ecx, 16
1236
        or      ecx, 0xff000000
1237
        pop     ebx eax
1238
        ret
1239
 
2430 mario79 1240
;--------------------------------------
2288 clevermous 1241
align 4
2430 mario79 1242
@@:
1243
        add     eax, cur_saved_data
1244
        mov     ecx, [eax]
7510 hidnplayr 1245
        or      ecx, 0xff000000
2430 mario79 1246
        pop     ebx eax
1247
        ret
1248
;--------------------------------------
1249
align 4
1250
.no_mouse_area:
1251
        xor     ecx, ecx
1252
        ret
1253
;-----------------------------------------------------------------------------
1254
align 4
1255
check_mouse_area_for_putpixel_new:
1256
; in:
1257
; ecx = x shl 16 + y
1258
; eax = color
1259
; out:
1260
; eax = new color
1261
;--------------------------------------
1262
; check for Y
1263
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1264
        jae     .no_mouse_area
1265
 
2575 mario79 1266
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1267
        jb      .no_mouse_area
1268
 
2430 mario79 1269
        rol     ecx, 16
1270
;--------------------------------------
1271
; check for X
2575 mario79 1272
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1273
        jae     .no_mouse_area
1274
 
1275
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
2430 mario79 1276
        jb      .no_mouse_area
1277
 
2575 mario79 1278
        ror     ecx, 16
2430 mario79 1279
;--------------------------------------
1280
align 4
1281
.1:
1282
        push    eax
1283
;--------------------------------------
1284
; ecx = (offset x) shl 16 + (offset y)
1285
        push    ebx
1286
        mov     ebx, ecx
1287
        shr     ebx, 16        ; x
1288
        and     ecx, 0xffff    ; y
2575 mario79 1289
 
1290
        cmp     ecx, [cur.h]
1291
        jae     @f
1292
 
1293
        cmp     ebx, [cur.w]
1294
        jb      .ok
1295
;--------------------------------------
1296
align 4
1297
@@:
1298
;        DEBUGF  1, "K : SHIT HAPPENS: %x %x \n", ecx,ebx
1299
        pop     ebx
1300
        jmp     .sh   ; SORRY! SHIT HAPPENS!
1301
;--------------------------------------
1302
align 4
1303
.ok:
2430 mario79 1304
; ecx = offset y
1305
; ebx = offset x
1306
        push    ebx ecx
1307
        imul    ecx, [cur.w]    ;y
1308
        add     ecx, ebx
1309
        mov     ebx, ecx
1310
        shl     ecx, 2
5154 hidnplayr 1311
        cmp     byte [_display.bits_per_pixel], 16
1312
        je      .16
1313
        cmp     byte [_display.bits_per_pixel], 24
2430 mario79 1314
        je      .24
1315
        and     eax, 0xFFFFFF
1316
        mov     [ecx + cur_saved_data], eax   ;store new color  to
1317
        jmp     @f
1318
;--------------------------------------
1319
align 4
5154 hidnplayr 1320
.16:
1321
        sub     ecx, ebx
1322
        sub     ecx, ebx
1323
; convert to 16 bpp and store to real LFB
1324
        and     eax, 00000000111110001111110011111000b
1325
        shr     ah, 2
1326
        shr     ax, 3
1327
        ror     eax, 8
1328
        add     al, ah
1329
        rol     eax, 8
1330
        mov     [ecx + cur_saved_data], ax      ;store new color  to
1331
        jmp     @f
1332
;--------------------------------------
1333
align 4
2430 mario79 1334
.24:
1335
        sub     ecx, ebx
1336
        mov     [ecx + cur_saved_data], ax      ;store new color  to
1337
        shr     eax, 16
1338
        mov     [ecx + cur_saved_data + 2], al  ;store new color  to
1339
;--------------------------------------
1340
align 4
1341
@@:
1342
        pop     ecx ebx
1343
 
1344
        shl     ecx, 5
1345
        add     ecx, ebx
1346
 
1347
        mov     eax, [current_cursor]
9715 Doczom 1348
        mov     eax, [eax + CURSOR.base]
1349
        lea     eax, [eax + ecx*4]
2430 mario79 1350
        mov     eax, [eax]
1351
 
1352
        pop     ebx
1353
 
1354
        test    eax, 0xFF000000
1355
        jz      @f
1356
 
2652 mario79 1357
        add     esp, 4
2430 mario79 1358
        ret
1359
;--------------------------------------
1360
align 4
2575 mario79 1361
.sh:
1362
        mov     ecx, -1
1363
;--------------------------------------
1364
align 4
2430 mario79 1365
@@:
1366
        pop     eax
1367
;--------------------------------------
1368
align 4
1369
.no_mouse_area:
1370
        ret
1371
;------------------------------------------------------------------------------
1372
align 4
2288 clevermous 1373
get_display:
1374
        mov     eax, _display
1375
        ret
2430 mario79 1376
;------------------------------------------------------------------------------
2288 clevermous 1377
align 4
1378
init_display:
1379
        xor     eax, eax
1380
        mov     edi, _display
1381
 
9715 Doczom 1382
        mov     [edi + display_t.init_cursor], eax
1383
        mov     [edi + display_t.select_cursor], eax
1384
        mov     [edi + display_t.show_cursor], eax
1385
        mov     [edi + display_t.move_cursor], eax
1386
        mov     [edi + display_t.restore_cursor], eax
2288 clevermous 1387
 
9715 Doczom 1388
        lea     ecx, [edi + display_t.cr_list.next]
1389
        mov     [edi + display_t.cr_list.next], ecx
1390
        mov     [edi + display_t.cr_list.prev], ecx
2288 clevermous 1391
 
9941 Doczom 1392
        cmp     [SCR_MODE], word 0x12
1393
        jne     .not_vga
1394
        ; TODO
1395
        mov     ebx, VGA_restore_32
1396
        mov     ecx, VGA_move_cursor_32
1397
        mov     edx, VGA_putpixel
1398
        jmp     .set
2288 clevermous 1399
 
9941 Doczom 1400
.not_vga:
2288 clevermous 1401
        test    word [SCR_MODE], 0x4000
9941 Doczom 1402
        jnz     .not_ega
1403
 
1404
        mov     ebx, restore_32
1405
        mov     ecx, move_cursor_32
1406
        mov     edx, Vesa20_putpixel32_new
1407
        mov     eax, [_display.bits_per_pixel]
1408
        jmp     .set
1409
 
1410
.not_ega:
2288 clevermous 1411
        mov     ebx, restore_32
1412
        mov     ecx, move_cursor_32
3537 Serge 1413
        mov     edx, Vesa20_putpixel32_new
5154 hidnplayr 1414
        mov     eax, [_display.bits_per_pixel]
9941 Doczom 1415
 
3537 Serge 1416
        cmp     al, 32
5154 hidnplayr 1417
        jne     .not_32bpp
2288 clevermous 1418
 
3537 Serge 1419
.set:
2288 clevermous 1420
        mov     [_display.select_cursor], select_cursor
1421
        mov     [_display.move_cursor], ecx
1422
        mov     [_display.restore_cursor], ebx
9941 Doczom 1423
        ;mov     [_display.check_mouse], check_mouse_area_for_putpixel_new
1424
        ;mov     [_display.check_m_pixel], check_mouse_area_for_getpixel_new
2288 clevermous 1425
 
3537 Serge 1426
        mov     [PUTPIXEL], edx
9941 Doczom 1427
 
9848 rgimad 1428
        stdcall load_cursor, def_hresize, dword LOAD_FROM_MEM
1429
        mov     [def_cursor_hresize], eax
1430
        stdcall load_cursor, def_vresize, dword LOAD_FROM_MEM
1431
        mov     [def_cursor_vresize], eax
1432
        stdcall load_cursor, def_dresize1, dword LOAD_FROM_MEM
1433
        mov     [def_cursor_dresize1], eax
1434
        stdcall load_cursor, def_dresize2, dword LOAD_FROM_MEM
1435
        mov     [def_cursor_dresize2], eax
1436
 
2497 mario79 1437
        stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM
1438
        mov     [def_cursor_clock], eax
2288 clevermous 1439
        stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
1440
        mov     [def_cursor], eax
1441
        ret
3537 Serge 1442
 
5154 hidnplayr 1443
.not_32bpp:
1444
        cmp     al, 24
1445
        jne     .not_24bpp
1446
 
3537 Serge 1447
        mov     ebx, restore_24
1448
        mov     ecx, move_cursor_24
1449
        mov     edx, Vesa20_putpixel24_new
5154 hidnplayr 1450
        jmp     .set
3537 Serge 1451
 
5154 hidnplayr 1452
.not_24bpp:
1453
        cmp     al, 16
1454
        jne     .not_16bpp
1455
        mov     ebx, restore_16
1456
        mov     ecx, move_cursor_16
1457
        mov     edx, Vesa20_putpixel16_new
1458
        jmp     .set
1459
 
1460
.not_16bpp:
1461
;        cmp     al, 15
1462
;        jne     .fail
1463
;        mov     ebx, restore_15
1464
;        mov     ecx, move_cursor_15
1465
;        mov     edx, Vesa20_putpixel15_new
1466
;        jmp     .set
2288 clevermous 1467
.fail:
9941 Doczom 1468
        ;xor     eax, eax
1469
        ;mov     [_display.select_cursor], eax
1470
        ;mov     [_display.move_cursor], eax
2288 clevermous 1471
        ret
2430 mario79 1472
;------------------------------------------------------------------------------
2288 clevermous 1473
align 4
1474
def_arrow:
1475
  file 'arrow.cur'
2430 mario79 1476
;------------------------------------------------------------------------------
2497 mario79 1477
align 4
9848 rgimad 1478
def_hresize:
1479
  file 'hresize.cur'
1480
;------------------------------------------------------------------------------
1481
align 4
1482
def_vresize:
1483
  file 'vresize.cur'
1484
;------------------------------------------------------------------------------
1485
align 4
1486
def_dresize1:
1487
  file 'dresize1.cur'
1488
;------------------------------------------------------------------------------
1489
align 4
1490
def_dresize2:
1491
  file 'dresize2.cur'
1492
;------------------------------------------------------------------------------
1493
align 4
2497 mario79 1494
clock_arrow:
1495
  file 'arrow_clock.cur'
1496
;------------------------------------------------------------------------------
2288 clevermous 1497