Subversion Repositories Kolibri OS

Rev

Rev 9958 | 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: 10039 $
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:
10039 Doczom 321
virtual at esp
322
.src     dd ?
323
.flags   dd ?
324
.hcursor dd ?
325
end virtual
2288 clevermous 326
 
327
        sub     esp, 4         ;space for .hcursor
328
        push    ecx
329
        push    ebx
330
 
331
        mov     ebx, eax
2384 hidnplayr 332
        mov     eax, sizeof.CURSOR
2288 clevermous 333
        call    create_kernel_object
334
        test    eax, eax
335
        jz      .fail
336
 
337
        mov     [.hcursor], eax
338
 
339
        xor     ebx, ebx
9715 Doczom 340
        mov     [eax + CURSOR.magic], 'CURS'
341
        mov     [eax + CURSOR.destroy], destroy_cursor
342
        mov     [eax + CURSOR.hot_x], ebx
343
        mov     [eax + CURSOR.hot_y], ebx
2288 clevermous 344
 
9926 Doczom 345
        stdcall kernel_alloc, PAGE_SIZE
2288 clevermous 346
        test    eax, eax
347
        jz      .fail
348
 
349
        mov     edi, [.hcursor]
9715 Doczom 350
        mov     [edi + CURSOR.base], eax
2288 clevermous 351
 
352
        mov     esi, [.src]
353
        mov     ebx, [.flags]
354
        cmp     bx, LOAD_INDIRECT
355
        je      .indirect
356
 
357
        movzx   ecx, word [esi+10]
358
        movzx   edx, word [esi+12]
9715 Doczom 359
        mov     [edi + CURSOR.hot_x], ecx
360
        mov     [edi + CURSOR.hot_y], edx
2288 clevermous 361
 
362
        stdcall init_cursor, eax, esi
363
 
2473 Serge 364
align 4
365
.add_cursor:
2337 Serge 366
        mov     ecx, [.hcursor]
9715 Doczom 367
        lea     ecx, [ecx + CURSOR.list_next]
2288 clevermous 368
        lea     edx, [_display.cr_list.next]
369
 
370
        pushfd
371
        cli
2337 Serge 372
        list_add ecx, edx   ;list_add_tail(new, head)
2288 clevermous 373
        popfd
374
 
375
        mov     eax, [.hcursor]
376
        cmp     [_display.init_cursor], 0
377
        je      .fail
378
 
379
        push    eax
380
        call    [_display.init_cursor]
381
        add     esp, 4
382
 
383
        mov     eax, [.hcursor]
2430 mario79 384
;--------------------------------------
385
align 4
2288 clevermous 386
.fail:
387
        add     esp, 12
388
        ret
2430 mario79 389
;--------------------------------------
390
align 4
2288 clevermous 391
.indirect:
392
        shr     ebx, 16
393
        movzx   ecx, bh
394
        movzx   edx, bl
9715 Doczom 395
        mov     [edi + CURSOR.hot_x], ecx
396
        mov     [edi + CURSOR.hot_y], edx
2288 clevermous 397
 
398
        xchg    edi, eax
9926 Doczom 399
        mov     ecx, PAGE_SIZE/4
2288 clevermous 400
        cld
401
        rep movsd
2473 Serge 402
        jmp     .add_cursor
2430 mario79 403
;------------------------------------------------------------------------------
2288 clevermous 404
align 4
405
proc load_cursor stdcall, src:dword, flags:dword
406
           locals
407
             handle  dd ?
408
           endl
409
 
410
        xor     eax, eax
411
        cmp     [create_cursor], eax
412
        je      .fail2
413
 
414
        mov     [handle], eax
415
        cmp     word [flags], LOAD_FROM_FILE
416
        jne     @F
417
 
418
        stdcall load_file, [src]
419
        test    eax, eax
420
        jz      .fail
421
        mov     [src], eax
2430 mario79 422
;--------------------------------------
423
align 4
2288 clevermous 424
@@:
425
        push    ebx
426
        push    esi
427
        push    edi
428
 
9828 Doczom 429
        mov     eax, [current_slot]
430
        mov     eax, [eax + APPDATA.tid]
2288 clevermous 431
        mov     ebx, [src]
432
        mov     ecx, [flags]
433
        call    create_cursor    ;eax, ebx, ecx
434
        mov     [handle], eax
435
 
436
        cmp     word [flags], LOAD_FROM_FILE
437
        jne     .exit
438
        stdcall kernel_free, [src]
2430 mario79 439
;--------------------------------------
440
align 4
2288 clevermous 441
.exit:
442
        pop     edi
443
        pop     esi
444
        pop     ebx
2430 mario79 445
;--------------------------------------
446
align 4
2288 clevermous 447
.fail:
448
        mov     eax, [handle]
2430 mario79 449
;--------------------------------------
450
align 4
2288 clevermous 451
.fail2:
452
        ret
453
endp
2430 mario79 454
;------------------------------------------------------------------------------
2288 clevermous 455
align 4
456
proc delete_cursor stdcall, hcursor:dword
457
 
3069 serge 458
;        DEBUGF 1,'K : delete_cursor %x\n', [hcursor]
459
 
2288 clevermous 460
        mov     esi, [hcursor]
3069 serge 461
 
9715 Doczom 462
        cmp     [esi + CURSOR.magic], 'CURS'
