TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: KARL CASAVANT
from: KURT KUZBA
date: 1998-05-13 06:41:00
subject: Mode12h.CPP 2/4

 /*_|_|   MODE12H.CPP   PUBLIC DOMAIN   ( part 2 of 4 )
 _|_|_|   Simple demonstration of pixel manipulation
 _|_|_|   in 640x480x16 video mode 12h.
 _|_|_|   Kurt Kuzba   (5/13/1998)*/
void Mode12h::PutPixel(int y, int x, int color)
{
   unsigned char far *V = (unsigned char far*)0xa0000000l;
   int bit = g_iPix[y & 7], bitmask = g_iPox[y & 7];
   V += ((x * 80) + y / 8);
   if(y = 640 || x >= 480)
      return;
   _asm {
      mov dx, 3ceh
      mov al, 04h
      out dx, al
      mov dx, 3c4h
      mov al, 02h
      out dx, al
      mov dx, 3cfh
      mov al, 00h
      out dx, al
      mov dx, 3c5h
      mov al, 01h
      out dx, al
   }
   if(color & 1)
   {
      *V |= bit;
   }
   else
      *V &= bitmask;
   _asm {
      mov dx, 3cfh
      mov al, 01h
      out dx, al
      mov dx, 3c5h
      mov al, 02h
      out dx, al
   }
   if(color & 2)
   {
      *V |= bit;
   }
   else
      *V &= bitmask;
   _asm {
      mov dx, 3cfh
      mov al, 02h
      out dx, al
      mov dx, 3c5h
      mov al, 04h
      out dx, al
   }
   if(color & 4)
   {
      *V |= bit;
   }
   else
      *V &= bitmask;
   _asm {
      mov dx, 3cfh
      mov al, 03h
      out dx, al
      mov dx, 3c5h
      mov al, 08h
      out dx, al
   }
   if(color & 8)
   {
      *V |= bit;
   }
   else
      *V &= bitmask;
}
 /*_|_|   end   MODE12H.CPP   PUBLIC DOMAIN   ( part 2 of 4 )*/
> ] Within every pearl there lies a tiny grain of truth.........
---
---------------
* 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™.