|
|
|
|
|
by viraptor
3566 days ago
|
|
Just curious, maybe someone has better idea if this is harder or easier than writing the whole CPU emulator. What about writing a compiler from 16b binary to 32b/64b binary? Specifically, translate the common calls to be as close to compiled native as possible. It seems to me that unless someone wrote some functions directly in asm, most code should be relatively easy to translate. Pros: better performance, better memory usage, most instructions map 1:1, there's lots of extra registers for storing extra state required by the translation, easier debugging (you can compile each function separately and verify without running). Cons: harder debugging (at runtime), harder to test, properly translating memory segmentation, need to find a way to adjust all the offsets automatically, need to convert all the API function call conventions (can be quite tricky with variadic arguments). |
|
Whereas a straightforward emulator of the 16-bit set with the standard computed jump table is fairly easy. Mostly requires a lot of typing. If your interpreter fits in the i-cache it can even be faster.
Although apparently since WINE will run 16-bit code, it looks like preservation of the 16-bit world is a Solved Problem.
(I've long wanted a human-assisted decompiler for 16-bit DOS/Windows code, as a means of salvaging old games. For a few games people have done this by hand and built modernised versions with the bugs fixed.)