delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/28/23:02:52

From: "Steve Patton" <leaphe AT pemail DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie Needs Help
Date: 28 Nov 1997 18:22:15 GMT
Organization: AT&T WorldNet Services
Lines: 44
Message-ID: <65n24n$q6h@bgtnsc03.worldnet.att.net>
References: <19971129 DOT 101142 DOT 16006 DOT 1 DOT matthew DOT krause AT juno DOT com>
NNTP-Posting-Host: 12.67.2.170
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> Sorry to ask such an obvious question, but I've new to C/DJGPP and just
> starting graphics work. But, Anyway does anyone know how to :
> 1 .Switch from text to graphics mode using DJGPP
> 2. Change a single pixel from "OFF" to "ON"
> Thanks in advance


To switch from text to graphics mode.  I'm assuming you're meaning VGA
320x200x256

__dpmi_regs r;

r.ax = 0x0013;

__dpmi_int ( 0x10, &r );

// if you get an error, you are either missing a header file, or there is
one too many, or too little _ , you can
// look it up in LIBC.INF out of C:/DJGPP/INFO directory to make sure.


To place a single pixel ( in that same mode)

int x, y, c;

x = 3;       // x
y = 5;      // y
c = 15;   // color value

_farpokeb ( _dos_ds, 0xA0000 + x + (y*320), c );


That requires an odd header file, it might be <sys\farptr.h>, but you
should look it up in LIBC.INF as well.  That's the second fastest way I
know how to.  (The fastest way I know how, requires disabling protected
memory, and is more complicated to get started)

Hope that helps!  But I recommend you do try getting the Allegro library. 
It has many of the functions and more, and is pretty fast for a library. 
Here's the address to Allegro home page

http://www.talula.demon.co.uk/allegro/

-Steve

- Raw text -


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