

The bit depth needs to be one of the following: The Y resolution can be any number from 1 to maximum in both Bochs and QEMU. In QEMU the X resolution must be divisible by 8. It seems that both Bochs and QEMU can use about any resolutions with a few restrictions. Since the BGA is not real hardware, X and Y resolutions can be set at will up to a maximum horizontal resolution (depending on your version of Bochs) of either 1024 or 1600 (VBE_DISPI_MAX_XRES) and a maximum vertical resolution of either 768 or 1200 (VBE_DISPI_MAX_YRES). To do so, disable the VBE extensions (see above), write the X resolution, Y resolution and BPP to their respective registers (VBE_DISPI_INDEX_XRES (1), VBE_DISPI_INDEX_YRES (2) and VBE_DISPI_INDEX_BPP (3)) and enable the VBE extensions. Most likely, setting the display resolution and bit depth is all you need. If done from an application (or your OS), this will break compatibility with the Bochs VBE BIOS, which expects the latest version. This is used by the Bochs VGA BIOS to ensure it is run with the right version of Bochs. If succesful, reading the register again will return the value just set. If for some reason you want Bochs to emulate an older version of the BGA, you can write the desired version to VBE_DISPI_INDEX_ID (0). If it returns a value of 0xB0C0 through 0xB0C3, you have an old version of Bochs and/or the Bochs VGA BIOS. If it equals VBE_DISPI_ID5 (0xB0C5) the latest version of the BGA is present. To check whether the BGA is available, read the value from VBE_DISPI_INDEX_ID (0).

The value returned depends on the specific register that is queried. To read a register, first write the index value to VBE_DISPI_IOPORT_INDEX (0x01CE), then read the 16-bit value from VBE_DISPI_IOPORT_DATA (0x01CF). To do so, write the value VBE_DISPI_ENABLED (0x01) to the same register (see also note below on enabling the LFB). The changes are not visible until the VBE extensions are enabled again. To do so, write the value VBE_DISPI_DISABLED (0x00) to VBE_DISPI_INDEX_ENABLE (4). In order to change the contents of registers 1-3 (VBE_DISPI_INDEX_XRES, VBE_DISPI_INDEX_YRES, VBE_DISPI_INDEX_BPP) the VBE extensions must be disabled first. The BGA supports 10 different index values (0 through 9): To write an index/data pair to one of the BGA registers, first write its index value to the 16-bit IO-port VBE_DISPI_IOPORT_INDEX (0x01CE), followed by writing the data value to the 16-bit IO-port VBE_DISPI_IOPORT_DATA (0x01CF). 0xB0C3 - support for getting capabilities, support for using 8 bit DAC.0xB0C2 - 15, 16, 24 and 32 BPP modes, support for linear frame buffer, support for retaining memory contents on mode switching.0xB0C1 - virtual width and height, X and Y offset.0xB0C0 - setting X and Y resolution and bit depth (8 BPP only), banked mode.Six versions of the BGA have existed, of which 0xB0C5 is the current version (as of 2009, Bochs version 2.4). They are used in the sections below, with their numerical value between parentheses.Īs Bochs has evolved, so has the BGA. The names of these defines all start with VBE_DISPI. The Bochs sources define in vga.h, located in the subdirectory iodev/, a number of defines that are useful for programming the BGA. QEMU (with the -std-vga command line argument) also uses the latest version. There are six versions of the BGA (0xB0C0 through 0xB0C5), but if you use the latest version of Bochs you only need to concern yourself with the latest one (0xB0C5). Via these ports it is possible to enable or disable the VBE extensions, change the screen resolution and bit depth, and manage a larger virtual screen. The first one is an index port, the second one a data port (comparable to how the VGA handles its sets of registers). The Bochs emulated graphics hardware (henceforth called BGA for Bochs Graphics Adaptor) is accessed via two 16-bit IO-ports. 3.4 Setting display resolution and bit depth.
