CPU emulation strategies

If it doesn't fit anywhere else, drop it in here. (not to be used as a chat/nonsense section)

Moderator: Moderator Team

Post Reply
PurpleGurl
Posts: 1784
Joined: Fri Aug 07, 2009 5:11 am
Location: USA

CPU emulation strategies

Post by PurpleGurl » Fri Mar 08, 2019 2:49 am

From what I understand, there are 4 emulation strategies.

1. Thunking, CPU switching tricks, etc. This is to trick a similar CPU into running it anyway. This is pretty much what x86 Windows does to a degree from what I understand.

2. Interpretation. This is when each instruction is converted to equivalent code in a linear fashion as it is encountered. This is what our NTVDM does. DOSBox might use this some, but if so, it also uses another strategy. A drawback is speed, as each instruction is converted as it is executed. That is why DOSBox might not run it all, since it takes liberties to make it run faster, since it is mainly used for games.

3. Dynamic recompiling. This is when the program is recompiled on the fly to work on a different CPU. This may load slower but result in faster code. So all the code is converted, then run. DOSBox might use this as one of its strategies.

4. Code replacement. In this case, the program in question is not actually run. The OS only detects that incompatible code is being run and replaces it with a compatible program. (Or the user runs a different program that does the same thing.) So that is how 16-bit installers may appear to work under 64-bit Windows. Those tend to be 32-bit programs in a 16-bit self-extracting archive. In that case, the OS intercepts the installer, runs its own installer, then parses the original to find the internal archive and decompress/install it the same way. This is the strategy I prefer with 16-bit games. Just download a 3rd party game engine replacement and use it with the original game files. For instance, if Duke Nukem 3D won't run, just use EDuke32 with your original game files.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests