Jack sets up Win32 Assembler Development Environment Author: Jack Yang time: Link: http://blog.csdn.net/magus_yang/archive/2007/02/25/1514026.aspx1. Download and install ultraedithttp: // www.ultraedit.com/my installation is 12.20b%1official Chinese version, installation is not important. 2. Download and install masmhttp: // www.masm32.com/my installation is version 9, and the installation path is: D:/masm32 3. Make tool http: // 211.90.241.130: 22366/view. asp? Two make.exe tools in the file1_53compressed package are Microsoft (r) program maintenance utility version 1.50make.exe. The makefile syntax supported by make version 4.0 copyright (c) 1987,199 6 Borland International is similar to that supported by common options. Decompress nmake.exeand make.exe to the bin subdirectory of the masm32 installation directory. 4. Compile a batch file var. BAT for setting environment variables as follows: @ echo off
Rem modify the following masm32dir environment variable according to the installation directory of the masm32 package!
Set masm32dir = D: masm32
Set include = % masm32dir % include; % include %
Set Lib = % masm32dir % LIB; % lib %
Set Path = % masm32dir % bin; % masm32dir %; % PATH %
Echo on
Each time a new command line console is opened, the var. BAT file is executed. The effort-Saving Approach is to add environment variables to user variables or system variables. Run the following command to check the environment variable settings: C:/> echo % include % C:/> echo % lib % C:/> echo % PATH % 5. the content of makefilemakefile is as follows: EXE = test.exe # specify the output file
Objs = test. OBJ # target file
Res = test. Res # required resource file
Link_flag =/subsystem: Windows # connection options
Ml_flag =/C/coff # compilation options
$ (Exe): $ (objs) $ (RES)
Link $ (link_flag) $ (objs) $ (RES)
. ASM. OBJ:
ML $ (ml_flag) $ <
. Rc. Res:
RC $ <
Clean:
Del *. OBJ
Del *. Res
Note: 1) nmake uses the target file in the first rule of the MAKEFILE file as the final file by default. In this example, the final file named test.exe 2 must be enclosed with parentheses When referencing macros such as $ (exe), $ (objs), and $ (RES) 3). The line feed for makefile is "/". "/" cannot be followed by other characters, including comments and spaces. 4) some special predefined macros used to specify the file name in the implicit rule $ @-full path file name of the target file $ *-remove the extension of the target file from the full path file name $? -The file names of all source files (dependent files) $ <-the file names of source files (dependent files) 5) are explicitly defined in the following format:
Target file: Dependent File
Command 6) Definition Format of implicit rules:
. Source extension. Target extension:
Common commands used to compile and link a Win32 Assembler source program using MASM are: ml/C/coff xx. asmlink/subsystem: Windows xx. OBJ yy. lib ZZ. res (Common PE file) Link/subsystem: Console xx. OBJ yy. lib ZZ. res (console file) Link/subsystem: Windows/dll/DEF: AA. def xx. OBJ yy. lib ZZ. res (DLL file)
6. The following are common options for executing nmake.exe nmake :/? Show Help information/F specified description file (makefile) file Name/X Save the screen output information to a file./A force updates all files/B files. If the time is equal, the new and old file information will be displayed when the file/d make is updated./N display command to be executed during make, but not really execute/P make is to display detailed information macro definition overwrite the macro definition target in the description file (makefile) with the new definition specify to create a file described in the description file (makefile)
For example:
Make clean
Used to clear the temporary files generated during the compilation process, that is, execute the del *. OBJ and del *. Res commands;
Make test. OBJ
Only test. ASM is compiled to generate the test. OBJ file;
Make test. Res
Compile only test. RC generates test. res file; the development and debugging process of Win32 Assembler: compile the source program-> switch to the MS-DOS window-> type nmake compile-> run the generated executable file-> switch to the text editor to modify the source program ........ this round-robin debugging program. References: Chapter 2 of "32-bit assembly language programming in Windows" (version 2) by Luo yunbin