SVGA VESA API linear framebuffer, a very brief intro
****************************************************
    As you probably know from writing SVGA code in real mode, the graphics
card uses a technic called bank switching to map areas of the video memory
into a 64k segment. This is necessary, as the amount of video memory
required for SVGA modes exceedes the 64k limit.

    But that's not the only way to access the video memory. As the number
of 32-bit protected mode software increased, new functions were added to
the VESA API. These include direct access to the *entire* video memory,
mapped somewhere into your computer's memory. That's called the linear
framebuffer (because it uses linear access without bank switching).

    That's an extremely fast way for 32-bit software to enhance video
performance, but it couldn't be used in real mode. But with flat real mode
we may use it too. The gain of speed is more than significant.

    Below are three excerps from Ralf Brown's interrupt, release 47. These
are the functions used in the example program.

Hope you got it...

INT 10 - VESA SuperVGA BIOS (VBE) - GET SuperVGA INFORMATION
        AX = 4F00h
        ES:DI -> buffer for SuperVGA information (see #0063)
Return: AL = 4Fh if function supported
        AH = status
            00h successful
                ES:DI buffer filled
            01h failed
            ---VBE v2.0---
            02h function not supported by current hardware configuration
            03h function invalid in current video mode
Desc:   determine whether VESA BIOS extensions are present and the
        capabilities supported by the display adapter
SeeAlso:AX=4E00h,AX=4F01h,AX=7F00h,AX=A00Ch
Index:  installation check;VESA SuperVGA

Format of SuperVGA information:
Offset  Size    Description     (Table 0063)
 00h  4 BYTEs   (ret) signature ("VESA")
                (call) VESA 2.0 request signature ("VBE2"), required to
                receive version 2.0 info
 04h    WORD    VESA version number (one-digit minor version)
 06h    DWORD   pointer to OEM name
                "761295520" for ATI
 0Ah    DWORD   capabilities flags (see #0064)
 0Eh    DWORD   pointer to list of supported VESA and OEM video modes
                (list of words terminated with FFFFh)
 12h    WORD    total amount of video memory in 64K blocks
---VBE v1.x ---
 14h 236 BYTEs  reserved
---VBE v2.0 ---
 14h    WORD    OEM software version
 16h    DWORD   pointer to vendor name
 1Ah    DWORD   pointer to product name
 1Eh    DWORD   pointer to product revision string
 22h 222 BYTEs  reserved
100h 256 BYTEs  OEM scratchpad
Notes:  the list of supported video modes is stored in the reserved portion
          of the SuperVGA information record by some implementations, and
          it may thus be necessary to either copy the mode list or use a
          different buffer for all subsequent VESA calls the 1.1 VESA
          document specifies 242 reserved bytes at the end, so the buffer
          should be 262 bytes to ensure that it is not overrun; for v2.0,
          the buffer should be 512 bytes the S3 specific video modes will
          most likely follow the FFFFH terminator at the end of the
          standard modes.  A search must then be made to find them, FFFFH
          will also terminate this second list Bitfields for VESA
          capabilities:
Bit(s)  Description     (Table 0064)
 0      DAC can be switched into 8-bit mode
 1      non-VGA controller
 2      programmed DAC with blank bit
 3-31   reserved
INT 10 - VESA SuperVGA BIOS - GET SuperVGA MODE INFORMATION
        AX = 4F01h
        CX = SuperVGA video mode
        ES:DI -> 256-byte buffer for mode information (see #0065)
Return: AL = 4Fh if function supported
        AH = status
            00h successful
                ES:DI buffer filled
            01h failed
Desc:   determine the attributes of the specified video mode
SeeAlso: AX=4F00h,AX=4F02h

Format of VESA SuperVGA mode information:
Offset  Size    Description     (Table 0065)
 00h    WORD    mode attributes (see #0066)
 02h    BYTE    window attributes, window A (see #0067)
 03h    BYTE    window attributes, window B (see #0067)
 04h    WORD    window granularity in KB
 06h    WORD    window size in KB
 08h    WORD    start segment of window A
 0Ah    WORD    start segment of window B
 0Ch    DWORD   -> FAR window positioning function (equivalent to AX=4F05h)
 10h    WORD    bytes per scan line

   remainder is optional for VESA modes in v1.0/1.1, needed for OEM modes

 12h    WORD    width in pixels (graphics) or characters (text)
 14h    WORD    height in pixels (graphics) or characters (text)
 16h    BYTE    width of character cell in pixels
 17h    BYTE    height of character cell in pixels
 18h    BYTE    number of memory planes
 19h    BYTE    number of bits per pixel
 1Ah    BYTE    number of banks
 1Bh    BYTE    memory model type (see #0068)
 1Ch    BYTE    size of bank in KB
 1Dh    BYTE    number of image pages
 1Eh    BYTE    reserved (0)
---VBE v1.2+---
 1Fh    BYTE    red mask size
 20h    BYTE    red field position
 21h    BYTE    green mask size
 22h    BYTE    green field size
 23h    BYTE    blue mask size
 24h    BYTE    blue field size
 25h    BYTE    reserved mask size
 26h    BYTE    reserved mask position
 27h    BYTE    direct color mode info
                bit 0: color ramp is programmable
                bit 1: bytes in reserved field may be used by application
---VBE v2.0 ---
 28h    DWORD   physical address of linear video buffer
 2Ch    DWORD   pointer to start of offscreen memory
 30h    WORD    KB of offscreen memory
 32h 206 BYTEs  reserved (0)

Bitfields for VESA SuperVGA mode attributes:
Bit(s)  Description     (Table 0066)
 0      mode supported
 1      optional information available
 2      BIOS output supported
 3      set if color, clear if monochrome
 4      set if graphics mode, clear if text mode
---VBE v2.0 ---
 5      mode is not VGA-compatible
 6      bank-switched mode not supported
 7      linear framebuffer mode supported

Bitfields for VESA SuperVGA window attributes:
Bit(s)  Description     (Table 0067)
 0      exists
 1      readable
 2      writable
 3-7    reserved

(Table 0068)
Values for VESA SuperVGA memory model type:
 00h    text
 01h    CGA graphics
 02h    HGC graphics
 03h    16-color (EGA) graphics
 04h    packed pixel graphics
 05h    "sequ 256" (non-chain 4) graphics
 06h    direct color (HiColor, 24-bit color)
 07h    YUV (luminance-chrominance, also called YIQ)
 08h-0Fh reserved for VESA
 10h-FFh OEM memory models
INT 10 - VESA SuperVGA BIOS - SET SuperVGA VIDEO MODE
        AX = 4F02h
        BX = mode (see #0069,#0070)
            bit 15 set means don't clear video memory
            bit 14 set means enable linear framebuffer mode (VBE v2.0+)
Return: AL = 4Fh if function supported
        AH = status
            00h successful
            01h failed
SeeAlso: AX=4E03h,AX=4F01h,AX=4F03h

(Table 0069)
Values for VESA video mode:
 00h-FFh OEM video modes (see #0009 at AH=00h)
 100h   640x400x256
 101h   640x480x256
 102h   800x600x16
 103h   800x600x256
 104h   1024x768x16
 105h   1024x768x256
 106h   1280x1024x16
 107h   1280x1024x256
 108h   80x60 text
 109h   132x25 text
 10Ah   132x43 text
 10Bh   132x50 text
 10Ch   132x60 text
---VBE v1.2---
 10Dh   320x200x32K
 10Eh   320x200x64K
 10Fh   320x200x16M
 110h   640x480x32K
 111h   640x480x64K
 112h   640x480x16M
 113h   800x600x32K
 114h   800x600x64K
 115h   800x600x16M
 116h   1024x768x32K
 117h   1024x768x64K
 118h   1024x768x16M
 119h   1280x1024x32K
 11Ah   1280x1024x64K
 11Bh   1280x1024x16M
---VBE 2.0---
81FFh   special full-memory access mode
Note:   the special mode 81FFh preserves the contents of the video memory
        and gives access to all of the memory; VESA recommends that the
        special mode be a packed-pixel mode
SeeAlso: #0009,#0070
Index:  video modes;VESA

(Table 0070)
Values for S3 OEM video mode:
 201h   640x480x256
 202h   800x600x16
 203h   800x600x256
 204h   1024x768x16
 205h   1024x768x256
 206h   1280x960x16
 207h   1152x864x256 (Diamond Stealth 64)
 208h   1280x1024x16
 20Ah   1152x864x64K (Diamond Stealth 64)
 211h   640x480x64K (Diamond Stealth 24)
 212h   640x480x16M (Diamond Stealth 24)
 301h   640x480x32K
Note:   these modes are only available on video cards using S3's VESA
        driver
SeeAlso: #0069
Index:  video modes;S3
