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

You can discuss anything about fan-made Commander Keen games here.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 808
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: 543
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.
User avatar
thehackercat
Yorp Doctor
Posts: 669
Joined: Fri Aug 14, 2009 0:05
Location: Slug Village

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: 543
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.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 808
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
User avatar
krivulak
Grunt
Posts: 21
Joined: Tue Jun 16, 2015 18:48

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

Post by krivulak »

I've given many, many hours looking in DOS memory management system and from what I can say, M$ memory manager is pure garbage. There is no way you can allocate more than 460k of memory because of... Well, I am not really sure.
I started fiddling with other, upper level modern memory managers like QEMM with no such luck, I tried alternatives to EMM386 which actually helped somewhat, but not really much. So far I am trying to make PTS-DOS to run on 486, but I am running into graphical problems with LCD - installation software is programmed with super odd horizontal frequency and LCDs aren't able to display that, so most attempts end with "Not supported display resolution" message.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 808
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 »

krivulak wrote: Mon Apr 13, 2020 16:10There is no way you can allocate more than 460k of memory because of... Well, I am not really sure.
Could you please explain where that number comes from? Without context, that number is absolutely meaningless to me. Maybe you were thinking about the 640k limit for conventional memory under DOS and somehow swapped the 4 and the 6 in that number?
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
krivulak
Grunt
Posts: 21
Joined: Tue Jun 16, 2015 18:48

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

Post by krivulak »

K1n9_Duk3 wrote: Mon Apr 13, 2020 20:22 Could you please explain where that number comes from? Without context, that number is absolutely meaningless to me. Maybe you were thinking about the 640k limit for conventional memory under DOS and somehow swapped the 4 and the 6 in that number?
True, last few days I have quite noticeable problems with speaking, don't know why. Maybe the quarantine and two months of complete isolation are starting to take their price... Anyways, five years ago when I was quite new to this problem I started new topic about troubles running Keen 9. (viewtopic.php?f=2&t=3302) Back then I found out that I can manage to make about 604k free conventional memory, but Keen never seems to allocate more than 350k with standard M$ memory manager. With 64k expanded memory it makes total of about 420k of memory used by Commander Keen, which is clearly not enough, but better than standard clean DOS boot which couldn't even manage to run music in the first level. With the super conservative way of booting DOS the music actually sometimes managed to play, but Defense Tower Surth still crashed as well as Trog Village from Terror From Outer Space. I think Atroxian Realm crashed too. Never finished any of those games since I don't play on anything other than the 486.
With himem from Freedos I actually managed to get 460k of total memory allocated, but even that was not enough. Just as I said, now I am trying to work with PTS-DOS, Russian clone of DOS with quite advanced memory manager (from what I heard you can manage to get about 630k conventional memory free with this), but I have never been able to make it work properly and about two weeks ago my rig started acting up - on certain memory addresses started somehow adding one bit in quite weird pattern, which sadly makes the computer unstable. And the worst thing is that I sold all of my 386 VLB boards so I don't have any spares to work on. Right now I am stuck with logic probe, vague manual and tears in my eyes, because I love that machine since I got it about six years ago...
Nevertheless, if I manage to make some progress, I will sure post a reply!
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 808
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 »

krivulak wrote: Mon Apr 13, 2020 21:22 Back then I found out that I can manage to make about 604k free conventional memory, but Keen never seems to allocate more than 350k with standard M$ memory manager.
I think you're comparing apples and oranges here. Those 604k of free conventional memory is how much free memory you have before starting the game. The number that's shown in the game's startup screen is how much free conventional memory you have after the game executable was loaded into memory. The executables usually take up over 200k of memory on their own, so this big difference is totally normal. Just check out the screenshot in the first post of this thread.

If you want to get this sorted out (assuming you can get your 486 back in working order), you should start with plain, unmodded Keen 4 and tweak your startup files to get the most out of your system. If you load DOS high and don't load any unnecessary drivers and TSRs, you should be able to get to a point where you have about 617k (or more) free conventional memory under DOS. That's the amount you see when you type MEM at the DOS prompt. That means an absolute bare-bones configuration without CD-ROM drivers or anything like that.

Try creating a boot disk with the CONFIG.SYS settings I listed in the first post of this thread. The AUTOEXEC.BAT file on that boot disk should be empty. Boot from that boot disk and see how much free conventional memory you have under DOS. Also check the startup screen of KEEN4 and compare it to the one I posted. The number for "Expanded" should always be either 0 (no EMS) or 64k (with EMS). The other values may vary. You can probalby get even more than 74k of "Extended" (XMS) memory, depending on your system, but you might also get less, as reported by keenmaster486.

