(譯)win32asm例項-1 (轉)
1.0 - 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.
在你的asm工程夾(建議這個資料夾和masm包放在同一個區因而你可以在例子中使用相對的lib/include(庫/包含檔案)路徑)中建立名為“mosaic”的新目錄。
this Zfile and extract it's contents in your 'mosaic' folder: ?file=mosaic.mosaic_lesson_files">mosaic lesson files.zip:namespace prefix = o ns = "urn:schemas--com::office" />
這個zip檔案並把它的內容解到你的“mosaic”目錄中:mosaic lesson files.zip
1.1 - Basic files基本檔案
The contains the basic (almost empty) files for your project. Here's a short description of the files:
Zip包中有你工程的基本(幾乎為空)檔案。這些檔案的簡單描述:
Mosaic.asm
;===============================================================================
; Mosaic.asm
;===============================================================================
.486
.model flat, stdcall
option casemap: none
includelib masm32libkernel32.lib
includelib masm32libuser32.lib
includelib masm32libgdi32.lib
includelib masm32libcomctl32.lib
includelib masm32libcomdlg32.lib
include masm32includekernel32.inc
include masm32includecomctl32.inc
include masm32includecomdlg32.inc
include masm32includeuser32.inc
include masm32includegdi32.inc
include masm32include.inc
include mosaic.inc
.code
start:
end start
This file contains the for a asm file.
這個檔案包含了win32asm原始檔的。
.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: code segment
start: just a label, could be anything
end start: indicates that the entry point of your program is at a label called start.
.486: 說明用486及以上的指令。
.model flat, stdcall:定義(flat)和習慣(stdcall)
includelib / include: 這些包含Windows所需要的庫和包含檔案。Windows.inc中有基本的windows常量。Mosaic.inc包含你自有的常量。
.code: 選擇程式碼段
start: 只是一個標籤,可以為任何東西
end start:表明你的的入口點是位於一個名為start的標籤.
Mosaic.inc
;---- msgbox macro: usage MSGBOX "string to display" -------
MSGBOX MACRO msg:REQ
LOCAL @msg
.data
@msg msg, 0
.code
invoke 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:
在mosaic.inc中有一個小的宏來簡化MessageBox的使用。一個宏是一小塊可以包含變數(例如這裡的msg)的程式碼。你可以在你的程式碼中使用它,而且在彙編時將會被宏中的程式碼所取代。我不會立刻深入宏的細節。只要記住你可以在你的程式中使用一下程式碼來顯示一個訊息對話方塊:
msgbox "Your string to display"
make.bat
@echo off
ml /c /coff mosaic.asm
rc -r mosaic.rc
link /subsystem:windows mosaic.obj mosaic.res
pause>nul
Use this batch file to assemble and link your program. The rc command will compile your resources.
使用這個批處理檔案來彙編並連結你的程式。Rc命令編譯你的資源
resources
This folder contains some bitmaps and icons we will use in our program:
這個資料夾包含一些我們將要在我們程式中使用的圖片和圖示:
Big icon
(big.ico)
Small icon
(small.ico)
Toolbar buttons
(Toolbar.bmp)
Demo game picture
(demo.bmp)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-991725/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- python例項1Python
- 如何將獨立例項轉換成叢集例項EU
- JS 預編譯程式碼例項分析JS編譯
- [譯]使用JavaScript建立WebAssembly模組例項JavaScriptWeb
- [非專業翻譯] Mapster - 配置例項
- CSS 例項之翻轉圖片CSS
- [譯]在JavaScript中建立WebAssembly模組例項JavaScriptWeb
- keras轉tensorflow lite【方法二】直接轉:簡單模型例項Keras模型
- div前後翻轉效果程式碼例項
- CSS3旋轉效果程式碼例項CSSS3
- [譯]例項詳解防抖與節流(乾貨!!!)
- [譯] 用 WebAssembly 提速 Web App 20 倍(例項學習)WebAPP
- 深入剖析Vue原始碼 - 例項掛載,編譯流程Vue原始碼編譯
- [翻譯]返回導向程式設計例項入門程式設計
- [轉載] Python 機器學習經典例項Python機器學習
- php例項化物件的例項方法PHP物件
- 閉包學習 1--例項分析 ComposerStaticInitxx::getInitializer
- Excel vba 例項(1) - 批量製作工資表頭Excel
- 網頁倒數計時跳轉程式碼例項網頁
- 將RAC軟體轉換為單例項軟體單例
- OkHttpClient例項HTTPclient
- unittest例項
- jQuery 例項jQuery
- 例項詳解不同VLAN間通訊(轉發過程)
- 例項詳解構建數倉中的行列轉換
- Activiti的流程例項【ProcessInstance】與執行例項【Execution】
- [譯] Kubernetes 分散式應用部署和人臉識別 app 例項分散式APP
- 例項化list
- msfvenom使用例項
- 雙層 for 例項
- python socket例項Python
- pinctrl使用例項
- Draggable 拖拽例項
- 策略模式例項模式
- SQLMAP 例項COOKBOOKSQL
- Java例項教程Java
- ORM 例項教程ORM
- 類和例項
- Proxy例項set()