www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/19/08:16:29

Xref: news2.mv.net comp.os.msdos.djgpp:7622
From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DPMI programming
Date: Sun, 18 Aug 1996 21:48:25 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 61
Message-ID: <3217F219.280@cs.com>
References: <4v797b$35l AT tornix DOT tornado DOT be>
NNTP-Posting-Host: ppp222.cs.com
Mime-Version: 1.0
To: Schmitz Stéphane <tyrell AT tornado DOT be>
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Schmitz Stéphane wrote:
> I just downloaded the DPMI specs but it doesn't help me a lot.
> It seems very difficult to code programs that use the DPMI interface.
> What I want is beeing able to use all the computer memory available (to
> dynamically allocate chunks of memory without worrying about the memory
> limits). For example, I have 32 megs of memory. What have I to code if I
> want to load, for example, a lot of big .WAV files into memory and then
> working on them ?

You're making things way too complex for yourself.  :)  The whole theory 
behind DPMI is that the host handles all memory allocation:  switch to 
protected mode, virtual memory, page swapping, etc.  You don't need to do 
anything at all to make this happen.  Just malloc() away, and just check 
for NULL to indicate that you ran out of memory.

> So here's my questions : is there a good DPMI documentation that explains
> everything from a to z (and easily understandable even by the beginner that
> I am) ? I have seen programs that use the extended memory and wondered how
> to do that. But reading and understanding a source is maybe a good way, but
> a long and *very* difficult one. Are there special libs to include in the
> executable file ? Are there C headers required (go32.h for example) ? Are
> there GCC command line parameters I have to type when I compile the program
> ? Are there any other programs needed when I run the app (go32-v2.exe,
> cwsdpmi.exe...) ? You see that I have a lot of questions ! (don't forget I'm
> a total beginner is this environment).

The DPMI spec was not meant to be read by novices.  While programming 
under DPMI is quite simple, the actual interface is extremely complex.  
If anyone has written a version for beginners to understand, I've never 
heard of it.  :)

On the other hand, all you need to run a DJGPP compiled program is a DPMI 
host of some sort.  When the program runs, the startup code in the stub 
looks for existing DPMI services, and only if it doesn't find them does 
it run CWSDPMI.  What this means is if your program is run in a Windows 
DOS shell, or on a system using QDPMI (QEMM's DPMI host), 4DOS, 386MAX,
OS/2 DOS mode, or Linux dosemu, it doesn't need anything else to run.  
However, it is always a good idea to include CWSDPMI anyway, just in case 
a user runs your program in vanilla DOS.  It must either be in the same 
directory as the program or somewhere in the PATH.

As for <dpmi.h> and <go32.h>, you only need these if you are going to be 
working directly with the DPMI interface.  Unless you are working with 
interrupts, direct hardware interface, or related things, you can safely 
ignore that part of DJGPP.  Also, you don't really need go32-v2 for 
anything either.  It exists for two (well, actually three) purposes:  To 
enable you to run old v1.* programs without the entire v1 installation 
(although you still need the go32 from v1), to run unstubified v2 
programs, and to give you a quick report on available system memory.

Hope this helps!

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>+ W+>++ N++ o+ K? w(---) O-
M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+ tv+() b+++ DI++ D++ G e(*)>++++
h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


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