Message-ID: <32A29911.5126@eepo.com.au> Date: Mon, 02 Dec 1996 16:53:37 +0800 From: Robert Hill MIME-Version: 1.0 To: djgpp AT delorie DOT com CC: Rob DOT Hill AT eepo DOT com DOT au Subject: Problems accessing system timer with nearptr.h Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dear Gurus.. 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, but all of the video functions underwent the same transformation and seem to go OK. The code is being compiled on DJGPP v 2 an run on an i486 DX4 100 (just in case this is useful) thankx for your help robby _________________________________________________________________________void Delay(int clicks) { // this function uses the internal time keeper timer i.e. the one that goes // at 18.2 clicks/sec to to a time delay. You can find a 32 bit value of // this timer at 0000:046Ch unsigned int *clock = (unsigned int *)0x0046C; unsigned int now; // get current time __djgpp_nearptr_enable(); clock += __djgpp_conventional_base; now = *clock; // wait till time has gone past current time plus the amount we eanted to // wait. Note each click is approx. 55 milliseconds. while(abs(*clock - now) < clicks){} __djgpp_nearptr_disable(); } // end Delay _________________________________________________________________________ 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 DPMI swap space available: 9772 Kb CONFIG=Qemm LOADHIDATA=C:\QEMM\LOADHI.RF COMSPEC=C:\COMMAND.COM BLASTER=A220 I5 D1 H5 P330 T6 SOUND=C:\DRIVERS\SB16 PATH=C:\WINDOWS;C:\DOS;C:\UUPC\BIN;D:\UTILS\ZIP;D:\UTILS\NORTON;D:\VIDEO\VIDDOS;C:\DJGPP\BIN; DJGPP=c:/djgpp/djgpp.env TEMP=C:\TEMP PICNIX_SWITCHAR=- TZ=WST-8 UUPCSYSRC=c:\uupc\uupc.rc UUPCNEWS=c:\uupc\news USER=ROB HOME=c:\home\ROB UUPCUSRRC=c:\home\ROB\personal.rc SNEWSRC=c:\home\ROB\snews.rc DEBUG=00 ANODE=Mr Gates' windowing environment's sacrificial goat PROMPT=$p$g windir=C:\WINDOWS