Unless you can get vanilla KEEN4 to show a total of 513k or more (which is how much memory is available in DOSBox), you will probably run into memory problems when trying to play mods on the same system using the same memory configuration. If you can't get the game to use XMS as well as EMS, you won't be able to get anywhere near those 513k of total available memory and the chances of getting any mods to run properly are extremely slim. And in order to allow the game to use XMS, you cannot let DOS use UMBs, which is what this thread was all about in the first place.

The problem with most mods is that modders develop them primarily for DOSBox and keep putting more and more stuff into the game levels until they run out of memory in DOSBox and are forced to stop. Sometimes these issues get fixed before release, but not always.

There is one additional thing you can try to free up a few kilobytes of memory for mods, and that is to get rid of CKPATCH. All mods of Keen 4-6 and Dreams need CKPATCH to modify parts of the game's executable in order to run. The CKPATCH program takes up about 22k of memory, so any Keen mod that uses CKPATCH will have about 22k less available memory than the orignal games on the same system. You can use my patching utility to create a fully patched executable for each mod, so you don't have to start the mod via CKPATCH anymore and therefore free up those 22k for the game. But you'll have to modify the patch script a little for this to work, since my tool is not 100% compatible with CKPATCH.

And just FYI, the reason why conventional memory is limited to 640k is that the 8086/8088 processors only had 1 megabyte of address space. Anything above 640k was reserved for accessing hardware other than the main memory. As I mentioned before, the EGA (and VGA) video memory starts at 640k. If I remember correctly, the first IBM PCs shipped with only 64k of memory, so the famous claim that "640k should be enough for everybody" would have made sense back then. Fun fact: if your PC only has a CGA or MDA video card, you can actually have 704k of conventional memory.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 808
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 »

keenmaster486 wrote: Tue Jan 28, 2020 16:47was only getting 30 or 40K of XMS for some reason
I think this might just have been because of a minor bug in the ID Engine's XMS code. It's possible that the game actually allocated 94k or 104k of XMS.

TL/DR: The amount of "Extended" (XMS) memory shown on the startup screen is not reliable. As a result, the "Total" amount on the startup screen and in the memory usage window is also unreliable. The game may have allocated 64k (or 128k?) more than that.

While testing the current build of FitF on my 386 DX-40, I noticed that it would only use 58k of XMS, even though the system should have around 122k of free upper memory. At first I thought the game was only using 58k of XMS, but then I noticed that the memory usage window claimed that the game was using about 4 gigabytes(!) of memory, even though the engine can only address 1 megabyte (and the system only has 4 megabytes of RAM).

This was the first hint that something was wrong with the XMS code. The 4 gigabytes number indicated that there was probably a 32 bit integer overflow somewhere. My memory info code displays the amount of memory actually used by subtracting the "Free with purge" amount (which is always correct) from the "Total" amount reported at the startup screen. So this meant that the game must have had more memory than it was reporting. I quickly tracked this down to an issue of 16-bit vs. 32-bit integers, so this problem will be fixed in FitF.

I also created a tiny little patch for Keen 4 and tested the result on my 386:

Image

Yup, plain old Keen 4 has 556k of available memory on my 386. That's about 43k more memory than what you get in DOSBox (total in DOSBox is about 513k), meaning that it's theoretically possible to create Keen mods that can be played on real DOS PCs, but won't work in DOSBox!

Just in case you're confused: The patch I wrote for Keen 4 only means that the game will show the correct amount of available memory. Without the patch, the game will still use the full 122k of XMS on this system, even though it only reports 58k on the startup screen.

Okay, so how can you check how much XMS memory can actually be allocated on your system?

One way is to edit your CONFIG.SYS again and change DOS=HIGH,NOUMB into DOS=HIGH,UMB and reboot the system. Run MEM and see how much high memory you have in total. That's roughly how much XMS the Keen games should be able to allocate (after changing your CONFIG.SYS back to NOUMB and rebooting the system, of course).

Or you can try the patch I have written (for KEEN4E v1.4 only!):

Code: Select all

%patch $157C2
	$BB $0010w $F7 $E3 $01 $06 $A017w $11 $16 $A019w
The other ways involve using the memory usage window (F10+M). The world map of the unmodified EGA version 1.4 of Keen 4 requires about 218k (when playing with music and AdLib sound effects). This value is calculated as "Total" - "With purge". Compare that to whatever you get on your system. The difference will be the error in the XMS size calculation. You could also read the memory map that the game displays after the memory usage window, but that might be a bit too complicated.

Note:
The amount of XMS memory that Keen 4-6 and Dreams can use may vary from system to system. XMS memory is allocated via upper memory blocks, and the address space of those upper memory blocks is shared with other hardware (video RAM, ROM chips, etc.). For example, my Pentium MMX laptop can only use up to 74k of XMS for the Keen games (as shown in the first post of this thread), because it has more (or at least bigger) ROM chips that take up a lot of the address space.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Frenkel
Vortininja
Posts: 37
Joined: Sat Jan 01, 2022 11:25

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

