delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/02/10:35:15

Date: Mon, 2 Dec 1996 17:15:17 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Robert Hill <Rob DOT Hill AT eepo DOT com DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: Problems accessing system timer with nearptr.h
In-Reply-To: <32A29911.5126@eepo.com.au>
Message-ID: <Pine.SUN.3.91.961202170050.427C-100000@is>
MIME-Version: 1.0

On Mon, 2 Dec 1996, Robert Hill wrote:

> The following function has been adapted from a book by Andre LaMothe on 
> basic game programming.  For some reason it causes a segmentation fault 
> and I can't figure out why.  My first assumption is that I have converted 
> the address of the system timer incorrectly,

That assumption was correct.  `clock' is defined by your code as a pointer
to an unsigned int: 

> unsigned int *clock = (unsigned int *)0x0046C;

Therefore, when you add `__djgpp_conventional_base' to it, like so:

> clock += __djgpp_conventional_base;

the compiler applies the usual rules of pointer arithmetics, and adds 4
times that much to your pointer, which is not what you want.  You should 
have done this:

	clock = (unsigned char *)clock + __djgpp_conventional_base;

and then it should work.

> go32/v2 version 2.0 built Jan 23 1996 22:03:02
> Usage: go32 coff-image [args]
> Rename this to go32.exe only if you need a go32 that can run v2 binaries 
> as
>  well as v1 binaries (old makefiles).  Put ahead of the old go32 in your 
> PATH.
> DPMI memory available: 8 Kb
                        ^^^^^^
???? 8 KB of free memory??  That's it?  Something's *very* wrong with 
your system setup, I'd say.  Please read the system configuration advice 
in the DJGPP FAQ list (section 3.9).  The FAQ is available as 
v2/faq202b.zip from the same place you get DJGPP.  Also see section 15.9 
of the FAQ which tells you how to set up the .PIF file of the DOS box 
with respect to memory requirements (since you obviously run DJGPP on 
Windows).

> DPMI swap space available: 9772 Kb
                             ^^^^
I'd suggest to enlarge the size of your swap file (or make more space 
available on your disk).  10MB is way too few for reasonable operation.

- Raw text -


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