2288 clevermous 463
        jne     .fail
464
 
9828 Doczom 465
        mov     ebx, [current_slot]
466
        mov     ebx, [ebx + APPDATA.tid]
467
        cmp     ebx, [esi + CURSOR.pid]
2288 clevermous 468
        jne     .fail
469
 
470
        mov     ebx, [current_slot]
9930 Doczom 471
        mov     ebx, [ebx + APPDATA.window]
472
        cmp     esi, [ebx + WDATA.cursor]
2288 clevermous 473
        jne     @F
474
        mov     eax, [def_cursor]
9930 Doczom 475
        mov     [ebx + WDATA.cursor], eax
2430 mario79 476
;--------------------------------------
477
align 4
2288 clevermous 478
@@:
479
        mov     eax, [hcursor]
9715 Doczom 480
        call    [eax + APPOBJ.destroy]
2430 mario79 481
;--------------------------------------
482
align 4
2288 clevermous 483
.fail:
484
        ret
485
endp
2430 mario79 486
;------------------------------------------------------------------------------
487
align 4
2288 clevermous 488
; param
489
;  eax= cursor
490
destroy_cursor:
491
 
492
        push    eax
9715 Doczom 493
        stdcall kernel_free, [eax + CURSOR.base]
2337 Serge 494
 
495
        mov     eax, [esp]
9715 Doczom 496
        lea     eax, [eax + CURSOR.list_next]
2337 Serge 497
 
498
        pushfd
499
        cli
500
        list_del eax
501
        popfd
502
 
2288 clevermous 503
        pop     eax
504
        call    destroy_kernel_object
505
        ret
2430 mario79 506
;------------------------------------------------------------------------------
2288 clevermous 507
align 4
508
select_cursor:
9828 Doczom 509
        mov     eax, [esp + 4]
2288 clevermous 510
        mov     [_display.cursor], eax
511
        ret     4
2430 mario79 512
;------------------------------------------------------------------------------
2288 clevermous 513
align 4
514
proc restore_24 stdcall, x:dword, y:dword
515
 
516
        push    ebx
517
 
518
        mov     ebx, [cur_saved_base]
519
        mov     edx, [cur.h]
520
        test    edx, edx
521
        jz      .ret
522
 
523
        push    esi
524
        push    edi
525
 
526
        mov     esi, cur_saved_data
527
        mov     ecx, [cur.w]
9828 Doczom 528
        lea     ecx, [ecx + ecx*2]
2288 clevermous 529
        push    ecx
2430 mario79 530
;--------------------------------------
531
align 4
2288 clevermous 532
@@:
533
        mov     edi, ebx
5351 serge 534
        add     ebx, [_display.lfb_pitch]
2288 clevermous 535
 
536
        mov     ecx, [esp]
537
        rep movsb
538
        dec     edx
539
        jnz     @B
540
 
541
        pop     ecx
542
        pop     edi
543
        pop     esi
2430 mario79 544
;--------------------------------------
545
align 4
2288 clevermous 546
.ret:
547
        pop     ebx
548
        ret
549
endp
2430 mario79 550
;------------------------------------------------------------------------------
2288 clevermous 551
align 4
552
proc restore_32 stdcall, x:dword, y:dword
553
 
554
        push    ebx
555
 
556
        mov     ebx, [cur_saved_base]
557
        mov     edx, [cur.h]
558
        test    edx, edx
559
        jz      .ret
560
 
561
        push    esi
562
        push    edi
563
 
564
        mov     esi, cur_saved_data
2430 mario79 565
;--------------------------------------
566
align 4
2288 clevermous 567
@@:
568
        mov     edi, ebx
5351 serge 569
        add     ebx, [_display.lfb_pitch]
2288 clevermous 570
 
571
        mov     ecx, [cur.w]
572
        rep movsd
573
        dec     edx
574
        jnz     @B
575
 
576
        pop     edi
6127 serge 577
        pop     esi
578
 
2430 mario79 579
;--------------------------------------
580
align 4
2288 clevermous 581
.ret:
582
        pop     ebx
583
        ret
584
endp
2430 mario79 585
;------------------------------------------------------------------------------
2288 clevermous 586
align 4
5154 hidnplayr 587
proc restore_16 stdcall, x:dword, y:dword
588
 
589
        push    ebx
590
 
591
        mov     ebx, [cur_saved_base]
592
        mov     edx, [cur.h]
593
        test    edx, edx
594
        jz      .ret
595
 
596
        push    esi
597
        push    edi
598
 
599
        mov     esi, cur_saved_data
600
;--------------------------------------
601
align 4
602
@@:
603
        mov     edi, ebx
5351 serge 604
        add     ebx, [_display.lfb_pitch]
5154 hidnplayr 605
 
606
        mov     ecx, [cur.w]
607
        rep movsw
608
        dec     edx
609
        jnz     @B
610
 
611
        pop     edi
6127 serge 612
        pop     esi
613
 
5154 hidnplayr 614
;--------------------------------------
615
align 4
616
.ret:
617
        pop     ebx
618
        ret
619
endp
620
;------------------------------------------------------------------------------
621
align 4
9941 Doczom 622
proc VGA_restore_32 stdcall, x:dword, y:dword
623
 
624
        push    ebx
625
 
626
        mov     ebx, [cur_saved_base]
627
        mov     edx, [cur.h]
