一个简单的汇编程序?
我最近学习了如何从 MSVC++ IDE 使用 MASM,为了测试它是否有效,我想运行一个简短的程序。
但是,我还不知道任何汇编(我所做的毫无用处:即:即使我知道 C++ 中的 i+=1;
是什么,但没有 我什么也做不了) int main()
)。
那么在哪里可以找到类似于 C++ 中使用的 helloworld 程序的简单汇编程序呢? (它实际上不必显示“Hello,World!”,它只需要执行一些操作,以便我可以确保我的设置有效)。
I've recently learned how to use MASM from MSVC++ IDE, and to test whether it works, I would like to run a short program.
However, I don't know any assembly yet (that which I do is useless: ie: even though I know what i+=1;
is in C++, I can't do anything without int main()
).
So where can I find a simple assembly program akin to the helloworld program used with C++? (It doesn't actually have to display "Hello, World!", it just has to do something so that I can make sure the set-up I have works).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是 MASM 在线文档:
http://web.sau.edu/LillisKevinM/csci240/masmdocs/
这里是关于组装的权威教程:
http://webster.cs.ucr.edu/
我认为在这两者之间应该能够加快速度并开始编写程序。
Here is the MASM documentation online:
http://web.sau.edu/LillisKevinM/csci240/masmdocs/
Here is the difinitive tutorial on assembly:
http://webster.cs.ucr.edu/
I think that between the two of those you should be able to get up to speed and start writing programs.
为了让您快速入门,我建议您访问以下网站:
RADasm 和 WinASM。
从这些站点中,您可以找到一些示例、一些带有 IDE 和编译器的预打包下载。 通过这种方式,实际上很容易尽早编写一些 GUI 软件,但请注意,请仔细阅读有关 x86 汇编的内容。 查看wikibooks - x86 汇编器。
To get you into a quick start I would suggest the following sites:
RADasm and WinASM.
From these sites you can find some examples, some prepackaged downloads with IDE and compiler. This way it is actually pretty easy to do some GUI-software early on but be warned, take care to read about x86 assembly. Check out wikibooks - x86 assembler.
试试这个
解释:
1°_ 你正在让 nasm 搜索 _main 标签:
global _main
2°_ 你正在声明
_main
标签3°_ 你正在将两个 cpu 寄存器的值:
ax
和bx
分别更改为0x01
和0x02
4°_ '将
ax
和bx
的值递增5°_ 最后,您将跳转到
_main
,这意味着您处于无限循环中Try this
Explanation:
1°_ you're saying to nasm to search for a _main label:
global _main
2°_ you're declaring the
_main
label3°_ you're changing the value of two cpu registers:
ax
andbx
to0x01
and0x02
respectively4°_ you're incrementing the values of
ax
andbx
5°_ lastly, you're jumping to
_main
, this mean you are in a infinite loop您可能会发现这个网站很有趣:
用汇编语言编写 Windows 应用程序。 您可以下载“小而美”入门工具包,其中包含一个用汇编语言编写 Windows 程序的示例应用程序。
You may find this site interesting:
Authoring Windows Applications In Assembly Language. You can download The Small Is Beautiful Starter Kit which contains a sample application to write a Windows program in assembly.