Xref: news2.mv.net comp.os.msdos.djgpp:8508 From: "david l." Newsgroups: comp.os.msdos.djgpp Subject: Re: FP_SEG & FP_OFF equivelent for DJGPP? Date: Tue, 10 Sep 1996 19:25:04 -0700 Organization: zNET Lines: 38 Message-ID: <32362300.53A3@znet.com> References: NNTP-Posting-Host: svts1-36.znet.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 Samuel Vincent wrote: > > On Fri, 6 Sep 1996, Matt wrote: > > > I am converting some real mode cd player code to djgpp and nowhere can > > I find the equivelent. I need the seg and offset for a variable that > > is required for the real mode int. Any Ideas? > > > > {this is probably a very dumb question} > > > > Matt Kittleson > > This is probably in the FAQ somewhere... > FP_SEG in 16 bit compilers would deal with a real mode segment > FP_OFF in 16 bit compilers would deal with a real mode offset. > Both of these would be 16 bit values. > > In DJGPP as in most 32-bit compilers, you deal mainly with one > large selector (the protected mode equivolent of a real mode segment, but > more complicated than just that.) Every pointer is a 32-bit value and is > only the offset in the program space. (A 32-bit offset.) This is much > like a near pointer in real mode, only, instead of being limited to 64k > near pointers due to the 16-bit value, you are 'limited' to 4 gigabytes of > memory with the new 32-bit value. > > Now how, might you ask, do you get a "far pointer?" I believe the answer > the your question is the functions in the header file . > There are macros in there which will retrieve or store values across > different selectors, and they are very efficient. In most cases you will > want to use these. Some may tell you about a method of disabling memory > protection and accessing the "far pointers" directly, but this will only > work in a ring 0 DPMI provider, such as CWSDPMI. It will not work under > any Windows or OS/2 dos shell, or any linux dos emulator. If you wish for > information on this technique, ask the others in/on this newsgroup/mailing > list. I never use that technique. The farptr.h macros and functions are > just as fast, when used correctly. > > -Sam