Skip to main content

Assembly Language: Configuration of Visual Studio

Setting up Visual Studio:

Introduction of Microsoft Visual Studio and configure it for Assembly Language Programming. 

Introduction to Visual Studio:

Visual Studio (for all its versions) is an integrated development environment (IDE) from Microsoft. It is a leading tool to develop computer programs, as well as web sites, web applications and web services.We could, however, use a stand-alone assembler like NASM or MASM to code in Assembly Language. Here is the configuration of Microsoft Visual Studio 2010 and provided below is the link of my YouTube channel that is showing the configuration of Microsoft Visual Studio 2012. The configuration of all the versions is SAME.

Configuring Visual Studio for Assembly Language:

Install the latest version (for 6th/7th edition) of Irvine’s link library from the link given below 
Once you have downloaded the required Irvine library, install it in your computer and verify that a folder named Irvine has been created in your C:\ drive. Now, follow these steps to configure
Visual Studio 2010.

1. Start Microsoft Visual Studio 2010. If you are running it for the first time then this would be the screen you may see

Select General Development Settings and press Start Visual Studio.


2. After startup, this would be the welcome screen



Click on the New Project link.


3. In the New Project dialog (shown in the image below), select Other Languages, select Visual C++, select General, and then select Empty Project. Give a name to the project (assume it Project2 for this tutorial). Now click the OK button.




4. Once your new project is created, press Ctrl+Shift+L to open Solution Explorer. In the solution explorer window, you would see your project’s file hierarchy. Now, right-click on your project in solution explorer and select Build Customization.



Tick the masm checkbox & select OK.



5. Right-click on Source Files in solution explorer & select Add > New Item.



Now go to Utility > Text File to add a new file, but we do not want to add .txt file, instead we want to add an .asm file. So, rename your new text file as Text.asm (we can choose any other name e.g. xyz.asm but for this tutorial we will use the name abc.asm).



6. Now right-click your project again and click Properties. Now click the tiny arrow marker besides Configuration Properties to expand it. Now click Microsoft Macro Assembler and expand it.



7. Now click General entry under Microsoft Macro Assembler and then set the value of Include
Paths as c:\Irvine. The menu should now like this



8. Click Listing File. Select Assembled Code Listing File option and set its value as $Project2.lst (we have written Project2 here. If you have given some other name to your project then it will be like $YourProjectName.lst).



9. Click Linker tab to expand it. Select General and set the value of Additional Library Directories to c:\Irvine.



10. Click Input, select Additional Dependencies. You will see a list of different .lib file name written there, do not alter any of those. Write irvine32.lib; at the start of the list like this



11. Click Debugging and make sure its Generate Debug Info option is set to Yes (/DEBUG).



12. Click System, select SubSystem and set its value to Console(/SUBSYSTEM:CONSOLE). Now click Apply and OK to close the Properties window.



Our Visual Studio 2010 configuration for Assembly Language is complete. We can now write a sample program and run it to test our project. Open abc.asm from the solution explorer by double-clicking it. The abc.asm file will contain all the code that we write in our program. Go on and copy the following code onto your abc.asm file.

TITLE My First Program (abc.asm)
INCLUDE Irvine32.inc

.code
main PROC
mov eax, 10h
mov ebx, 25h
call DumpRegs
exit
main ENDP
END main

Press Ctrl+F5 to see the output in console window.



As we can see in the output window, the program has affected two registers eax & ebx. Let us dissect our code line by line to see what it does. The first line TITLE MyFirstProgram (Test.asm) gives an optional title to our program. The second line INCLUDE irvine32.inc adds a reference to the include file that links your program to the Irvine library. The third line .code defines the beginning of the code segment. The code segment is the segment of memory where all your code resides. In the fourth line, a main procedure is defined. The fifth and sixth lines show a mnemonic mov instruction that ‘moves’ values 10h and 15h to eax and ebx, respectively. The radix h defines a hexadecimal constant. The lines seven and eight calls the procedure DumpRegs that outputs the current values of the registers followed by a call to windows procedure named exit that halts the program. The lines nine and ten mark the end of the main procedure. 

Comments

Popular posts from this blog

Data Structures: Primitive Operations

Primitive Operations  Primitive operations are the building blocks of the algorithm in the Data Structures. It help us to count the operations in any certain algorithm to calculate the time complexity of the algorithm. What is Data Structure? Data Structure is the systematic way of accessing and organizing data. What is Algorithm? Algorithm is the step by step procedure to perform the task in the finite amount of time. You might be thinking why is there a need to calculate the time complexity of the algorithm. Technically talking being a Computer Science student, it is too much necessary to calculate the run time to check the efficiency of the algorithm. The analysis is performed on the two basic factors that are: Run time  Space Usage There are two types of the analysis: Experimental Analysis Theoretical Analysis Experimental analysis is performed on the finite amount of data while the theoretical analysis is performed on all types of data so we can ...