Mail Archives: djgpp/1998/03/29/13:27:03
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 -