This section discusses the basics of generating an executable file from an Assembly language source code file. There is also a discussion of the compiler options of conditional assembly and macros.
With the older versions of Microsoft Assemblers, there are two basic steps used to generate an executable file to run under DOS. The first step is to compile the Assembly language source code into an object file. The second step is to link the object file with any other object files necessary and any needed library routines to generate the executable file. With the new version of Microsoft Assembler, you can compile and link with a single command.
The following examples use the Microsoft Macro Assembler (ML) for compiling and linking operations. When using ML to compile Assembly language code, there are four default filename extensions used for the files. These are .ASM for the Assembly language file, .OBJ for the object files, .LIB for the library files, and .EXE for the executable file.
Instructions for compiling a program are specific to the compiling software product and there may be many different options. A simple way to compile is to enter the following at the DOS prompt:
This command performs a standard compile of the file with a .ASM extension and produces a file with the same name but with a .EXE extension that can be executed. An example of a command line with a compiler option follows:
ML /Fl filename.ASM
The /Fl is used to generate an Assembly language code listing which is helpful for finding program errors. The compiling phase is where you find most of the spelling and syntax errors.