Subversion Repositories Kolibri OS

Rev

Rev 2337 | Rev 2430 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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