# 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.

TODO: at this point, only VESA2 is supported.

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.

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.

## Example initialization

  needs io/screen drv/pc/vga drv/pc/vesa
  vesascreen to screen
  :realias graphicsmode $111 vesamode ; \ 640x480x16
  :realias consolemode deactivatevesa ;
  :quithook consolemode ;

## API

### Constants

vesascreen
  A [io/screen] struct that is updated with correct metadata on "vesamode".

### Words

.vesa ( -- )
  Print general information about VESA support.

.vesamodes ( -- )
  List all available VESA modes.

vesamode ( mode -- )
  Put the screen in VESA mode. "mode" is a VESA mode ID, as listed in
  .vesamodes. Safe bets are $111 (640x480x16) or $112 (640x480x24) present on
  a vast majority of VESA cards.

deactivatevesa ( -- )
  If VESA is activated, call "vgatextmode" from [drv/pc/vga]. Otherwise, do
  nothing.