Date: Fri, 6 Sep 1996 05:23:15 -0700 (PDT) From: Samuel Vincent To: Matt cc: djgpp AT delorie DOT com Subject: Re: FP_SEG & FP_OFF equivelent for DJGPP? In-Reply-To: <322f8e29.841234@nntp.ix.netcom.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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