628
        test    edx, edx
629
        jz      .ret
630
 
631
        push    esi
632
        push    edi
633
 
634
        mov     esi, cur_saved_data
635
        mov     edi, ebx
636
        push    [cur.w]
637
        push    [cur.top];[y]
638
        push    [cur.left];[x]
639
        ;mov     eax, [cur.top]
640
        ;add     [esp + 4], eax
641
        ;mov     eax, [cur.left]
642
        ;add     [esp], eax
643
;--------------------------------------
644
align 4
645
@@:
646
        mov     ecx, [esi]
647
        add     esi, 4
648
 
649
        ;mov     eax, [esp]
650
        ;sub     eax, [x]
651
        ;shl     eax, 2 ; *4
652
        ;mov     [edi + eax], ecx
653
 
654
        mov     eax, [esp]
655
        mov     ebx, [esp + 4]
656
 
657
        push    edx  edi
658
        mov     edi, 1
659
        or      ecx, 0x04000000
660
        call    __sys_putpixel
661
        pop     edi edx
662
        add     dword[esp], 1
663
        dec     dword[esp + 8]
664
        jnz     @b
665
 
666
        mov     eax, [cur.w]
667
        mov     ecx, [cur.left];[x]
668
        ;add     ecx, [cur.left]
669
        mov     [esp + 8], eax
670
 
671
        mov     dword[esp], ecx
672
 
673
        inc     dword[esp + 4]
674
        ;add     edi, [_display.lfb_pitch]
675
        dec     edx
676
        jnz     @b
677
 
678
        add     esp, 4*3
679
 
680
        pop     edi
681
        pop     esi
682
;--------------------------------------
683
align 4
684
.ret:
685
        pop     ebx
686
        ret
687
endp
688
;------------------------------------------------------------------------------
689
align 4
2288 clevermous 690
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
691
           locals
692
             h      dd ?
693
             _dx     dd ?
694
             _dy     dd ?
695
           endl
696
 
697
        mov     esi, [hcursor]
698
        mov     ecx, [x]
699
        mov     eax, [y]
2446 mario79 700
;        mov     ebx, [BytesPerScanLine]
2288 clevermous 701
 
702
        xor     edx, edx
9715 Doczom 703
        sub     ecx, [esi + CURSOR.hot_x]
704
        lea     ebx, [ecx + 32-1]
2288 clevermous 705
        mov     [x], ecx
706
        sets    dl
707
        dec     edx
708
        and     ecx, edx      ;clip x to 0<=x
709
        mov     [cur.left], ecx
710
        mov     edi, ecx
711
        sub     edi, [x]
712
        mov     [_dx], edi
713
 
714
        xor     edx, edx
9715 Doczom 715
        sub     eax, [esi + CURSOR.hot_y]
2288 clevermous 716
        lea     edi, [eax+32-1]
717
        mov     [y], eax
718
        sets    dl
719
        dec     edx
720
        and     eax, edx      ;clip y to 0<=y
721
        mov     [cur.top], eax
722
        mov     edx, eax
723
        sub     edx, [y]
724
        mov     [_dy], edx
725
 
2446 mario79 726
;        mul     dword [BytesPerScanLine]
9715 Doczom 727
        mov     eax, [BPSLine_calc_area + eax*4]
728
        lea     edx, [LFB_BASE + ecx*3]
2288 clevermous 729
        add     edx, eax
730
        mov     [cur_saved_base], edx
731
 
5350 serge 732
        cmp     ebx, [_display.width]
733
        jb      @F
734
        mov     ebx, [_display.width]
2430 mario79 735
;--------------------------------------
736
align 4
2288 clevermous 737
@@:
5350 serge 738
        cmp     edi, [_display.height]
739
        jb      @F
740
        mov     edi, [_display.height]
2430 mario79 741
;--------------------------------------
742
align 4
2288 clevermous 743
@@:
744
 
745
        sub     ebx, [x]
746
        sub     edi, [y]
2576 mario79 747
        sub     ebx, [_dx]
748
        sub     edi, [_dy]
2288 clevermous 749
 
750
        mov     [cur.w], ebx
751
        mov     [cur.h], edi
752
        mov     [h], edi
753
 
754
        mov     eax, edi
755
        mov     edi, cur_saved_data
2430 mario79 756
;--------------------------------------
757
align 4
2288 clevermous 758
@@:
759
        mov     esi, edx
5351 serge 760
        add     edx, [_display.lfb_pitch]
2288 clevermous 761
        mov     ecx, [cur.w]
9715 Doczom 762
        lea     ecx, [ecx + ecx*2]
2288 clevermous 763
        rep movsb
764
        dec     eax
765
        jnz     @B
766
 
767
;draw cursor
768
        mov     ebx, [cur_saved_base]
769
        mov     eax, [_dy]
770
        shl     eax, 5
771
        add     eax, [_dx]
772
 
773
        mov     esi, [hcursor]
9715 Doczom 774
        mov     esi, [esi + CURSOR.base]
775
        lea     edx, [esi + eax*4]
2430 mario79 776
;--------------------------------------
777
align 4
2288 clevermous 778
.row:
779
        mov     ecx, [cur.w]
780
        mov     esi, edx
781
        mov     edi, ebx
782
        add     edx, 32*4
5351 serge 783
        add     ebx, [_display.lfb_pitch]
