[Original] masm32 beginner's Guide

Source: Internet
Author: User
If you are using an assembly language to develop a program in windows, masm32 is a good choice.

(Use Google to search for masm32 .)

To do well, you must first sharpen your tools.

This article mainly describes three points for masm32 V8:

1. Basic usage
How to create, compile, link the source program file and run the generated executable file in masm32.

2. How to enable the online help function of masm32

3. Menu of ing qeditor

I. Basic usage
In the C:/pwin951/Temp folder, create test. ASM and generate test. EXE.

After installing masm32, open "Resource Manager" or "My Computer", enter the masm32 folder (assumed as C:/masm32), and double-click qeditor. exe
This enters the integrated development environment of masm32.

1. [This step is optional. the following optional steps are referred to as "optional"] enter the resource file, then, use the menu file-> save on the menu bar or the disk icon in the shortcut toolbar that represents the disk function. For the first time, enter the file name. Specify the extension. RC and save the disk. Note that if you compile the resource file in the integration environment, the file name must be rsrc. RC (case sensitive ).

2. [Optional] compile the resource file. Choose project> compile resource file from the menu bar. At this time, the system opens a DOS window to run the relevant batch processing files and report the results.

If the compilation is not successful, the information is (the specific error information varies with the error ):

Microsoft (r) Windows (r) resource compiler, version 5.00.1823.1-build 1823
Copyright (c) Microsoft Corp. 1985-1998. All rights reserved.

Using codePage 936 as default
Creating rsrc. Res
RC: rcpp-CP 936-f c:/pwin951/temp/rca83947-g C:/pwin951/temp/rda83947-drc_in voked-d_win32-PC /: /-e-I. -I.

Rsrc. RC.

Rsrc. RC (1): Error rc2135: file not found: mainicon. ICO.
Writing menu: 600, Lang: 0x409, size 128
Microsoft (r) Windows resourceObjectConverter version 5.00.1736.1
Copyright (c) Microsoft Corp. 1992-1997. All rights reserved.

Cvtres: Fatal error cvt1101: cannot open rsrc. res for reading
Press any key to continue...

The row number, error type code, and error message of the error statement are provided.
Close the DOS window with one click, modify the resource file according to the error message, save the disk, and re-compile.

TIPS:In qeditor.exe, you can jump to the specified row by ctlr + G.

Until the following successful information is displayed:

Microsoft (r) Windows (r) resource compiler, version 5.00.1823.1-build 1823
Copyright (c) Microsoft Corp. 1985-1998. All rights reserved.

Using codePage 936 as default
Creating rsrc. Res
RC: rcpp-CP 936-f c:/pwin951/temp/rca81843-g C:/pwin951/temp/rda81843-drc_in
Voked-d_win32-PC/:/-E-I.-I.

Rsrc. RC.
Writing menu: 600, Lang: 0x409, size 128
Microsoft (r) Windows resourceObjectConverter version 5.00.1736.1
Copyright (c) Microsoft Corp. 1992-1997. All rights reserved.

Press any key to continue...

The rsrc. Res and rsrc. OBJ files are generated. Close the DOS window with one click.

Enter the source program, and then use the menu file-> save on the menu bar or the disk icon in the shortcut toolbar to represent the disk function. Enter the file name for the first time. Specify the extension. ASM [C:/pwin951/temp/test in this example. ASM].

Compile the source program. Choose project> assemblier ASM file from the menu bar. In this case, the system opens a DOS window to run related batch files. A window named "/masm32/bin/asw..txt" is displayed.

If the Assembly fails, the following information is displayed (the specific error information varies with the error ):

Processing ing: C:/pwin951/temp/test. ASM
C:/pwin951/temp/test. ASM (60): Error a2006: Undefined Symbol: NULL
C:/pwin951/temp/test. ASM (60): Error a2114: invoke argument Type Mismatch: argument: 1

Volume in drive C is Liu
Volume serial number is 4061-17d7
Directory of C:/pwin951/temp

Test ASM 8,402 06-05-02 test. ASM
1 file (s) 13,010 bytes
0 Dir (s) 24,403,968 bytes free
Detailed error information is included. For example

C:/pwin951/temp/test. ASM (60): Error a2006: Undefined Symbol: NULL

Medium

C:/pwin951/temp/test. ASM is the file description of the source program file.
(60) 60 indicates the row number of the statements that cause errors in the source program.
Error a2006 a2006 is the error type code
Undefined Symbol: NULL indicates an error message.

In this case, modify the corresponding lines in the source program based on the information, save the disk, and re-compile it. The window displays the following successful information:

Processing ing: C:/pwin951/temp/test. ASM

