Industrial Training




JPEG Display Process page-1



VESA Programming

An uncompressed JPEG file is represented as a 24 bit per pixel full color image .In order to represent this on the screen , a SVGA (Super Video Graphics Array ) adapter card with VESA ( Video Electronics Standards Association ) compatibility must be used.


Introduction to VESA programming



Purpose

To build a module in ‘C’ to display 24 bit image , module acts as an interface between Super VGA video adapters and application program.


Summary

The VBE (VESA Bios Extensions) standard provides a set of functions which an application program can use:


◙ To obtain information about the capabilities and characteristics of a specific


Super VGA.

◙ To control the operation of such hardware in terms of video mode, initialization, and video memory access.

The functions are provided as an extension to the VGA BIOS video services, accessed through interrupt 10h( hexadecimal ).


Introduction

This document contains a specification for a standardized interface to extended VGA video modes and functions. The specification consists of mechanisms for supporting standard extended video modes and functions that have been approved by the main VESA committee and non-standard video modes that an individual VGA supplier may choose to add, in a uniform manner that application software can utilize without having to understand the intricate details of the particular VGA hardware.


The primary topics of this specification are definitions of extended VGA video modes and the functions necessary for application software to understand the characteristics of the video mode and manipulate the extended memory associated with the video mode. Readers of this document should already be familiar with programming VGAs at the hardware level. Readers who are unfamiliar with programming the VGA should first read one of the many VGA programming tutorials before attempting to understand these extensions to the standard VGA .


Goals and Objectives

The IBM VGA has become a standard in the PC graphics world. A multitude of different VGA offerings exist in the marketplace, each one providing BIOS or register compatibility with the IBM VGA. More and more of these VGA compatible products implements various supersets of the VGA standard. These extensions range from higher resolutions and more colors to improved performance and even some graphics processing capabilities. Intense competition has dramatically improved the price/performance ratio, to the benefit of the end user.


However, several serious problems face a software developer who intends to take advantage of these "Super VGA" environments. Because there is no standard hardware implementation, the developer is faced with widely disparate Super VGA hardware architectures. Lacking a common software interface, designing applications for these environments is costly and technically difficult. Except for applications supported by OEM-specific display drivers, very few software packages can take advantage of the power and capabilities of Super VGA products.


The purpose of the VESA VGA BIOS Extension is to remedy this situation. Being a common software interface to Super VGA graphics products, the primary objective is to enable application and system software to adapt to and exploit the wide range of features available in these VGA extensions.


Specifically, the VESA BIOS Extension attempts to address the following issues:


◙ Return information about the video environment to the application


◙ Assist the application in initializing and programming the hardware


Video Environment Information

Today, an application has no standard mechanism to determine what Super VGA hardware it is running on. Only by knowing OEM-specific features can an application determine the presence of a particular video board. This often involves reading and testing registers located at I/O addresses unique to each OEM. By not knowing what hardware an application is running on, few, if any, of the extended features of the underlying hardware can be used.


The VESA BIOS Extension provides several functions to return information about the video environment. These functions return system level information as well as video mode specific details. Function 00h returns general system level information, including an OEM identification string. The function also returns a pointer to the supported video modes. Function 01h may be used by the application to obtain information about each supported video mode. Function 03h returns the current video mode.


Programming Support

Due to the fact that different Super VGA products have different hardware implementations, application software has great difficulty in adapting to each environment. However, since each is based on the VGA hardware architecture, differences are most common in video mode initialization and memory mapping. The rest of the architecture is usually kept intact, including I/O mapped registers, video buffer location in the CPU address space, DAC location and function, etc.


The VESA BIOS Extension provides several functions to interface to the different Super VGA hardware implementations. The most important of these is Function 02h, Set Super VGA video mode. This function isolates the application from the tedious and complicated task of setting up a video mode. Function 05h provides an interface to the underlying memory mapping hardware. Function 04h enables an application to save and restore a Super VGA state without knowing anything of the specific implementation.

Compatibility

A primary design objective of the VESA BIOS Extension is to preserve maximum compatibility to the standard VGA environment. In no way should the BIOS extensions compromise compatibility or performance. Another but related concern is to minimize the changes necessary to an existing VGA BIOS. Ram, as well as ROM-based implementations of the BIOS extension should be possible.


Scope of VBE Standard

The purpose of the VESA BIOS Extension is to provide support for extended VGA environments. Thus, the underlying hardware architecture is assumed to be a VGA. Graphics software that drives a Super VGA board will perform its graphics output in generally the same way it drives a standard VGA, i.e. writing directly to a VGA style frame buffer, manipulating graphics controller registers, directly programming the palette, etc. No significant graphics processing will be done in hardware. For this reason, the VESA BIOS Extension does not provide any graphics output functions, such as BitBlt, line or circle drawing, etc.


