TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Sebastien Pujol
from: Kurt Kuzba
date: 1998-07-16 01:03:18
subject: Vesatest.c 1/2

SP>   I would also like to know if there is any reference
SP>   material out there for VESA Video Mode setting.
   Look for PCGPE.ZIP, the PC Game Programmer's Encyclopedia.
/*_|_|   VESATEST.C   ( part 1 of 2 )
_|_|_|   A program to test vesa mode 103 (800x600x256).
_|_|_|   No guarantee or warrantee given or implied.
_|_|_|   PUBLIC DOMAIN   by Kurt Kuzba.  (8/24/1997)*/
#include 
#include 
#include 
typedef struct { int y[2], x[2]; } LineEnds;
void Vmode(int m)
{
   _asm{
      mov ax, m;
      int 10h;
   }
}
void vesamode(int mode)
{
   _asm {
      mov ax, 4F02h;
      mov bx, mode;
      int 10h;
   }
}
void plotdot(int x, int y, int c)
{
   long po, pa, px = (long)x, py = (long)y;
   int o;
   static int a = 0;
   if(x  799 || y  599) return;
   po = pa = (py << 9) + (py << 8) + (py << 5) + px;
   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;
   }
}
void bresenham_circle(int xc, int yc, int r, int c)
{
   int x = 0, d = (1 - r) << 1, w = (800 / 600) << 1;
   while(r >= 0)
   {
      plotdot(xc + x, yc + r, c);
      plotdot(xc + x, yc - r, c);
      plotdot(xc - x, yc + r, c);
      plotdot(xc - x, yc - r, c);
      if(d + r > 0)
         d -= (w * --r) - 1;
      if(x > d)
         d += ((++x) << 1) + 1;
   }
}
void bresenham_disc(int xc, int yc, int r, int c, int hg, int wd)
{
   int l, x = 0, d = (1 - r) << 1, w = (wd / hg) << 1;
   while(r >= 0)
   {
      for(l = xc - x; l <= xc + x; l++)
      {   plotdot(l, yc + r, c);   plotdot(l, yc - r, c);   }
      if(d + r > 0)   d -= (w * --r) - 1;
      if(x > d)       d += ((++x) << 1) + 1;
   }
}
int rnd(int m){return (int)(((long)rand()*((long)m+1)-1)/RAND_MAX);}
/*_|_|   end   VESATEST.C   ( part 1 of 2 )*/

> ] It's around somewhere. I put it where I wouldn't lose it....

---
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)
SEEN-BY: 396/1 622/419 632/371 633/260 267 270 371 634/397 635/506 728
SEEN-BY: 639/252 670/213 218
@PATH: 154/750 222 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.