Spotlight › VESA

A desktop at 1024 by 768

VESA.DRV puts the os8088 desktop on a graphics card's high-resolution screens, up to 1024 by 768 pixels, on any card with a VESA BIOS. The desktop keeps its sixteen colours. A picture viewer can show a photograph in up to 65,536.

largest screen
1024 x 768
colours for a picture
65,536
of a fill spent switching banks
0.2%
PiXEL at 1024x768
The os8088 desktop at 1024 by 768. A PiXEL window nearly fills it, showing a photograph of the Chicago skyline at dusk at twice its size, in smooth blues and oranges. The menu bar runs across the top, the drive icons sit at the right edge and the status bar reads 200% and 256 colors.
PiXEL on a 1024x768 screen with 65,536 colours. The photograph is a 320 by 240 PCX file with its own palette of 256 colours, shown at twice its size. The small preview at the top right is drawn in the desktop's sixteen colours, so both kinds of drawing are in one window. Click for the full-size screen.

What VESA is

A 1989 standard for asking a graphics card for more than VGA offers.

Bigger screens, and no common way to ask for them

IBM's VGA, from 1987, gives a PC a screen of 640 by 480 pixels in 16 colours. The cards that followed it carried more memory and could show 800 by 600, 1024 by 768 and thousands of colours. Every maker switched those screens on in its own way, so a program needed a separate driver for each card.

The Video Electronics Standards Association fixed that in 1989 with the VESA BIOS Extensions, usually shortened to VBE. A card with VBE carries a small program in its own memory chip that answers the same questions on every brand: which screens can you show, how is each one laid out, and switch to this one. The cards that carry it came in 286, 386 and 486 PCs. The emulated cards in QEMU and in 86Box carry it too.

Looking through a 64KB window

os8088 runs the processor the way the original IBM PC did. In that mode the screen's memory is reached through one 64KB opening in the address space. That is enough for VGA's 16-colour screen. It is not enough for a 1024 by 768 screen with two bytes a pixel, which is 1,572,864 bytes.

So the card lets software slide the opening along its memory, one 64KB bank at a time. A row of that screen is 2,048 bytes and fits in one bank. Filling the whole screen moves the opening 24 times. VESA.DRV works out which bank each row lands in and moves the opening only when a row crosses into the next one.

Newer cards can also show the whole screen at a single address above the first megabyte. os8088 does not use that. The original PC's mode cannot reach that address, and the tricks that can need a 386 and stop working every time os8088 switches between tasks.

The 1024x768 desktop
The os8088 desktop at 1024 by 768 in its usual black and white. A Disk window lists all 24 files in the APPS folder of drive B. A Fractal window shows a Mandelbrot set in bright colours. A Calculator and a Note Pad window, reading The same desktop, on a screen of 1024 by 768, sit at the right, with room to spare below them.
The same desktop, with more desk. At this size a folder window shows all 24 files in the apps disk's APPS folder without scrolling, and a Fractal, a Calculator and a Note Pad fit beside it. In a browser window 1,070 pixels wide or more, this picture is shown at its real size.

Sixteen colours, and a picture at full depth

Why the desktop does not change colour, and how a program gets past that.

Every part of os8088 names a colour by a number from 0 to 15. The windows, the menus, the icons and every program written for it do. Allowing more colours there would mean rewriting the drawing code and every program.

So the desktop keeps its sixteen colours on any screen, and the driver translates each one as it draws. On a 256-colour screen the card's first sixteen palette entries are set to the VGA's own colours. On a 65,536-colour screen each of the sixteen becomes the matching 16-bit colour value. White stays white and black stays black.

A program that wants more colour gets one new system call. It hands over pixels already in the screen's own format, and the driver copies them to the screen. PiXEL, os8088's picture viewer, is the first program to use it. On a 65,536-colour screen it draws a picture with every colour the file has. On a 256-colour screen it keeps to the sixteen: the picture's own palette has 256 entries, and the desktop's sixteen leave 240 free.

On the VESA screen
The Chicago skyline at dusk as PiXEL draws it on a 65,536-colour screen: a smooth blue sky shading to orange at the horizon, lit towers and reflections on the river.
CITY.PCX at 65,536 colours. The picture area of PiXEL's window, enlarged two times. It holds 193 different colours, all from the file's own palette.
On the VGA
The same skyline drawn on the 640 by 480 VGA desktop in sixteen colours: the sky is bands of dotted blue and green, and the city is a speckle of orange, red and grey dots.
The same file on the 16-colour VGA. PiXEL mixes dots of the sixteen colours to suggest the ones it cannot show. The same area, enlarged the same way, holds 13 different colours.

On the screen

Where you switch it on, and what programs look like with the room.

