www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/09/10:56:57

Date: Sun, 9 Jun 1996 17:41:46 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Chris Grubb <Cgrubb AT mail DOT tds DOT net>
Cc: djgpp AT delorie DOT com
Subject: Re: newbie djgpp putpixel ques.
In-Reply-To: <31BA4381.7C6E@ccm.tdsnet.com>
Message-Id: <Pine.SUN.3.91.960609173839.342c-100000@is>
Mime-Version: 1.0

On Sat, 8 Jun 1996, Chris Grubb wrote:

> I'm new to djgpp, and c in general..but I'm learning..can someone please point out to me what's wrong 
> with this putpixel routine..when I try to run it, I get a page fault..here's the code

Please download the file v2/faq200b.zip and read the DJGPP FAQ list, 
especially since you are a newcomer to DJGPP.  Sections 10.1 and 18.4 
there explain how to access the video memory under DJGPP.  Specifically, 
the code below is your problem:

> void put_pixel(int color, int x, int y)
> {
> long *base_address = 0xA0000;
> long *memory_address = 0;
> 
> 	memory_address = base_address + (320 * y) + x;	
> 	*(memory_address) = color;
> }

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019