2430 mario79 784
;--------------------------------------
785
align 4
2288 clevermous 786
.pix:
787
        lodsd
788
        test    eax, 0xFF000000
789
        jz      @F
790
        mov     [edi], ax
791
        shr     eax, 16
792
        mov     [edi+2], al
2430 mario79 793
;--------------------------------------
794
align 4
2288 clevermous 795
@@:
796
        add     edi, 3
797
        dec     ecx
798
        jnz     .pix
799
 
800
        dec     [h]
801
        jnz     .row
802
        ret
803
endp
2430 mario79 804
;------------------------------------------------------------------------------
2288 clevermous 805
align 4
806
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
807
           locals
808
             h      dd ?
809
             _dx     dd ?
810
             _dy     dd ?
811
           endl
812
 
813
        mov     esi, [hcursor]
814
        mov     ecx, [x]
815
        mov     eax, [y]
816
 
817
        xor     edx, edx
9715 Doczom 818
        sub     ecx, [esi + CURSOR.hot_x]
2288 clevermous 819
        lea     ebx, [ecx+32-1]
820
        mov     [x], ecx
821
        sets    dl
822
        dec     edx
823
        and     ecx, edx      ;clip x to 0<=x
824
        mov     [cur.left], ecx
825
        mov     edi, ecx
826
        sub     edi, [x]
827
        mov     [_dx], edi
828
 
829
        xor     edx, edx
9715 Doczom 830
        sub     eax, [esi + CURSOR.hot_y]
2288 clevermous 831
        lea     edi, [eax+32-1]
832
        mov     [y], eax
833
        sets    dl
834
        dec     edx
835
        and     eax, edx      ;clip y to 0<=y
836
        mov     [cur.top], eax
837
        mov     edx, eax
838
        sub     edx, [y]
839
        mov     [_dy], edx
840
 
2446 mario79 841
;        mul     dword [BytesPerScanLine]
2480 mario79 842
        mov     eax, [BPSLine_calc_area+eax*4]
9715 Doczom 843
        lea     edx, [LFB_BASE + eax + ecx*4]
2288 clevermous 844
        mov     [cur_saved_base], edx
845
 
5350 serge 846
        cmp     ebx, [_display.width]
847
        jb      @F
848
        mov     ebx, [_display.width]
2430 mario79 849
;--------------------------------------
850
align 4
2288 clevermous 851
@@:
5350 serge 852
        cmp     edi, [_display.height]
853
        jb      @F
854
        mov     edi, [_display.height]
2430 mario79 855
;--------------------------------------
856
align 4
2288 clevermous 857
@@:
858
        sub     ebx, [x]
859
        sub     edi, [y]
2576 mario79 860
        sub     ebx, [_dx]
861
        sub     edi, [_dy]
2288 clevermous 862
 
863
        mov     [cur.w], ebx
864
        mov     [cur.h], edi
865
        mov     [h], edi
866
 
867
        mov     eax, edi
868
        mov     edi, cur_saved_data
2430 mario79 869
;--------------------------------------
870
align 4
2288 clevermous 871
@@:
872
        mov     esi, edx
5351 serge 873
        add     edx, [_display.lfb_pitch]
2288 clevermous 874
        mov     ecx, [cur.w]
875
        rep movsd
876
        dec     eax
877
        jnz     @B
878
 
879
;draw cursor
880
        mov     ebx, [cur_saved_base]
881
        mov     eax, [_dy]
882
        shl     eax, 5
883
        add     eax, [_dx]
884
 
885
        mov     esi, [hcursor]
9715 Doczom 886
        mov     esi, [esi + CURSOR.base]
2288 clevermous 887
        lea     edx, [esi+eax*4]
2430 mario79 888
;--------------------------------------
889
align 4
2288 clevermous 890
.row:
891
        mov     ecx, [cur.w]
892
        mov     esi, edx
893
        mov     edi, ebx
894
        add     edx, 32*4
5351 serge 895
        add     ebx, [_display.lfb_pitch]
2430 mario79 896
;--------------------------------------
897
align 4
2288 clevermous 898
.pix:
899
        lodsd
900
        test    eax, 0xFF000000
901
        jz      @F
902
        mov     [edi], eax
2430 mario79 903
;--------------------------------------
904
align 4
2288 clevermous 905
@@:
906
        add     edi, 4
907
        dec     ecx
908
        jnz     .pix
909
 
910
        dec     [h]
911
        jnz     .row
912
        ret
913
endp
2430 mario79 914
;------------------------------------------------------------------------------
915
align 4
5154 hidnplayr 916
proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
917
           locals
918
             h      dd ?
919
             _dx     dd ?
920
             _dy     dd ?
921
           endl
922
 
923
        mov     esi, [hcursor]
924
        mov     ecx, [x]
925
        mov     eax, [y]
926
 
927
        xor     edx, edx
9715 Doczom 928
        sub     ecx, [esi + CURSOR.hot_x]
929
        lea     ebx, [ecx + 32-1]
5154 hidnplayr 930
        mov     [x], ecx
931
        sets    dl
932
        dec     edx
933
        and     ecx, edx      ;clip x to 0<=x
934
        mov     [cur.left], ecx
935
        mov     edi, ecx
936
        sub     edi, [x]
937
        mov     [_dx], edi
938
 
939
        xor     edx, edx
