www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/14/01:23:25

Xref: news-dnh.mv.net comp.os.msdos.djgpp:3207
Path: news-dnh.mv.net!mv!news.sprintlink.net!news.inc.net!news.sol.net!spool.mu.edu!usenet.eel.ufl.edu!gatech2!ncar!elroy.jpl.nasa.gov!swrinde!newsfeed.internetmci.com!news.zynet.com!fg1.plk.af.mil!lynx.unm.edu!bubba.NMSU.Edu!paris!jshagam
From: Quantum Porcupine <jshagam AT nmsu DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Graphics.h weirdnesses
Date: Mon, 13 Nov 1995 19:08:56 -0700
Organization: New Mexico State University
Lines: 62
Nntp-Posting-Host: paris.nmsu.edu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

SOrry if this is FAQ, BUT...  FOr some reason, graphics.h doesn't work 
properly for me, no matter what gfx mode I use.  It does some really 
weird bitplaning stuff where doing something like GrSetPixel(x, y, c) 
doesn't put a pixel at x, y with color c, but a group of 16 pixels at 
x*16, y with a bitpattern matching c with color 4 or something odd.  I've 
never gotten a program compiled by DJGPP to work properly with graphics, 
and I'm new to protected mode under DOS (although I know C, GCC, etc. 
fine from UNIX).  I'd really like to take the protected-mode plunge, and 
until I want to spend $100 for Watcom I'd rather just learn using DJGPP.

In any case,here's the code for the program in question:

#include <stdio.h>
#include <graphics.h>

int main(void) {
  int x, y;

  GrSetMode (GR_320_200_graphics);
  for (x=0; x <= 15; x++)
    for (y=0; y <= 199; y++)
      GrSetPixel (x, y, y);

  scanf ("\n");
  GrSetMode (GR_default_graphics);

  return 0;
}

I use the 320x200 mode because for now I just want to work in mode13h.  
From what I could decode of the various graphics library sources, the 
various graphics modes just select a BIOS graphics mode and starts it up 
with Int10h, and the setpixel just writes to the screen buffer at 
0xD0000000.  Oh, and the 0xD0000000 bit leaves me a bit confused as well, 
because I thought that video memory would start at 0xA0000 (with FOUR 
zeros :).  Please correct me if I'm wrong however... Until now, all my 
work with gcc has been for UNIX and all my work with DOS has been in 
Turbo Pascal 7...

I really need to convert (well, rewrite more like it) some graphics code 
into protected-mode C, for a game I'm working on.  If you have access to 
IRC, you can see what I currently have (from TP) by typing this:

/msg TCbot send voxel14.exe

I don't plan on working on the TP version of this code any longer, since 
a 256x256 matrix is definitely too small to work in. :)

Thanks for your time.  I'd prefer a posted response, as it'll give me a 
decent reason to be in here instead of lame comp.lang.pascal.borland 
(well, clpb used to be cool, but now everyone's either: 1. "Here's a 
binary"  2. "Don't post binaries" or 3. "Could someone [re]post a binary 
of...?"  Very annoying, and since everyone needs me to work in C these 
days I'd might as well switch, even though I still prefer Pascal :)
    ________________________________________________________________________
   / Joshua Shagam                    /    (Quantum Porcupine / Versatile) /
  / mailto:JShagam AT nmsu DOT edu          /       http://web.nmsu.edu/~jshagam /
 / phone://1.505.645.3856/~joshua   /  for the Quantum Porcupine Archive /
/__________________________________/____________________________________/
Q: How many hoards would the mongols board if the mongol hordes got bored?
A: The mongols would board all the hoards if the hordes got really bored!

- Raw text -


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