Getting Keen 4-6 and Dreams mods running on real DOS PCs

You can discuss anything about fan-made Commander Keen games here.
Post Reply
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 600
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Getting Keen 4-6 and Dreams mods running on real DOS PCs

Post by K1n9_Duk3 »

I know I'm not the only one around here who tends to play some Keen games and mods on a real DOS PC from time to time. Unfortunately, most mods require very large amounts of memory, to the point where some of them won't even run without issues in DOSBox. Many mods even come with a disclaimer saying that they will only work in DOSBox and cannot be played on real DOS PCs.

The biggest problem (aside from the fact that you need to remove as many TSRs and device drivers as possible to free up memory) is the fact that the games appear to be unable to detect and use XMS for data storage, only EMS seems to work.
keenmaster486 wrote:
Wed Jan 22, 2020 6:34
After all this, though, Keen refuses to detect both XMS and EMS at the same time. It grabs an extra 64K of RAM from the EMS, and refuses to get any more.
Well, today I decided to look up the specification of the XMS driver calls that the ID Memory Manager uses when trying to allocate XMS memory. That's where I found this:
Under DOS 5+, if CONFIG.SYS contains the line DOS=UMB, then no upper memory blocks will be available for allocation because all blocks have been grabbed by MS-DOS while booting.
And sure enough, after modifying the startup files of my primary DOS system, this is what the startup screen for Keen 4 looks like:
Image
It doesn't reach quite the amount of memory available to the game under DOSBox (which is 513k), but 507k is about as close as it gets. I am running MS-DOS 6.22 on that system, so perhaps you could gain a little more memory by replacing DOS 6.22's HIMEM.SYS and EMM386.EXE with third-party memory managers.

For reference, this is what my CONFIG.SYS looks like on that DOS 6.22 machine:

Code: Select all

DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF
DEVICE=C:\DOS\EMM386.EXE RAM I=B000-B7FF
DOS=HIGH,NOUMB
BUFFERS=15,0
FILES=30
LASTDRIVE=E
FCBS=4,0
My AUTOEXEC.BAT is empty, except for the usual PROMPT, PATH and SET BLASTER lines. So no DOSKEY, no CD-ROM or mouse drivers, nothing.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net

User avatar
keenmaster486
Vorticon Elite
Posts: 529
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Re: Getting Keen 4-6 and Dreams mods running on real DOS PCs

Post by keenmaster486 »

Woah!

I vaguely suspected the UMB thing might affect it, but I was not prescient enough to actually try to remove it.

Thanks for figuring this out, K1n9_Duk3. I'll test it on my machines soon.
I flermmed the plootash just like you asked.
Very silly indeed: https://audaxeundum.wordpress.com/

User avatar
thehackercat
Yorp Doctor
Posts: 665
Joined: Fri Aug 14, 2009 0:05

Re: Getting Keen 4-6 and Dreams mods running on real DOS PCs

Post by thehackercat »

Very cool!

I had a working 486 until a couple years ago; after a hard drive failure I left it at my parents' house until I could find a replacement part. Turns out somebody got rid of it a while back.

I guess this means I can use this trick you've found as an excuse to get another one!
Image

User avatar
keenmaster486
Vorticon Elite
Posts: 529
Joined: Sun Mar 20, 2016 18:29
Location: Tranquility Base
Contact:

Re: Getting Keen 4-6 and Dreams mods running on real DOS PCs

Post by keenmaster486 »

OK, so I tested this trick on my 486 and my IBM PC AT (286).

On the 486 it works! But not nearly as well as your results, K1n9_Duk3... I wasn't able to get it to surpass 500K. It was grabbing enough memory for any of the big mods to function properly, but only barely. My best results came with JEMMEX, with something like 450K for Keen 4 (was only getting 30 or 40K of XMS for some reason). MEM /DEBUG doesn't reveal anything strange. Using HIMEM and EMM386 always results in less memory overall, and copying your CONFIG.SYS verbatim gets me about 440K if I remember right.

On the 286, it doesn't work at all. I get the same result as before. Not sure why. It has HIMEM.SYS and a proprietary EMM for my Everex RAM card (hardware XMS and EMS)
I flermmed the plootash just like you asked.
Very silly indeed: https://audaxeundum.wordpress.com/

User avatar
K1n9_Duk3
Vorticon Elite
Posts: 600
Joined: Mon Aug 25, 2008 9:30
Location: Germany
Contact:

Re: Getting Keen 4-6 and Dreams mods running on real DOS PCs

Post by K1n9_Duk3 »

I guess the results may vary depending on the hardware configuration. The way the EMS and XMS memory allocation works in the Keen games is that the unused parts of the upper end of the address space are mapped to physical memory addresses. This area (anything between 640 kB and 1 MB) is usually reserved for accessing hardware like the video RAM (EGA/VGA memory starts at 640k a.k.a. 0xA000), BIOS ROM etc. If you have expansion cards or ROM chips installed that use parts of this address space, you obviously can't use those addresses to access additional memory.

I also only get around 42k of XMS used by Keen 4 when I run EMM386.EXE without the "I=B000-B7FF" part. Making these addresses usable gives me another 32k and thus boosts the total up to 74k.

Also, HIMEM.SYS from DOS 6.22 is unable to provide UMBs on its own, it relies on EMM386.EXE to provide UMBs. So if the proprietary EMM driver for your RAM card doesn't provide UMBs or is incompatible with HIMEM.SYS, the Keen games won't be able to use XMS. And since your system uses an actual RAM card, it's possible that the EMS driver doesn't provide any UMBs at all. EMM386 uses 386 code to remap the real-mode address lines to memory areas that can only be accessed in protected mode. Maybe that remapping is what's commonly referred to as "UMB". I think EMS cards don't need to remap anything, since they are real expansion cards with their own chips. They can just read from or write to their memory chips depending on which address lines are active on the ISA bus.

And just a heads up: While I was looking up the XMS commands used by Keen, I also found that XMS drivers don't have to implement these commands to be considered "XMS compliant". So when in doubt, go back to Microsoft's HIMEM.SYS.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net

Post Reply