9715 Doczom 940
        sub     eax, [esi + CURSOR.hot_y]
941
        lea     edi, [eax + 32-1]
5154 hidnplayr 942
        mov     [y], eax
943
        sets    dl
944
        dec     edx
945
        and     eax, edx      ;clip y to 0<=y
946
        mov     [cur.top], eax
947
        mov     edx, eax
948
        sub     edx, [y]
949
        mov     [_dy], edx
950
 
951
;        mul     dword [BytesPerScanLine]
9715 Doczom 952
        mov     eax, [BPSLine_calc_area + eax*4]
953
        lea     edx, [LFB_BASE + eax + ecx*2]
5154 hidnplayr 954
        mov     [cur_saved_base], edx
955
 
5350 serge 956
        cmp     ebx, [_display.width]
957
        jb      @F
958
        mov     ebx, [_display.width]
5154 hidnplayr 959
;--------------------------------------
960
align 4
961
@@:
5350 serge 962
        cmp     edi, [_display.height]
963
        jb      @F
964
        mov     edi, [_display.height]
5154 hidnplayr 965
;--------------------------------------
966
align 4
967
@@:
968
        sub     ebx, [x]
969
        sub     edi, [y]
970
        sub     ebx, [_dx]
971
        sub     edi, [_dy]
972
 
973
        mov     [cur.w], ebx
974
        mov     [cur.h], edi
975
        mov     [h], edi
976
 
977
        mov     eax, edi
978
        mov     edi, cur_saved_data
979
;--------------------------------------
980
align 4
981
@@:
982
        mov     esi, edx
5351 serge 983
        add     edx, [_display.lfb_pitch]
5154 hidnplayr 984
        mov     ecx, [cur.w]
985
 
986
        rep movsw
987
        dec     eax
988
        jnz     @B
989
 
990
;draw cursor
991
        mov     ebx, [cur_saved_base]
992
        mov     eax, [_dy]
993
        shl     eax, 5
994
        add     eax, [_dx]
995
 
996
        mov     esi, [hcursor]
9715 Doczom 997
        mov     esi, [esi + CURSOR.base]
998
        lea     edx, [esi + eax*4]
5154 hidnplayr 999
;--------------------------------------
1000
align 4
1001
.row:
1002
        mov     ecx, [cur.w]
1003
        mov     esi, edx
1004
        mov     edi, ebx
1005
        add     edx, 32*4
5351 serge 1006
        add     ebx, [_display.lfb_pitch]
5154 hidnplayr 1007
;--------------------------------------
1008
align 4
1009
.pix:
1010
        lodsd
1011
        test    eax, 0xFF000000
1012
        jz      @F
1013
; convert to 16 bpp and store to real LFB
1014
        and     eax, 00000000111110001111110011111000b
1015
        shr     ah, 2
1016
        shr     ax, 3
1017
        ror     eax, 8
1018
        add     al, ah
1019
        rol     eax, 8
1020
        mov     [edi], ax
1021
;--------------------------------------
1022
align 4
1023
@@:
1024
        add     edi, 2
1025
        dec     ecx
1026
        jnz     .pix
1027
 
1028
        dec     [h]
1029
        jnz     .row
1030
        ret
1031
endp
9941 Doczom 1032
 
5154 hidnplayr 1033
;------------------------------------------------------------------------------
1034
align 4
9941 Doczom 1035
proc VGA_move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
1036
           locals
1037
             h      dd ?
1038
             _dx     dd ?
1039
             _dy     dd ?
1040
             bg_ptr dd ?
1041
             tmp_x  dd ?
1042
             tmp_y  dd ?
1043
           endl
1044
 
1045
        mov     esi, [hcursor]
1046
        mov     ecx, [x]
1047
        mov     eax, [y]
1048
 
1049
        xor     edx, edx
1050
        sub     ecx, [esi + CURSOR.hot_x]
1051
        lea     ebx, [ecx+32-1]
1052
        mov     [x], ecx
1053
        sets    dl
1054
        dec     edx
1055
        and     ecx, edx      ;clip x to 0<=x
1056
        mov     [cur.left], ecx
1057
        mov     edi, ecx
1058
        sub     edi, [x]
1059
        mov     [_dx], edi
1060
 
1061
        xor     edx, edx
1062
        sub     eax, [esi + CURSOR.hot_y]
1063
        lea     edi, [eax+32-1]
1064
        mov     [y], eax
1065
        sets    dl
1066
        dec     edx
1067
        and     eax, edx      ;clip y to 0<=y
1068
        mov     [cur.top], eax
1069
        mov     edx, eax
1070
        sub     edx, [y]
1071
        mov     [_dy], edx
1072
 
1073
        mov     [tmp_x], ecx
1074
        mov     [tmp_y], eax
1075
        mov     eax, [BPSLine_calc_area+eax*4]
1076
        lea     edx, [LFB_BASE + eax + ecx*4]
1077
        mov     [cur_saved_base], edx
1078
 
1079
        cmp     ebx, [_display.width]
1080
        jb      @F
1081
        mov     ebx, [_display.width]
1082
;--------------------------------------
1083
align 4
1084
@@:
1085
        cmp     edi, [_display.height]
1086
        jb      @F
1087
        mov     edi, [_display.height]
1088
;--------------------------------------
1089
align 4
1090
@@:
1091
        sub     ebx, [x]
