From: Stephen Liu Newsgroups: comp.os.msdos.djgpp Subject: Writing directly to vga memory in DJGPP Date: Thu, 27 Feb 1997 21:59:28 -0500 Organization: Kadoorie Corp. Lines: 39 Message-ID: <33164A10.1D88@bigfoot.com> NNTP-Posting-Host: 128.226.101.87 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp The following program clears the screen in VGA mode (13h) in each of the 255 colors. My buffer is declared as: unsigned char *vidbuffer=(unsigned char *)0xA0000; Is this correct? When I run it under Win95, it creates a memory exception and quits the program. //******************************************************************* #include #include unsigned char *vidbuffer=(unsigned char *)0xA0000; void setmode(int mode) { union REGS regs; regs.h.al = mode; regs.h.ah = 0; int86(0x10, ®s, ®s); } void clrvidbuffer(unsigned char color) { int i; for (i=0; i<32000; i++) { vidbuffer[i]=color; // Write pixel to buffer } } void main() { int i; setmode(0x13); // Set VGA mode for (i=0; i<256; i++) clrvidbuffer(i); // Clear the screen in each color } //*******************************************************************