TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JABO
from: KURT KUZBA
date: 1998-03-15 13:42:00
subject: VESATEST.CPP 1/3

   This program requires a VESA compatible video card, or that
   you have installed a VESA standard video driver on your
   system. The elipses aren't right, unfortunately, and I
   haven't taken the time to find out why as of yet.
   The drawing routines could be faster, but the Dot
   function was called in order to illustrate plotting a pixel
   in these modes, which will be necessary if you want to draw
   any sort of .GIF or .PCX or anything in the given modes.
/*_|_|   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   */
> ] I am Borgs Bunny. What's assimilated, Doc?..................
---
---------------
* Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

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