home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / UGPRG.ZIP / VGA-MISC / VBE20.DOC < prev    next >
Encoding:
Text File  |  1995-02-08  |  68.1 KB  |  1,368 lines

  1.  
  2.  
  3.   Video Electronics Standards Association               VBE/Core 2.0 Standard
  4.   2150 North First Street, Suite 440
  5.   San Jose, CA 95131-2029              
  6.   Phone: (408) 435-0333
  7.   FAX: (408) 435-8225
  8.  
  9.  
  10.                           VESA BIOS EXTENSION (VBE)
  11.                               Core Functions
  12.  
  13.                                Version: 2.0
  14.  
  15.  
  16.  
  17.  
  18.  
  19.      NOTE: This is _NOT_ an official version of the VBE/Core 2.0 standard,
  20.            but is provided as is by SciTech Software until the official
  21.            specification is made available electronically. This document
  22.            contains a summary of the important portions of the standard
  23.            related to developing working code for VBE 2.0.
  24.  
  25.            For more information on the official specification, please
  26.            contact VESA at the address listed above.
  27.  
  28.  
  29.  
  30.  
  31.      1.    Introduction
  32.  
  33.      This document contains the VESA BIOS Extension (VBE) specification for
  34.      standard software access to graphics display controllers that support
  35.      resolutions, color depths, and frame buffer organizations beyond the
  36.      VGA hardware standard.  It is intended for use by both applications
  37.      programmers and system software developers.
  38.  
  39.      System software developers may use this document to supplement the
  40.      System and INT 10h ROM BIOS functions to provide the VBE services.
  41.      Application developers can use this document as a guide to programming
  42.      all VBE compatible devices.
  43.  
  44.      To understand the VBE specification, some knowledge of 80x86 assembly
  45.      language and the VGA hardware registers may be required.  However,
  46.      the services described in this specification may be called from any
  47.      high-level programming language that provides a mechanism for
  48.      generating software interrupts with the 80x86 registers set to user-
  49.      specified values.
  50.  
  51.      In this specification, 'VBE' and 'VBE 2.0' are synonymous with 'VBE
  52.      Core Functions version 2.0'.
  53.  
  54.  
  55.      1.1. Scope of the VBE Standard
  56.  
  57.      The primary purpose of the VESA VBE  is to provide standard software
  58.      support for the many unique implementations of Super VGA (SVGA)
  59.      graphics controllers on the PC platform that provide features beyond
  60.      the original VGA hardware standard.  This is to provide a feasible
  61.      mechanism by which application developers can take advantage of this
  62.      nonstandard hardware in graphics applications.
  63.  
  64.      The VBE specification offers an extensible software foundation which
  65.      allows it to evolve as display and audio devices evolve over time,
  66.      without sacrificing backward software compatibility with older
  67.      implementations.  New application software should be able to work with
  68.      older hardware, and application software that has already shipped
  69.      should work correctly on new hardware devices.
  70.  
  71.      VBE services provide standard access to all resolutions and color
  72.      depths provided on the display controller, and report the availability
  73.      and details of all supported configurations to the application as
  74.      necessary.
  75.  
  76.      VBE implementations facilitate the field support of audio and display
  77.      hardware by providing the application software with the manufacturer's
  78.      name and the product identification of the display hardware.
  79.  
  80.      Since graphics controller services on the PC are typically implemented
  81.      in ROM, the VBE services are defined so that they should be
  82.      implemented within the standard VGA ROM.  When ROM implementations of
  83.      VBE are not possible, or when field software upgrades to the onboard
  84.      ROM are necessary, the VBE implementation may be also offered as a
  85.      device driver or DOS Terminate & Stay Resident (TSR) program.
  86.  
  87.      The standard VBE functions may be supplemented by OEM's as necessary
  88.      to support custom or proprietary functions unique to the manufacturer.
  89.      This mechanism enables the OEM to establish functions that may be
  90.      standard to the product line, or provide access to special hardware
  91.  
  92.      enhancements.
  93.  
  94.      Although previous VBE standards assumed that the underlying graphics
  95.      architecture was a VGA device, the display services described by VBE
  96.      2.0 can be implemented on any frame buffer oriented graphics device.
  97.  
  98.      The majority of VBE services facilitate the setup and configuration of
  99.      the hardware, allowing applications high performance, direct access to
  100.      the configured device at runtime.  To further improve the performance
  101.      of flat frame buffer display devices in extended resolutions, VBE 2.0
  102.      provides new memory models that do not require the traditional frame
  103.      buffer "banking" mechanisms.
  104.  
  105.      VBE is expected to work on all 80x86 platforms, in real and protected
  106.      modes.
  107.  
  108.      Since some modern display devices are designed without any VGA
  109.      support, two display controllers may be present in the system.  One
  110.      display controller would be used for VGA compatibility, and the other
  111.      used for graphic extensions to the basic VGA modes, resolutions, and
  112.      frame buffer models.  Therefore, VBE must be able offer the
  113.      application automatic access to the appropriate device based on the
  114.      mode or resolution that is requested by the application.
  115.  
  116.      Currently beyond the scope of the VBE specification is the handling of
  117.      hardware configuration and installation issues.  It was originally
  118.      considered to become part of VBE 2.0, however we have deferred the
  119.      issues to the Graphics Configuration Supplemental Specification.  In
  120.      addition, it is also possible for an OEM to define their own
  121.      extensions using the OEM Supplemental Specification if required.
  122.  
  123.  
  124.      1.2. Backgrounder
  125.                 1
  126.      The IBM VGA  has become a de facto standard in the PC graphics world.
  127.      A multitude of different VGA offerings exist in the marketplace, each
  128.      one providing BIOS or register compatibility with the IBM VGA. More
  129.      and more of these VGA compatible products implement various supersets
  130.      of the VGA standard. These extensions range from higher resolutions
  131.      and more colors to improved performance and even some graphics
  132.      processing capabilities. Intense competition has dramatically improved
  133.      the price/performance ratio, to the benefit of the end user.
  134.  
  135.      However, several serious problems face a software developer who
  136.      intends to take advantage of these "Super VGA"  environments. Because
  137.      there is no standard hardware implementation, the developer is faced
  138.      with widely disparate Super VGA hardware architecture. Lacking a
  139.      common software interface, designing applications for these
  140.      environments is costly and technically difficult. Except for
  141.      applications supported by OEM-specific display drivers, very few
  142.      software packages can take advantage of the power and capabilities of
  143.      Super VGA products.
  144.  
  145.      The VBE standard was originally conceived to enable the development of
  146.      applications that wished to take advantage of display resolutions and
  147.      color depths beyond the VGA definition.  The need for an application
  148.      or software standard was recognized by the developers of graphic
  149.      hardware to encourage the use and acceptance of their rapidly
  150.      advancing product families.  It became obvious that the majority of
  151.      software application developers did not have the resources to develop
  152.      and support custom device level software for the hundreds of display
  153.      boards on the market.  Therefore the rich new features of these
  154.      display devices were not being used outside of the relatively small
  155.      CAD market, and only then after considerable effort.
  156.  
  157.      Indeed, the need for a standard for SVGA display adapters became so
  158.      important that the VESA organization was formed to seek out a
  159.      solution.  The original VBE standard was devised and agreed upon by
  160.      each of the active display controller manufacturers, and has since
  161.      been adopted by DOS application developers to enable use of non-VGA
  162.      extended display modes.
  163.  
  164.      As time went along VBE 1.1 was created to add more video modes and
  165.      increased logical line length/double buffering support.  VBE 1.2 was
  166.      created to add modes and also added high color RAMDAC support.
  167.  
  168.      In the three years since VBE 1.2 was approved we have seen the
  169.      standard become widely accepted and many successful programs have
  170.      embraced VBE.  However, it has become obvious that the need for a more
  171.      robust and extensible standard exists.  Early extensions to the VGA
  172.      standard continued using all of the original VGA I/O ports and frame
  173.      buffer address to communicate with the controller hardware.  As we've
  174.      seen, the supported resolutions and color depths have grown,
  175.      intelligent controllers with BITBLT and LineDraw Functions have become
  176.      common, and new flat frame buffer memory models have appeared along
  177.      with display controllers that are not based on VGA in any way.  VBE
  178.      2.0 and future extensions will support non-VGA based controllers with
  179.      new functions for reading and writing the palette and for access to
  180.      the flat frame buffer models.
  181.  
  182.      VBE 2.0, as designed, offers the extensibility and the robustness that
  183.      was lacking in the previous specifications, while at the same time
  184.      offering backwards compatibility.
  185.  
  186.      In the future, we see the need for adding supplemental specifications
  187.      for issues like Multimedia; Advanced Graphics Functions; and "Plug and
  188.      Play" features.
  189.  
  190.      2.VBE Overview
  191.  
  192.      This chapter outlines the various features and limitations of the VBE
  193.      standard.
  194.  
  195.  
  196.      2.1. VBE  Features
  197.  
  198.        Standard application interface to Graphics Controllers (SVGA
  199.        Devices)
  200.        Standard method of identifying products and manufacturers.
  201.        Provision for OEM extensions through Sub-function 14h
  202.        Simple protected mode interface.
  203.        Extensible interface through supplemental specifications.
  204.  
  205.  
  206.      2.2. VBE Affected Devices
  207.  
  208.      All frame buffer-based devices in the IBM PC platform (with the
  209.      exception of Hercules, Monochrome (MDA), CGA and EGA devices) are
  210.      suitable for use within the VBE standard to enable access to the
  211.      device by VBE-compliant applications.
  212.  
  213.  
  214.      2.3. Providing Vendor Information
  215.  
  216.      The VGA specification does not provide a standard mechanism to
  217.      determine what graphic hardware it is running on. Only by knowing OEM-
  218.      specific features can an application determine the presence of a
  219.      particular graphics controller or display board. This often involves
  220.      reading and testing registers located at I/O addresses unique to each
  221.      OEM. By not knowing what hardware an application is running on, few,
  222.      if any, of the extended features of the underlying hardware can be
  223.      used.
  224.  
  225.      The VESA BIOS Extension provides several functions to return
  226.      information about the graphics environment. These functions return
  227.      system level information as well as graphics mode specific details.
  228.      Function 00h returns general system level information, including an
  229.      OEM identification string. The function also returns a pointer to the
  230.      supported VBE and OEM modes. Function 01h may be used by the
  231.      application to obtain additional information about each supported
  232.      mode. Function 03h returns the current VBE mode.
  233.  
  234.      3.VBE Mode Numbers
  235.  
  236.      Standard VGA mode numbers are 7 bits wide and presently range from 00h
  237.      to 13h. OEMs have defined extended display modes in the range 14h to
  238.      7Fh. Values in the range 80h to FFh cannot be used, since VGA BIOS
  239.      Function 00h (Set video mode) interprets bit 7 as a flag to clear or
  240.      preserve display memory.
  241.  
  242.      Due to the limitations of 7 bit mode numbers, the optional VBE mode
  243.      numbers are 14 bits wide. To initialize a VBE mode, the mode number is
  244.      passed in the BX register to VBE Function 02h (Set VBE mode).
  245.  
  246.      The format of VBE mode numbers is as follows:
  247.  
  248.           D0-D8     =    Mode number
  249.                          If D8 == 0, this is not a VESA defined mode
  250.                          If D8 == 1, this is a VESA defined mode
  251.           D9-D13    =    Reserved by VESA for future expansion (= 0)
  252.           D14       =    Linear/Flat Frame Buffer Select
  253.                          If D14 == 0, Use VGA Frame Buffer
  254.                          If D14 == 1, Use Linear/Flat Frame Buffer
  255.           D15       =    Preserve Display Memory Select
  256.                          If D15 == 0, Clear display memory
  257.                          If D14 == 1, Preserve display memory
  258.  
  259.      Thus, VBE mode numbers begin at 100h. This mode numbering scheme
  260.      implements standard 7-bit mode numbers for OEM-defined modes.
  261.      Standard VGA modes may be initialized through VBE Function 02h (Set
  262.      VBE mode) simply by placing the mode number in BL and clearing the
  263.      upper byte (BH). 7-bit OEM-defined display modes may be initialized in
  264.      the same way.  Note that modes may only be set if the mode exists in
  265.      the Video Mode List returned in Function 0.
  266.  
  267.      Note: Starting with VBE version 2.0 VESA will no longer define new
  268.      VESA mode numbers and it will not longer be mandatory to support these
  269.      old mode numbers.  However, it is highly recommended that BIOS
  270.      implementations continue to support these mode numbers for
  271.      compatibility with old software.  VBE 2.0-aware applications should
  272.      follow the guidelines in Appendix 5 - Application Programming
  273.      Considerations - for setting a desired mode.
  274.  
  275.      Note:  Mode 81FFh is a special mode designed to preserve the current
  276.      memory contents and to give access to the entire video memory.  This
  277.      mode is especially useful for saving the entire video memory contents
  278.      before going into a state that could lose the contents (e.g. set this
  279.      mode to gain access to all video memory to save it before going into a
  280.      volatile power down state).  This mode is required because the entire
  281.      video memory contents are not always accessible in every mode.  It is
  282.      recommended that this mode be packed pixel in format, and a
  283.      ModeInfoBlock must be defined for it.  Look in the ModeInfoBlock to
  284.      determine if paging is required and how paging is supported if it is.
  285.      Also note that there are no implied resolutions or timings associated
  286.      with this mode.
  287.  
  288.      Note:  Future display resolutions will be defined by VESA display
  289.      vendors.  The color depths will not be specified and new mode numbers
  290.      will not be assigned for these resolutions.  For example, if the VESA
  291.  
  292.      display vendors define 1600x1200 as a VESA resolution, application
  293.      developers should target their display resolution for 1600x1200 rather
  294.      than choosing an arbitrary resolution like 1550x1190.  The VBE
  295.      implementation should be queried to get the available resolutions and
  296.      color depths and the application should be flexible enough to work
  297.      with this list.  Appendix 5 gives a detailed summary of the way an
  298.      application should go about selecting and setting modes.
  299.  
  300.      4.VBE Functions
  301.  
  302.      This chapter describes in detail each of the functions defined by the
  303.      VBE standard.  VBE functions are called using the INT 10h interrupt
  304.      vector, passing arguments in the 80X86 registers.  The INT 10h
  305.      interrupt handler first determines if a VBE function has been
  306.      requested, and if so, processes that request.  Otherwise control is
  307.      passed to the standard VGA BIOS for completion.
  308.  
  309.      All VBE functions are called with the AH register set to 4Fh to
  310.      distinguish them from the standard VGA BIOS functions.  The AL
  311.      register is used to indicate which VBE function is to be performed.
  312.      For supplemental or extended functionality the BL register is used
  313.      when appropriate to indicate a specific sub-function.
  314.  
  315.      Functions 00-0Fh have been reserved for Standard VBE function numbers;
  316.      Functions 10-FFh are reserved for VBE Supplemental Specifications.
  317.  
  318.      In addition to the INT 10h interface, a Protected Mode Interface is
  319.      available and is described below.
  320.  
  321.  
  322.      4.1. VBE Return Status
  323.  
  324.      The AX register is used to indicate the completion status upon return
  325.      from VBE functions.  If VBE support for the specified function is
  326.      available, the 4Fh value passed in the AH register on entry is
  327.      returned in the AL register.  If the VBE function completed
  328.      successfully, 00h is returned in the AH register.  Otherwise the AH
  329.      register is set to indicate the nature of the failure.
  330.  
  331.      VBE RETURN STATUS
  332.  
  333.           AL ==     4Fh: Function is supported
  334.           AL !=     4Fh: Function is not supported
  335.           AH ==     00h: Function call successful
  336.           AH ==     01h: Function call failed
  337.           AH ==     02h: Software supports this function, but the hardware
  338.                          does not
  339.           AH ==     03h: Function call invalid in current video mode
  340.  
  341.      Note: Applications should treat any non-zero value in the AH register
  342.      as a general failure condition as later versions of the VBE may define
  343.      additional error codes.
  344.  
  345.  
  346.      4.2. Protected Mode considerations
  347.  
  348.      VBE services may be called directly from 32-bit Protected mode only.
  349.  
  350.      For 32 bit protected mode, 2 selector/segment descriptors for 32-bit
  351.      code and the data segment are needed. These will be allocated and
  352.      initialized by the caller. The segment limit fields will be set to
  353.      64k. These selectors may either be in the GDT or LDT, but must be
  354.      valid whenever the VBE is called in protected mode. The caller must
  355.      supply a stack large enough for use by VBE and by potential interrupt
  356.      handlers. The caller's stack will be active if or when interrupts are
  357.      enabled in the VBE routine, since the VBE will not switch stacks when
  358.      interrupts are enabled, including NMI interrupts. The 32-bit VBE
  359.      interface requires a 32-bit stack.
  360.  
  361.      When the VBE services are called, the current I/O permission bit map
  362.      must allow access to the I/O ports that the VBE may need to access.
  363.      This can be found in the Sub-table (Ports and Memory) returned by VBE
  364.      Function 0Ah.
  365.  
  366.      To summarize, it is the calling application's responsibility to ensure
  367.      to that it has the appropriate I/O and memory privileges, a large
  368.      enough stack and appropriate selectors allocated.  It is also the
  369.      calling application's responsibility to preserve registers if it needs
  370.      them.
  371.  
  372.      4.3. Function 00h - Return VBE Controller Information
  373.  
  374.      This required function returns the capabilities of the display
  375.      controller, the revision level of the VBE implementation, and vendor
  376.      specific information to assist in supporting all display controllers
  377.      in the field.
  378.  
  379.      The purpose of this function is to provide information to the calling
  380.      program about the general capabilities of the installed VBE software
  381.      and hardware. This function fills an information block structure at
  382.      the address specified by the caller. The VbeInfoBlock information
  383.      block size is 256 bytes for VBE 1.x, and 512 bytes for VBE 2.0.
  384.  
  385.      Input:    AX   = 4F00h  Return VBE Controller Information
  386.             ES:DI   =        Pointer to buffer in which to place
  387.                              VbeInfoBlock structure
  388.                              (VbeSignature should be set to 'VBE2' when
  389.                              function is called to indicate VBE 2.0
  390.                              information is desired and the information
  391.                              block is 512 bytes in size.)
  392.  
  393.      Output:   AX   =         VBE Return Status  
  394.  
  395.      Note: All other registers are preserved.
  396.  
  397.      The information block has the following structure:
  398.  
  399.      VbeInfoBlock struc
  400.      VbeSignature        db   'VESA'    ; VBE Signature
  401.      VbeVersion          dw   0200h     ; VBE Version
  402.      OemStringPtr        dd   ?         ; Pointer to OEM String
  403.      Capabilities        db   4 dup (?) ; Capabilities of graphics cont.
  404.      VideoModePtr        dd   ?         ; Pointer to Video Mode List
  405.      TotalMemory         dw   ?         ; Number of 64kb memory blocks
  406.                                         ; Added for VBE 2.0
  407.      OemSoftwareRev      dw   ?         ; VBE implementation Software revision
  408.      OemVendorNamePtr    dd   ?         ; Pointer to Vendor Name String
  409.      OemProductNamePtr   dd   ?         ; Pointer to Product Name String
  410.      OemProductRevPtr    dd   ?         ; Pointer to Product Revision String
  411.      Reserved            db   222 dup (?); Reserved for VBE implementation
  412.                                         ; scratch area
  413.      OemData             db   256 dup (?); Data Area for OEM Strings
  414.      VbeInfoBlock ends
  415.  
  416.      Note: All data in this structure is subject to change by the VBE
  417.      implementation when VBE Function 00h is called.  Therefore, it should
  418.      not be used by the application to store data of any kind.
  419.  
  420.      Description of the VbeInfoBlock structure fields:
  421.  
  422.      The VbeSignature field is filled with the ASCII characters 'VESA' by
  423.      the VBE implementation.  VBE 2.0 applications should preset this field
  424.      with the ASCII characters 'VBE2' to indicate to the VBE implementation
  425.      that the VBE 2.0 extended information is desired, and the VbeInfoBlock
  426.      is 512 bytes in size.  Upon return from VBE Function 00h, this field
  427.      should always be set to 'VESA' by the VBE implementation.
  428.  
  429.      The VbeVersion is a BCD value which specifies what level of the VBE
  430.      standard is implemented in the software. The higher byte specifies the
  431.      major version number. The lower byte specifies the minor version
  432.      number.
  433.  
  434.      Note:  The BCD value for VBE 2.0 is 0200h and the BCD value for VBE
  435.      1.2 is 0102h. In the past we have had some applications
  436.      misinterpreting these BCD values.  For example, BCD 0102h was
  437.      interpreted as 1.02, which is incorrect.
  438.  
  439.      The OemStringPtr is a Real Mode far pointer to a null terminated OEM-
  440.      defined string. This string may be used to identify the graphics
  441.      controller chip or OEM product family for hardware specific display
  442.      drivers. There are no restrictions on the format of the string.  This
  443.      pointer may point into either ROM or RAM, depending on the specific
  444.      implementation.  VBE 2.0 BIOS implementations must place this string
  445.      in the OemData area within the VbeInfoBlock if 'VBE2' is preset in the
  446.      VbeSignature field on entry to Function 00h.  This makes it possible
  447.      to convert the RealMode address to an offset within the VbeInfoBlock
  448.      for Protected mode applications.
  449.  
  450.      Note: The length of the OEMString is not defined, but for space
  451.      considerations, we recommend a string length of less than 256 bytes.
  452.  
  453.      The Capabilities field indicates the support of specific features in
  454.      the graphics environment. The bits are defined as follows:
  455.  
  456.      D0     = 0     DAC is fixed width, with 6 bits per primary color
  457.             = 1     DAC width is switchable to 8 bits per primary color
  458.      D1     = 0     Controller is VGA compatible
  459.             = 1     Controller is not VGA compatible
  460.      D2     = 0     Normal RAMDAC operation
  461.             = 1     When programming large blocks of information to the
  462.                     RAMDAC use blank bit in Function 09h. i.e. RAMDAC
  463.                     recommends programming during blank period only.
  464.      D3-31  = Reserved
  465.  
  466.      BIOS Implementation Note: The DAC must always be restored to 6 bits
  467.      per primary as default upon a mode set.  If the DAC has been switched
  468.      to 8 bits per primary, the mode set must restore the DAC to 6 bits per
  469.      primary to ensure the application developer that he does not have to
  470.      reset it.
  471.  
  472.      Application Developer's Note:  If a DAC is switchable, you can assume
  473.      that the DAC will be restored to 6 bits per primary upon a mode set.
  474.      For an application to use a DAC the application program is responsible
  475.      for setting the DAC to 8 bits per primary mode using Function 08h.
  476.  
  477.      VGA compatibility is defined as supporting all standard IBM VGA modes,
  478.      fonts and I/O ports; however, VGA compatibility doesn't guarantee that
  479.      all modes which can be set are VGA compatible, or that the 8x14 font
  480.      is available.
  481.  
  482.      The need for D2 = 1 "program the RAMDAC using the blank bit in
  483.      Function 09h" is for older style RAMDAC's where programming the RAM
  484.      values during display time causes a "snow-like" effect on the screen.
  485.      Newer style RAMDAC's don't have this limitation and can easily be
  486.      programmed at any time, but older RAMDAC's require the that they be
  487.      blanked so as not to display the snow while values change during
  488.      display time..  This bit informs the software that they should make
  489.      the function call with 80h rather than 00h to ensure the minimization
  490.      of the "snow-like" effect.
  491.  
  492.      The VideoModePtr points to a list of  mode numbers for all  display
  493.      modes supported by the VBE implementation.  Each mode number occupies
  494.      one word (16 bits). The list of mode numbers is terminated by a -1
  495.      (0FFFFh).  The mode numbers in this list represent all of the
  496.      potentially supported modes by the display controller.  Please refer
  497.      to Chapter 3 for a description of VESA VBE mode numbers.  VBE 2.0 BIOS
  498.      implementations must place this mode list in the Reserved area in the
  499.      VbeInfoBlock or have it statically stored within the VBE
  500.      implementation if 'VBE2' is preset in the VbeSignature field on entry
  501.      to Function 00h.
  502.  
  503.      Note: It is the application's responsibility to verify the actual
  504.      availability of any mode returned by this function through the Return
  505.      VBE Mode Information (VBE Function 01h) call. Some of the returned
  506.      modes may not be available due to the actual amount of memory
  507.      physically installed on the display board or due to the capabilities
  508.      of the attached monitor.
  509.  
  510.      Note: If a VideoModeList is found to contain no entries (starts with
  511.      0FFFFh), it can be assumed that the VBE implementation is a "stub"
  512.      implementation where only Function 00h is supported for diagnostic or
  513.      "Plug and Play" reasons.  These stub implementations are not VBE 2.0
  514.      compliant and should only be implemented in cases where no space is
  515.      available to implement the whole VBE.
  516.  
  517.      The TotalMemory field indicates the maximum amount of memory
  518.      physically installed and available to the frame buffer in 64KB units.
  519.      (e.g. 256KB = 4, 512KB = 8)  Not all video modes can address all this
  520.      memory, see the ModeInfoBlock for detailed information about the
  521.      addressible memory for a given mode.
  522.  
  523.      The OemSoftwareRev field is a BCD value which specifies the OEM
  524.      revision level of the VBE software.  The higher byte specifies the
  525.      major version number. The lower byte specifies the minor version
  526.      number.  This field can be used to identify the OEM's VBE software
  527.      release.  This field is only filled in when 'VBE2' is preset in the
  528.      VbeSignature field on entry to Function 00h.
  529.  
  530.      The OemVendorNamePtr is a pointer to  a null-terminated string
  531.      containing the name of the vendor who produced the display controller
  532.      board product.  (This string may be contained in the VbeInfoBlock or
  533.      the VBE implementation.)  This field is only filled in when 'VBE2' is
  534.      preset in the VbeSignature field on entry to Function 00h.  (Note:
  535.      the length of the strings OemProductRev, OemProductName and
  536.      OemVendorName (including terminators) summed, must fit within a 256
  537.      byte buffer; this is to allow for return in the OemData field if
  538.      necessary.)
  539.  
  540.      The OemProductNamePtr is a pointer to  a null-terminated string
  541.      containing the product name of the display controller board.  (This
  542.      string may be contained in the VbeInfoBlock or the VBE
  543.      implementation.)  This field is only filled in when 'VBE2' is preset
  544.      in the VbeSignature field on entry to Function 00h.  (Note:  the
  545.      length of the strings OemProductRev, OemProductName and OemVendorName
  546.      (including terminators) summed, must fit within a 256 byte buffer;
  547.      this is to allow for return in the OemData field if necessary.)
  548.  
  549.      The OemProductRevPtr is a pointer to a null-terminated string
  550.      containing the revision or manufacturing level of the display
  551.      controller board product.  (This string may be contained in the
  552.      VbeInfoBlock or the VBE implementation.)  This field can be used to
  553.      determine which production revision of the display controller board is
  554.      installed.  This field is only filled in when 'VBE2' is preset in the
  555.      VbeSignature field on entry to Function 00h.  (Note:  the length of
  556.      the strings OemProductRev, OemProductName and OemVendorName (including
  557.      terminators) summed, must fit within a 256 byte buffer; this is to
  558.      allow for return in the OemData field if necessary.)
  559.  
  560.      The Reserved field is a space reserved for dynamically building the
  561.      VideoModeList if necessary if the VideoModeList is not statically
  562.      stored within the VBE implementation.  This field should not be used
  563.      for anything else, and may be reassigned in the future.  Application
  564.      software should not assume that information in this field is valid.
  565.  
  566.      The OemData field is a 256 byte data area that is used to return OEM
  567.      information returned by VBE Function 00h when 'VBE2' is preset in the
  568.      VbeSignature field.  The OemVendorName string, OemProductName string
  569.      and OemProductRev string are copied into this area by the VBE
  570.      implementation.  This area will only be used by VBE implementations
  571.      2.0 and above when 'VBE2' is preset in the VbeSignature field.
  572.      4.4. Function 01h - Return VBE Mode Information
  573.  
  574.      This required function returns extended information about a specific
  575.      VBE display mode from the mode list returned by VBE Function 00h.
  576.      This function fills the mode information block, ModeInfoBlock,
  577.      structure with technical details on the requested mode.  The
  578.      ModeInfoBlock structure is provided by the application with a fixed
  579.      size of 256 bytes.
  580.  
  581.      Information can be obtained for all listed modes in the Video Mode
  582.      List returned in Function 00h.  If the requested mode cannot be used
  583.      or is unavailable, a bit will be set in the ModeAttributes field to
  584.      indicate that the mode is not supported in the current configuration.
  585.  
  586.      Input:    AX   = 4F01h   Return VBE mode information
  587.                CX   =         Mode number
  588.             ES:DI   =         Pointer to ModeInfoBlock structure
  589.  
  590.      Output:   AX   =         VBE Return Status
  591.  
  592.      Note: All other registers are preserved.
  593.  
  594.      The mode information block has the following structure:
  595.  
  596.      ModeInfoBlock   struc
  597.  
  598.      ; Mandatory information for all VBE revisions
  599.      ModeAttributes      dw ?      ; mode attributes
  600.      WinAAttributes      db ?      ; window A attributes
  601.      WinBAttributes      db ?      ; window B attributes
  602.      WinGranularity      dw ?      ; window granularity
  603.      WinSize             dw ?      ; window size
  604.      WinASegment         dw ?      ; window A start segment
  605.      WinBSegment         dw ?      ; window B start segment
  606.      WinFuncPtr          dd ?      ; pointer to window function
  607.      BytesPerScanLine    dw ?      ; bytes per scan line
  608.  
  609.      ; Mandatory information for VBE 1.2 and above
  610.      XResolution         dw ?      ; horizontal resolution in pixels or chars
  611.      YResolution         dw ?      ; vertical resolution in pixels or chars
  612.      XCharSize           db ?      ; character cell width in pixels
  613.      YCharSize           db ?      ; character cell height in pixels
  614.      NumberOfPlanes      db ?      ; number of memory planes
  615.      BitsPerPixel        db ?      ; bits per pixel
  616.      NumberOfBanks       db ?      ; number of banks
  617.      MemoryModel         db ?      ; memory model type
  618.      BankSize            db ?      ; bank size in KB
  619.      NumberOfImagePages  db ?      ; number of images
  620.      Reserved            db ?      ; reserved for page function
  621.  
  622.      ; Direct Color fields (required for direct/6 and YUV/7 memory models)
  623.      RedMaskSize         db ?      ; size of direct color red mask in bits
  624.      RedFieldPosition    db ?      ; bit position of lsb of red mask
  625.      GreenMaskSize       db ?      ; size of direct color green mask in bits
  626.      GreenFieldPosition  db ?      ; bit position of lsb of green mask
  627.      BlueMaskSize        db ?      ; size of direct color blue mask in bits
  628.      BlueFieldPosition   db ?      ; bit position of lsb of blue mask
  629.      RsvdMaskSize        db ?      ; size of direct color reserved mask in bits
  630.      RsvdFieldPosition   db ?      ; bit position of lsb of reserved mask
  631.      DirectColorModeInfo db ?      ; direct color mode attributes
  632.  
  633.      ; Mandatory information for VBE 2.0 and above
  634.      PhysBasePtr         dd ?      ; physical address for flat frame buffer
  635.      OffScreenMemOffset  dd ?      ; pointer to start of off screen memory
  636.      OffScreenMemSize    dw ?      ; amount of off screen memory in 1k units
  637.      Reserved            db 206 dup (?)  ; remainder of ModeInfoBlock
  638.      ModeInfoBlock ends
  639.  
  640.      The ModeAttributes field describes certain important characteristics
  641.      of the graphics mode.
  642.  
  643.      The ModeAttributes field is defined as follows:
  644.  
  645.      D0   =    Mode supported by hardware configuration
  646.           0 =  Mode not supported in hardware
  647.           1 =  Mode supported in hardware
  648.      D1   =    1 (Reserved)
  649.      D2   =    TTY Output functions supported by BIOS
  650.           0 =  TTY Output functions not supported by BIOS
  651.           1 =  TTY Output functions supported by BIOS
  652.      D3   =    Monochrome/color mode (see note below)
  653.           0 =  Monochrome mode
  654.           1 =   Color mode
  655.      D4   =    Mode type
  656.           0 =  Text mode
  657.           1 =  Graphics mode
  658.      D5   =    VGA compatible mode
  659.           0 =  Yes
  660.           1 =  No
  661.      D6   =    VGA compatible windowed memory mode is available
  662.           0 =  Yes
  663.           1 =  No
  664.      D7   =    Linear frame buffer mode is available
  665.           0 =  No
  666.           1 =  Yes
  667.      D8-D15 =  Reserved
  668.  
  669.      Bit D0 is set to indicate that this mode can be initialized in the
  670.      present hardware configuration. This bit is reset to indicate the
  671.      unavailability of a graphics mode if it requires a certain monitor
  672.      type, more memory than is physically installed, etc.
  673.  
  674.      Bit D1 was used by VBE 1.0 and 1.1 to indicate that the optional
  675.      information following the BytesPerScanLine field were present in the
  676.      data structure.  This information became mandatory with VBE version
  677.      1.2 and above, so D1 is no longer used and should be set to 1.  The
  678.      Direct Color fields are valid only if the MemoryModel field is set to
  679.      a 6 (Direct Color) or 7 (YUV).
  680.  
  681.      Bit D2 indicates whether the video BIOS has support for output
  682.      functions like TTY output, scroll, etc. in this mode.  TTY support is
  683.      recommended but not required for all extended text and graphic modes.
  684.      If bit D2 is set to 1, then the INT 10h BIOS must support all of the
  685.      standard output functions listed below.
  686.  
  687.      All of the following TTY functions must be supported when this bit is
  688.      set:
  689.  
  690.           01   Set Cursor Size
  691.           02   Set Cursor Position
  692.           06   Scroll TTY window up or Blank Window
  693.           07   Scroll TTY window down or Blank Window
  694.           09   Write character and attribute at cursor position
  695.           0A   Write character only at cursor position
  696.           0E   Write character and advance cursor  
  697.  
  698.      Bit D3 is set to indicate color modes, and cleared for monochrome
  699.      modes.
  700.  
  701.      Bit D4 is set to indicate graphics modes, and cleared for text modes.
  702.  
  703.      Note: Monochrome modes map their CRTC address at 3B4h. Color modes map
  704.      their CRTC address at 3D4h. Monochrome modes have attributes in which
  705.      only bit 3 (video) and bit 4 (intensity) of the attribute controller
  706.      output are significant. Therefore, monochrome text modes have
  707.      attributes of off, video, high intensity, blink, etc. Monochrome
  708.      graphics modes are two plane graphics modes and have attributes of
  709.      off, video, high intensity, and blink. Extended two color modes that
  710.      have their CRTC address at 3D4h, are color modes with one bit per
  711.      pixel and one plane. The standard VGA modes, 06h and 11h would be
  712.      classified as color modes, while the standard VGA modes 07h and 0Fh
  713.      would be classified as monochrome modes.
  714.  
  715.      Bit D5 is used to indicate if the mode is compatible with the VGA
  716.      hardware registers and I/O ports.  If this bit is set, then the mode
  717.      is NOT VGA compatible and no assumptions should be made about the
  718.      availability of any VGA registers.   If clear, then the standard VGA
  719.      I/O ports and frame buffer address defined in WinASegment and/or
  720.      WinBSegment can be assumed.
  721.  
  722.      Bit D6 is used to indicate if the mode provides Windowing or Banking
  723.      of the frame buffer into the frame buffer memory region specified by
  724.      WinASegment and WinBSegment.  If set, then Windowing of the frame
  725.      buffer is NOT possible.  If clear, then the device is capable of
  726.      mapping the frame buffer into the segment specified in WinASegment
  727.      and/or WinBSegment.  (This bit is used in conjunction with bit D7, see
  728.      table following D7 for usage)
  729.  
  730.      Bit D7 indicates the presence of a Linear Frame Buffer memory model.
  731.      If this bit is set, the display controller can be put into a flat
  732.      memory model by setting the mode (VBE Function 02h) with the Flat
  733.      Memory Model bit set. (This bit is used in conjunction with bit D6,
  734.      see following table for usage)
  735.  
  736.                       +-----------+-----+-----+
  737.                       |           | D7  | D6  |
  738.                       +-----------+-----+-----+
  739.                       |  Windowed |  0  |  0  |
  740.                       |   frame   |     |     |
  741.                       |   buffer  |     |     |
  742.                       |    only   |     |     |
  743.                       +-----------+-----+-----+
  744.                       |    n/a    |  0  |  1  |
  745.                       +-----------+-----+-----+
  746.                       |    Both   |  1  |  0  |
  747.                       |  Windowed |     |     |
  748.                       |    and 4  |     |     |
  749.                       |  Linear   |     |     |
  750.                       +-----------+-----+-----+
  751.                       |   Linear  |  1  |  1  |
  752.                       |   frame   |     |     |
  753.                       |   buffer  |     |     |
  754.                       |    only   |     |     |
  755.                       +-----------+-----+-----+
  756.  
  757.  
  758.      The BytesPerScanLine field specifies how many full bytes are in each
  759.      logical scanline. The logical scanline could be equal to or larger
  760.      than the displayed scanline.
  761.  
  762.      The WinAAttributes and WinBAttributes describe the characteristics of
  763.      the CPU windowing scheme such as whether the windows exist and are
  764.      read/writeable, as follows:
  765.  
  766.      D0    =    Relocatable window(s) supported
  767.            0 =  Single non-relocatable window only
  768.            1 =  Relocatable window(s) are supported
  769.      D1    =    Window readable
  770.            0 =  Window is not readable
  771.            1 =  Window is readable
  772.      D2    =    Window writeable
  773.            0 =  Window is not writeable
  774.            1 =  Window is writeable
  775.      D3-D7 =    Reserved
  776.  
  777.      Even if windowing is not supported, (bit D0 = 0 for both Window A and
  778.      Window B), then an application can assume that the display memory
  779.      buffer resides at the location specified by WinASegment and/or
  780.      WinBSegment.
  781.  
  782.      WinGranularity specifies the smallest boundary, in KB, on which the
  783.      window can be placed in the frame buffer memory. The value of this
  784.      field is undefined if Bit D0 of the appropriate WinAttributes field is
  785.      not set.
  786.  
  787.      WinSize specifies the size of the window in KB.
  788.  
  789.      WinASegment and WinBSegment address specify the segment addresses
  790.      where the windows are located in the CPU address space.
  791.  
  792.      Use D14 of the Mode Number to select the Linear Buffer on a mode set
  793.      (Function 02h).
  794.  
  795.      WinFuncPtr specifies the segment:offset of the VBE memory windowing
  796.      function. The windowing function can be invoked either through VBE
  797.      Function 05h, or by calling the function directly. A direct call will
  798.      provide faster access to the hardware paging registers than using VBE
  799.      Function 05h, and is intended to be used by high performance
  800.      applications. If this field is NULL, then VBE Function 05h must be
  801.      used to set the memory window when paging is supported.  This direct
  802.      call method uses the same parameters as VBE Function 05h including AX
  803.      and for VBE 2.0 implementations will return the correct Return Status.
  804.      VBE 1.2 implementations and earlier, did not require the Return Status
  805.      information to be returned.  For more information on the direct call
  806.      method, see the notes in VBE Function 05h and the sample code in
  807.      Appendix 5.
  808.  
  809.      The XResolution and YResolution specify the width and height in pixel
  810.      elements or characters for this display mode. In graphics modes, these
  811.      fields indicate the number of horizontal and vertical pixels that may
  812.      be displayed. In text modes, these fields indicate the number of
  813.      horizontal and vertical character positions.  The number of pixel
  814.      positions for text modes may be calculated by multiplying the returned
  815.      XResolution and YResolution values by the character cell width and
  816.      height indicated in the XCharSize and YCharSize fields described
  817.      below.
  818.  
  819.      The XCharSize and YCharSize specify the size of the character cell in
  820.      pixels.  (This value is not zero based)  e.g. XCharSize for Mode 3
  821.      using the 9 point font will have a value of 9.
  822.  
  823.      The NumberOfPlanes field specifies the number of memory planes
  824.      available to software in that mode. For standard 16-color VGA
  825.      graphics, this would be set to 4. For standard packed pixel modes, the
  826.      field would be set to 1.  For 256-color non-chain-4 modes, where you
  827.      need to do banking to address all pixels this value should be set to
  828.      the number of banks required to get to all the pixels (typically this
  829.      will be 4 or 8).
  830.  
  831.      The BitsPerPixel field specifies the total number of bits allocated to
  832.      one pixel. For example, a standard VGA 4 Plane 16-color graphics mode
  833.      would have a 4 in this field and a packed pixel 256-color graphics
  834.      mode would specify 8 in this field. The number of bits per pixel per
  835.      plane can normally be derived by dividing the BitsPerPixel field by
  836.      the NumberOfPlanes field.
  837.  
  838.      The MemoryModel field specifies the general type of memory
  839.      organization used in this mode. The following models have been
  840.      defined:
  841.  
  842.      00h  =    Text mode
  843.      01h  =    CGA graphics
  844.      02h  =    Hercules graphics
  845.      03h  =    Planar
  846.      04h  =    Packed pixel
  847.      05h  =    Non-chain 4, 256 color
  848.      06h  =    Direct Color
  849.      07h  =    YUV
  850.      08h-0Fh =      Reserved, to be defined by VESA
  851.      10h-FFh =      To be defined by OEM
  852.  
  853.      VBE Version 1.1 and earlier defined Direct Color graphics modes with
  854.      pixel formats 1:5:5:5, 8:8:8, and 8:8:8:8  as a Packed Pixel model
  855.      with 16, 24, and 32 bits per pixel, respectively. In VBE Version 1.2
  856.  
  857.      and later, the Direct Color modes use the Direct Color memory model
  858.      and use the MaskSize and FieldPosition fields of the ModeInfoBlock to
  859.      describe the pixel format. BitsPerPixel is always defined to be the
  860.      total memory size of the pixel, in bits.
  861.  
  862.      NumberOfBanks. This is the number of banks in which the scan lines are
  863.      grouped. The quotient from dividing the scan line number by the number
  864.      of banks is the bank that contains the scan line and the remainder is
  865.      the scan line number within the bank. For example, CGA graphics modes
  866.      have two banks and Hercules graphics mode has four banks. For modes
  867.      that don't have scanline banks (such as VGA modes 0Dh-13h), this field
  868.      should be set to 1.
  869.  
  870.      The BankSize field specifies the size of a bank (group of scan lines)
  871.      in units of 1 KB. For CGA and Hercules graphics modes this is 8, as
  872.      each bank is 8192 bytes in length. For modes that don't have scanline
  873.      banks (such as VGA modes 0Dh-13h), this field should be set to 0.
  874.  
  875.      The NumberOfImagePages field specifies the "total number minus one (-
  876.      1)"of complete display images that will fit into the frame buffer
  877.      memory. The application may load more than one image into the frame
  878.      buffer memory if this field is non-zero, and move the display window
  879.      within each of those pages.  This should only be used for determining
  880.      the additional display pages which are available to the application;
  881.      to determine the available off screen memory, use the
  882.      OffScreenMemOffset and OffScreenMemSize information.
  883.  
  884.      Note: If the ModeInfoBlock is for an IBM Standard VGA mode and the
  885.      NumberOfImagePages field contains more pages than would be found in a
  886.      256KB implementation, the TTY support described in the ModeAttributes
  887.      must be accurate.  i.e. if the TTY functions are claimed to be
  888.      supported, they must be supported in all pages, not just the pages
  889.      normally found in the 256KB implementation.
  890.  
  891.      The Reserved field has been defined to support a future VBE feature
  892.      and will always be set to one in this version.
  893.  
  894.      The RedMaskSize, GreenMaskSize, BlueMaskSize, and RsvdMaskSize fields
  895.      define the size, in bits, of the red, green, and blue components of a
  896.      direct color pixel. A bit mask can be constructed from the MaskSize
  897.      fields using simple shift arithmetic. For example, the MaskSize values
  898.      for a Direct Color 5:6:5 mode would be 5, 6, 5, and 0, for the red,
  899.      green, blue, and reserved fields, respectively. Note that in the YUV
  900.      MemoryModel, the red field is used for V, the green field is used for
  901.      Y, and the blue field is used for U. The MaskSize fields should be set
  902.      to 0 in modes using a memory model that does not have pixels with
  903.      component fields.
  904.  
  905.      The RedFieldPosition, GreenFieldPosition, BlueFieldPosition, and
  906.      RsvdFieldPosition fields define the bit position within the direct
  907.      color pixel or YUV pixel of the least significant bit of the
  908.      respective color component. A color value can be aligned with its
  909.      pixel field by shifting the value left by the FieldPosition. For
  910.      example, the FieldPosition values for a Direct Color 5:6:5 mode would
  911.      be 11, 5, 0, and 0, for the red, green, blue, and reserved fields,
  912.      respectively. Note that in the YUV MemoryModel, the red field is used
  913.      for V, the green field is used for Y, and the blue field is used for
  914.      U. The FieldPosition fields should be set to 0 in modes using a memory
  915.      model that does not have pixels with component fields.
  916.  
  917.      The DirectColorModeInfo field describes important characteristics of
  918.  
  919.      direct color modes.  Bit D0 specifies whether the color ramp of the
  920.      DAC is fixed or programmable. If the color ramp is fixed, then it can
  921.      not be changed. If the color ramp is programmable, it is assumed that
  922.      the red, green, and blue lookup tables can be loaded by using VBE
  923.      Function 09h.  Bit D1 specifies whether the bits in the Rsvd field of
  924.      the direct color pixel can be used by the application or are reserved,
  925.      and thus unusable.
  926.  
  927.      D0   =    Color ramp is fixed/programmable
  928.           0 =  Color ramp is fixed
  929.           1 =  Color ramp is programmable
  930.      D1   =    Bits in Rsvd field are usable/reserved
  931.           0 =  Bits in Rsvd field are reserved
  932.           1 =  Bits in Rsvd field are usable by the application
  933.  
  934.      The PhysBasePtr is a 32 bit physical address of the start of frame
  935.      buffer memory when the controller is in flat frame buffer memory mode.
  936.      If this mode is not available, then this field will be zero.
  937.  
  938.      The OffScreenMemOffset is a 32 bit offset from the start of the frame
  939.      buffer memory.  Extra off-screen memory that is needed by the
  940.      controller may be located either before or after this off screen
  941.      memory, be sure to check OffScreenMemSize to determine the amount of
  942.      off-screen memory which is available to the application.
  943.  
  944.      The OffScreenMemSize contains the amount of available, contiguous off-
  945.      screen memory in 1k units, which can be used by the application.
  946.  
  947.      Note: Version 1.1 and later VBE will zero out all unused fields in the
  948.      Mode Information Block, always returning exactly 256 bytes. This
  949.      facilitates upward compatibility with future versions of the standard,
  950.      as any newly added fields will be designed such that values of zero
  951.      will indicate nominal defaults or non-implementation of optional
  952.      features. (For example, a field containing a bit-mask of extended
  953.      capabilities would reflect the absence of all such capabilities.)
  954.      Applications that wish to be backwards compatible to Version 1.0 VBE
  955.      should pre-initialize the 256 byte buffer before calling the Return
  956.      VBE Mode Information function.
  957.  
  958.      4.5. Function 02h  - Set VBE Mode
  959.  
  960.      This required function initializes the controller and sets a VBE mode.
  961.      The format of VESA VBE mode numbers is described earlier in this
  962.      document. If the mode cannot be set, the BIOS should leave the
  963.      graphics environment unchanged and return a failure error code.
  964.  
  965.      Input:    AX   = 4F02h     Set VBE Mode
  966.                BX   =           Desired Mode to set
  967.                     D0-D8  =    Mode number
  968.                     D9-D13 =    Reserved (must be 0)
  969.                     D14    = 0  Use windowed frame buffer model
  970.                            = 1  Use linear/flat frame buffer model
  971.                     D15    = 0  Clear display memory
  972.                            = 1  Don't clear display memory
  973.  
  974.      Output:   AX   =           VBE Return Status
  975.  
  976.      Note: All other registers are preserved.
  977.  
  978.      If the requested mode number is not available, then the call will
  979.      fail, returning AH=01h to indicate the failure to the application.
  980.  
  981.      If bit D14 is set, the mode will be initialized for use with a flat
  982.      frame buffer model.  The base address of the frame buffer can be
  983.      determined from the extended mode information returned by VBE Function
  984.      01h.  If D14 is set, and a linear frame buffer model is not available
  985.      then the call will fail, returning AH=01h to the application.
  986.  
  987.      If bit D15 is not set, all reported image pages, based on Function 00h
  988.      returned information NumberOfImagePages, will be cleared to 00h in
  989.      graphics mode, and 20 07 in text mode.  Memory over and above the
  990.      reported image pages will not be changed.  If bit D15 is set, then the
  991.      contents of the frame buffer after the mode change is undefined.
  992.      Note, the 1-byte mode numbers used in Function 00h of an IBM VGA
  993.      compatible BIOS use D7 to signify the same thing as D15 does in this
  994.      function.  If D7 is set for an IBM compatible mode set using this
  995.      Function (02), this mode set will fail.  VBE aware applications must
  996.      use the memory clear bit in D15.
  997.  
  998.      Note: VBE BIOS 2.0 implementations should also update the BIOS Data
  999.      Area 40:87 memory clear bit so that VBE Function 03h can return this
  1000.      flag. VBE BIOS 1.2 and earlier implementations ignore the memory clear
  1001.      bit.
  1002.  
  1003.      Note:  This call should not set modes not listed in the list of
  1004.      supported modes.  In addition all modes (including IBM standard VGA
  1005.      modes), if listed as supported, must have ModeInfoBlock structures
  1006.      associated with them.  Required ModeInfoBlock values for the IBM
  1007.      Standard Modes are listed in Appendix 2.
  1008.  
  1009.      Note: If there is a failure when selecting an unsupported D14 value,
  1010.      the error return should be 02h.
  1011.  
  1012.      4.6. Function 03h - Return current VBE Mode
  1013.  
  1014.      This required function returns the current VBE mode. The format of VBE
  1015.      mode numbers is described earlier in this document.
  1016.  
  1017.      Input:    AX   = 4F03h   Return current VBE Mode
  1018.  
  1019.      Output:   AX   =         VBE Return Status
  1020.                BX   =         Current VBE mode
  1021.                     D0-D13 =  Mode number
  1022.                     D14  = 0  Windowed frame buffer model
  1023.                          = 1  Linear/flat frame buffer model
  1024.                     D15  = 0  Memory cleared at last mode set
  1025.                          = 1  Memory not cleared at last mode set
  1026.  
  1027.      Note: All other registers are preserved.
  1028.  
  1029.      Version 1.x Note: In a standard VGA BIOS, Function 0Fh (Read current
  1030.      video state) returns the current graphics mode in the AL register. In
  1031.      D7 of AL, it also returns the status of the memory clear bit (D7 of
  1032.      40:87). This bit is set if the mode was set without clearing memory.
  1033.      In this VBE function, the memory clear bit will not be returned in BX
  1034.      since the purpose of the function is to return the video mode only. If
  1035.      an application wants to obtain the memory clear bit, it should call
  1036.      the standard VGA BIOS Function 0Fh.
  1037.  
  1038.      Version 2.x Note:  Unlike version 1.x VBE implementations, the memory
  1039.      clear flag will be returned.  The application should NOT call the
  1040.      standard VGA BIOS Function 0Fh if the mode was set with VBE Function
  1041.      02h.
  1042.  
  1043.      Note: The mode number returned must be the same mode number used in
  1044.      the VBE Function 02h mode set.
  1045.  
  1046.      Note: This function is not guaranteed to return an accurate mode value
  1047.      if the mode set was not done with VBE Function 02h.
  1048.  
  1049.      4.7. Function 04h  - Save/Restore state
  1050.  
  1051.      This required function provides a complete mechanism to save and
  1052.      restore the display controller hardware state. The functions are a
  1053.      superset of the three subfunctions under the standard VGA BIOS
  1054.      Function 1Ch (Save/restore state) which does not guarantee that the
  1055.      extended registers of the video device are saved or restored. The
  1056.      complete hardware state (except frame buffer memory) should be
  1057.      saveable/restorable by setting the requested states mask (in the CX
  1058.      register) to 000Fh.
  1059.  
  1060.      Input:    AX   = 4F04h   Save/Restore state
  1061.                DL   = 00h         Return save/restore state buffer size
  1062.                     = 01h         Save state
  1063.                     = 02h         Restore state
  1064.                CX   =         Requested states
  1065.                     D0=           Save/restore controller hardware state
  1066.                     D1=           Save/restore BIOS data state
  1067.                     D2=           Save/restore DAC state
  1068.                     D3=           Save/restore Register state
  1069.                ES:BX=         Pointer to buffer  (if DL <> 00h)
  1070.  
  1071.      Output:   AX   =         VBE Return Status
  1072.                BX   =         Number of 64-byte blocks to hold the state
  1073.                               buffer  (if DL=00h)
  1074.  
  1075.      Note: All other registers are preserved.
  1076.  
  1077.      4.8. Function 05h - Display Window Control
  1078.  
  1079.      This required function sets or gets the position of the specified
  1080.      display window or page in the frame buffer memory by adjusting the
  1081.      necessary hardware paging registers.  To use this function properly,
  1082.      the software should first use VBE Function 01h (Return VBE Mode
  1083.      information) to determine the size, location and granularity of the
  1084.      windows.
  1085.  
  1086.      For performance reasons, it may be more efficient to call this
  1087.      function directly, without incurring the INT 10h overhead.  VBE
  1088.      Function 01h returns the segment:offset of this windowing function
  1089.      that may be called directly for this reason.  Note that a different
  1090.      entry point may be returned based upon the selected mode.  Therefore,
  1091.      it is necessary to retrieve this segment:offset specifically for each
  1092.      desired mode.
  1093.  
  1094.      Input:    AX   = 4F05h   VBE Display Window Control
  1095.                BH   = 00h          Set memory window
  1096.                     = 01h          Get memory window
  1097.                BL   =         Window number
  1098.                     = 00h          Window A
  1099.                     = 01h          Window B
  1100.                DX   =         Window number in video memory in window
  1101.                               granularity units  (Set Memory Window only)
  1102.  
  1103.      Output:   AX   =         VBE Return Status
  1104.                DX   =         Window number in window granularity units
  1105.                                    (Get Memory Window only)
  1106.  
  1107.      Note: In VBE 1.2 implementations, the direct far call version returns
  1108.      no Return Status information to the application. Also, in the far call
  1109.      version, the AX and DX registers will be destroyed. Therefore if AX
  1110.      and/or DX must be preserved, the application must do so prior to
  1111.      making the far call.  The application must still load the input
  1112.      arguments in BH, BL, and DX (for Set Window).  In VBE 2.0
  1113.      implementations, the BIOS will return the correct Return Status, and
  1114.      therefore the application must assume that AX and DX will be
  1115.      destroyed.
  1116.  
  1117.      Application Developer's Note:  This function is not intended for use
  1118.      in a linear frame buffer mode, if this function is requested, the
  1119.      function call will fail with the VBE Completion code AH=03h.
  1120.  
  1121.      VBE BIOS Implementation Note:  If this function is called while in a
  1122.      linear frame buffer memory model, this function must fail with
  1123.      completion code AH=03h.
  1124.  
  1125.      4.9. Function 06h - Set/Get Logical Scan Line Length
  1126.  
  1127.      This required function sets or gets the length of a logical scan line.
  1128.      This allows an application to set up a logical display memory buffer
  1129.      that is wider than the displayed area. VBE Function 07h (Set/Get
  1130.      Display Start) then allows the application to set the starting
  1131.      position that is to be displayed.
  1132.  
  1133.      Input:    AX   = 4F06h   VBE Set/Get Logical Scan Line Length
  1134.                BL   = 00h          Set Scan Line Length in Pixels
  1135.                     = 01h          Get Scan Line Length
  1136.                     = 02h          Set Scan Line Length in Bytes
  1137.                     = 03h          Get Maximum Scan Line Length
  1138.                CX   =         If BL=00h  Desired Width in Pixels
  1139.                               If BL=02h  Desired Width in Bytes
  1140.                               (Ignored for Get Functions)
  1141.  
  1142.      Output:   AX   =         VBE Return Status
  1143.                BX   =         Bytes Per Scan Line
  1144.                CX   =         Actual Pixels Per Scan Line
  1145.                               (truncated to nearest complete pixel)
  1146.                DX   =         Maximum Number of Scan Lines
  1147.  
  1148.      Note: The desired width in pixels or bytes may not be achievable
  1149.      because of hardware considerations.  The next larger value will be
  1150.      selected that will accommodate the desired number of pixels or bytes,
  1151.      and the actual number of pixels will be returned in CX. BX returns a
  1152.      value that when added to a pointer into display memory will point to
  1153.      the next scan line. For example, in VGA mode 13h this would be 320,
  1154.      but in mode 12h this would be 80.  DX returns the number of logical
  1155.      scan lines based upon the new scan line length and the total memory
  1156.      installed and usable in this display mode.
  1157.  
  1158.      Note: This function is also valid in text modes.   In text modes the
  1159.      application should convert the character line length to pixel line
  1160.      length by getting the current character cell width through the
  1161.      XCharSize field returned in ModeInfoBlock, multiplying that times the
  1162.      desired number of characters per line, and passing that value in the
  1163.      CX register.  In addition, this function will only work if the line
  1164.      length is specified in character granularity.  i.e. in 8 dot modes
  1165.      only multiples of 8 will work.  Any value which is not in character
  1166.      granularity will result in a function call failure.
  1167.  
  1168.      Note: On a failure to set scan line length by setting a CX value too
  1169.      large, the function will fail with error code 02h.
  1170.  
  1171.      Note: The value returned when BL=03h is the lesser of either the
  1172.      maximum line length that the hardware can support, or the longest scan
  1173.      line length that would support the number of lines in the current
  1174.      video mode.
  1175.  
  1176.      4.10.     Function 07h - Set/Get Display Start
  1177.  
  1178.      This required function selects the pixel to be displayed in the upper
  1179.      left corner of the display.  This function can be used to pan and
  1180.      scroll around logical screens that are larger than the displayed
  1181.      screen.  This function can also be used to rapidly switch between two
  1182.      different displayed screens for double buffered animation effects.
  1183.  
  1184.      Input:    AX   = 4F07h   VBE Set/Get Display Start Control
  1185.                BH   = 00h          Reserved and must be 00h
  1186.                BL   = 00h          Set Display Start
  1187.                     = 01h          Get Display Start
  1188.                     = 80h          Set Display Start during Vertical
  1189.      Retrace
  1190.                CX   =         First Displayed Pixel In Scan Line
  1191.                               (Set Display Start only)
  1192.                DX   =         First Displayed Scan Line (Set Display Start
  1193.      only)
  1194.  
  1195.      Output:   AX   =         VBE Return Status
  1196.                BH   =         00h Reserved and will be 0 (Get Display Start
  1197.      only)
  1198.                CX   =         First Displayed Pixel In Scan Line (Get Display
  1199.                               Start only)
  1200.                DX   =         First Displayed Scan Line (Get Display
  1201.                               Start only)
  1202.  
  1203.      Note:  This function is also valid in text modes.  To use this
  1204.      function in text mode, the application should convert the character
  1205.      coordinates to pixel coordinates by using XCharSize and YCharSize
  1206.      returned in the ModeInfoBlock.  If the requested Display Start
  1207.      coordinates do not allow for a full page of video memory or the
  1208.      hardware does not support memory wrapping, the Function call should
  1209.      fail and no changes should be made.  As a general case, if a requested
  1210.      Display Start is not available, fail the Function call and make no
  1211.      changes.
  1212.  
  1213.      4.11.     Function 08h - Set/Get DAC Palette Format
  1214.  
  1215.      This required function manipulates the operating mode or format of the
  1216.      DAC palette. Some DACs are configurable to provide 6 bits, 8 bits, or
  1217.      more of color definition per red, green, and blue primary colors.
  1218.      The DAC palette width is assumed to be reset to the standard VGA value
  1219.      of 6 bits per primary color during any mode set
  1220.  
  1221.      Input:    AX   = 4F08h   VBE Set/Get Palette Format
  1222.                BL   = 00h          Set DAC Palette Format
  1223.                     = 01h          Get DAC Palette Format
  1224.                BH   =         Desired bits of color per primary
  1225.                               (Set DAC Palette Format only)
  1226.  
  1227.      Output:   AX   =         VBE Return Status
  1228.                BH   =         Current number of bits of color per primary
  1229.  
  1230.      An application can determine if DAC switching is available by querying
  1231.      Bit D0 of the Capabilities field of the VbeInfoBlock structure
  1232.      returned by VBE Function 00h (Return Controller Information). The
  1233.      application can then attempt to set the DAC palette width to the
  1234.      desired value. If the display controller hardware is not capable of
  1235.      selecting the requested palette width, then the next lower value that
  1236.      the hardware is capable of will be selected. The resulting palette
  1237.      width is returned.
  1238.  
  1239.      This function will return failure code AH=03h if called in a direct
  1240.      color or YUV mode.
  1241.  
  1242.      4.12.     Function 09h - Set/Get Palette Data
  1243.  
  1244.      This required function is very important for RAMDAC's which are larger
  1245.      than a standard VGA RAMDAC.  The standard INT 10h BIOS Palette
  1246.      function calls assume standard VGA ports and VGA palette widths.  This
  1247.      function offers a palette interface that is independent of the VGA
  1248.      assumptions.
  1249.  
  1250.  
  1251.      Input:    AX   = 4F09h   VBE Load/Unload Palette Data
  1252.                BL   = 00h          Set Palette Data
  1253.                     = 01h          Get Palette Data
  1254.                     = 02h          Set Secondary Palette Data
  1255.                     = 03h          Get Secondary Palette Data
  1256.                     = 80h          Set Palette Data during Vertical Retrace
  1257.                                 with Blank Bit on
  1258.                CX   =         Number of palette registers to update
  1259.                DX   =         First palette register to update
  1260.                ES:DI=         Table of palette values (see below for
  1261.      format)
  1262.  
  1263.      Output:   AX   =         VBE Return Status
  1264.  
  1265.      Format of Palette Values:   Alignment byte, Red byte, Green byte, Blue
  1266.      byte
  1267.  
  1268.      Note: The need for BL= 80h is for older style RAMDAC's where
  1269.      programming the RAM values during display time causes a "snow-like"
  1270.      effect on the screen.  Newer style RAMDAC's don't have this limitation
  1271.      and can easily be programmed at any time, but older RAMDAC's require
  1272.      that they be programmed during a non-display time only to stop the
  1273.      snow like effect seen when changing the DAC values.  When this is
  1274.      requested the VBE implementation will program the DAC with blanking
  1275.      on.  Check D2 of the Capabilities field returned by VBE Function 00h
  1276.      to determine if 80h should be used instead of 00h.
  1277.  
  1278.      Note: The need for the secondary palette is for anticipated future
  1279.      palette extensions, if a secondary palette does not exist in a
  1280.      implementation and these calls are made, the VBE implementation will
  1281.      return error code 02h.
  1282.  
  1283.      Note:  When in 6 bit mode, the format of the 6 bits is LSB, this is
  1284.      done for speed reasons, as the application can typically shift the
  1285.      data faster than the BIOS can.
  1286.  
  1287.      Note: All application should assume the DAC is defaulted to 6 bit
  1288.      mode.  The application is responsible for switching the DAC to higher
  1289.      color modes using Function 08h.
  1290.  
  1291.      Note: Query VBE Function 08h to determine the RAMDAC width before
  1292.      loading a new palette.
  1293.  
  1294.      4.13.     Function 0Ah - Return VBE Protected Mode Interface
  1295.  
  1296.      This required function call returns a pointer to a table that contains
  1297.      code for a 32-bit protected mode interface that can either be copied
  1298.      into local 32 bit memory space or can be executed from ROM providing
  1299.      the calling application sets all required selectors and I/O access
  1300.      correctly. This function returns a pointer (in real mode space) with
  1301.      offsets to the code fragments, and additionally returns an offset to a
  1302.      table which contains Non-VGA Port and Memory locations which an
  1303.      Application may have to have I/O access to.
  1304.  
  1305.  
  1306.      Input:    AX   = 4F0Ah   VBE 2.0 Protected Mode Interface
  1307.                BL   = 00h          Return protected mode table
  1308.  
  1309.  
  1310.      Output:   AX   =         Status
  1311.                ES   =         Real Mode Segment of Table
  1312.                DI   =         Offset of Table
  1313.                CX   =         Length of Table including protected mode code
  1314.                               (for copying purposes)
  1315.  
  1316.  
  1317.      The format of the table is as follows:
  1318.  
  1319.           ES:DI + 00h    Word Offset in table of Protected mode code for
  1320.                          Function 5 for Set Window Call
  1321.           ES:DI + 02h    Word Offset in table of Protected mode code for
  1322.                          Function 7 for set Display Start
  1323.           ES:DI + 04h    Word Offset in table of Protected mode code for
  1324.                          Function 9 for set Primary Palette data
  1325.           ES:DI + 06h    Word  Offset in table of Ports and Memory Locations
  1326.                          that the application may need I/O privilege for.
  1327.                          (Optional:  if unsupported this must be 0000h)
  1328.                          (See Sub-table for format)
  1329.           ES:DI + ?      Variable remainder of Table including Code
  1330.  
  1331.  
  1332.      The format of the Sub-Table (Ports and Memory locations)
  1333.  
  1334.           Port, Port, ... , Port, Terminate Port List with FF FF, Memory
  1335.           locations (4 bytes), Length (2 bytes), Terminate Memory List with
  1336.           FF FF.
  1337.  
  1338.      Example 1. For Port/Index combination 3DE/Fh and Memory locations
  1339.      DE800-DEA00h (length = 200h) the table would look like this:
  1340.           DE 03 DF 03 FF FF 00 E8 0D 00 00 02 FF FF
  1341.  
  1342.      Example 2. For only the ports it would look like:
  1343.           DE 03 DF 03 FF FF FF FF
  1344.  
  1345.      Example 3. For only the memory locations it would look like
  1346.           FF FF 00 E8 0D 00 00 02 FF FF
  1347.  
  1348.      Note:. All protected mode functions should end with a near RET (as
  1349.      opposed to FAR RET) to allow the application software to CALL the code
  1350.      from within the ROM.
  1351.  
  1352.      Note:  The Port and Memory location Sub-table does not include the
  1353.      Frame Buffer Memory location.  The Frame Buffer Memory location is
  1354.      contained within the ModeInfoBlock returned by VBE Function 01h.
  1355.  
  1356.      Note:  The protected mode code is assembled for a 32-bit code segment,
  1357.      when copying it, the application must copy the code to a 32-bit code
  1358.      segment.
  1359.  
  1360.      Note:  It is the application's responsibility to ensure that the
  1361.      selectors and segments are set up correctly.
  1362.  
  1363.      Note:  Currently undefined registers may be destroyed with the
  1364.      exception of ESI, EBP, DS and SS.
  1365.  
  1366.  
  1367.      Note:  Refer to Section 4.2 for information on protected mode
  1368.      considerations.
  1369.  
  1370. --------------------------  END OF DOCUMENT --------------------------------
  1371.  
  1372.