vga_setmodeSection: Svgalib User Manual (3)Updated: 28 Jul 1999 |
vga_setmodeSection: Svgalib User Manual (3)Updated: 28 Jul 1999 |
#include <vga.h>
int vga_setmode(int mode);
vga_setmode() returns 0 on success and -1 if this mode is not available.
From svgalib-1.4.1, if mode is -1 then vga_setmode() returns the current svgalib version, in BCD format, so svgalib 1.4.1 returns 0x1410.
mode should be one of the following, predefined values, or generally a value in range 1 <= mode <= vga_lastmodenumber() where vga_modeinfo(3) returned details about this mode. Instead of trying to set the mode, vga_hasmode(3) determines if the mode would actually be supported. It is also possible to use the numeric values given below though this is discouraged. They are commonly used as values for the SVGALIB_DEFAULT_MODE environment variable to set the vga_getdefaultmode(3).
Here are the predefined values for mode.
Memory layout for the VGA modes is weird. Too weird to be explained here, but you can check the usual VGA literature. vga_setmodeX(3) has a short explanation which is valid for all 256 color modes.
G320x200x16(1), G640x200x16(2), G640x350x16(3), G640x480x16(4), G320x200x256(5), G320x240x256(6), G320x400x256(7), G360x480x256(8), and G640x480x2(9)
G640x480x256(10), G800x600x256(11), G1024x768x256(12), and G1280x1024x256(13)
For the 16M modes, from low to high addresses the 3 bytes are named BGR and specify the blue, green, red parts of the pixel value.
G320x200x32K(14), G320x200x64K(15), G320x200x16M(16), G640x480x32K(17), G640x480x64K(18), G640x480x16M(19), G800x600x32K(20), G800x600x64K(21), G800x600x16M(22), G1024x768x32K(23), G1024x768x64K(24), G1024x768x16M(25), G1280x1024x32K(26), G1280x1024x64K(27), and G1280x1024x16M(28)
G800x600x16(29), G1024x768x16(30), and G1280x1024x16(31)
G720x348x2(32)
This eases pixel address calculations on the screen and drawing operations. However, 1/3 more data has to be moved to the screen. Experiments show that usually the higher memory bandwidth used outweighs the effects of the simplified algorithms by far.
G320x200x16M32(33), G640x480x16M32(34), G800x600x16M32(35), G1024x768x16M32(36), and G1280x1024x16M32(37)
G1152x864x16(38), G1152x864x256(39), G1152x864x32K(40), G1152x864x64K(41), G1152x864x16M(42), G1152x864x16M32(43), G1600x1200x16(44), G1600x1200x256(45), G1600x1200x32K(46), G1600x1200x64K(47), G1600x1200x16M(48), and G1600x1200x16M32(49)
The vgatest(6) produces a list of supported modes for your hardware, prints some info on the modes and allows you to try each of them.
svgalib(7), vgagl(7), libvga.config(5), vgatest(6), vga_hasmode(3), vga_init(3), vga_modeinfo(3), vga_getcurrentmode(3), vga_getdefaultmode(3), vga_lastmodenumber(3), vga_getmodename(3), vga_getmodenumber(3)
This manual page was edited by Michael Weller <eowmob@exp-math.uni-essen.de>. The exact source of the referenced function as well as of the original documentation is unknown.
It is very likely that both are at least to some extent are due to Harm Hanemaayer <H.Hanemaayer@inter.nl.net>.
Occasionally this might be wrong. I hereby asked to be excused by the original author and will happily accept any additions or corrections to this first version of the svgalib manual.