An important constraint of the functionalities that can be placed into the VESA BIOS Extension is that ROM space is severely limited in certain existing BIOS implementations.

Outside the scope of this VESA BIOS Extension is the handling of different monitors and monitor timings. Such items are dealt with in other VESA fora. The purpose of the VESA BIOS Extension is to provide a standardized software interface to Super VGA graphics modes, independent of monitor and monitor timing issues.

Standard VGA BIOS

A primary design goal with the VESA BIOS Extension is to minimize the effects on the standard VGA BIOS. Standard VGA BIOS functions should need to be modified as little as possible. This is important since ROM, as well as RAM based versions of the extensions, may be implemented.


However, two standard VGA BIOS functions are affected by the VESA extension. These are Function 00h (Set video mode) and Function 0Fh (Read current video state). VESA-aware applications will not set the video mode using VGA BIOS function 00h. Nor will such applications use VGA BIOS function 0Fh. VESA BIOS functions 02h (Set Super VGA mode) and 03h (Get Super VGA mode) will be used instead.


To make such applications work, VESA recommends that whatever value returned by VGA BIOS function 0Fh (it is up to the OEM to define this number) should be used to reinitialize the video mode through VGA BIOS function 00h. Thus, the BIOS should keep track of the last Super VGA mode in effect.

It is recommended, but not mandatory, to support output functions (such as TTY-output, scroll, set pixel, etc.) in Super VGA modes. If the BIOS extension doesn't support such output functions, bit D2 (Output functions supported) of the ModeAttributes field (returned by VESA BIOS function 01h) should be clear.


VBE Function Reference

The common subfunctions available are listed below

0 Get SVGA general information

1 Get SVGA mode information

2 Set SVGA video mode

3 Get current SVGA video mode

4 Get save state buffer size (DL = 0)

Save the SVGA state (DL = 1)

Restore the SVGA state (DL = 2)

5 Set SVGA memory window position (BH = 0)

Get SVAG memory window position (BH = 1)

6 Set logical scan line length (BL = 0)

Get logical scan line length (BL = 1)

7 Set logical display start (BL = 0)

Get logical display start (BL = 1)


Super VGA Mode Numbers

Standard VGA mode numbers are 7 bits wide and presently range from 00h to 13h. OEMs have defined extended video modes in the range 14h to 7Fh. Values in the range 80h to FFh cannot be used, since VGA BIOS function 00h (Set video mode) interprets bit 7 as a flag to clear/not clear video memory.


Due to the limitations of 7 bit mode numbers, VESA video mode numbers are 15 bits wide. To initialize a Super VGA mode, its number is passed in the BX register to VESA BIOS function 02h (Set Super VGA mode).

The format of VESA mode numbers is as follows:

D0-D8 = Mode number

If D8 == 0, this is not a VESA defined mode

If D8 == 1, this is a VESA defined mode

D9-D14 = Reserved by VESA for future expansion (= 0)

D15 = Reserved (= 0)


Thus, VESA mode numbers begin at 100h. This mode numbering scheme implements standard VGA mode numbers as well as OEM-defined mode numbers as subsets of the VESA mode number. That means that regular VGA modes may be initialized through VESA BIOS function 02h (Set Super VGA mode), simply by placing the mode number in BL and clearing the upper byte (BH). OEM-defined modes may be initialized in the same way.


To date, VESA has defined a 7-bit video mode number, 6Ah, for the 800x600, 16-color, 4-plane graphics mode. The corresponding 15-bit mode number for this mode is 102h.


The following VESA mode numbers have been defined:

GRAPHICS Modes list

Mode Resolution Color Depth

number

100h 640x400 256

101h 640x480 256

102h 800x600 16

103h 800x600 256

104h 1024x768 16

105h 1024x768 256

106h 1280x1024 16

107h 1280x1024 256

10Dh 320x200 32K (1:5:5:5)

10Eh 320x200 64K (5:6:5)

10Fh 320x200 16.8M (8:8:8) *

110h 640x480 32K (1:5:5:5)

111h 640x480 64K (5:6:5)

112h 640x480 16.8M (8:8:8) * ( 24 bit mode )

113h 800x600 32K (1:5:5:5)

114h 800x600 64K (5:6:5)

115h 800x600 16.8M (8:8:8) * ( 24 bit mode )

116h 1024x768 32K (1:5:5:5)

117h 1024x768 64K (5:6:5)

118h 1024x768 16.8M (8:8:8) * ( 24 bit mode )

119h 1280x1024 32K (1:5:5:5)

11Ah 1280x1024 64K (5:6:5)

11Bh 1280x1024 16.8M (8:8:8) * ( 24 bit mode )

11Ch 1600x1200 256

11Dh 1600x1200 32K (1:5:5:5) (Unverified)

11Eh 1600x1200 64K (5:6:5) (Unverified)



Hi I am Pluto.