汇编语言的Hello World,汇编语言没有我想象的那么低级,它已经具备了不少高级语言的特性,代码也变得清晰,层次清楚,易于维护了。
a.asm
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
ml a.asm /subsystem:windows
生成a.exe后直接执行
是时候转变对汇编语言是低级语言的印象了。现在的宏汇编已经和高级语言没有太大的距离了。如下在的阶乘子程序:
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
用C语言来写:
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://ly4cn.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
不过C++2005自带的MASM没有 *.inc文件,连2003的h2inc.exe都不提供。据说M$有可能会发布MASM8.0版本的开发包,但是至今没有任何消息。很郁闷!!!
经过一翻搜索,终于找到第三方支持的MASM开发包。http://www.masm32.rantx.com/files/m32v9r.zip
支持网站:http://www.movsd.com/
http://spiff.tripnet.se/~iczelion/
最新的版本用的 MASM 是6.14版本。附加的inc和lib文件非常全面。
之所以不用更新版本的MASM是为了避免License问题。关于6.14版本与更高版本之间的兼容比较,可以参考:
http://www.masm32.com/mlcompat.htm
更全面的中文教程(yycnet.yeah.net翻译)地址在下面:
http://211.147.7.6:9999/flyfish/source/win32asm.chm
对Masm8.0有兴趣,并想知道其改进,可再参考MSDN Library中关于MASM的参考。