I hope you still remember what is MASM. It is Macro Assembler from Microsoft. And as a programming tool, MASM (ML.EXE) is continously improved. You can get it by installing .NET Framework SDK. Version 8.00 was introduced with the release of VC 2005 and appears to be a reasonably reliable version to be used in serious 32-Bit and 64-Bit application development. MASM can write at the lowest possible level in an assembler with direct DB sequences in the code section. Many confuse the higher level simulations in MASM with the incapacity to write true low level code. MASM is the architypal MACRO assembler for the Windows platform and this macro capacity is powerful enough to emulate many forms of higher level constructions.
Nobody seems to have told this to the hundreds of thousands of developers who write executable programs and static (Lib) and synamic (DLLs) libraries for 32 bit Windows in MASM. In 32 bit Windows, MASM (ML.EXE) produces the identical COFF to Visual C/C++ (CL.EXE) so object modules written in either MASM or Visual C/C++ are interchangable. With MASM you have the choice of writing an object module in C/C++ and using it with a MASM application just as you can write an object module in MASM and use it with Visual C/C++. The difference with MASM is it is powerful enough to use a C/C++ compiler as an accessory to assembler programming. Means that you compile your C/C++ codes with /FA option to get the MASM codes, and manipulate the result as MASM code for later being compiled with ML.EXE.
Pretty nice huh? You can use MASM to write your high performance DLL or COM and call it from higher level DLL/COM that you maybe built using C/C++. If you already know P/Invoke, you can use DLLImport to call your libraries from your beloved .NET component. With this style of architecture, you can control many thing. Let CLR manage what it can does, and let you manage what do you really want, for example, performance. Not whole parts of your apps have to be implemented in MASM. You always have freedom to architecting your apps based on requirement.
What you write is what you get with MASM, "not What you see what you get". If you use some of the more common higher level capacities in MASM, you get the format it is written to create and this applies to the use of a stack frame for procedures and characteristics like jump length extension if a jump is too far away from the label it jumps to. In both instances you have options to change this, you can disable jump extensions if you want to and specify the jump range with SHORT or NEAR. With a procedure where you don't want a stack frame, you use a standard MASM syntax to turn the stack frame off and re-enable it after the procedure is finished. This technique is commonly used when writing reusable code for libraries where an extra register is required or where the stack overhead may slightly slow down the procedure.
MASM can be used to write from very simple code to extremely complex code. Just give it time, you will get its benefit one day. You decide what you want from MASM. The difference is that it is powerful enough to do both without the ugly and complicated syntax of some of the other assemblers around that don't have the parsing power that of MASM. Differing from some of the less powerful assemblers, MASM uses the historical Intel notation when it uses keywords like OFFSET as this correctly distinguishes between a fixed address within an executable image and a stack variable which is created at run time when a procedure is called. When MASM requires operators like BYTE PTR, it is to distinguish between ambiguous notation forms where the size of the data cannot be determined any other way.
MASM is also capable of writing many normal high level constructions like structures, unions, pointers and high level style procedures that have both size of parameter checking and parameter count checking but the difference again is that it is powerful enough to do this where many of the others are not. While you can write unreliable and impossible to debug code like some other assemblers must do, with MASM you have the choice to write highly reliable code that is subject to type checking. The real problem is that such capacities are technically hard to write into an assembler and while some of the authors of other assemblers are very higly skilled programmers, an individual does not have the resources or capacity of a large software corporation that has developed MASM over 23 years. If you still at University, thats the best moment to learn MASM!. Just invest to learn and trust me, one day you will gain benefit from economic point of view. If you want to follow my track in learning journey, here it is:
- Get Intel Processor Manual specific for your machine. Learning how computer really works is a fun.
- Buy one MASM book. I recommend Kip Irvine book. Assembly Language for Intel-Based Computers (5th Edition)
- Learn algorithm books (like famous Knuth books) and try to write from pseudo code to C/C++ and MASM as well.
Happy programming. I will share my experiences and enjoy yours as well.