dmsc / emu2

Simple x86 and DOS emulator for the Linux terminal.
GNU General Public License v2.0
406 stars 31 forks source link

emu2 seems to hang when running MASM v1.10 #14

Closed tkchia closed 4 years ago

tkchia commented 4 years ago

I tried using emu2 to run Microsoft's MASM v1.10 as distributed with their MS-DOS source code.

However, the emulator seems to hang without doing anything, not even displaying the copyright message, I had to press Ctrl-C to stop it:

$ emu2 MASM.EXE
^C

Unfortunately I do not have much idea of where the problem might be.

Thank you!

dmsc commented 4 years ago

Hi!

This is a bug in old MASM versions, they crash if the computer has more than 512kB of memory.

The solution is to set the environment variable EMU2_LOWMEM so the emulator limits available memory:

EMU2_LOWMEM=1 emu2 MASM.EXE

This is described in the README file :)

Have fun!

tkchia commented 4 years ago

Hello @dmsc,

Thanks for the tip.

But it still seems strange to me that emu2 needs this fix. I had no issues running the same masm.exe under DOSBox and QEMU --- both of which reported 640 KiB of conventional memory.

Thank you!

(Edit: It looks like it is because emu2 loads masm.exe at a really low address in memory, 0x80:0. Anyway, thanks again!)

dmsc commented 4 years ago

Hi!

But it still seems strange to me that emu2 needs this fix. I had no issues running the same masm.exe under DOSBox and QEMU --- both of which reported 640 KiB of conventional memory.

The problem is the amount of free memory, see https://slions.net/threads/debugging-ibm-macro-assembler-version-1-00.33/ and https://slions.net/threads/detecting-a-signedness-bug-in-vintage-compiled-pascal-programs.34/#36-6

The bug also means that certain free memory values allows the program to run but can crash afterwards with out-of-memory errors!

Thank you!

No problem!

(Edit: It looks like it is because emu2 loads masm.exe at a really low address in memory, 0x80:0. Anyway, thanks again!)

Yes, I used the lowest possible address, as all the DOS functions are emulated.

Have Fun!