Volume in drive C is Liu
Volume serial number is 4061-17d7
Directory of C:/pwin951/temp

Test ASM 8,401 06-05-02 test. ASM
Test OBJ 3,720 06-05-02 test. OBJ
2 file (s) 16,729 bytes
0 Dir (s) 22,298,624 bytes free

This includes information about the newly generated target file test. obj.

Links to the target file. Choose project> link OBJ file from the menu bar. At this time, the system opens a DOS window to run the relevant batch processing files, and the window named "/masm32/bin/lnk.txt" is displayed. The results are as follows:

Volume in drive C is Liu
Volume serial number is 4061-17d7
Directory of C:/pwin951/temp

Test ASM 8,401 06-05-02 test. ASM
Test OBJ 3,720 06-05-02 test. OBJ
Test EXE 4,608 06-05-02 test.exe
3 file (s) 16,729 bytes
0 Dir (s) 24,395,776 bytes free

This includes information about the newly generated executable file test. EXE.

Note: the failure to find the resource file is not an error. Therefore, if your program uses a window, the compilation and link are completed smoothly, but the program window is not displayed during running, however, you put the window information in the resource file, but the resource file has not been compiled or has not been compiled successfully.

Worker runs the generated executable file. Use the menu project> run program on the menu bar.

Have you seen the program running result?

If your program uses a window but does not see the window during running, it is likely that you put the window information in the resource file, but the resource file has not been compiled or compilation failed.

In short, it should be noted that after modifying the source program file or resource file, you must first save the disk and then perform subsequent operations. Otherwise, the error persists.

Functions and usage of other menu items in the project menu:

Assemble & link: compiles and links the source program, which is applicable to the situation where the resource file is not modified but the source program is modified.
Build all: Compile the resource file, compile the source program, and link the program. This is suitable for modifying both the resource file and the source program.

Console link OBJ file assembly console source code
& Console assemble Link
Console build all generate console executable programs

Ii. Enable the online help function of masm32
When using masm32 to write programs, a large number of Windows API functions are used. It is hard to remember the different parameters of many functions that can only be used for current queries.

Masm32 provides the online help function, but you must set it to "get it done ".

Press the function key F1 in qeditor. The help file is displayed ?. HLP not found? What should I do? Do it with me:

Choose tools> Change Editor settings. The window "Change quick editor Settings" is displayed. Find "F1 help file =?" In the list box under double click item to edit ?. HLP. What we saw just now ?. HLP is here. In the past, masm32 did not know where our help file was stored, so we can only specify the location by ourselves.

Double-click this item. In the displayed dialog box, enter the file description of the Help file we use. [for example, if my file is "C:/pwin951/help/win32.hlp ", is included with dlephi.], Or click the "Browse..." button to select from the select file dialog box. Click "save" and close the window.

Restart qeditor and place the cursor in an API function name, such as MessageBox. Press the function key F1 to help!

Note: After modifying the settings, you must restart qeditor to make the new settings take effect.

Iii. Menu of ing qeditor

The menu content of qeditor is saved in the file qeditor. ini, and the text of the menu item is changed to Chinese, then the Chinese version is finished (of course you need to use the Chinese version of Windows ).

Since qeditor. INI is a very important file, you must back up the file before modification. Be careful when modifying the file. The following is the Chinese content of the menu item text corresponding to the project menu.

;--------------------------------------------------------
; Do not edit this file manually, the sequence of settings
; Must be in the correct order and it must have the correct
; Number of settings otherwise the editor may not function
; Properly.
;--------------------------------------------------------

[Editor settings]
Masm32 version 6
Command.com
0
1
1
4
2
2
76
80
70
*
*
*
*
/Pwin951/help/win32.hlp
0
[Menu settings]
;------------------------------------------------------------
; File paths shocould have the drive added so that the relative
; Paths become absolute paths. This allows the tools to be
; Accessed from different drives on the computer.
;-----------------------------------------------------------

[& R project]
& R compile the resource file,/masm32/bin/Bres. Bat {B}
& A compile the source program file,/masm32/bin/assmbl. Bat {B}
-
& L link the target file,/masm32/bin/lnk. Bat {B}
Compile the source program and link the target file,/masm32/bin/build. Bat {B}
& B compile the resource file, compile the source program, and link the target file,/masm32/bin/bldall. Bat {B}
Run & makeit. BAT to generate the executable file, makeit. bat
-
& O link to the target file in the console,/masm32/bin/lnkc. Bat {B}
& C compile and link the console file,/masm32/bin/buildc. Bat {B}
& A generate the console executable file in one step,/masm32/bin/bldallc. Bat {B}
-
& R runtime program, using bw..exe

[& Tools]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.