www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/27/11:50:03

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199607271545.AA278252310@relay1.geis.com>
Date: Sat, 27 Jul 96 15:28:00 UTC 0000
To: dbarrett AT engin DOT umich DOT edu
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Flat Memory Questions

Reply to message 2198889    from DBARRETT AT SRVR on 07/26/96  3:14PM


>Ok, I admit it: I've just recently started experimented with DJGPP.  But,
>I have searched long and hard for documentation describing how to set the
>computer into Protected Mode with the Flat Memory option but have been
>unsuccessful.  Could someone please point me to a tutorial or something
>(or describe the process) to do this:
>
>1. Set the computer into PM with Flat addressing
>2. Allocate a simple "char Array[1024*1024]" (for example)
>3. Dynamically allocate memory in large chunks.

This is all done automatically for you by the DJGPP startup code.  You
don't have to touch a thing; you can just begin programming and allocating
however much memory you want as soon as you get DJGPP.  Since
DJGPP _only_ runs in protected mode, I can't see any circumstance
where you'd need to make the switch yourself.  Switching back to real
mode to handle DOS calls and interrupts is also handled transparently
by the DJGPP code, via __dpmi_int(), int86(), and other library functions.

The great thing to remember about protected mode is that YOU, the
programmer, never have to worry about segments, limits on memory
allocation, far/near pointers, interrupt handling, low-level i/o calls,
virtual memory, memory management, or ANY of the various aspects
of protected-mode operation unless you want or need to interface
with these directly for the purposes of the programs you're writing.
(wow, what a sentence!  :O)

>I've looked around a bit through the DPMI functions, but I don't
>understand the difference between them.  Could someone please explain
>them to me?  Thanks!

Each DPMI function is simply a wrapper for a DPMI interrupt call.  For
an exact description of DPMI functions, download and read the DPMI
0.9 spec, pointers to which can be found in the FAQ (faq201b.zip).  For
the differences between the _go32_dpmi_ * functions and the __dpmi_*
functions, read the section of the FAQ detailing these differences.

If you _really_ want to know how to switch into and out of pmode manually,
you can examine the stub.asm code (djgpp/src/stub/stub.asm), as well as
the sources for cwsdpmi (csdpmi2s.zip), the free DPMI host provided with
DJGPP.  Another possible place for information would be the library source
code for __dpmi_int() and the other __dpmi_ functions (download djlsr200.zip).
The DPMI spec also covers this topic, but it's far too complex an issue to
explain in a brief post.

John

- Raw text -


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