# VESA

VESA is the Video Electronics Standard Association and they created VBE, the
VESA BIOS Extension standard. VESA 1.2 was released in 1991 and is the version
that really caught on, so that's our baseline. VESA is much easier to work with
than VGA, so that's why we prefer it.

The driver lives in drv/pc/vesa.fs

After you've loaded it, you can get general VESA information with ".vesa" and
you can list available modes with ".vesamodes". The output is
"<id> width/height/bpp". A "*" at the end indicates that this mode is a "linear"
mode.

There's a big difference between VESA 1.2 and VESA 2.0: the presence of linear
buffer modes. A "regular" mode requires bank switching to access the totality of
the memory for that mode, which comes in 64K banks. It's a hassle to manage.
Linear modes provide a contiguous memory area, which is much nicer. When
available, you always want linear mode, it's much faster.

TODO: in fact, at this time, only linear mode is supported. bank switching
support incoming...

This driver provides a struct which you can instantiate and plug into the
"screen" global variable from [io/screen]. Example:

  needs drv/pc/vesa
  newvesascreen to screen
  screen activate

The driver also has the "vesamode" variable, which defaults to $112
(640x480x24), indicating which mode ID will be used on "screen activate".

Because the VESA mode and VGA text mode are mutually exclusive, unless you set
up a FB grid [io/fbgrid], you'll have to switch between those modes. You can do
so with "activate" or "activate1.2" and "deactivate".

## API

newvesascreen ( -- screen )
  Create a new VESA 2 screen struct.

activate ( screen -- )
  Put the screen in VESA2 mode. This is likely the word you'll want to use.

activate1.2 ( screen -- )
  Put the screen in a VESA 1.2 compatible non-linear mode. You'll only need this
  on very old hardware.

deactivate ( screen -- )
  Put the screen in VGA text mode.

activated? ( screen -- )
  Yields whether "screen" is currently in VESA mode.
