www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/29/13:27:03

Date: Sun, 29 Mar 1998 14:31:18 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: OneClickAway AT worldnet DOT att DOT net
cc: djgpp AT delorie DOT com
Subject: Re: Newbie's problem with internal timer
In-Reply-To: <6fjkln$spk@bgtnsc02.worldnet.att.net>
Message-ID: <Pine.SUN.3.91.980329143057.15237W-100000@is>
MIME-Version: 1.0

On 28 Mar 1998 OneClickAway AT worldnet DOT att DOT net wrote:

> #include <sys/farptr.h>
> 
> void main(void) {
>    _farpeekl(0x0000,0x046C);
> }
> 
> I get a GP Fault when it is run.  This is the output the error generates:

Please read the documentation of `_farpeekl' before using it.  The
library reference explicitly tells you to use `_dos_ds' as the
selector (the first argument to the function).  The DJGPP FAQ list
(v2/faq210b.zip from the same place you get DJGPP) explains this as
well in section 18.4.

But you have used 0 (of all the numbers!) as the selector.  That is an
illegal selector, which is why your program crashed.  It even tells
you that this is the problem:

> cs: sel=00a7  base=832f2000  limit=0005ffff
> ds: sel=00b7  base=832f2000  limit=0005ffff
> es: sel=00b7  base=832f2000  limit=0005ffff
> fs: sel=0000
      ^^^^^^^^
See that FS register which has 0 selector, with no base and limit?

> How can I find the value of the internal timer without getting a GP Fault? 

Read the docs, then use the functions correctly, with `_dos_ds' as the
selector for conventional memory.

> Can I still reprogram the timer frequency by writing to the 8253 control
> register?

Yes, you can.  Use `inportb' and `outportb' functions to read and
write I/O ports.

- Raw text -


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