From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Far pointers Date: Tue, 15 Apr 1997 06:44:08 -0700 Organization: Two pounds of chaos and a pinch of salt Lines: 44 Message-ID: <33538628.4156@NO.SPAM.cs.com> References: <3352d8db DOT 6938055 AT news DOT earthlink DOT net> NNTP-Posting-Host: ppp108.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Adam Haun wrote: > > This may be a stupid newbie lamer question, but anyway...is it > possible to use a far pointer in DJGPP without resorting to all those > strange funtions referenced in the help file? Depends on your definition of far pointers. DJGPP programs do not need far pointers in the traditional sense, because all code and data resides in the same address space with an upper size limit of 4 GB. You only begin needing far pointers (or their cousins, near pointers) to access addresses outside your program's data space, such as the VGA memory. In that case, there are at least three techniques that will work. The simplest way to access an absolute address is as follows: #include #include void poke_absolute_address( size_t addr, char byte, size_t length ) { __djgpp_nearptr_enable(); memset( addr + __djgpp_conventional_base, byte, length ); __djgpp_nearptr_disable(); return; } Of course, this is both slow (in terms of the nearptr_enable and disable functions) and unsafe (in that you can easily crash your computer with a rogue address). See chapters 10, 17 and 18 of the DJGPP FAQ (v2/faq210b.zip) for more information. -- John M. Aldrich * 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