GO> activate 256 colors?
C++ code for activating VESA modes 101h and 103h in Borland.
This is not optimized for speed. It is set out as an example
of the general method for using these modes.
I don't know about 1024x1024x16M, having never attempted it,
but if you have a list of VESA modes, you could add it.
Handling the pixels would not be as simple as with 256 colors,
of course, but a 24-bit color depth would be 3 bytes per pixel.
Unless you want to use photographic quality graphics, 256
colors should be all that you need, really. Try the PC Game
Programmer's Encyclopedia. [ PCGPE ]
/*_|_| VESATEST.CPP PUBLIC DOMAIN PART 1 OF 3
_|_|_| Example of using 800x600 and 640x480 VESA modes.
_|_|_| No warrantee or guarantee. Kurt Kuzba. (8/24/1997)*/
#include
#include
#include
#include
class Vesamodes {
public:
Vesamodes(int);
~Vesamodes(void);
void Dot(int, int, int);
void Line(int, int, int, int, int);
void Circle(int, int, int, int, int, int, int);
private:
void Disk(int, int, int r, int c, int hg, int wd);
int High, Wide, Color;
};
Vesamodes::Vesamodes(int mode = 0)
{
switch(mode)
{
case 800: High = 600; Wide = 800; mode = 0x103; break;
default: High = 480; Wide = 640; mode = 0x101; break;
}
Color = 7;
_asm {
mov ax, 4F02h;
mov bx, mode;
int 10h;
}
}
void Vesamodes::Dot(int x, int y, int c)
{
long po, pa, px = (long)x, py = (long)y;
int o;
static int a = 0;
if(x = Wide || y = High) return;
switch(Wide)
{
case 800: po = pa = (py << 9) + (py << 8) + (py << 5) + px;
break;
default: po = pa = (py << 9) + (py << 7) + px; break;
}
po &= 0xffffL;
pa /= 0x10000L;
o = (int)po;
if(a != (int)pa)
{
a = (int)pa;
_asm {
mov ax, 4F05h;
xor bx, bx;
mov dx, a;
int 10h;
}
}
_asm{
mov ax, 0A000h;
mov di, o;
mov es, ax;
mov ax, c;
stosb;
}
}
/*_|_| end VESATEST.CPP PUBLIC DOMAIN PART 1 OF 3 */
> ] God's side of the tire is Never Flat........................
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
|