Subversion Repositories Kolibri OS

Rev

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

Rev 9930 Rev 9941
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2023. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 9930 $
8
$Revision: 9941 $
9
 
9
 
10
 
10
 
Line 615... Line 615...
615
        pop     ebx
615
        pop     ebx
616
        ret
616
        ret
617
endp
617
endp
618
;------------------------------------------------------------------------------
618
;------------------------------------------------------------------------------
619
align 4
619
align 4
-
 
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
620
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
688
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
621
           locals
689
           locals
622
             h      dd ?
690
             h      dd ?
623
             _dx     dd ?
691
             _dx     dd ?
624
             _dy     dd ?
692
             _dy     dd ?
Line 957... Line 1025...
957
 
1025
 
958
        dec     [h]
1026
        dec     [h]
959
        jnz     .row
1027
        jnz     .row
960
        ret
1028
        ret
-
 
1029
endp
-
 
1030
 
-
 
1031
;------------------------------------------------------------------------------
-
 
1032
align 4
-
 
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
961
endp
1184
 
962
;------------------------------------------------------------------------------
1185
;------------------------------------------------------------------------------
963
align 4
1186
align 4
964
check_mouse_area_for_getpixel_new:
1187
check_mouse_area_for_getpixel_new:
965
; in:
1188
; in:
Line 1165... Line 1388...
1165
        lea     ecx, [edi + display_t.cr_list.next]
1388
        lea     ecx, [edi + display_t.cr_list.next]
1166
        mov     [edi + display_t.cr_list.next], ecx
1389
        mov     [edi + display_t.cr_list.next], ecx
1167
        mov     [edi + display_t.cr_list.prev], ecx
1390
        mov     [edi + display_t.cr_list.prev], ecx
Line 1168... Line 1391...
1168
 
1391
 
1169
if ~defined UEFI
1392
if ~defined UEFI
-
 
1393
        cmp     [SCR_MODE], word 0x12
-
 
1394
        jne     .not_vga
-
 
1395
        ; TODO
-
 
1396
        mov     ebx, VGA_restore_32
-
 
1397
        mov     ecx, VGA_move_cursor_32
1170
        cmp     [SCR_MODE], word 0x13
1398
        mov     edx, VGA_putpixel
Line -... Line 1399...
-
 
1399
        jmp     .set
1171
        jbe     .fail
1400
 
-
 
1401
.not_vga:
-
 
1402
        test    word [SCR_MODE], 0x4000
-
 
1403
        jnz     .not_ega
-
 
1404
 
-
 
1405
        mov     ebx, restore_32
-
 
1406
        mov     ecx, move_cursor_32
1172
 
1407
        mov     edx, Vesa20_putpixel32_new
-
 
1408
        mov     eax, [_display.bits_per_pixel]
-
 
1409
        jmp     .set
1173
        test    word [SCR_MODE], 0x4000
1410
 
1174
        jz      .fail
1411
.not_ega:
1175
end if
1412
end if
1176
        mov     ebx, restore_32
1413
        mov     ebx, restore_32
1177
        mov     ecx, move_cursor_32
1414
        mov     ecx, move_cursor_32
-
 
1415
        mov     edx, Vesa20_putpixel32_new
1178
        mov     edx, Vesa20_putpixel32_new
1416
        mov     eax, [_display.bits_per_pixel]
1179
        mov     eax, [_display.bits_per_pixel]
1417
 
Line 1180... Line 1418...
1180
        cmp     al, 32
1418
        cmp     al, 32
1181
        jne     .not_32bpp
1419
        jne     .not_32bpp
1182
 
1420
 
1183
.set:
1421
.set:
1184
        mov     [_display.select_cursor], select_cursor
1422
        mov     [_display.select_cursor], select_cursor
1185
        mov     [_display.move_cursor], ecx
1423
        mov     [_display.move_cursor], ecx
Line 1186... Line -...
1186
        mov     [_display.restore_cursor], ebx
-
 
1187
        mov     [_display.check_mouse], check_mouse_area_for_putpixel_new
-
 
1188
        mov     [_display.check_m_pixel], check_mouse_area_for_getpixel_new
1424
        mov     [_display.restore_cursor], ebx
1189
 
1425
        ;mov     [_display.check_mouse], check_mouse_area_for_putpixel_new
1190
        cmp     [PUTPIXEL], dword VGA_putpixel
1426
        ;mov     [_display.check_m_pixel], check_mouse_area_for_getpixel_new
1191
        je      @f
1427
 
1192
        mov     [PUTPIXEL], edx
1428
        mov     [PUTPIXEL], edx
1193
@@:
1429
 
1194
        stdcall load_cursor, def_hresize, dword LOAD_FROM_MEM
1430
        stdcall load_cursor, def_hresize, dword LOAD_FROM_MEM
Line 1228... Line 1464...
1228
;        jne     .fail
1464
;        jne     .fail
1229
;        mov     ebx, restore_15
1465
;        mov     ebx, restore_15
1230
;        mov     ecx, move_cursor_15
1466
;        mov     ecx, move_cursor_15
1231
;        mov     edx, Vesa20_putpixel15_new
1467
;        mov     edx, Vesa20_putpixel15_new
1232
;        jmp     .set
1468
;        jmp     .set
1233
 
-
 
1234
.fail:
1469
.fail:
1235
        xor     eax, eax
1470
        ;xor     eax, eax
1236
        mov     [_display.select_cursor], eax
1471
        ;mov     [_display.select_cursor], eax
1237
        mov     [_display.move_cursor], eax
1472
        ;mov     [_display.move_cursor], eax
1238
        ret
1473
        ret
1239
;------------------------------------------------------------------------------
1474
;------------------------------------------------------------------------------
1240
align 4
1475
align 4
1241
def_arrow:
1476
def_arrow:
1242
  file 'arrow.cur'
1477
  file 'arrow.cur'