Post by Frenkel »

So the problem is in ID_MM.C function MML_SetupXMS()

Code: Select all

mminfo.XMSmem += size*16;
where mminfo.XMSmem is 32 bits but size is 16 bits, right?
User avatar
Frenkel
Vortininja
Posts: 37
Joined: Sat Jan 01, 2022 11:25

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

Post by Frenkel »

BTW, the startup screen is 4000 bytes and is released from memory when it isn't needed anymore, but the total memory available counter doesn't get updated. So it's possible the game won't start and tell you you do not have enough memory to run Commander Keen, while you do have in fact just enough free memory.
Also, F10 + M should show about 4k more in the total memory field.
Bounder
Meep
Posts: 2
Joined: Sun Aug 25, 2024 18:51

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

Post by Bounder »

Has anyone figured out a way to make Keen use "XMS" (i.e. upper memory blocks) on an 80286?

I am pursuing a personal obsession of mine (trying to get Foray in the Forest to work well on an actual 80286), so far, I'm trying out some different configurations in 86Box to find something that works before trying to do it with real hardware. I am guessing some combination of the following would work:

- 2MB base RAM
- Minimal DOS setup (PC DOS 2000, etc.), DOS loaded HIGH
- EMS board
- An additional EMS board or otherwise a 286 with a chipset that can be programmed to provide UMBs from extended (not expanded) memory

The game is playable on an 80286 with 10MHz but runs a lot better with something a bit faster.

Edit: Quarterdeck's QRAM did the trick with 176kB of upper memory on a typical 286 computer, provided it had a NEAT etc. type of chipset (in 86Box). Foray in the Forest plays fine on it. There was no need to configure an EMS board at all. I used PC DOS 2000 since it has a slightly smaller conventional memory footprint.

To make it playable (on an emulated 12MHz 80286), set the frame rate to 35 (or less). A 16-bit VGA is going to work a lot better than some old 8 bit VGA or EGA. Most ISA Super VGA cards will work too and are probably the easiest to find nowadays. Great job to the team for making a game that will actually work on real hardware.
Last edited by Bounder on Mon Aug 26, 2024 2:34, edited 1 time in total.
User avatar
K1n9_Duk3
Vorticon Elite
Posts: 808
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 »

Frenkel wrote: Sun Jan 09, 2022 0:56 So the problem is in ID_MM.C function MML_SetupXMS()

Code: Select all

mminfo.XMSmem += size*16;
where mminfo.XMSmem is 32 bits but size is 16 bits, right?
This answer probably comes two and a half years too late, but yes, that line is the problem. The code should really have been something like this:

Code: Select all

mminfo.XMSmem += size*16l;
For those who don't know: The "l" suffix at the end of a number constant causes the compiler to treat that number as a signed long (32 bit) value, which means the result of the multiplication will be 32 bits as well. After changing the code like above, the correct amount will be added when size is >= 0x1000.

I suspect that this bug might be the reason why DOSBox doesn't provide a full 64k block of UMB memory.

Not adding the reclaimed 4000 bytes to the memory size values is negligable. The size values are really only used by the CheckMemory() function when the game starts. Everything else uses the numbers reported by the MM_UnusedMemory() and MM_TotalFree() functions, which are always accurate. Yes, you could add 4000 to mminfo.mainmem and mminfo.farheap (the F10+M memory usage window uses mminfo.mainmem, the minimum memory check at startup uses mminfo.nearheap+mminfo.farheap). But simply subtracting 4000 from the hard-coded minimum value would lead to the same result during the minimum memory check without adding any extra code.

I suspect that this is exactly what the id team did for Keen 4-6. When I use my memory checking patches to calculate how much memory is actually used by each level, I get the following results for v1.4 of the games:

KEEN 4 EGA (MINMEMORY is 310000):
310992 (level 15, no sound, no music)
316080 (level 15, AdLib sounds, no music)
318832 (level 15, AdLib sounds + music)

KEEN 5 EGA (MINMEMORY is 310000):
310480 (level 13, no sound, no music)
316992 (level 13, AdLib sounds, no music)
323440 (level 13, AdLib sounds + music)

KEEN 6 EGA (MINMEMORY is 300000):
303664 (level 10, no sound, no music)
309264 (level 10, AdLib sounds, no music)
321696 (level 10, AdLib sounds + music)

I have only listed the highest requirements for each setup to keep things short. As you can see, the MINMEMORY value would always be insufficient for at least one level of each game. But if you take into account that there will be 4000 bytes more available, then all three games would be playable with the given minimum amount of memory, but only if you play without sounds and music.

