Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Minion

far pointers

This topic is 5965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I guess this is something that no book has talked about that I''ve read, and now when I see it I''m perplexed. If anyone could explain what this means I would appreciate it very much. Thank You, Minion

Share this post


Link to post
Share on other sites
Advertisement
far and near pointers were something with DOS, when you had different memory models to choose from(16 bit). with 32 bit programming, you dont have to worry about that stuff anymore, since it has a flat memory model. dont worry about those far and near types, if you get code with them, just delete the far or near, or put

#define far
#define near

and that should take them out for you

Share this post


Link to post
Share on other sites
If you ever look into assembler then you''ll probably come across them (near and far), like barazor said its to do with the 16 bit and 32bit addressing modes. Its not really to do with DOS since its a hardware issue but since i haven''t really programmed under DOS i''ll defer to his experience.

The quick explanation is that with 16 bit addressing you can only access 64K of different values, but with 32 bit you can access up to 4Gig of locations (hence the 4Gig of RAM limitation some server PCs bump into). A FAR pointer would access anywhere in that 4Gig of space using the 32 bit address value, the NEAR pointer would access a location UP TO a 16bit value away from the current position.

Got it? Cool.

/* Ignorance is bliss, then you go and spoil it by learning stuff */

Share this post


Link to post
Share on other sites
You had 24bit memory addressing under DOS/real-mode. There were 8bits used for the segment and 16bits for segment offset.
IIRc, a near pointer meant you were only messing with the offset, whereas a far pointer meant you were messing with both.

DOOM (and a pile of other games) used DOS4GW (a Watcom product) that switched you into 32bit protected mode under DOS; so 16bit games on the PC are rather old now.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!