Date: Sun, 29 Mar 1998 14:23:30 -0800 (PST) Message-Id: <199803292223.OAA18975@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: , djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: Newbie's problem with internal timer Precedence: bulk At 07:56 3/28/1998 GMT, OneClickAway AT worldnet DOT att DOT net wrote: >I am a newbie to programming 32-bit DOS. I am used to programming 16-bit >DOS, and using memory locations 0000:046C-0000:046F to find the value of >the internal timer. However, when I make a program like this: > >#include > >void main(void) { > _farpeekl(0x0000,0x046C); >} > >I get a GP Fault when it is run. This is the output the error generates: [stricken] Read more carefully the documentation of `_farpeekl'. That first argument is not a real-mode segment, but a protected-mode *selector*. The selector with value 0 is the null selector and is always invalid, hence the crash. You need a selector which addresses DOS memory, and conveniently one exists in the `_dos_ds' macro. The offset argument, on the other hand, is a linear offset. You can construct it from a real-mode style seg:ofs address with ((seg << 4) + ofs). So what you want is: #include #include _farpeekl(_dos_ds, 0x0046C); Also, `main' must return an `int', 0 for success. Nate Eldredge eldredge AT ap DOT net