Also keep in mind that the requirements for music may be slightly higher than what's shown here. The compressed music data needs to be loaded into memory before it can be decompressed into the final music buffer. If the compressed data is is bigger than 4096 bytes, then the game needs to allocate a temporary buffer for it, which means the memory requirements for playing that level with music would be a bit higher.

Another contributing factor that can cause the "Insufficient memory to load music" error is the fact that the memory blocks can become fragmented. That means there may be 2000 bytes free in one section (let's say in the far heap) and another 5000 bytes in a different section (in the XMS UMB memory, for example), but no contiguous block of 6000 bytes, which means that even though there are 7000 bytes free in total, the memory manager won't be able to allocate a 6000 byte buffer. I added some extra features for the memory manager in Foray in the Forest that allow the memory manager to "defrag" the memory blocks to merge as much free memory as possible into one big block. The FITF memory manager will also stop any music and turn the sounds off to avoid an "out of memory" crash if possible.

Bounder wrote: Sun Aug 25, 2024 19:01 Has anyone figured out a way to make Keen use "XMS" (i.e. upper memory blocks) on an 80286?
I described one possible way of making XMS UMB memory available for Foray in the Forest on 286 machines in the HELPME.COM file that comes with FITF:
If your system is equipped with a 286 CPU, then you cannot use EMM386.EXE to emulate EMS and provide UMBs. If you have more than 640K of memory installed and some of that memory is already mapped into the Upper Memory Area (i.e. the addresses above the 640K limit in the first megabyte of the address space) then you can use that memory as Upper Memory Blocks.

There is a utility called "USE!UMBS", written by Marco van Zwetselaar, that can be used to provide UMBs on 286 systems and below. Search for "USE!UMBS" or "use_umbs.zip". The download should include a tool named TEST!UMB.EXE that you can use to check if any real memory is mapped into the Upper Memory Area on your system.

If your system does not provide such memory, you will have to install a memory expansion card that can map memory into the Upper Memory Area.

If TEST!UMB confirms that you have memory that can be used for UMBs, you can add USE!UMBS.SYS to your CONFIG.SYS (please refer to the USE!UMBS documentation for more information on how to use it). Since USE!UMBS version 2.0 does not implement freeing UMBs after use, we recommend using the setting DOS=HIGH,UMB in your CONFIG.SYS to let DOS manage the UMBs. Otherwise you might have to reboot the system before running Foray in the Forest to make sure UMB memory is still available.
I haven't been able to verify this on my own, since the only 286 board I own doesn't map the extra memory (it has 1 MB RAM on board) into the Upper Memory Area, it maps the memory to the addresses at 1 MB and above. But keenmaster486 sent me a photo of the Keen 4 startup screen displaying "111 Kbytes" extended memory on his 286 system after installing the USE!UMBS driver.

My 286 board has a Morse chipset with a 12 MHz 80286 CPU. I have tested FITF using this board, using a 16 bit SVGA card (the only ISA graphics card I have) and I have concluded that the game would be playable in 12 MHz mode, but 6 MHz mode was too slow in my opinion.

And yes, you don't really need EMS memory for the Keen games. Since the game's memory manager will only use 64k of EMS memory anyway, simply using the EMS page frame addresses for UMB memory will give you the same amount of memory. You can test this on MS-DOS 6.22 systems by loading EMM386.EXE with the NOEMS parameter and using DOS=HIGH,NOUMB in your CONFIG.SYS file. This might also work for other DOS versions, but I have only tested it with 6.22. But unless the system already has some real memory mapped into the upper memory area, you will still need the EMS driver (or a similar driver) to allow 386+ systems to remap some real memory addresses into the upper memory area.
Hail to the K1n9, baby!
http://k1n9duk3.shikadi.net
User avatar
Frenkel
Vortininja
Posts: 37
Joined: Sat Jan 01, 2022 11:25

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

Post by Frenkel »

K1n9_Duk3 wrote: Mon Sep 02, 2024 5:40
Frenkel wrote: Sun Jan 09, 2022 0:56 So the problem is in ID_MM.C function MML_SetupXMS()

Code: Select all

mminfo.XMSmem += size*16;
where mminfo.XMSmem is 32 bits but size is 16 bits, right?
This answer probably comes two and a half years too late, but yes, that line is the problem. The code should really have been something like this:

Code: Select all

mminfo.XMSmem += size*16l;
I solved it by doing:

Code: Select all

mminfo.XMSmem += size;
and doing the multiply by 16 at the end of the function when the size is already in 32-bit variable:

Code: Select all

done:;
	mminfo.XMSmem *= 16;
Post Reply