windows組合語言開發環境搭建

來源:互聯網
上載者:User

標籤:--   彙編   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組合語言開發環境搭建

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.