- 浏览: 1323555 次
-
文章分类
最新评论
-
TryIT1993:
你好,我想问个问题,value代表的是什么值,是获胜的次数,还 ...
围棋博弈程序的实现与思考(1)——局面评估 -
zhiquanliu:
这个代码对于IE浏览器是有问题的 , 当按住ctrl 滚动滚轮 ...
JavaScript获取文本框光标的像素位置 -
comdevlihun:
有源码吗?
围棋博弈程序的实现与思考(7)——运行结果 -
wenjinglian:
taominghua 写道我就是一个码农,很迷茫.我不甘于落后 ...
我在淘宝这7年 -
taominghua:
我因为一首歌去想念一个人,喜欢一个城市去与一个人邂逅,因为这个 ...
因为一首歌,想念一个人?
Warriors of the Visual Studio, Assemble! (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.
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 ApplicationsFirst, you must install some version of Visual Studio or Visual C++ Express:
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 ProgramsClick 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:
A subdirectory named Examples will contain all the example programs shown in the book. Building a Sample Assembly Language ProgramPreliminary Step: Set Tab Size to 5Start 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 ProjectVisual 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:
You should see the following program in the editor window:
Later, we'll show you how to copy this program and use it as a starting point to write your own programs. Build the ProgramNext, you will build (assemble and link) the sample program:
In the output window at the bottom of the screen, you should see messages similar to the following, indicating the build progress:
If you do not see these messages, the project has probably not been modified since it was last built. No problem--just add a space somewhere in the document, save it, and try the Build command again. Run the ProgramSelect Start without Debugging from the Debug menu. The following console window should appear, although your window will be larger than the one shown here: The "Press any key to continue..." message is automatically generated by Visual C++ Express. Congratulations, you have just run your first Assembly Language program. Press any key to close the Console window.
Creating New Projects of Your OwnBefore long, you will want to create your own projects. The easiest way to do this is to copy the entire c:/Irvine/Examples/Project_Sample folder to a new location. Copy it to a folder in which you have read/write permissions. (If you're working in a college computer lab, a useful location is a portable USB drive. Then you can modify the program, build, and run it again. Step 5: Running the Sample Program in Debug ModeIn this step, you will set a breakpoint inside the sample program. Then you will use the Visual C++ debugger to step through the program's execution one statement at a time.
RegistersIf you want to display the CPU registers, do the following: Start debugging the program, then select Windows from the Debug menu. Select Registers from the drop-down list. The bottom window will display the register contents. Right click this window and check the item Flags to enable the display of conditional flags. You can interrupt a debugging session at any time by selecting Stop Debugging from the Debug menu. You can do the same by clicking the blue square button on the toolbar. To remove a breakpoint from the program, click on the red dot so that it disappears. Setting a BreakPointIf you set a breakpoint in a program, you can use the debugger to execute the program a full speed (more or less) until it reaches the breakpoint. At that point, the debugger drops into single-step mode.
You can remove a breakpoint by clicking its red dot with the mouse. Take a few minutes to experiment with the Debug menu commands. Set more breakpoints and run the program again. For the time being, you can use the F11 key to step through the program in the same way the F10 key did. Building and Running Other ProgramsSuppose you want to run another example program, or possibly create your own program. You can either edit and modify main.asm, or you can remove main.asm from the project and insert some other .asm file into the project.
Adding a File to a ProjectThe easiest way to add an assembly language source file to an open project is to drag its filename with the mouse from a Windows Explorer window onto the name of your project in the Solution Explorer window. A reference to the file (not a copy) will be inserted in your project's directory. Try this now:
Here is what you should see in the Console window, except that only your EAX register will have the same value as ours: When you press a key, the console window will close. Copying a source fileIf you want to make a copy of an existing file, use Windows Explorer to copy the file into your project directory. Then, right-click the project name in Solution Explorer, select Add, select Existing Item, and select the filename. Return to top or read about Project Properties settings. Building 16-bit Applications (Chapters 12-16)Only Chapters 12 through 16 require the building of 16-bit applications. Except for a few exceptions, which are noted in the book, your 16-bit applications will run under Windows XP and Windows Vista. If you plan to build 16-bit applications, you need to add two new commands to the Tools menu in Visual C++ Express (or Visual Studio). To add a command, select External Tools from the Tools menu. The following dialog will appear, although many of the items in your list on the left side will be missing: Step 1: Create the Build 16-bit ASM CommandClick the Add button and fill in the Title, Command, Arguments, and Initial directory fields as shown in the screen snapshot. If you click the buttons with arrows on the right side of the Arguments and Initial directory fields, a convenient list appears. You can select an item without having to worry about spelling: Click the Apply button to save the command. Step 2: Create the Run 16-bit ASM CommandClick the Add button again, and create a new command named Run 16-bit ASM: Click the OK button to save the command and close the External Tools dialog. Testing Your new 16-Bit CommandsTo test your new 16-bit commands, open the file named 16-bit.asm from the ch03 folder in the book's example programs. Select Build 16-bit ASM from the Tools menu. The following command window should appear, showing the successful execution of the assembler and linker, followed by a listing of all files related to this program: Press a key to close the window. Next, you will run the program. Select Run 16-bit ASM from the Tools menu. The following window will appear, although the contents of all registers except EAX will be different: Press a key to close the window. You have completed the setup for building and running 16-bit assembly language programs.
Project Properties SettingsYou might be interested to know more about how Visual C++ projects are set up for assembly language programs. Assuming that our sample project is still open, select Project Properties from the Project menu. Expand the entry under Configuration Properties. Then expand the entry named Microsoft Macro Assembler. This is what you should see: Click the entry named General under Microsoft Macro Assembler . Notice that the Include Paths option has been set to the c:/Irvine directory. This tells the assembler where to find files having a filename extension of ".inc". Here is a sample: Find the Linker entry under Configuration Properties. Select the Input entry, and notice that two filenames have been added to the Additional Dependencies entry. The user32.lib file is a standard MS-Windows file. The irvine32.lib file is the link library file supplied with this book. There must be at least one space separating the file names: Next, select Linker under Configuration Properties, and then select General. The Additional Library Directories option equals c:/Irvine, so the linker can find the Irvine32.lib library file: Select Linker under the Configuration Properties and select Debugging. Notice that the Generate Debug Info option is set to Yes: Select System under the Linker entry. Notice that the SubSystem option has been set to Console: We use the Console setting because it is easy for assembly language programs to write output to a text console (Command) window. This is the window you see when running cmd.exe from the Start > Run menu in Windows. Click the OK button to close the Project Property Pages window. Generating a Source Listing FilePrior to 7/26/06, the sample Visual Express projects in the book's download file did not generate source listing files. Here's how to change that behavior in a single project: Open the project. From the menu, select Project, select Project Properties. In the list box, select Microsoft Macro Assembler, then select Listing File. Set the Assembled Code Listing file option to $(InputName).lst .
Creating a Project from ScratchYou do not have to create your own projects completely by yourself. Quite frankly, it's a lot of work. We've placed a copy of the Project_sample project in each folder of the book's example programs. You can just add your own program to one of these projects. You can name a project anything you want, of course, but we will assume your project is named MyProject in the following examples, and that you will save it in the c:/temp directory. The commands are a little different, depending on which software you use: Visual C++ Express 2005 & 20081.Select New from the File menu, and select Project. 2.In the New Project window, select General, and select Empty Project as the project type: You probably will want to leave the Create directory for solution option unchecked. 3.Click the OK button to create the empty project. Visual Studio 2005 & 2008
You probably will want to leave the Create directory for solution option unchecked. Both Visual Studio and Visual C++ Express
![]() Click the OK button to close this window. 4.Next, you need to add some customizations. We will assume you installed the book's files in the c:/Irvine directory. Make all changes shown in the Project Properties Settings section of this document. If you installed the book's sample programs in some other location than c:/Irvine, you'll need to make appropriate changes to the project properties. 5.Select Build Solution. If your Output window is similar to the following message, you did everything right: 1>------ Build started: Project: MyProject, Configuration: Debug Win32
1>Linking...
1>Embedding manifest...
1>Build log was saved at "file://c:/temp/MyProject/Debug/BuildLog.htm"
1>MyProject - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped
MASM syntax highlightingWhen a text editor uses syntax highlighting, language keywords, strings, and other elements appear in different colors. Visual Studio and Visual C++ Express can highlight MASM reserved words and strings, as shown in the following example: This won't happen automatically, but you can create a syntax definition file named Usertype.dat that contains MASM keywords. Then when Visual Studio (or Visual C++ Express) starts, it reads the syntax file and highlights MASM keywords. Here are the required steps to set up MASM syntax highlighting in Visual Studio or Visual C++ Express: 1) Download the Usertype.dat file given here to a folder in which you have read/write permissions. If you are using Windows Vista, download to My Documents, or C:/temp, or any folder that doesn't have security restrictions. 2) Copy Usertype.dat to the C:/Program Files/Microsoft Visual Studio 9.0/Common7/IDE folder. If you are using Windows Vista, it will display a verification window before copying the file. 3) Open Visual Studio or Visual C++ Express, select Options from the Tools menu, select Text Editor, and select File Extension. On the right side of the dialog (shown below), enter asm as the extension, select Microsoft Visual C++ from the Editor list, and click the Add button. Click the OK button to save your changes. Close Visual Studio and restart it. Open your project and display an ASM file. You should see syntax highlighting in the editor.
Assembling, Linking, and Debugging with a Batch FileMany people like to use a Windows batch file to assemble and link programs. A batch file is a text file containing a sequence of commands that execute as if they had been typed at the command prompt. In fact, they are powerful enough to contain variables, loops, IF statements, and so on. The easiest way to run a batch file is to first open a Command window and then type the name of the batch file (along with arguments) at the command prompt. To open a Command window, you must execute a program named cmd.exe. We will make that easy for you. Step 1:Download a ZIP file containing the following items:
There are two different versions of the ZIP file:
Step 2: Extract the ZIP file into the c:/Irvine/Examples directory on your computer. Step 3: Do the following:
Type the following command to assemble and link a source file named main.asm: asm32 main You should see the following messages:
In fact, several files were produced.
If there were errors in the program, you would see error messages generated by the assembler. Here is an example: Assembling: main.asm You would then open the main.asm file with a text editor (such as Notepad), fix the errors, and run the asm32 batch file again.
Assembling Programs in Other DirectoriesNo doubt, you will want to assemble programs in various different disk folders, not just the batch_sample folder used in the foregoing example. All you need to do is copy the cmd.exe shortcut we gave you to your working directory, where your assembly language source files are located. When you double-click to run the shortcut, it will open a Command window in the current folder. Assembling, Linking, and Debugging
|
本文转载自Irvine的介绍 http://kipirvine.com/asm/gettingStarted/index.htm
相关推荐
勇士大战僵尸 warriors vs zombies.exe
Stickman Warriors 不一样的火柴人勇士 Unity横版格斗游戏项目源码C# 支持Unity版本5.4.3f1及以上 令人上瘾的清版游戏,具有硬核和逼真的物理游戏玩法。简单的控制,你可以执行惊人的特技和打击来击败你的对手。 ...
I added 2 shields for free, because your knights and warriors need all the help that can get! The models poly count ranges are around 350- 2000 poly, with the arrows being 30-50, this is so you can ...
Stickman Warriors - Super Dragon火柴人勇士- Unity火柴人横版格斗项目源码 支持unity2018.4.18f1版本及以上 你必须为生存而战,享受战斗生存游戏。你可以击败你的敌人是最高的duplex战士,是最后一个生存的挑战...
安装此扩展程序,并获得不同的高清照片和金州勇士队的壁纸,每一个新选项卡都会打开。 如果您是勇士队的忠实粉丝,那么您肯定会喜欢这种扩展。 我们手动选择了NBA最好的球队之一的金州勇士队的篮球运动员的高清照片...
Get the answers to all these questions and many more using simple terms and sample code. Learn everything you need to use Redux to build complex and production-ready web applications.
勇士们认为赢得联赛首次冠军的胜利。使用每个新选项卡享受壁纸图像。 ★我们的金色州勇士主题中包含的内容?该延期提供了大量的金色州勇士壁纸。您可以选择幻灯片选择,享受良好的壁纸。您还可以洗牌所有壁纸,或...
Unity ASTS : Samurai Warriors_移动端一个游戏源码,链接:https://pan.baidu.com/s/1n2jQJbJdTjtBhEEFEJ6bhQ,购买之前请先确认链接可用,文件里是链接密码。资源仅供大家学习交流,下载的文件很小,是因为这是...
勇士机器人 勇士机器人,社区百分百开发 如何参与Bot的开发? 您可以通过不同的方式参与: 通过记录未记录的代码 通过更正代码(错误补丁,代码优化等) 通过为机器人编码或提供新功能 该文件 该文档是代码中的...
武士传说项目源码 ASTA Samurai Warriors u5.6.zip
unity3d 游戏角色模型 Warriors and Commoners 资源包
Design.warriors.guide.to.FPGA.pdf FPGA进阶书籍
JavaScript The Web Warrior Series(6th) 英文无水印pdf 第6版 pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有...
unity3d 游戏角色模型 Warriors and Commoners 资源包.zip模型资源unity模型资源下载unity3d 游戏角色模型 Warriors and Commoners 资源包.zip模型资源unity模型资源下载unity3d 游戏角色模型 Warriors and ...
CodeWars Kata解决方案C#(C Sharp) 概述 我使用C#8.0 .Net Core 3.1...在Visual Studio 2019或JetBrains Rider中打开一个项目。 git clone https://github.com/a-kozhanov/codewars-csharp.git 执照 麻省理工学院
勇士 我们认为,与乳腺癌作斗争的人不应被称为幸存者或患者。 他们是勇士,在文档中,我们会这样称呼他们。 问题 乳腺癌是女性中最常见的癌症之一,其精神和情感影响比其他类型的癌症更为严重(Ramezani,2001; ...
Course.Technology.Wizards.and.Warriors.Massively.Multiplayer.Online.Game.Creation
NC-Warriors-网站该应用程序将替代当前的NC Warriors网站 。 新网站将提供更流畅的用户交互。 还可以让玩家登录并查看某些玩家统计信息。产品特点家当前功能未来功能导航栏通过导航到其他页面来更新导航栏玩家概述...
手腕战士 终点 POST / api / v1 / user 创建用户。 需要有效载荷:typeOfCreate:“ fitbit”。 需要有效负载:fitbitToken。 PUT / api / v1 /用户 更新fitbit令牌。 必须对会话进行身份验证。...