The linear executable of M.A.X. is 1.597.679 bytes from which the disassembled x86 GAS assembly listing is something around 10.632.890 bytes or 507.141 lines of code. The game has 5704 functions. About 16 hundred of them are library functions from libraries like GNW, S.O.S., MVE player or the compiler’s C/C++ runtime. 1582 of those library functions are already replaced or reimplemented. From M.A.X. specific functions 1457 got reimplemented so far and 2665 remains to be done.

M.A.X. is mostly implemented in C++. The source code is riddled with hundreds of polymorphic classes and smart container classes that are mostly based on templates. The Watcom C/C++ compiler option set that was used by the code authors does not optimize much on these classes, tons of them are just instances of the same template base classes.

As of today the reimplemented source code consists of 205 source files that contain 37.953 lines of code, excluding comments and empty lines, having an overall size of 1.725.565 bytes.

The work involves three main activities. The first one involves digging the Internet for clues, buying old M.A.X. related relics from various sources and finally annoying people all around the World. By now former Interplay employees are fed up with me for sure. The second activity is quite fun at times. It is about solving riddles and playing jigsaw puzzles in IDA Freeware or poking around in DOSBox or GDB debuggers to see what happens other than crashes. The third activity is all about writing and testing C/C++ code. This could be satisfying when something actually works.

This video demonstrates the third activity, reimplementing a function. 412 lines of assembly code are converted to 141 lines of C/C++ code in about an hour.


Now that this is finished, there are only 2664 more functions to go.