How to compile MESS (Win32)

(Last updated 19-Apr-2002)

(This document is based on "How to compile MAME (Win32)". Since the procedure for compiling MAME and MESS are virtually identical, these two documents are virtually identical)

Compiling means rebuilding the actual executable program from its source code. MESS is almost fully written in C, with some assembler hacks in speed-critical places. The Win32 version of MESS is compiled with MinGW, which is the minimalist Win32 port of a C compiler called GCC and its libraries.

This particular how-to is written for MESS 0.56, but with a bit of luck you can compile other versions with the help of this page. This how-to tells how to compile the Win32 version of MESS, which includes both the command line and GUI versions.

The MinGW development environment will be installed to C:\MINGW and MESS sources will be placed into C:\MINGW\MESS. Before beginning, you should make sure that you do not have the directories c:\mingw\ and c:\download\ yet. If you do have them, rename them to another name or simply delete them (if you are sure that there aren't any important files in there).

Remember, when you type commands into the command prompt, you should avoid making typos ;-) In this how-to, filenames and other static text are marked with the color brown and command lines or other information that you need to type in are marked with the color green.


1. Get Unzip

First of all, most files that are transferred over the Internet are compressed, to minimize download times and bandwidth costs. You might already have a Windows-based uncompressing utility, but since compiling MESS is done in a command prompt, a different kind of utility is necessary. Download the following file into the directory c:\windows\command\ so that the utility is accessible from any directory.

File name File size Description
unzip.exe 140kB This is the Info-ZIP uncompressing utility called UnZip/NT v5.41.


2. Get MinGW

Then you need the MinGW files. Make a new directory, for example c:\download\ and download the following files into that directory. Note that there may be newer versions of these files, but MESS is not verified to compile with any other versions of the following files.

File name File size Description
mingw_for_mame.zip 5517 kB This is the MinGW compile environment for use in Windows.


3. Uncompress MinGW

Next we will uncompress the MinGW files and set up some environment variables so that MinGW is functional. Open up a command prompt. You can find it either from under Start Menu - Programs, or you can simply select Run and type command.com into the dialog box. When you have it open, type cd \download and hit enter to change to the correct directory. After that, type

If you do not see the message "1 archive was successfully processed.", re-download the archives. If you get a "Bad commmand or file name", verify once again that you have unzip.exe in c:\windows\command\


4. Set up MinGW

Next we will have to set up the environment variables. To make the changes permanent, we will have to edit AUTOEXEC.BAT, which is a file that always gets run before Windows starts up. Type edit \autoexec.bat and hit enter. There might be a lot of things in there, so do not touch anything else than what you are told to.

Find the line which says something like PATH C:\WIN98;C:\WIN98\COMMAND (there might be some other directories defined after these two). Add ;C:\MINGW\BIN to the end of that line, so that it will look like PATH C:\WIN98;C:\WIN98\COMMAND;C:\MINGW\BIN (again, there might be something extra in there, leave them as they are). Take note that if you have added C:\DJGPP\BIN into that line, you should remove it. Now you can save the file (ALT-F then S) and quit (ALT-F then X) (These might differ depending on your language version of Windows). Then you will need to reboot your computer, to make the changes effective.

With systems that don't use startup files (such as Windows NT, 2000 or XP), you can instead type edit c:\mingw\mingw.bat and write SET PATH=%PATH%;c:\mingw\bin into it. You'll have to run this file (simply type c:\mingw\mingw to run it) before being able to use MinGW.


5. Compile MESS

Now you can compile MESS. Download the source ZIP into c:\download\

File name File size Description
mess056s.zip
2717 kB This is the source archive of MESS 0.56.

Go to the download directory by typing cd \download and uncompress the MESS sources by typing unzip mess056s.zip -d c:\mingw\mess\.

Then you can compile MESS. Type make -f makefile.mes and hit enter. This will finally compile MESS itself. If you want to compile the CPU optimized versions, type make -f makefile.mes I686=1 or make -f makefile.mes K6=1 instead of just make -f makefile.mes. It will take a lot of time, ranging from 15 minutes to an hour depending on your CPU speed, so go get yourself something to drink.

When the compilation is done, you can type dir. You should see a brand new MESS.EXE in there.

You also need to make the INI file, by typing mess -cc (an abbreviation of -createconfig).

Congratulations, you did it!


6. A new MESS appeared

To successfully compile a new version of MESS, you should NOT uncompress a new set of sources over an old version of MESS. Instead, rename the MESS directory to another name or simply delete it totally (if you are sure that nothing important is there), and then uncompress the new set of sources to an empty directory.


7. Then what..

Of course, the biggest advantage of building your own binary is the possibility to tinker around with the source files. For example, to try out drivers which are not fully working yet, take a look at the file mess/system.c with a normal text editor (like EDIT). The disabled drivers are marked with the text TESTDRIVER. Simply remove the TEST part from a driver you want to test, save the file and type make -f makefile.mes again. Remember, the license forbids you from redistributing binaries that contain systems which are disabled in the official versions. Naturally, there should not be any reasons to redistribute such binaries since this page makes it easy for everybody to build their own binaries.

You might notice that the UPX part takes an obscene amount of time. The simplest solution to avoid it is to just rename upx.exe to another name. If you do that, the make utility will give you an error and the file MESSDLIB.DLL is about 7 MB, but it will work fine.


8. Debug modes

To include the debugger functionality in your MESS executable, edit makefile.mes. Near the top you will see a text like "uncomment next line to include the debugger". Remove the # character from the next line, so that it only has DEBUG = 1 in that particular line. Save the file, type make -f makefile.mes clean and then make -f makefile.mes. To actually use the debugger, edit MESS.INI and find the line that says debug = no. Change it to debug = yes and save the file. In MESS, hit tilde ( ~ ) or key to the left of the key  1  to enter the debugger.