1092
        sub     edi, [y]
1093
        sub     ebx, [_dx]
1094
        sub     edi, [_dy]
1095
 
1096
        mov     [cur.w], ebx
1097
        mov     [cur.h], edi
1098
        mov     [h], edi
1099
 
1100
        mov     eax, edi
1101
        mov     edi, cur_saved_data
1102
 
1103
        xor     ecx, ecx
1104
        mov     eax, ecx
1105
;--------------------------------------
1106
align 4
1107
@@:
1108
        ; get and save pixel background
1109
        push    eax ecx ebx edx
1110
        add     eax, [tmp_x]
1111
        mov     ebx, ecx
1112
        add     ebx, [tmp_y]
1113
        push    edi
1114
 
1115
        or      ecx, 0x04000000
1116
        call    [GETPIXEL]
1117
 
1118
        pop     edi
1119
        ;and     ecx, 0x00ffffff
1120
        mov     [edi], ecx
1121
        add     edi, 4
1122
 
1123
        pop     edx ebx ecx eax
1124
        inc     eax
1125
        cmp     eax, [cur.w]
1126
        jb      @b
1127
        xor     eax, eax
1128
        inc     ecx
1129
        cmp     ecx, [h]
1130
        jb      @B
1131
 
1132
;draw cursor
1133
        mov     ebx, [cur_saved_base]
1134
        mov     eax, [_dy]
1135
        shl     eax, 5
1136
        add     eax, [_dx]
1137
 
1138
        mov     esi, [hcursor]
1139
        mov     esi, [esi + CURSOR.base]
1140
        lea     edx, [esi+eax*4]
1141
        mov     [bg_ptr], cur_saved_data
1142
 
1143
        mov     [_dy], 0
1144
;--------------------------------------
1145
align 4
1146
.row:
1147
        mov     [_dx], 0
1148
        mov     ecx, [cur.w]
1149
        mov     esi, edx  ; cursor image base
1150
        mov     edi, ebx
1151
        add     edx, 32*4
1152
        add     ebx, [_display.lfb_pitch]
1153
;--------------------------------------
1154
align 4
1155
.pix:
1156
        ; get pixel cursor
1157
        lodsd
1158
        test    eax, 0xFF000000
1159
        jz      @F
1160
        mov     [edi], eax
1161
 
1162
        pusha
1163
        mov     edi, 1 ; force
1164
        mov     ecx, eax ; color
1165
        and     ecx, 0x00ffffff
1166
        or      ecx, 0x04000000
1167
        mov     eax, [x]
1168
        mov     ebx, [y]
1169
        add     eax, [_dx]
1170
        add     ebx, [_dy]
1171
        call    __sys_putpixel
1172
        popa
1173
;--------------------------------------
1174
align 4
1175
@@:
1176
        inc     [_dx]
1177
        add     edi, 4
1178
        dec     ecx
1179
        jnz     .pix
1180
 
1181
        inc     [_dy]
1182
        dec     [h]
1183
        jnz     .row
1184
        ret
1185
endp
1186
 
1187
;------------------------------------------------------------------------------
1188
align 4
2430 mario79 1189
check_mouse_area_for_getpixel_new:
1190
; in:
1191
; eax = x
1192
; ebx = y
1193
; out:
1194
; ecx = new color
1195
;--------------------------------------
1196
; check for Y
1197
        cmp     bx, [Y_UNDER_subtraction_CUR_hot_y]
1198
        jb      .no_mouse_area
2288 clevermous 1199
 
2430 mario79 1200
        cmp     bx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1201
        jae     .no_mouse_area
1202
;--------------------------------------
1203
; check for X
1204
        cmp     ax, [X_UNDER_subtraction_CUR_hot_x]
1205
        jb      .no_mouse_area
2288 clevermous 1206
 
2430 mario79 1207
        cmp     ax, [X_UNDER_sub_CUR_hot_x_add_curh]
1208
        jae     .no_mouse_area
1209
;--------------------------------------
1210
        push    eax ebx
1211
; offset X
2575 mario79 1212
        movzx   ecx, word [X_UNDER_subtraction_CUR_hot_x]
2430 mario79 1213
        sub     eax, ecx        ; x1
1214
; offset Y
2575 mario79 1215
        movzx   ecx, word [Y_UNDER_subtraction_CUR_hot_y]
2430 mario79 1216
        sub     ebx, ecx        ; y1
1217
;--------------------------------------
1218
; ebx = offset y
1219
; eax = offset x
1220
        imul    ebx, [cur.w]     ;y
1221
        add     eax, ebx
1222
        mov     ebx, eax
1223
        shl     eax, 2
5154 hidnplayr 1224
        cmp     byte [_display.bits_per_pixel], 32
2430 mario79 1225
        je      @f
1226
        sub     eax, ebx
5154 hidnplayr 1227
        cmp     byte [_display.bits_per_pixel], 24
1228
        je      @f
1229
        sub     eax, ebx
7510 hidnplayr 1230
        add     eax, cur_saved_data
1231
        mov     ecx, [eax]
1232
        shl     ecx, 3
1233
        ror     ecx, 8
1234
        shl     cx, 2
1235
        ror     ecx, 8
1236
        shl     cl, 3
1237
        rol     ecx, 16
1238
        or      ecx, 0xff000000
1239
        pop     ebx eax
