(Translation) Win32ASM instance-1

zhaozj2021-02-16  48

1.0 - New Project new project

Create a new folder named 'mosaic' in your asm projects folder (it is adviceable to create this folder on the same drive as the MASM package so you can use the relative lib / include paths in the examples.

In your ASM project folder (suggesting this folder and MASM package in the same area, you can create a new directory named "MOSAIC" in the example in the example. .

Download this Zip file and extract it's contents in your 'Mosaic' Folder: Mosaic Lesson Files.zip

Download this zip file and unpack its content into your "Mosaic" directory: Mosaic Lesson Files.zip

1.1 - Basic Files basic document

The Zip Contains The Basic (Almost Empty) Files for Your Project. Here's A Short Description of the Files:

There is a basic (almost empty) document in the zip package. Simple description of these files:

Mosaic.asm

; ================================================== ==============================; mosaic.asm; =============== ============================================================================================================================================================================================================= ===============. 486.Model Flat, StdCallOption Casemap: NONE

includelib /masm32/lib/kernel32.libincludelib /masm32/lib/user32.libincludelib /masm32/lib/gdi32.libincludelib /masm32/lib/comctl32.libincludelib /masm32/lib/comdlg32.libinclude /masm32/include/kernel32.incinclude / masm32 / include / comctl32.incinclude /masm32/include/comdlg32.incinclude /masm32/include/user32.incinclude /masm32/include/gdi32.incinclude /masm32/include/windows.incinclude mosaic.inc.codestart:

End Start

This File Contains The framework for a win32 asm source file.

This file contains the framework of the Win32ASM source file.

.486: indicates to use the 486 assembly instructions.model flat, stdcall: defines the memory model (flat) and the calling convention (stdcall) includelib / include: These include the libraries and include files for the windows functions needed The windows. .inc includes basic windows constants The mosaic.inc contains your own constants..code:. select code segmentstart: just a label, could be anythingend start: indicates that the entry point of your program is at a label called start.

.486: Describe the assembly instructions with 486 and above. .Model flat, stdcall: Defines Memory Mode (FLAT) and Calling Customs (stdcall) include INCLUDELIB / INCLUDE: These contain libraries needed to be Windows functions and contain files. There are basic Windows constants in Windows.inc. Mosaic.inc contains your own constants. .code: Select code segment Start: just a label, you can be anything End Start: indicating that your program's entry point is a label named Start.

Mosaic.inc

; ---- MSGBOX Macro: Usage Msgbox "String to Display" ------- Msgbox Macro Msg: Reqlocal @ msg.data @ msg DB MSG, 0.CodeInvoke Messagebox, Null, Addr @msg, Addr Appname, MB_OK ENDM

In mosaic.inc there is a little macro to simplify the use of MessageBoxes. A macro is a piece of code that can contain variables (here msg for example), which you can then use in your code and will be replaced by the macro code When Assembling. I don't go into Details About Macro's Right Now, Just Remember You can show a msgbox in your program by using: There is a small macro to simplify the use of MessageBox in Mosaic.inc. A macro is a piece of code that can contain variables (eg, MSG here). You can use it in your code and will be replaced by the code in the macro when assembled. I will not immediately go deep into the details of the macro. Just remember that you can use the code in your program to display a message dialog:

MSGBOX "Your String to Display"

Make.bat

@echo offml / c / coff mosaic.asmrc -r mosaic.rclink / subsystem: windows mosaic.obj mosaic.respause> NUL

Use this Batch File To Assemble and Link Your Program. The RC Command Will Compile Your Resources.

Use this batch file to compile and link your program. RC command compiles your resource

Resources /

This Folder Contains Some Bitmaps and iCons We will use in our program:

This folder contains pictures and icons we want to use in our programs:

Big Icon (SMALL.ICO) Toolbar Buttons (Toolbar.BMP) Demo Game Picture (Demo.bmp)

转载请注明原文地址:https://www.9cbs.com/read-26621.html

New Post(0)