TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DANIAL GIBSON
from: JANI SAKSA
date: 1997-04-26 13:26:00
subject: Re: Ega

 -=> Propably Danial Gibson wrote to All <=-
 Hello Danial!
 DG> Hi,
 DG> Anyone know how to put a pixel in EGA (mode 10h) video? I can't seem
 DG> to get the adressing right. Do I have to set pages or something? A
 DG> PutPixel function would be terrific.
 Should be something like this (untested, and translated quickly
 from Pascal to C):
 #define width_in_bytes 40      // For screenwidth of 640 pixels use 80
 void putpixel(int x, int y, int color) {
 char *p;
   p = (far*)0xa0000000 + (x*width_in_bytes) + (x >> 3);
   outp(0x3ce, 8);
   outp(0xecf, 0x80 >> (x & 7));
   outp(0x3ce, 5);
   outp(0x3cf, 2);
   *p = *p;     // This "dummy read" is really needed!
   *p = color;  // Now the actual writing
   outp(0x3ce, 5);      // I believe that following 4 lines are not needed
   outp(0x3cf, 0);
   outp(0x3ce, 8);
   outp(0x3cf, 0xff);
}
 DG> Thanks.
 DG> Danial.
//
// Sir Robin (jsaksa@tiira.cedunet.com)
// http://www.cedunet.com/~jsaksa/
// DooM-page, programming stuff, music page
//
... Mouse.com detected. Run Cat.exe to delete? (Y/n)
--- BBBS/2 v3.33 How-C
---------------
* Origin: Cat-Box - 02-4841086 (2:222/120)

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