標籤:-- 彙編 copyright nload 開發 --help format 輸出 搭建
1.下載軟體mash32
http://www.masm32.com/download/masm32v11r.zip
此軟體包含對彙編檔案的編譯和運行,下載後直接運行並解壓即可
2.配置環境變數
在系統內容中添加如下路徑:E:\masm32\bin
查看是否配置成功,可以查看ml和link命令是否OK
$ ml
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
usage: ML [ options ] filelist [ /link linkoptions]
Run "ML /help" or "ML /?" for more info
$ link
link: 缺少運算元
Try ‘link --help‘ for more information.
3.第一個彙編來源程式
assume cs:codesgcodesg segment mov ax,0123H mov bx,0456H add ax,bx add ax,ax mov ax,4c00H int 21H codesg endsend
此程式照抄教科書,其中包含虛擬碼和彙編代碼,彙編代碼最後會被CPU執行,虛擬碼不會被CPU執行。
編譯:
$ ml test.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.
Assembling: test.asm
link: 額外的運算元 "NUL"
Try ‘link --help‘ for more information.
雖然有警告,但是ml這一步已經完成,此步驟是將asm->obj
連結:
$ link test.obj test.exe
沒有報任何錯誤,必須要接後面的test.exe參數,否則會報錯。建議obj和exe檔案名稱一樣
運行:
$ test.exe
程式沒有任何輸出是因為此段代碼沒有向終端輸出任何資訊
總結:
通過mash基本完成對開發環境的搭建,正式開始組合語言學習之旅!!
windows組合語言開發環境搭建