Subversion Repositories Kolibri OS

Rev

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