From: Andrew Crabtree Message-Id: <199704092116.AA069380576@typhoon.rose.hp.com> Subject: Re: A beginner question ... To: Johan DOT DeMessemaeker AT rug DOT ac DOT be (De Messemaeker Johan) Date: Wed, 09 Apr 1997 14:16:15 PDT Cc: djgpp AT delorie DOT com In-Reply-To: <334BA55C.2209@rug.ac.be>; from "De Messemaeker Johan" at Apr 09, 97 4:19 pm > what is the exact difference between far and near pointers ... Slightly different depending on whether you are in real mode or protected mode. Sinece you are posting to DJGPP I assume you mean protected mode but I will try to explain both. In Real mode memory is addressed using a segment and an offset. Each is 16 bits. Together they are 32 bits long and a far pointer. Now, think of a .com program. Everything resides in a single segment in memory. If you are going to access any memory in your data segment you know that it will all have the same segment value, and just different offsets. Therefore, you can store just the 16 bit offset portions. But, if you want to access video memory directly say, then you will need to specify a full segment:offset to it. If your program grows to big for the tiny model, and you need multiple code or data segments then you need to keep track of both the offsets and segments. In protected mode you now have selectors instead of segments (still 16 bits though). Offsets are now 32 bits long. In djgpp all pointers are just the 32 bit offset portion. Some of the far routines in djgpp use full 48 bit pointers (video memory again say). 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 ?) Andrew