Subversion Repositories Kolibri OS

Rev

Rev 1376 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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