I am working on reversing a DOS game consisting of 16-bit MZ EXE files. I was able to determine the exectuables were generated by Microsoft C v 5.10, and loading the signatures from the static libraries shipping with that compiler into IDA allowed me to identify standard C library functions within the executable.

I started out trying to rewrite the game in C++ on the side while analyzing the executables in IDA and the DOSbox debugger, but I ditched that approach due to the fact that it will take a long time before I have something operational, and I will probably make many mistakes along the way which will mean my implementation will either diverge from the original, or (more likely) be completely broken by the time I'm done.

The idea now is to reassemble the disassembly into working exe-s and replace the functions with equivalents written in C, which will keep me on track and also allow me to verify if my code is a 1:1 replacement for the original.

Question is, I understand that functions can move around in the executable both during building as well as the final linking. For GCC, I think it should be possible to enforce a specific layout of the binary with linker scripts, but the MSC compiler has no such feature, so my question is, is there some way of making sure my reassembled/recompiled binary puts the functions in the same order as the original, or is there a different approach I can take to verify conformity with the original despite the ordering discrepancies?

  • Why do you need to keep the layout?
    – Igor Skochinsky
    Commented Jun 8, 2021 at 10:04
  • To be able to easily compare my version with the original, if it's binarily identical. Commented Jun 8, 2021 at 13:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.