www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/07/23:00:29

From: "Majisun" <username AT infowest DOT com>
Subject: HELP, PLEASE HELP... SIG INT
Newsgroups: comp.os.msdos.djgpp
Message-ID: <01bd3434$3eb169c0$613d31cf@default>
NNTP-Posting-Host: dialup2-22.infowest.net
Date: 8 Feb 98 01:46:28 GMT
Lines: 75
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Okay, the problem is like this: I have a pointer to the video buffer and a
double buffer pointer.  I used calloc(0, 64000) to set the double buffer. 
I also added __djgpp_conventional_base to the video_buffer, but for some
reason I can't access one of them.  I think it is the video_buffer, because
I access the double_buffer all the time.  Someone please help.  It compiles
fine but I get a SIG INT error (I think that means that I am trying to use
memory that I shouldn't doesn't it?)  I am in mode 13h.  Any help is
GREATLY appreciated.  Here is a simple starfield that I am trying to write.
 I will post it all and then cut parts that really don't matter.  It
started out in C, but I hate using printf, so I am using a hybrid.  The
prototypes of the functions are there, the functions themselves are not,
because that would've taken up more space than I need.  It shows up when I
memcpy() the dbuf to screen.  I have commented it.

//All the includes are here

class STAR
{
	public:
	int x, y, intensity;
};

STAR syst[16000];
char *screen = (char *)0xa000;
char *dbuf;

void update_stars(void);
void save_stars(void);
void set_VGA(void);
void set_TEXT(void);

int main(char argc, char **argv)
{
   int dumdum, idumdum;
   if(argc<2)
   {
      cout << "Please input random number: ";
      cin >> dumdum;
   }
   else
   {
      dumdum = (int)argv[2];
   }
   srandom(dumdum);

   dbuf = (char *)calloc(0, 64000);
	if(dbuf == NULL)
	{
		cout << "NULL!";
		while(!kbhit());
	}
   screen = (char *)__djgpp_conventional_base + 0xa000;

	set_VGA();

	while(!kbhit())
	{
		update_stars();
                while (inportb(0x3da) & 0x08);
                while (!(inportb(0x3da) & 0x08));
                memcpy(screen, dbuf, 64000); // here is where the problem
shows up on my debugger

	}

   set_TEXT();
   free(dbuf);
   save_stars();

	return 0;
}


IF YOU FIGURED THIS OUT MY MAIL ADDRESS IS MAJISUN AT HOTMAIL DOT COM!!
AND I THANK YOU, THANK YOU, THANK YOU!!!

- Raw text -


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