1240
        ret
1241
 
2430 mario79 1242
;--------------------------------------
2288 clevermous 1243
align 4
2430 mario79 1244
@@:
1245
        add     eax, cur_saved_data
1246
        mov     ecx, [eax]
7510 hidnplayr 1247
        or      ecx, 0xff000000
2430 mario79 1248
        pop     ebx eax
1249
        ret
1250
;--------------------------------------
1251
align 4
1252
.no_mouse_area:
1253
        xor     ecx, ecx
1254
        ret
1255
;-----------------------------------------------------------------------------
1256
align 4
1257
check_mouse_area_for_putpixel_new:
1258
; in:
1259
; ecx = x shl 16 + y
1260
; eax = color
1261
; out:
1262
; eax = new color
1263
;--------------------------------------
1264
; check for Y
1265
        cmp     cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
1266
        jae     .no_mouse_area
1267
 
2575 mario79 1268
        sub     cx, [Y_UNDER_subtraction_CUR_hot_y]
1269
        jb      .no_mouse_area
1270
 
2430 mario79 1271
        rol     ecx, 16
1272
;--------------------------------------
1273
; check for X
2575 mario79 1274
        cmp     cx, [X_UNDER_sub_CUR_hot_x_add_curh]
1275
        jae     .no_mouse_area
1276
 
1277
        sub     cx, [X_UNDER_subtraction_CUR_hot_x]
2430 mario79 1278
        jb      .no_mouse_area
1279
 
2575 mario79 1280
        ror     ecx, 16
2430 mario79 1281
;--------------------------------------
1282
align 4
1283
.1:
1284
        push    eax
1285
;--------------------------------------
1286
; ecx = (offset x) shl 16 + (offset y)
1287
        push    ebx
1288
        mov     ebx, ecx
1289
        shr     ebx, 16        ; x
1290
        and     ecx, 0xffff    ; y
2575 mario79 1291
 
1292
        cmp     ecx, [cur.h]
1293
        jae     @f
1294
 
1295
        cmp     ebx, [cur.w]
1296
        jb      .ok
1297
;--------------------------------------
1298
align 4
1299
@@:
1300
;        DEBUGF  1, "K : SHIT HAPPENS: %x %x \n", ecx,ebx
1301
        pop     ebx
1302
        jmp     .sh   ; SORRY! SHIT HAPPENS!
1303
;--------------------------------------
1304
align 4
1305
.ok:
2430 mario79 1306
; ecx = offset y
1307
; ebx = offset x
1308
        push    ebx ecx
1309
        imul    ecx, [cur.w]    ;y
1310
        add     ecx, ebx
1311
        mov     ebx, ecx
1312
        shl     ecx, 2
5154 hidnplayr 1313
        cmp     byte [_display.bits_per_pixel], 16
1314
        je      .16
1315
        cmp     byte [_display.bits_per_pixel], 24
2430 mario79 1316
        je      .24
1317
        and     eax, 0xFFFFFF
1318
        mov     [ecx + cur_saved_data], eax   ;store new color  to
1319
        jmp     @f
1320
;--------------------------------------
1321
align 4
5154 hidnplayr 1322
.16:
1323
        sub     ecx, ebx
1324
        sub     ecx, ebx
1325
; convert to 16 bpp and store to real LFB
1326
        and     eax, 00000000111110001111110011111000b
1327
        shr     ah, 2
1328
        shr     ax, 3
1329
        ror     eax, 8
1330
        add     al, ah
1331
        rol     eax, 8
1332
        mov     [ecx + cur_saved_data], ax      ;store new color  to
1333
        jmp     @f
1334
;--------------------------------------
1335
align 4
2430 mario79 1336
.24:
1337
        sub     ecx, ebx
1338
        mov     [ecx + cur_saved_data], ax      ;store new color  to
1339
        shr     eax, 16
1340
        mov     [ecx + cur_saved_data + 2], al  ;store new color  to
1341
;--------------------------------------
1342
align 4
1343
@@:
1344
        pop     ecx ebx
1345
 
1346
        shl     ecx, 5
1347
        add     ecx, ebx
1348
 
1349
        mov     eax, [current_cursor]
9715 Doczom 1350
        mov     eax, [eax + CURSOR.base]
1351
        lea     eax, [eax + ecx*4]
2430 mario79 1352
        mov     eax, [eax]
1353
 
1354
        pop     ebx
1355
 
1356
        test    eax, 0xFF000000
1357
        jz      @f
1358
 
2652 mario79 1359
        add     esp, 4
2430 mario79 1360
        ret
1361
;--------------------------------------
1362
align 4
2575 mario79 1363
.sh:
1364
        mov     ecx, -1
1365
;--------------------------------------
1366
align 4
2430 mario79 1367
@@:
1368
        pop     eax
1369
;--------------------------------------
1370
align 4
1371
.no_mouse_area:
1372
        ret
1373
;------------------------------------------------------------------------------
1374
align 4
2288 clevermous 1375
get_display:
1376
        mov     eax, _display
1377
        ret
2430 mario79 1378
;------------------------------------------------------------------------------
2288 clevermous 1379
align 4
1380
init_display:
1381
        xor     eax, eax
1382
        mov     edi, _display
1383
 
9715 Doczom 1384
        mov     [edi + display_t.init_cursor], eax
