delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/09/06:34:29

From: Prashant TR <prashant_tr AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: far pointers
Date: 09 Jun 2000 13:41:39 +0530
Organization: VSNL
Lines: 23
Message-ID: <m3d7lrxohw.fsf@vsnl.net.in>
References: <39405DEE DOT 89226F7B AT ccs DOT iitb DOT ernet DOT in>
NNTP-Posting-Host: ppp-181-126.bng.vsnl.net.in
X-Trace: news.vsnl.net.in 960576223 6828 203.197.181.126 (9 Jun 2000 18:43:43 GMT)
X-Complaints-To: postmaster AT news DOT vsnl DOT net DOT in
NNTP-Posting-Date: 9 Jun 2000 18:43:43 GMT
X-Newsreader: Gnus v5.7/Emacs 20.5
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Gaurang Kanvinde <n8007034 AT ccs DOT iitb DOT ernet DOT in> writes:

> How do I access memory registers in C? DJGPP gcc does not recognise  the
> far pointers that can be used otherwise. Instead,   _farpeek and
> _farpoke functions are used.

The reason for this is explained in the FAQ and it requires some
knowledge of Protected Mode.

> Can someone tell me how to use these functions?. What are the SELECTOR
> and OFFSET arguments in these functions?

_dos_ds is the selector value (Add #include <go32.h> to your source
file) generally. The offset is the linear address. For example, if you
wanted to access the long integer value at F000:FFFF, you'd write
_farpeekl(_dos_ds, 0xffff0); // That was 0F000h * 0x10 + 0xFFFF.

Btw, I'll add some document on protected mode on my site something
today evening. You might want to check that out.

When available, it will be at http://www.midpec.com/djgpp/protmode/

Hope this helps!

- Raw text -


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