Drivers
The Control Panel's Drivers page: USB Mouse, EMS and CD-ROM unticked and Not loaded, and VESA Display ticked and Loaded, about 8K.
One tick on the Drivers page. VESA Display is a driver like the sound or network ones. It is read from the system disk only when it is ticked, and it takes about 8KB of memory while it is loaded.
Display
The Control Panel's Display page listing three choices: Vga 640x480, Cga 640x200 and Vesa 1024x768x16, with the Vesa row selected, a Set Primary button and a Force Color box.
The Display page names the screen in use. The last number is bits per pixel: 16 means 65,536 colours, 8 means 256. Click the Vesa row again while it is selected to step through the screens the card offers.
Solitaire
A Solitaire window with a green table, red hearts and diamonds and a blue card back, opened in the middle of the 1024 by 768 desktop with plenty of empty desktop around it.
Solitaire in colour. Programs ask os8088 for colours by the same sixteen numbers they always used, so the red suits and the blue card back come out as they do on the VGA.
Gorillas
A game of Gorillas in a window at the top left of the 1024 by 768 desktop: two gorillas on coloured buildings under a blue sky and a smiling sun, with the angle, velocity, score and wind across the top.
Gorillas in a window. Taken past its setup questions into a game. The rest of the screen stays free for other windows.

How it works

A driver file does the drawing; the system itself barely changes.

The driver

One check per drawing routine

Each of os8088's drawing routines starts by checking one byte: is the VESA display in use? If not, it carries on as before. If it is, it hands the work to VESA.DRV, which draws the same rectangle, letter or icon in the card's format.

Everything that knows what VBE is lives in that one file. The system carries 942 bytes for it, measured when the feature was built. The small system for 128KB machines carries none of it.

Choosing a screen

The biggest screen the card has

When it loads, the driver asks the card for its list of screens. It keeps up to 16: 640 to 1024 pixels wide, 400 to 768 tall, at 256 or 65,536 colours. It needs VBE version 1.2 or later. A card older than that is refused and the desktop stays as it was.

By default it takes the largest screen, and the one with more colours when two are the same size. On QEMU that is 1024 by 768 at 65,536 colours. A screen you chose is kept. If the disk is moved to a card without that screen, the driver takes the largest one instead.

The pointer

Drawn from the mouse itself

The arrow is redrawn every time the mouse reports a movement, in the middle of whatever else the machine is doing. At 65,536 colours the patch of screen saved under it is 512 bytes, against 192 on the VGA, so the driver keeps that patch itself.

Moving the arrow into the next bank means calling the card's BIOS. That call needs more room on the mouse handler's private stack, which grew from 128 bytes to 256.

Where the time goes

Measured on 86Box's emulated 486DX2 at 66 MHz with a Cirrus Logic CL-GD5428 card, at 1024 by 768 and 65,536 colours. One bank switch through the BIOS takes 7.0 microseconds. Filling an area 624 by 200 pixels takes 23.3 ms and crosses seven banks, so the switching is 0.2% of the time. The rest is the card's bus taking 10.7MB a second.

A picture handed over in the screen's own format draws 5.3 times faster than the same picture in sixteen colours, which has to be unpacked a pixel at a time. A row of 78 characters of text takes 5.5 ms. These are the emulator's figures for that machine; no real card has been measured yet.

What it does not do

Some of these are choices, and some are things nobody has been able to test yet.

  • No 24-bit or 32-bit colour. A three- or four-byte pixel would make a full 1024 by 768 screen 3MB to move through a 64KB opening. The driver offers 256 and 65,536 colours only.
  • Nothing above 1024 by 768.
  • Hibernate is greyed while the desktop is on the VESA screen. The menu item reads Hibernate (VESA). A saved image would wake into a display that might have no driver to draw it.
  • No two-monitor desktop with it. Extending the desktop onto a second card is refused while the VESA screen is the main one.
  • Not for an IBM PC or XT. The driver is written for the same 8086 processor as the rest of os8088, but VESA cards came with later machines, and the XT-class machines os8088 is tested on have none. The small system for 128KB machines does not include it.
  • No real card has been tried. It has run on QEMU's emulated card and on 86Box's emulated Cirrus Logic card. A real card, and a card with a 15-bit colour screen, would be the first of each.

Full-screen programs still work. A game that switches the card into one of the VGA's own modes, such as Gorillas in full screen, comes back to the VESA desktop when it leaves full screen. The contract for all of this is section 120 of the os8088 specification.

Try it yourself

QEMU's standard graphics card has a VESA BIOS, so any os8088 system disk will do.

  1. Boot os8088 in QEMU with the system disk and the apps disk from a release. QEMU's default graphics card is the one you want:

    qemu-system-i386 -machine pc,vmport=off \
      -drive file=os8088.img,format=raw,if=floppy -boot a \
      -drive file=apps.img,format=raw,if=floppy,index=1 \
      -chardev msmouse,id=m0 -serial chardev:m0
  2. Open the Control Panel from the menu under the chip logo, choose Drivers, scroll down the list and tick VESA Display. The desktop moves to the largest screen the card offers, and does so at every start while the tick is set.

  3. Choose a different screen on the Display page if you want one. Click the Vesa row while it is selected to step through the screens, then press Set Primary. The choice is kept.

  4. Open a picture in PiXEL on a screen ending in x16 to see it at full colour.

Building from source? make 486-vesa-desk starts 86Box's 486 with the Cirrus Logic card on the VESA desktop, and make vesatest builds the disks the screenshots on this page were taken from.