delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/28/20:11:55

From: "James Migel" <jmigel AT sprint DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Newbie tries to plot a pixel and fails :)
Lines: 50
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <abi04.2131$t12.95240@newscontent-01.sprint.ca>
Date: Sun, 28 Nov 1999 15:45:36 -0700
NNTP-Posting-Host: 209.148.201.254
X-Complaints-To: abuse AT sprint DOT ca
X-Trace: newscontent-01.sprint.ca 943828806 209.148.201.254 (Sun, 28 Nov 1999 17:40:06 EST)
NNTP-Posting-Date: Sun, 28 Nov 1999 17:40:06 EST
Organization: Sprint Canada Inc.
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi all, I'm trying to work my way through the DJGPP tutorial on the game
programming megasite http://perplexed.com/GPMega/ and am having trouble
plotting a pixel. I have my code right I think... mode 13 starts and then it
is supposed to plot at x=25 y=25 color=25 but I see nothing... I thought
that maybe my color (25) was black but it doesn't matter what I use I still
get a blank screen. Is it possible that I have to load a color palette
before it knows any colors? code as follows:

#include<stdio.h>
#include<dos.h>
#define GRAPHICS 0x013
#define TEXT 0x03
/*prototypes*/
void SetGraphicsMode(int iMode);
void PlotPixel(int ix,int iy,char cColor);
/*global pointer to video buffer*/
char *pcVideoBuffer=(char *)0xa0000;

int main(void)
{
 SetGraphicsMode(GRAPHICS);
 fflush(stdin);
 getchar();
 PlotPixel(25,25,25);
 fflush(stdin);
 getchar();
 SetGraphicsMode(TEXT);
 return 0;
}

void SetGraphicsMode(int iMode)
{
 union REGS regs;
 regs.x.ax=iMode;
 int86(0x10,&regs,&regs);
}

void PlotPixel(int ix,int iy,char cColor)
{
 pcVideoBuffer[(iy<<8)+(iy<<6)+ix]=cColor;
}

Any help would be greatly appreciated... I love this compiler, if you can
believe it I have gotten way farther (mode13!!!) with it than I ever did
with borland or microsoft compilers.
Thanks in advance.
James



- Raw text -


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