Subversion Repositories Kolibri OS

Rev

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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. $Revision: 5154 $
  9.  
  10. struc VBE_VGAInfo {
  11.   .VESASignature          dd ?    ; char
  12.   .VESAVersion            dw ?    ; short
  13.   .OemStringPtr           dd ?    ; char *
  14.   .Capabilities           dd ?    ; ulong
  15.   .VideoModePtr           dd ?    ; ulong
  16.   .TotalMemory            dw ?    ; short
  17.   ; VBE 2.0+
  18.   .OemSoftwareRev         db ?    ; short
  19.   .OemVendorNamePtr       dw ?    ; char *
  20.   .OemProductNamePtr      dw ?    ; char *
  21.   .OemProductRevPtr       dw ?    ; char *
  22.   .reserved               rb 222  ; char
  23.   .OemData                rb 256  ; char
  24. }
  25.  
  26. struc VBE_ModeInfo {
  27.   .ModeAttributes         dw ?    ; short
  28.   .WinAAttributes         db ?    ; char
  29.   .WinBAttributes         db ?    ; char
  30.   .WinGranularity         dw ?    ; short
  31.   .WinSize                dw ?    ; short
  32.   .WinASegment            dw ?    ; ushort
  33.   .WinBSegment            dw ?    ; ushort
  34.   .WinFuncPtr             dd ?    ; void *
  35.   .BytesPerScanLine       dw ?    ; short
  36.   .XRes                   dw ?    ; short
  37.   .YRes                   dw ?    ; short
  38.   .XCharSize              db ?    ; char
  39.   .YCharSize              db ?    ; char
  40.   .NumberOfPlanes         db ?    ; char
  41.   .BitsPerPixel           db ?    ; char
  42.   .NumberOfBanks          db ?    ; char
  43.   .MemoryModel            db ?    ; char
  44.   .BankSize               db ?    ; char
  45.   .NumberOfImagePages     db ?    ; char
  46.   .res1                   db ?    ; char
  47.   .RedMaskSize            db ?    ; char
  48.   .RedFieldPosition       db ?    ; char
  49.   .GreenMaskSize          db ?    ; char
  50.   .GreenFieldPosition     db ?    ; char
  51.   .BlueMaskSize           db ?    ; char
  52.   .BlueFieldPosition      db ?    ; char
  53.   .RsvedMaskSize          db ?    ; char
  54.   .RsvedFieldPosition     db ?    ; char
  55.   .DirectColorModeInfo    db ?    ; char ; MISSED IN THIS TUTORIAL!! SEE ABOVE
  56.   ; VBE 2.0+
  57.   .PhysBasePtr            dd ?    ; ulong
  58.   .OffScreenMemOffset     dd ?    ; ulong
  59.   .OffScreenMemSize       dw ?    ; short
  60.   ; VBE 3.0+
  61.   .LinbytesPerScanLine    dw ?    ; short
  62.   .BankNumberOfImagePages db ?    ; char
  63.   .LinNumberOfImagePages  db ?    ; char
  64.   .LinRedMaskSize         db ?    ; char
  65.   .LinRedFieldPosition    db ?    ; char
  66.   .LingreenMaskSize       db ?    ; char
  67.   .LinGreenFieldPosition  db ?    ; char
  68.   .LinBlueMaskSize        db ?    ; char
  69.   .LinBlueFieldPosition   db ?    ; char
  70.   .LinRsvdMaskSize        db ?    ; char
  71.   .LinRsvdFieldPosition   db ?    ; char
  72.   .MaxPixelClock          dd ?    ; ulong
  73.   .res2                   rb 190  ; char
  74. }
  75.  
  76. virtual at $A000
  77.   vi VBE_VGAInfo
  78.   mi VBE_ModeInfo
  79. modes_table:
  80. end virtual
  81. cursor_pos  dw 0         ;временное хранение курсора.
  82. cursor_pos_old  dw 0
  83. home_cursor dw 0    ;current shows rows a table
  84. end_cursor  dw 0     ;end of position current shows rows a table
  85. scroll_start dw 0    ;start position of scroll bar
  86. scroll_end  dw 0     ;end position of scroll bar
  87. long_v_table equ 9   ;long of visible video table
  88. size_of_step equ 10
  89. scroll_area_size equ (long_v_table-2)
  90. int2str:
  91.         dec     bl
  92.         jz      @f
  93.         xor     edx, edx
  94.         div     ecx
  95.         push    edx
  96.         call    int2str
  97.         pop     eax
  98.     @@:
  99.         or      al, 0x30
  100.         mov     [ds:di], al
  101.         inc     di
  102.         ret
  103.  
  104. int2strnz:
  105.         cmp     eax, ecx
  106.         jb      @f
  107.         xor     edx, edx
  108.         div     ecx
  109.         push    edx
  110.         call    int2strnz
  111.         pop     eax
  112.     @@:
  113.         or      al, 0x30
  114.         mov     [es:di], al
  115.         inc     di
  116.         ret
  117.  
  118. ;-------------------------------------------------------
  119. ;Write message about incorrect v_mode and write message about jmp on swith v_mode
  120. v_mode_error:
  121.         _setcursor 19,2
  122.         mov     si, fatalsel
  123.         call    printplain
  124.         _setcursor 20,2
  125.         mov     si, pres_key
  126.         call    printplain
  127.         xor     eax, eax
  128.         int     16h
  129.         jmp     cfgmanager.d
  130. ;-------------------------------------------------------
  131. ;
  132.  
  133.  
  134.  
  135. ;-------------------------------------------------------
  136. print_vesa_info:
  137.         _setcursor 5,2
  138.  
  139.         mov     [es:vi.VESASignature], 'VBE2'
  140.         mov     ax, 0x4F00
  141.         mov     di, vi     ;0xa000
  142.         int     0x10
  143.         or      ah, ah
  144.         jz      @f
  145.         mov     [es:vi.VESASignature], 'VESA'
  146.         mov     ax, $4F00
  147.         mov     di, vi
  148.         int     0x10
  149.         or      ah, ah
  150.         jnz     .exit
  151.   @@:
  152.         cmp     [es:vi.VESASignature], 'VESA'
  153.         jne     .exit
  154.         cmp     [es:vi.VESAVersion], 0x0100
  155.         jb      .exit
  156.         jmp     .vesaok2
  157.  
  158.   .exit:
  159.         mov     si, novesa
  160.         call    printplain
  161.         ret
  162.  
  163.   .vesaok2:
  164.         mov     ax, [es:vi.VESAVersion]
  165.         add     ax, '00'
  166.  
  167.         mov     [s_vesa.ver], ah
  168.         mov     [s_vesa.ver+2], al
  169.         mov     si, s_vesa
  170.         call    printplain
  171.  
  172.         _setcursor 4,2
  173.         mov     si, word[es:vi.OemStringPtr]
  174.         mov     di, si
  175.  
  176.         push    ds
  177.         mov     ds, word[es:vi.OemStringPtr+2]
  178.         call    printplain
  179.         pop     ds
  180.  
  181.         ret
  182. ;-----------------------------------------------------------------------------
  183.  
  184. calc_vmodes_table:
  185.         pushad
  186.  
  187. ;        push    0
  188. ;        pop     es
  189.  
  190.         lfs     si, [es:vi.VideoModePtr]
  191.  
  192.         mov     bx, modes_table
  193. ;save no vesa mode of work 320x200, EGA/CGA 256 梥⮢ and 640x480, VGA 16 梥⮢
  194.         mov     word [es:bx], 640
  195.         mov     word [es:bx+2], 480
  196.         mov     word [es:bx+6], 0x13
  197.        
  198.         mov     word [es:bx+10], 640
  199.         mov     word [es:bx+12], 480
  200.         mov     word [es:bx+16], 0x12
  201.         add     bx, 20
  202.   .next_mode:
  203.         mov     cx, word [fs:si]; mode number
  204.         cmp     cx, -1
  205.         je      .modes_ok.2
  206.  
  207.         mov     ax, 0x4F01
  208.         mov     di, mi
  209.         int     0x10
  210.  
  211.         or      ah, ah
  212.         jnz     .modes_ok.2;vesa_info.exit
  213.  
  214.         test    [es:mi.ModeAttributes], 00000001b  ;videomode support ?
  215.         jz      @f
  216.         test    [es:mi.ModeAttributes], 00010000b  ;picture ?
  217.         jz      @f
  218.         test    [es:mi.ModeAttributes], 10000000b  ;LFB ?
  219.         jz      @f
  220.  
  221.         cmp     [es:mi.BitsPerPixel], 16   ;List only supported videomodes (16, 24 and 32 bpp)
  222.         jb      @f
  223.  
  224. ; 16 bpp might actually be 15 bpp
  225.         cmp     [es:mi.BitsPerPixel], 16
  226.         jne     .l0
  227.         cmp     [es:mi.GreenMaskSize], 5
  228.         jne     .l0
  229. ;        mov     [es:mi.BitsPerPixel],15
  230.         jmp     @f                         ; 15 bpp isnt supported ATM
  231.  
  232.  
  233. .l0:
  234.         cmp     [es:mi.XRes], 640
  235.         jb      @f
  236.         cmp     [es:mi.YRes], 480
  237.         jb      @f
  238. ;        cmp     [es:mi.BitsPerPixel],8
  239. ;        jb      @f
  240.  
  241.         mov     ax, [es:mi.XRes]
  242.         mov     [es:bx+0], ax              ; +0[2] : resolution X
  243.         mov     ax, [es:mi.YRes]
  244.         mov     [es:bx+2], ax              ; +2[2] : resolution Y
  245.         mov     ax, [es:mi.ModeAttributes]
  246.         mov     [es:bx+4], ax              ; +4[2] : attributes
  247.  
  248.         cmp     [s_vesa.ver], '2'
  249. ;        jb      .lp1
  250.         jb      @f    ; We do not use Vesa 1.2 mode is now
  251.  
  252.         or      cx, 0x4000 ; use LFB
  253. .lp1:
  254.         mov     [es:bx+6], cx              ; +6 : mode number
  255.         movzx   ax, byte [es:mi.BitsPerPixel]
  256.         mov     word [es:bx+8], ax              ; +8 : bits per pixel
  257.         add     bx, size_of_step                ; size of record
  258.  
  259.     @@:
  260.         add     si, 2
  261.         jmp     .next_mode
  262.  
  263.   .modes_ok.2:
  264.  
  265.         mov     word[es:bx], -1 ;end video table
  266.         mov     word[end_cursor], bx    ;save end cursor position
  267. ;;;;;;;;;;;;;;;;;;
  268. ;Sort array
  269. ;        mov     si,modes_table
  270. ;.new_mode:
  271. ;        mov     ax,word [es:si]
  272. ;        cmp     ax,-1
  273. ;        je      .exxit
  274. ;        add     ax,word [es:si+2]
  275. ;        add     ax,word [es:si+8]
  276. ;        mov     bp,si
  277. ;.again:
  278. ;        add     bp,12
  279. ;        mov     bx,word [es:bp]
  280. ;        cmp     bx,-1
  281. ;        je      .exit
  282. ;        add     bx,word [es:bp+2]
  283. ;        add     bx,word [es:bp+8]
  284. ;
  285. ;        cmp     ax,bx
  286. ;        ja      .loops
  287. ;        jmp     .again
  288. ;.loops:
  289. ;        push    dword [es:si]
  290. ;        push    dword [es:si+4]
  291. ;        push    dword [es:si+8]
  292. ;        push    dword [es:bp]
  293. ;        push    dword [es:bp+4]
  294. ;        push    dword [es:bp+8]
  295. ;
  296. ;        pop     dword [es:si+8]
  297. ;        pop     dword [es:si+4]
  298. ;        pop     dword [es:si]
  299. ;        pop     dword [es:bp+8]
  300. ;        pop     dword [es:bp+4]
  301. ;        pop     dword [es:bp]
  302. ;        jmp     .new_mode
  303. ;
  304. ;.exit:  add     si,12
  305. ;        jmp     .new_mode
  306. ;.exxit:
  307.         popad
  308.         ret
  309.  
  310. ;-----------------------------------------------------------------------------
  311.  
  312. draw_current_vmode:
  313.         push    0
  314.         pop     es
  315.  
  316.         mov     si, word [cursor_pos]
  317.  
  318.         cmp     word [es:si+6], 0x12
  319.         je      .no_vesa_0x12
  320.  
  321.         cmp     word [es:si+6], 0x13
  322.         je      .no_vesa_0x13
  323.  
  324. if defined extended_primary_loader
  325.         mov     di, config_file_variables
  326. else
  327.         mov     di, loader_block_error
  328. end if
  329.         movzx   eax, word[es:si+0]
  330.         mov     ecx, 10
  331.         call    int2strnz
  332.         mov     byte[es:di], 'x'
  333.         inc     di
  334.         movzx   eax, word[es:si+2]
  335.         call    int2strnz
  336.         mov     byte[es:di], 'x'
  337.         inc     di
  338.         movzx   eax, word[es:si+8]
  339.         call    int2strnz
  340.         mov     dword[es:di], 0x00000d0a
  341. if defined extended_primary_loader
  342.         mov     si, config_file_variables
  343. else
  344.         mov     si, loader_block_error
  345. end if
  346.         push    ds
  347.         push    es
  348.         pop     ds
  349.         call    printplain
  350.         pop     ds
  351.         ret
  352. .no_vesa_0x13:
  353.         mov     si, mode0
  354.         jmp     .print
  355. .no_vesa_0x12:
  356.         mov     si, mode9
  357. .print:
  358.         call    printplain
  359.         ret
  360. ;-----------------------------------------------------------------------------
  361. check_first_parm:
  362. if defined extended_primary_loader
  363.         mov     cx, [number_vm]
  364.         jcxz    .novbemode
  365.         mov     si, modes_table
  366. .findvbemode:
  367.         cmp     [es:si+6], cx
  368.         jnz     @f
  369.         cmp     word [es:si+8], 32
  370.         je      .ok_found_mode
  371.         cmp     word [es:si+8], 24
  372.         je      .ok_found_mode
  373. @@:
  374.         add     si, size_of_step
  375.         cmp     word [es:si], -1
  376.         jnz     .findvbemode
  377. .novbemode:
  378.         mov     ax, [x_save]
  379.         test    ax, ax
  380.         jz      .zerro
  381.         mov     bx, [y_save]
  382.         mov     si, modes_table
  383.         call    .loops
  384.         test    ax, ax
  385.         jz      .ok_found_mode
  386. else
  387.         mov     si, word [preboot_graph]
  388.         test    si, si
  389.         jnz     .no_zero         ;if no zero
  390. end if
  391. .zerro:
  392. ;        mov     ax,modes_table
  393. ;        mov     word [cursor_pos],ax
  394. ;        mov     word [home_cursor],ax
  395. ;        mov     word [preboot_graph],ax
  396. ;SET default video of mode first probe will fined a move of work 1024x768@32
  397.  
  398.         mov     ax, 1024
  399.         mov     bx, 768
  400.         mov     si, modes_table
  401.         call    .loops
  402.         test    ax, ax
  403.         jz      .ok_found_mode
  404.         mov     ax, 800
  405.         mov     bx, 600
  406.         mov     si, modes_table
  407.         call    .loops
  408.         test    ax, ax
  409.         jz      .ok_found_mode
  410.         mov     ax, 640
  411.         mov     bx, 480
  412.         mov     si, modes_table
  413.         call    .loops
  414.         test    ax, ax
  415.         jz      .ok_found_mode
  416.  
  417.         mov     si, modes_table
  418. if ~ defined extended_primary_loader
  419.         jmp     .ok_found_mode
  420.  
  421.  
  422.  
  423. .no_zero:
  424.         mov     bp, word [number_vm]
  425.         cmp     bp, word [es:si+6]
  426.         jz      .ok_found_mode
  427.         mov     ax, word [x_save]
  428.         mov     bx, word [y_save]
  429.         mov     si, modes_table
  430.         call    .loops
  431.         test    ax, ax
  432.         jz      .ok_found_mode
  433.  
  434.         mov     si, modes_table
  435. ;        cmp     ax,modes_table
  436. ;        jb      .zerro           ;check on correct if bellow
  437. ;        cmp     ax,word [end_cursor]
  438. ;        ja      .zerro           ;check on correct if anymore
  439. end if
  440.  
  441. .ok_found_mode:
  442.         mov     word [home_cursor], si
  443. ;        mov     word [cursor_pos],si
  444.         mov     word [preboot_graph], si
  445.         mov     ax, si
  446.  
  447.         mov     ecx, long_v_table
  448.  
  449. .loop:
  450.         add     ax, size_of_step
  451.         cmp     ax, word [end_cursor]
  452.         jae     .next_step
  453.         loop    .loop
  454. .next_step:
  455.         sub     ax, size_of_step*long_v_table
  456.         cmp     ax, modes_table
  457.         jae     @f
  458.         mov     ax, modes_table
  459. @@:
  460.  
  461.         mov     word [home_cursor], ax
  462.         mov     si, [preboot_graph]
  463.         mov     word [cursor_pos], si
  464.  
  465.         push    word [es:si]
  466.         pop     word [x_save]
  467.         push    word [es:si+2]
  468.         pop     word [y_save]
  469.         push    word [es:si+6]
  470.         pop     word [number_vm]
  471.  
  472.         ret
  473. ;;;;;;;;;;;;;;;;;;;;;;;;;;;
  474. .loops:
  475.         cmp     ax, word [es:si]
  476.         jne     .next
  477.         cmp     bx, word [es:si+2]
  478.         jne     .next
  479.         cmp     word [es:si+8], 32
  480.         je      .ok
  481.         cmp     word [es:si+8], 24
  482.         je      .ok
  483. .next:
  484.         add     si, size_of_step
  485.         cmp     word [es:si], -1
  486.         je      .exit
  487.         jmp     .loops
  488. .ok:
  489.         xor     ax, ax
  490.         ret
  491. .exit:
  492.         or      ax, -1
  493.         ret
  494.  
  495.  
  496. ;-----------------------------------------------------------------------------
  497.  
  498. ;default_vmode:
  499.  
  500. ;-----------------------------------------------------------------------------
  501. draw_vmodes_table:
  502.         _setcursor 9, 2
  503.         mov     si, gr_mode
  504.         call    printplain
  505.  
  506.         mov     si, _st
  507.         call    printplain
  508.  
  509.         push    word [cursor_pos]
  510.         pop     ax
  511.         push    word [home_cursor]
  512.         pop     si
  513.         mov     cx, si
  514.  
  515.         cmp     ax, si
  516.         je      .ok
  517.         jb      .low
  518.  
  519.  
  520.         add     cx, size_of_step*long_v_table
  521.  
  522.         cmp     ax, cx
  523.         jb      .ok
  524.  
  525.         sub     cx, size_of_step*long_v_table
  526.         add     cx, size_of_step
  527.         cmp     cx, word[end_cursor]
  528.         jae     .ok
  529.         add     si, size_of_step
  530.         push    si
  531.         pop     word [home_cursor]
  532.         jmp     .ok
  533.  
  534.  
  535. .low:
  536.         sub     cx, size_of_step
  537.         cmp     cx, modes_table
  538.         jb      .ok
  539.         push    cx
  540.         push    cx
  541.         pop     word [home_cursor]
  542.         pop     si
  543.  
  544.  
  545. .ok:
  546. ; calculate scroll position
  547.         push    si
  548.         mov     ax, [end_cursor]
  549.         sub     ax, modes_table
  550.         mov     bx, size_of_step
  551.         cwd
  552.         div     bx
  553.         mov     si, ax          ; si = size of list
  554.         mov     ax, [home_cursor]
  555.         sub     ax, modes_table
  556.         cwd
  557.         div     bx
  558.         mov     di, ax
  559.         mov     ax, scroll_area_size*long_v_table
  560.         cwd
  561.         div     si
  562.         test    ax, ax
  563.         jnz     @f
  564.         inc     ax
  565. @@:
  566.         cmp     al, scroll_area_size
  567.         jb      @f
  568.         mov     al, scroll_area_size
  569. @@:
  570.         mov     cx, ax
  571. ; cx = scroll height
  572. ; calculate scroll pos
  573.         xor     bx, bx          ; initialize scroll pos
  574.         sub     al, scroll_area_size+1
  575.         neg     al
  576.         sub     si, long_v_table-1
  577.         jbe     @f
  578.         mul     di
  579.         div     si
  580.         mov     bx, ax
  581. @@:
  582.         inc     bx
  583.         imul    ax, bx, size_of_step
  584.         add     ax, [home_cursor]
  585.         mov     [scroll_start], ax
  586.         imul    cx, size_of_step
  587.         add     ax, cx
  588.         mov     [scroll_end], ax
  589.         pop     si
  590.         mov     bp, long_v_table              ;show rows
  591. .@@_next_bit:
  592. ;clear cursor
  593.         mov     ax, '  '
  594.         mov     word[ds:_r1+21], ax
  595.         mov     word[ds:_r1+50], ax
  596.  
  597.         mov     word[ds:_r2+21], ax
  598.         mov     word[ds:_r2+45], ax
  599.  
  600.         mov     word[ds:_rs+21], ax
  601.         mov     word[ds:_rs+46], ax
  602. ; draw string
  603.         cmp     word [es:si+6], 0x12
  604.         je      .show_0x12
  605.         cmp     word [es:si+6], 0x13
  606.         je      .show_0x13
  607.  
  608.         movzx   eax, word[es:si]
  609.         cmp     ax, -1
  610.         je      .@@_end
  611.         mov     di, _rs+23
  612.         mov     ecx, 10
  613.         mov     bl, 4
  614.         call    int2str
  615.         movzx   eax, word[es:si+2]
  616.         inc     di
  617.         mov     bl, 4
  618.         call    int2str
  619.  
  620.         movzx   eax, word[es:si+8]
  621.         inc     di
  622.         mov     bl, 2
  623.         call    int2str
  624.  
  625.         cmp     si, word [cursor_pos]
  626.         jne     .next
  627. ;draw   cursor
  628.         mov     word[ds:_rs+21], '>>'
  629.         mov     word[ds:_rs+46], '<<'
  630.  
  631.  
  632.  
  633. .next:
  634.         push    si
  635.         mov     si, _rs
  636. .@@_sh:
  637. ; add to the string pseudographics for scrollbar
  638.         pop     bx
  639.         push    bx
  640.         mov     byte [si+53], ' '
  641.         cmp     bx, [scroll_start]
  642.         jb      @f
  643.         cmp     bx, [scroll_end]
  644.         jae     @f
  645.         mov     byte [si+53], 0xDB ; filled bar
  646. @@:
  647.         push    bx
  648.         add     bx, size_of_step
  649.         cmp     bx, [end_cursor]
  650.         jnz     @f
  651.         mov     byte [si+53], 31 ; 'down arrow' symbol
  652. @@:
  653.         sub     bx, [home_cursor]
  654.         cmp     bx, size_of_step*long_v_table
  655.         jnz     @f
  656.         mov     byte [si+53], 31 ; 'down arrow' symbol
  657. @@:
  658.         pop     bx
  659.         cmp     bx, [home_cursor]
  660.         jnz     @f
  661.         mov     byte [si+53], 30 ; 'up arrow' symbol
  662. @@:
  663.         call    printplain
  664.         pop     si
  665.         add     si, size_of_step
  666.  
  667.         dec     bp
  668.         jnz     .@@_next_bit
  669.  
  670. .@@_end:
  671.         mov     si, _bt
  672.         call    printplain
  673.         ret
  674. .show_0x13:
  675.         push    si
  676.  
  677.         cmp     si, word [cursor_pos]
  678.         jne     @f
  679.         mov     word[ds:_r1+21], '>>'
  680.         mov     word[ds:_r1+50], '<<'
  681. @@:
  682.         mov     si, _r1
  683.         jmp     .@@_sh
  684. .show_0x12:
  685.         push    si
  686.         cmp     si, word [cursor_pos]
  687.         jne     @f
  688.  
  689.         mov     word[ds:_r2+21], '>>'
  690.         mov     word[ds:_r2+45], '<<'
  691. @@:
  692.         mov     si, _r2
  693.         jmp     .@@_sh
  694.  
  695. ;-----------------------------------------------------------------------------
  696. ;Clear arrea of current video page (0xb800)
  697. clear_vmodes_table:
  698.         pusha
  699.        ; draw frames
  700.         push    es
  701.         push    0xb800
  702.         pop     es
  703.         mov     di, 1444
  704.         xor     ax, ax
  705.         mov     ah, 1*16+15
  706.         mov     cx, 77
  707.         mov     bp, 12
  708. .loop_start:
  709.         rep stosw
  710.         mov     cx, 77
  711.         add     di, 6
  712.         dec     bp
  713.         jns     .loop_start
  714.         pop     es
  715.         popa
  716.         ret
  717.  
  718. ;-----------------------------------------------------------------------------
  719.  
  720. set_vmode:
  721.         push    0 ;0;x1000
  722.         pop     es
  723.  
  724.         mov     si, word [preboot_graph]           ;[preboot_graph]
  725.         mov     cx, word [es:si+6]           ; number of mode
  726.        
  727.  
  728.         mov     ax, word [es:si+0]           ; resolution X
  729.         mov     bx, word [es:si+2]           ; resolution Y
  730.  
  731.  
  732.         mov     word [es:BOOT_X_RES], ax             ; resolution X
  733.         mov     word [es:BOOT_Y_RES], bx             ; resolution Y
  734.         mov     word [es:BOOT_VESA_MODE], cx             ; number of mode
  735.  
  736.         cmp     cx, 0x12
  737.         je      .mode0x12_0x13
  738.         cmp     cx, 0x13
  739.         je      .mode0x12_0x13
  740.  
  741.  
  742. ;        cmp     byte [s_vesa.ver], '2'
  743. ;        jb      .vesa12
  744.  
  745. ;  VESA 2 and Vesa 3
  746.  
  747.         mov     ax, 0x4f01
  748.         and     cx, 0xfff
  749.         mov     di, mi;0xa000
  750.         int     0x10
  751.         ; LFB
  752.         mov     eax, [es:mi.PhysBasePtr];di+0x28]
  753.         mov     [es:BOOT_LFB], eax
  754.         ; ---- vbe voodoo
  755.         BytesPerLine equ 0x10
  756.         mov     ax, [es:di+BytesPerLine]
  757.         mov     [es:BOOT_PITCH], ax
  758.         ; BPP
  759.         cmp     [es:mi.BitsPerPixel], 16
  760.         jne     .l0
  761.         cmp     [es:mi.GreenMaskSize], 5
  762.         jne     .l0
  763.         mov     [es:mi.BitsPerPixel], 15
  764. .l0:
  765.         mov     al, byte [es:di+0x19]
  766.         mov     [es:BOOT_BPP], al
  767.         jmp     .exit
  768.  
  769. .mode0x12_0x13:
  770.         mov     byte [es:BOOT_BPP], 32
  771.         or      dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
  772.  
  773.  
  774. ;  VESA 1.2 PM BANK SWITCH ADDRESS
  775.  
  776. ;.vesa12:
  777. ;        mov     ax, 0x4f0A
  778. ;        xor     bx, bx
  779. ;        int     0x10
  780. ;        xor     eax, eax
  781. ;        xor     ebx, ebx
  782. ;        mov     ax, es
  783. ;        shl     eax, 4
  784. ;        mov     bx, di
  785. ;        add     eax, ebx
  786. ;        movzx   ebx, word[es:di]
  787. ;        add     eax, ebx
  788. ;        push    0x0000
  789. ;        pop     es
  790. ;        mov     [es:0x9014], eax
  791.   .exit:
  792.         ret
  793.  
  794. ;=============================================================================
  795. ;=============================================================================
  796. ;=============================================================================
  797.  
  798.