On Monday, August 28, 2017 at 5:21:58 AM UTC-7, JJ wrote:
> Between those many DOS extenders such as DOS/4G, PMODE, CWSDPMI, HX-DOS,
> GO32, EMX, etc., which one do you think is the best from programmer's
> perspective? If possible, I mostly want to know their disadvantages because
> they can be party crashers, so there'll be less to choose from.
I'm not sure if there's the best one. They differ
in a number of ways. I can think of a few:
- how well they support newer hardware
and especially faster CPUs and larger RAMs
(there can be overflows and lock ups that never
happened in the DOS days because things
didn't work as fast as they do now and
because there rarely was more than some 16-32
MB of RAM (AFAIR, Windows 9x itself can't
handle more than 768MB of RAM))
- whether they support DPMI 0.9 or 1.0 or a mix
- whether they support 16-bit DPMI or 32-bit DPMI
or both
- whether they're only DPMI hosts or that and
DOS extenders
- how buggy they are
- whether they implement virtual memory
using disk space
- whether they have an option to run your code
in ring 3 (the most common) or ring 0
(the most dangerous because you can screw up
without being able to recover from e.g. a
double fault)
- whether they can be part of your EXE
- whether they can be loaded resident and
not be part of your EXE
- whether they provide additional functionality
(dunno, compressing the EXE or emulating some
devices or non-DPMI APIs)
I don't have a lot of experience with DPMI, but
I know that DOS/4GW works well with Watcom and
CWSDPMI works well with DJGPP. I implemented
DPMI support in my C compiler using whatever
32-bit DPMI host is present or loading CWSDPMI
on demand when none is there (what DJGPP-compiled
programs do). Seems to be working fine. I did
have to write some "extending" code for a few
DOS functions (file I/O) because CWSDPMI is not
a DOS extender, it's only a DPMI host. And I did
discover some instability when allocating and
freeing lots of memory blocks randomly and
launching child processes in a loop. But I then
changed the allocation pattern (to allocate all
heap memory at once and then manage it manually)
and the problem went away. I don't recall if
DJGPP is just lucky to not hit this or its
memory management is also somewhat special and
avoids allocation patterns that CWSDPMI can't
handle. DGJPP's make works just fine even though
it's seemingly doing the same kind of thing,
allocating memory and launching child processes.
Besides the DPMI itself it's also a question of
what you're gonna use it for and what compiler
(if any) you're going to use. One thing I hated
about DJGPP is that I needed to perform explicit
address translation to reach the video buffer
segment (0xA000 or 0xB800) and other things
outside my programs code and data. With Watcom
there's no problem just writing your pixels or
characters to 0xA0000+ or 0xB8000+. But, as I
understand it, a NULL pointer dereference in
Watcom may go unnoticed. DJGPP will catch it.
The difference is in how the two compilers'
libraries set up translation. I think Watcom
just maps the first megabyte directly, 1:1.
DJGPP has a shifted mapping (and, unless I'm
mistaken, it can change at run time).
And we should not forget about who's gonna
write the code, how qualified and determined
they are to do it right or fix the problems
as they arise.
And then again, it's 2017. Do you really need
this DOS/DPMI stuff? From the vagueness of the
question (you aren't telling us the purpose)
one may conclude that this is for a pet/fun
project. If it's so, then go have fun with
crashes and all and learn something in the
process.
Alex