1. Install masm32
Download on the official website: http://www.masm32.com/
2. Download Irvine32.inc and Irvine32.lib
https://cloud.189.cn/t/QzArYnN7J7Jf or https://download.csdn.net/download/wxwpxh/12249620 After unzipping, there is a 12M Irvine.zip file, and then unzip the library you need.
Or you can download it directly here masm32.7z (https://cloud.189.cn/t/f2m2ArrE7fuu), Irvine32.inc and Irvine32.lib are already in the Irvine subdirectory of the package. If you installed masm32 and downloaded Irvine libraries from the first two parts, modify the following environment setting script var.bat according to the path you installed or unzipped.
The following configuration was downloaded from https://cloud.189.cn/t/f2m2ArrE7fuu masm32.7z The package is decompressed directly to the D drive to set it up.
@echo off set include=D:\masm32\include;D:\masm32\Irvine set lib=D:\masm32\lib;D:\masm32\Irvine set path=D:\masm32\bin;D:\masm32;%path% echo on
4. Compile and run:
Place this var.bat in the source directory and execute it so that the compilation run environment is set up. Here are two examples of consol s and windows
Code 1: random.asm
; Demonstrate the random Procedure (random.asm) ;ml /coff random.asm /link /subsystem:console INCLUDE Irvine32.inc includelib Irvine32.lib INCLUDELIB Kernel32.lib INCLUDELIB User32.lib .data str1 BYTE "I love to sleep", 0 Base DWORD 10h .code main PROC call Randomize mov eax, 16 mov ecx, 4 call Crlf L1: push eax call RandomRange mul Base mov ebx, eax mov eax, Base call RandomRange add eax, ebx call SetTextColor mov edx, OFFSET str1 call WriteString call Crlf pop eax loop L1 mov eax, black * 16 + 10 call SetTextColor exit main ENDP END main
Compile and run:
D:\prg\Win32Asm\Irvine>var D:\prg\Win32Asm\Irvine>ml /coff random.asm /link /subsystem:console Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: random.asm Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /subsystem:console "random.obj" "/OUT:random.exe" D:\prg\Win32Asm\Irvine>random.exe I love to sleep I love to sleep I love to sleep I love to sleep
Code 2: msgbox1.asm
; MsgBox demo (msgbox1.asm) ;ml /coff msgbox1.asm /link /subsystem:windows Include Irvine32.inc Includelib Irvine32.lib Includelib kernel32.lib Includelib user32.lib .data msg BYTE "Plus_RE!",0 msgTitle BYTE "Test MsgBox",0 .code main PROC mov edx, OFFSET msg mov ebx, OFFSET msgTitle call MsgBox exit main ENDP END main
Compile and run: