From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: memory matters Date: Tue, 07 Jan 1997 20:35:47 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 36 Message-ID: <32D32423.233C@cs.com> References: <3 DOT 0 DOT 32 DOT 19970107201525 DOT 0069f258 AT alpha DOT luc DOT ac DOT be> Reply-To: fighteer AT cs DOT com 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 Filip Aben wrote: > > hi there, > > I've been programmin c for some years now and i finally took the step > towards protected mode (no big step though): DJGPP. In real mode i knew > what i was doing as to allocating and accessing memory (segments, mem > models and stuff), but in PM i haven't got a clue how it works... > (selectors,gdt and stuff) > Does anyone know or have a tutorial or some docs on this one?? Well, the simplest answer to your question is that under PM, there are no segments. So you can just go ahead and allocate that 20 MB structure and never again need to worry whether it is overlapping a segment or anything! The big secret is that there is no secret. :) The more complete answer is that protected mode still uses segments, but in a much looser way. Your entire program, for example, has one "segment" of memory all to itself, and can do anything it pleases within that segment. If you want to start playing with things outside of that segment, like DOS memory, memory-mapped devices, etc., then you need some additional techniques. They aren't very hard to learn; just a lot different from what you've been plodding along with in real mode. See the DJGPP Frequently Asked Questions list (v2/faq202b.zip) for a whole host of answers to the various questions of RM<->PM conversions. Chapter 10 is a very good place to start. Good luck! -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Plan: To find ANYONE willing to | http://www.cs.com/fighteer | | play Descent 2 on DWANGO! | Tagline: | ---------------------------------------------------------------------