Visual Studio 编写汇编程序的环境设置

Warriors of the Visual Studio, Assemble!

If you've recently purchased Assembly Language for Intel-Based Computers, 5th edition, you probably want to get the software set up so you can start working. This tutorial should make the process easier. If you're in a hurry to get started, you only need to read Item 1.

  1. Required setup for 32-bit applications
  2. Building 16-bit applications (Chapters 12-16)
  3. Project properties settings
  4. Creating a project from scratch
  5. Generating a source listing file
  6. Using the Visual Studio debugger
  7. MASM syntax highlighting
  8. Assembling, linking, and debugging with a batch file

Found an error in this document? Please email me immediately. Except where noted, all instructions in this document apply equally to Visual Studio and Visual C++ Express.


Required Setup for 32-bit Applications

First, you must install some version of Visual Studio or Visual C++ Express:
  1. If you have installed Visual Studio 2008 Professional or Team Suite, these products also contain the Microsoft Assembler 9.0.
  2. If you have installed Visual C++ 2008 Express Service Pack 1, it includes MASM 9.0.
  3. If you have installed Visual C++ 2005 Express, you must also download the Microsoft Assembler 8.0
    (see below).
Downloading Microsoft Express Editions

You can verify that the Microsoft Assembler is installed by looking for the file ml.exe in the /vc/bin folder of your Visual Studio installation directory, such as c:/Program Files/Microsoft Visual Studio 9.0/vc/bin.

Downloading and installing the Microsoft Assembler 8.0: Visit Microsoft's MASM 8.0 download site. Follow the download and installation instructions on the Microsoft page. If the link is broken, please let us know by email. Note that this MASM download only works with Visual C++ 2005 Express. MASM 8.0 is almost identical to MASM 9.0.

Next: Install the Book's Example Programs

Click this link to get the latest copy of the book's link libraries and example programs. The examples are stored in a self-extracting archive file that automatically extracts to the c:/Irvine folder. Unless you have some objection to using that location, do not alter the path. (Lab managers: you can designate c:/Irvine directory as read-only.) If you plan to change the installation location, read our instructions relating to changing project properties.

The folllowing files will be copied into the c:/Irvine directory:

Filename

Description

GraphWin.inc

Include file for writing Windows applications

Irvine16.inc

Include file used with the Irvine16 link library (16-bit applications)

Irvine16.lib

16-bit link function library used with this book

Irvine32.inc

Include file used with the Irvine32 link library (32-bit applications)

Link16.exe 16-bit linker

Irvine32.lib

32-bit link function library used with this book

Macros.inc

Include file containing macros (explained in Chapter 10)

SmallWin.inc

Small-sized include file, used by Irvine32.inc

make16.bat Batch file for building 16-bit applications

VirtualKeys.inc

Keyboard code definitions file, used by Irvine32.inc

A subdirectory named Examples will contain all the example programs shown in the book.

Building a Sample Assembly Language Program

Preliminary Step: Set Tab Size to 5

Start Visual C++ Express, and select Options from the Tools menu. Select Text Editor, Select All Languages, and select Tabs:

Set the Tab Size and Indent Size to 5.

Opening a Project

Visual Studio and Visual C++ Express require assembly language source files to belong to a project, which is a kind of container. A project holds configuration information such as the locations of the assembler, linker, and required libraries. A project has its own folder, and it holds the names and locations of all files belonging to it. We have created a sample project folder in the c:/Irvine/Examples directory, and its name is Project_Sample.

Do the following steps, in order:

  1. Start Visual Studio or Visual C++ Express.
  2. If you're using Visual Studio, select Open Project from the File menu. Or, if you're using Visual C++ Express, select Open, and select Project/Solution.
  3. Navigate to the c:/Irvine/Examples/Project_Sample folder and open the file named Project.sln.
  4. In the Solution Explorer window, click the + symbol next to the item named Project to expand it. Double-cli
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值