Subversion Repositories Kolibri OS

Rev

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

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