I have been a big fan of assembly programming since my old school days. The raw power of CPU which you get is just pure awesome. But, with that power, you also get much headache of non-availablity of standard IDE’s for using Assembly language.
Visual Studio is one of the options, but it restricts you to the installed version of Microsoft Macro Assembler (ml.exe)
Some prefer using QEditor.exe which ships with MASM32 SDK
Some like me, just cannot stay away from there favourite editors such as Notepad++, Ultraedit etc.
The benefit of using editors such as Notepad++, Ultraedit is that you get fully customizable syntax highlighting and command line tools to be used while assembling and linking their programs. However, with these tools you have to add commands to both assemble and link your programs. And if you are like me, who fiddles with 16bit, 32bit and 64 bit assembly programs, you have to add seperate commands for them. And not to forget, seperate commands for outputting debug and release binaries as well.
To simplify the above process, I have been exploring the use of makefiles to assemble and link my programs and this has worked wonderfully well. I just maintain my each assembly project in seperate directory with the makefile and use that as a command to assembly and link the program from Notepad++, using NppExec plugin. Apart from Notepad++, I am using following tools as my development environment. You might be using different, but they can be applied in same concept.
- NMAKE(nmake.exe) v10.00.30319.01 which ships with Visual Studio 2010 available here
- Borland Resource compiler (brcc32.exe) v4.50 which ships with Borland compiler tools available somewhere on the net
- Microsoft Macro Assembler(ml.exe) v6.14 and Linker (link.exe) v5.12 which ships with Masm 32 SDK available here
Note that all the above tools should be put preferable in the PATH variable for easy access. I do this by creating a simple command script as follows:
I am going to show you some scenarios here on how I am using Makefiles to assemble and link my programs. Note that this is not a tutorial for using makefiles. I assume you have some basic familiarity with it.
- A Win32 Assembly program without the use of resources:
- A win32 Assembly program with the use of resources:
Now, Provided NMAKE is in your path variable, you can simply set a command in Notepad++ or in your favourite text editor to invoke nmake in current directory.
And to clean the output,