《更好的解释(数学篇)》——简介

汇编语言Hello, world![Windows版]

λ posted @ 2011年6月28日 13:02 in Mixture with tags ASM , 5709 阅读

在Windows下想見識彙編語言的小樣,其實暫時不需要安裝什麼彙編工具,Windows自古以來就有了——DEBUG.EXE,它就呆在C:\Windows\System32這系統路徑下呢,直接把它糾出來開始工作吧。

首先按Win+R打開運行框,接著輸入cmd(Win98用戶則輸入command……),接著便如圖進行吧:

彙編helloworld

最後我隻補充幾點:

  • DEBUG.EXE中使用的數字默認為十六進制;
  • 代碼左邊的0B8F:XXXX是內存地址,在不同的機子上是不同的,不過我們都是在XXXX:0100處開始彙編的,故不用擔心;
  • 兩個寄存器BX:CX合起來的數表示程序大小,亦即32位二進制無符號數能表示的大小(4GB);
  • COM格式的運行程序,定義數據(如上面的DB 'Hello, world!$')要放到最後;

看,才17字節大的helloworld,對比一下用C語言寫出來的大傢伙(一般都幾十或幾百KB),就能知道直接用彙編語言寫多麼省事了。

可是……僅僅用DEBUG.EXE是無法提高開發彙編程序的速度的,故我們要用到另外一個工具——MASM Plus,這是一位彙編大牛寫的~以後我們會多多用到的!


本網站無註明「轉載」的著作均由Jak Wings製作 CC BY-NC-SA 2.5
Creative Commons 保持署名-相同方式分享 2.5

  • 无匹配
Avatar_small
Plux 说:
Oct 08, 2011 06:32:21 PM

64位的win 7好像把debug删掉了……

Avatar_small
λ 说:
Oct 09, 2011 04:10:11 AM

-_-;; 这个……我都嫌 32 位的 Win7 运行不了 16 位程序了(恨),想必 64 位的也恨 32 位了……

Mike 说:
Oct 23, 2011 10:14:35 AM

其实linux下只要有gcc就会有gas,shell下输入as回车就是。

Avatar_small
λ 说:
Oct 23, 2011 12:00:52 PM

Orz.. 竟然32/64位都能生成

Emma 说:
Feb 01, 2023 10:08:01 PM

DEBUG.EXE has been around since the dawn of Windows and continues to be a great resource for anyone wanting to understand Lab grown diamonds assembly language. It's easy to access, all you need to do is open the run box (Win+R) and type "cmd" (or "command" for Win98 users). With DEBUG.EXE, you can quickly gain insight into the inner workings of Windows and start to get familiar with assembly language.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter