www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/06/03:16:54

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Questions about 32-bit
Date: Fri, 06 Feb 1998 00:22:46 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 51
Message-ID: <34DA9E26.20C9@cs.com>
References: <6be2pa$m0i$1 AT herald DOT Mines DOT EDU>
NNTP-Posting-Host: ppp219.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jean-Luc Romano wrote:
> 
>    Say, I have a few questions about DJGPP in general.  From what
> I've heard DJGPP is a 32 bit compiler for MS-DOS.  How can that be,
> if MS-DOS is a 16 bit operating system?

DJGPP uses the DOS Protected Mode Interface (DPMI), an international
standard for running 32 bit programs on top of a 16 bit DOS shell.  In
fact, all 32 bit programs running on a DOS-based PC use some form of
DPMI, even Windows 3.1/95.

DJGPP handles most aspects of the protected mode interface completely
transparently to the programmer; you don't need to do anything special
in your programs to use it.

>    Also, I've seen the use of small, medium, large, and huge memory
> models as well as the mention of near and far pointers in game
> tutorials for Borland and MicroSoft C/C++ compilers.  However, I've
> never seen any mention of them in any DJGPP/Allegro tutorial.
>    Why is that?
> Does this have anything to do with the fact that DJGPP is a 32-bit
> compiler?

Yes.  The only memory model used in DJGPP is a 32-bit flat memory
model.  This means that your program and its data reside in a single
segment with a maximum size of 4 gigabytes.  This is practically limited
to the amount of memory provided by the particular DPMI host being
used.  In real terms, you can completely eliminate "far", "near",
"huge", MK_FP, FP_SEG, FP_OFF, and all those other horribly nasty real
mode hacks.

The tradeoff for protected mode programs is that it's somewhat more
difficult to access memory locations outside your program's address
space (such as memory-mapped devices in conventional memory), due to
memory protection.  You can work around memory protection in several
ways, all documented in the DJGPP Frequently Asked Questions list
(v2/faq210b.zip from SimTel or online at
http://www.delorie.com/djgpp/v2faq/).  In fact, many of the questions
you asked here and many more specific questions that you didn't ask are
answered in the FAQ, in and around chapters 17 and 18.  It is
recommended reading for all DJGPP users.

Good luck!

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "It may be better to be a live jackal|
|       aka Fighteer I       | than a dead lion, but it is better   |
|   mailto:fighteer AT cs DOT com   | still to be a live lion."            |
| http://www.cs.com/fighteer |                - Lazarus Long        |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019