1385
        mov     [edi + display_t.select_cursor], eax
1386
        mov     [edi + display_t.show_cursor], eax
1387
        mov     [edi + display_t.move_cursor], eax
1388
        mov     [edi + display_t.restore_cursor], eax
2288 clevermous 1389
 
9715 Doczom 1390
        lea     ecx, [edi + display_t.cr_list.next]
1391
        mov     [edi + display_t.cr_list.next], ecx
1392
        mov     [edi + display_t.cr_list.prev], ecx
2288 clevermous 1393
 
9941 Doczom 1394
        cmp     [SCR_MODE], word 0x12
1395
        jne     .not_vga
1396
        ; TODO
1397
        mov     ebx, VGA_restore_32
1398
        mov     ecx, VGA_move_cursor_32
1399
        mov     edx, VGA_putpixel
1400
        jmp     .set
2288 clevermous 1401
 
9941 Doczom 1402
.not_vga:
2288 clevermous 1403
        test    word [SCR_MODE], 0x4000
9941 Doczom 1404
        jnz     .not_ega
1405
 
1406
        mov     ebx, restore_32
1407
        mov     ecx, move_cursor_32
1408
        mov     edx, Vesa20_putpixel32_new
1409
        mov     eax, [_display.bits_per_pixel]
1410
        jmp     .set
1411
 
1412
.not_ega:
2288 clevermous 1413
        mov     ebx, restore_32
1414
        mov     ecx, move_cursor_32
3537 Serge 1415
        mov     edx, Vesa20_putpixel32_new
5154 hidnplayr 1416
        mov     eax, [_display.bits_per_pixel]
9941 Doczom 1417
 
3537 Serge 1418
        cmp     al, 32
5154 hidnplayr 1419
        jne     .not_32bpp
2288 clevermous 1420
 
3537 Serge 1421
.set:
2288 clevermous 1422
        mov     [_display.select_cursor], select_cursor
1423
        mov     [_display.move_cursor], ecx
1424
        mov     [_display.restore_cursor], ebx
9941 Doczom 1425
        ;mov     [_display.check_mouse], check_mouse_area_for_putpixel_new
1426
        ;mov     [_display.check_m_pixel], check_mouse_area_for_getpixel_new
2288 clevermous 1427
 
3537 Serge 1428
        mov     [PUTPIXEL], edx
9941 Doczom 1429
 
9848 rgimad 1430
        stdcall load_cursor, def_hresize, dword LOAD_FROM_MEM
1431
        mov     [def_cursor_hresize], eax
1432
        stdcall load_cursor, def_vresize, dword LOAD_FROM_MEM
1433
        mov     [def_cursor_vresize], eax
1434
        stdcall load_cursor, def_dresize1, dword LOAD_FROM_MEM
1435
        mov     [def_cursor_dresize1], eax
1436
        stdcall load_cursor, def_dresize2, dword LOAD_FROM_MEM
1437
        mov     [def_cursor_dresize2], eax
1438
 
2497 mario79 1439
        stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM
1440
        mov     [def_cursor_clock], eax
2288 clevermous 1441
        stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
1442
        mov     [def_cursor], eax
1443
        ret
3537 Serge 1444
 
5154 hidnplayr 1445
.not_32bpp:
1446
        cmp     al, 24
1447
        jne     .not_24bpp
1448
 
3537 Serge 1449
        mov     ebx, restore_24
1450
        mov     ecx, move_cursor_24
1451
        mov     edx, Vesa20_putpixel24_new
5154 hidnplayr 1452
        jmp     .set
3537 Serge 1453
 
5154 hidnplayr 1454
.not_24bpp:
1455
        cmp     al, 16
1456
        jne     .not_16bpp
1457
        mov     ebx, restore_16
1458
        mov     ecx, move_cursor_16
1459
        mov     edx, Vesa20_putpixel16_new
1460
        jmp     .set
1461
 
1462
.not_16bpp:
1463
;        cmp     al, 15
1464
;        jne     .fail
1465
;        mov     ebx, restore_15
1466
;        mov     ecx, move_cursor_15
1467
;        mov     edx, Vesa20_putpixel15_new
1468
;        jmp     .set
2288 clevermous 1469
.fail:
9941 Doczom 1470
        ;xor     eax, eax
1471
        ;mov     [_display.select_cursor], eax
1472
        ;mov     [_display.move_cursor], eax
2288 clevermous 1473
        ret
2430 mario79 1474
;------------------------------------------------------------------------------
2288 clevermous 1475
align 4
1476
def_arrow:
1477
  file 'arrow.cur'
2430 mario79 1478
;------------------------------------------------------------------------------
2497 mario79 1479
align 4
9848 rgimad 1480
def_hresize:
1481
  file 'hresize.cur'
1482
;------------------------------------------------------------------------------
1483
align 4
1484
def_vresize:
1485
  file 'vresize.cur'
1486
;------------------------------------------------------------------------------
1487
align 4
1488
def_dresize1:
1489
  file 'dresize1.cur'
1490
;------------------------------------------------------------------------------
1491
align 4
1492
def_dresize2:
1493
  file 'dresize2.cur'
1494
;------------------------------------------------------------------------------
1495
align 4
2497 mario79 1496
clock_arrow:
1497
  file 'arrow_clock.cur'
1498
;------------------------------------------------------------------------------
2288 clevermous 1499