Beyond 640K in DOS.....

Started by
4 comments, last by KaneBlackflame 24 years, 6 months ago
Can someone define what a descriptor and selector are. I am trying to learn DPMI and I think I know what these things are, but I''m not sure. Also, does anyone have a good example of entering DPMI, allocating some memory, freeing it, and then jumping back to real mode? I just need a quick example to get started...
"Victims...aren't we all?" -Brandon Lee, the Crow
Advertisement
You could do some research on DJGPP - which is a free DOS32 C/C++ compiler. It can be found at:

http://www.delorie.com
Find the sources for PMODE/W somewhere. That is a small and real fast DOS4G/W (the one used by DOOM/Descent/A lot of other games) compatible DOS extender. It includes source for Raw/DPMI/VCPI access.

If you can''t find PMODE/W sources, you could also look for START32 sources.

DaBit.

In a nutshell, a descriptor is held by a protected mode program in a descriptor table. Each descriptor has information about a block of memory, such as where the block starts, how many bytes it is, if it can be read/written/executed, ...... A selector is simply a pointer (not a C pointer) to a specific descriptor.

In general, you don''t want to enter protected mode yourself. Its a hassle. Extenders handle all that for you, and set you up with basic selectors. For example, Watcom/DOS4GW set CS,DS, and ES to a start address of 0 and length of 4Gig: The entire memory space. Pretty easy to use, but not really ''protected'' anymore. DJGPP does it more correctly, but its much more of hassle to do any hardware programming.

Rock
Finally some straight answers....Thanx Rock. I am a little lost of how to use extenders though. Most just say "run me and magic will happen". Do they have specific functions to call to make them work? Or do you just program stuff and it magically can access all the stuff you need?
"Victims...aren't we all?" -Brandon Lee, the Crow
If you''re used to 16bit DOS, than extenders are pretty magical. Seriously.

For most programs, you really don''t need to understand how it works. You must use a 32bit compiler (such as Watcom or DJGPP) to create the app, and usually (but not mandatory) you distribute an .exe (ex: dos4gw.exe) that sets up all the protected mode stuff under the covers, but aside from that, it''s pretty transparent. Just write standard C/C++ and you have access to gobs of memory (usually limited to around 32 or 64 Megs, but dependant on the extender).

For games, you actually do need to understand much more. I promote using the DPMI functions (int 31h. You''ll need the spec), but compilers like DJGPP have specific functions to handle lots of those things (but of course they are only supported by DJGPP, where-as DPMI is supported by all). Mostly the complexities involve hardware manipulation, such as linear frame buffers, DOS memory access, and interrupts. Those are the tricky things. As with all new environments, start with a hello world program, and go from there.

Rock

This topic is closed to new replies.

Advertisement