www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/09/04:18:02

Xref: news2.mv.net comp.os.msdos.djgpp:4736
From: Chris Grubb <Cgrubb AT ccm DOT tdsnet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: newbie djgpp putpixel ques.
Date: Sat, 08 Jun 1996 23:22:41 -0400
Organization: TDS TELECOM - Madison, WI
Lines: 37
Message-ID: <31BA4381.7C6E@ccm.tdsnet.com>
NNTP-Posting-Host: aumi0-a08.ccm.tds.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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


void set_mode_13h(void);
void set_mode_03h(void);
void put_pixel(int color, int x, int y);

void main( void )
{
	set_mode_13h();
	put_pixel(200,1,1);
	getkey();
	set_mode_03h();
}

void set_mode_13h(void) {
	asm("movw $0x13,%ax
		int $0x10
		");	
		
}
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;
}
void set_mode_03h(void) {
	asm("movw $0x03,%ax
		int $0x10
		");		
}

thanks for any help

- Raw text -


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