www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/09/22:04:09

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: A beginner question ...
Date: Wed, 09 Apr 1997 05:56:50 -0700
Organization: Two pounds of chaos and a pinch of salt
Lines: 28
Message-ID: <334B9212.E15@cs.com>
References: <199704092116 DOT AA069380576 AT typhoon DOT rose DOT hp DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp110.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Andrew Crabtree wrote:
> 
> I know there is also a near pointer concept in djgpp.  I am not sure what it
> does exactly (although I assume it allows you to access memory not normally
> in your selector with just a 32 bit offset ?)

To use near pointers, you simply set the global ds selector to -1
(0xffffffff), which allows you to address any location in memory without
generating a segmentation violation.  Then you can write to any absolute
address by adding the global variable __djgpp_conventional_base to the
absolute address (thus, video memory would be at 0xa0000 +
__djgpp_conventional_base).  The header file <dpmi.h> declares two
functions:  __djgpp_nearptr_enable() and __djgpp_nearptr_disable(), that
handle the selector settings for you.  Look them up in the libc
reference for more information, and also look at chapter 10 of the DJGPP
FAQ.

-- 
John M. Aldrich <fighteer AT cs DOT com>                      

* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
  causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
  again.
* It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


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