使用 Visual Studio 2008 汇编、链接、调试和执行 MASM 6.11 汇编代码
我想最大程度地使用 Visual Studio 2008,同时有效地编译/链接/构建/等代码,就好像所有这些构建过程都是由 MASM 6.11 提供的工具完成的一样。 MASM 的确切版本并不重要,只要它在 6.x 范围内即可,因为这是我的大学用来教授 16 位汇编的版本。
我对此主题做了一些研究,得出的结论是有几个选项:
- 重新配置 VS 以使用相同的标志调用 MASM 6.11 可执行文件,等等,就像 MASM 6.11 本身所做的那样。
- 创建由 VS 调用的中间批处理文件,然后为 MASM 的链接器等调用正确的命令。
- 重新配置 VS 的内置构建工具/规则(汇编器、链接器等)以提供与 VS 使用的环境相同的环境MASM 6.11。
当我意识到 VS 的“外部工具”界面中可用的选项可能不足以正确调用 MASM 的构建工具时,提出了选项(2),因此解释 VS 传递参数的严格方法的批处理文件可能会有所帮助,因为很多我学习如何实现此功能的过程涉及从命令提示符手动调用 ML.exe、LINK.exe 等。
下面是几个可能对回答我的问题有用的链接。 请记住,我已经阅读了所有这些内容,但没有一个是真正的解决方案。 我只能希望我指定的 MASM 6.11 不会阻止任何人贡献一个可能更普遍的答案。
与选项(2)类似的方法,但该线程上的用户无法联系:
http://www.codeguru.com/forum/archive/ index.php/t-284051.html
(另外,我对中间批处理文件的必要性存有疑问)
对我的问题的过时解释:
http://www.cs.fiu.edu/~downeyt/cop3402/ masmaul.html
可能是我最接近最终解决方案的东西,但指的是除了 MASM 之外的一套工具,还使用批处理文件:
http://www.kipirvine.com/asm/gettingStarted/index.html htm#16-bit
如果我在代码的每个步骤中使用的工具的术语 -> ,我深表歉意。 exe 进程已关闭,但由于我试图重现完成编写代码和生成可执行文件之间的整个步骤,因此我认为这并不重要。
I would like to use Visual Studio 2008 to the greatest extent possible while effectively compiling/linking/building/etc code as if all these build processes were being done by the tools provided with MASM 6.11. The exact version of MASM does not matter, so long as it's within the 6.x range, as that is what my college is using to teach 16-bit assembly.
I have done some research on the subject and have come to the conclusion that there are several options:
- Reconfigure VS to call the MASM 6.11 executables with the same flags, etc as MASM 6.11 would natively do.
- Create intermediary batch file(s) to be called by VS to then invoke the proper commands for MASM's linker, etc.
- Reconfigure VS's built-in build tools/rules (assembler, linker, etc) to provide an environment identical to the one used by MASM 6.11.
Option (2) was brought up when I realized that the options available in VS's "External Tools" interface may be insufficient to correctly invoke MASM's build tools, thus a batch file to interpret VS's strict method of passing arguments might be helpful, as a lot of my learning about how to get this working involved my manually calling ML.exe, LINK.exe, etc from the command prompt.
Below are several links that may prove useful in answering my question. Please keep in mind that I have read them all and none are the actual solution. I can only hope my specifying MASM 6.11 doesn't prevent anyone from contributing a perhaps more generalized answer.
Similar method used to Option (2), but users on the thread are not contactable:
http://www.codeguru.com/forum/archive/index.php/t-284051.html
(also, I have my doubts about the necessity of an intermediary batch file)
Out of date explanation to my question:
http://www.cs.fiu.edu/~downeyt/cop3402/masmaul.html
Probably the closest thing I've come to a definitive solution, but refers to a suite of tools from something besides MASM, also uses a batch file:
http://www.kipirvine.com/asm/gettingStarted/index.htm#16-bit
I apologize if my terminology for the tools used in each step of the code -> exe process is off, but since I'm trying to reproduce the entirety of steps in between completion of writing the code and generating an executable, I don't think it matters much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有一个 MASM 规则文件位于(32 位系统删除
(x86)
):将该文件复制到您的项目目录,并将其添加到您项目的自定义构建规则中。 然后“修改规则文件...”,选择MASM构建规则和“修改构建规则...”。
添加属性:
将“附加依赖项”值设置为[AdditionalDependencies]。 构建现在应该自动检测对
*.inc
的更改,并且您可以编辑单个 asm 文件的属性以指定其他文件。There is a MASM rules file located at (32-bit system remove
(x86)
):Copy that file to your project directory, and add it to the Custom Build Rules for your project. Then "Modify Rule File...", select the MASM build rule and "Modify Build Rule...".
Add a property:
Set the Additional Dependencies value to [AdditionalDependencies]. The build should now automatically detect changes to
*.inc
, and you can edit the properties for an individual asm file to specify others.您可以创建一个 makefile 项目。 在 Visual Studio 中,在“文件”/“新建”/“项目”下,选择“Visual C++”/“Makefile 项目”。
这允许您运行任意命令来构建您的项目。 它不一定是 C/C++。 它甚至不必是传统的 NMake makefile。 我使用它通过批处理文件和 NAnt 脚本编译驱动程序。
让它运行 MASM 6.x 工具链应该相当容易。
You can create a makefile project. In Visual Studio, under File / New / Project, choose Visual C++ / Makefile project.
This allows you to run an arbitrary command to build your project. It doesn't have to be C/C++. It doesn't even have to be a traditional NMake makefile. I've used it to compile a driver using a batch file, and using a NAnt script.
It should be fairly easy to get it to run the MASM 6.x toolchain.
我建议根据文件扩展名定义自定义构建规则。
(Visual Studio 2008,至少在专业版中,可以生成可以分发的.rules 文件)。 在那里您可以为 asm 文件定义自定义构建工具。 通过使用这种方法,您应该能够保持链接器步骤不变。
早些时候,我们使用 MASM32 链接文本 作为 IDE 来帮助学生学习汇编。 您可以检查他们的批处理文件,他们如何进行组装和链接。
I would suggest to define Custom Build rules depending on file extension.
(Visual Studio 2008, at least in Professinal Edition, can generate .rules files, which can be distributed). There you can define custom build tools for asm files. By using this approach, you should be able to leave the linker step as is.
Way back, we used MASM32 link text as IDE to help students learn assembly. You could check their batchfiles what they do to assemble and link.
为什么不使用文件中定义的自定义构建步骤而不是批处理文件?
instead of batch files, why not use the a custom build step defined on the file?
如果您要使用 Visual Studio,您不能为他们提供一个 C/C++ 框架项目,其中包含调用具有空内联汇编块的函数的控制台应用程序的入口点,并让他们在其中填充结果吗?
If you are going to use Visual Studio, couldn't you give them a skeleton project in C/C++ with the entry point for a console app calling a function that has en empty inline assembly block, and let them fill their results in it?
你为什么不使用欧文的指南呢? Irvine 的库很好,如果您愿意,您可以忽略它并直接使用 Windows 进程。 我一直在寻找这样的指南,欧文的是最好的解决方案。
Why don't you use Irvine's guide? Irvine's library is nice and if you want, you can ignore it and work with Windows procs directly. I've searching for a guide like this, Irvine's was the best solution.