I have been developing a simple RTS game using C++ in Linux. By the DJGPP, I can also cross-compile the game to DOS build. In Linux, once the game starts, it only uses about 25MB of RAM though many game objects such as game units are created. But when it runs in DOSbox, it is very slow at the beginning and getting slower while the number of created game units is increased. Of course, DOS is old, but I think 25 MB is enough to run the game there.
Could you let me know what's wrong with me?
So my questions are following;
- The game uses about 25MB of RAM in Linux, so does it have to use such an amount in DOS, too?
Linux executables are 32 or 64-bit whereas DOS is a 16-bit OS so many objects will be smaller in DOS. However many 32/64-bit operations in DOS would be longer in DOS due to obvious reasons, which means they'll require larger code space to accommodate. Depending on the code the memory usage in DOS may be smaller or larger
- Is there a boundary value that limits the usage of RAM in DOS?
DOS (hence also FreeDOS) doesn't manage memory like that. Only a single process (excluding TSRs) runs at a single time so they own the whole memory space and manage that themselves. There's no need for process protection, a process can access everything
Besides DOS can't support more than 1MB RAM of memory. You have only 640KB of userspace RAM and that's the limit you get
You can access more memory with EMS, XMS but they don't belong to DOS and you'll have to explicitly load those libraries and call the appropriate APIs
For more information read DOS memory management