www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/08/01:19:35

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: HELP, PLEASE HELP... SIG INT
Date: Sun, 08 Feb 1998 01:12:06 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 38
Message-ID: <34DD4CB6.49A3@cs.com>
References: <01bd3434$3eb169c0$613d31cf AT default>
NNTP-Posting-Host: ppp214.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Majisun wrote:
> 
> 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.

You are doing lots of things wrong.  First, the address of video memory
is not 0xa000, it's 0xa0000.  Second, you aren't disabling memory
protection before trying to access it.  This is done with
__djgpp_nearptr_enable(), and should be reversed with
__djgpp_nearptr_disable() before your program exits.  Remember to add
__djgpp_conventional_base after enabling near pointers.  Third, "hybrid"
C/C++ programs are a major pain in the ass to maintain.  It's best to
stick to one language.  printf() is easy to learn; I don't understand
what could possibly be so difficult about it.  Fourth, it's best to seed
the random number generator with a truly random number, such as the
clock value.  This is done by including time.h and calling "srandom(
(int) time( NULL ) );".  Fifth (and this isn't so much an error as bad
style), you don't need to declare main()'s parameters if you aren't
going to use them.

Lastly, everybody on this list really hates it when you disguise your
email address, as it makes it more difficult to reply with helpful
information.

Good luck!
-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Always listen to experts.  They'll  |
|       aka Fighteer I       | tell you what can't be done, and why.|
|   mailto:fighteer AT cs DOT com   | Then do it."                         |
| http://www.cs.com/fighteer/|                - Lazarus Long        |
---------------------------------------------------------------------

- Raw text -


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