Sunday, September 23, 2012

Assembly Programming with Visual Studio 2010/2012

Introduction 

This article provides a simple example on how to write a small program in x86 assembly language. The technologies used will be MASM (the Microsoft Assembler now distributed with Visual Studio) and Microsoft Visual Studio 2010 or Visual Studio 2012. Assembly programs offer the advantage of speed and full control over things that in other programming languages you cannot even touch. The example is a very simple example of basic text encryption and entails all basic assembly commands that one can use to start dealing with the magical realm of low level programming. And knowing how the computer responds at that level is crucial for someone who wants to be a programmer. Again, the main advice is one: EXPERIMENT! Try various commands you find in MASM manuals, change commands on your own, play with the memory and the registers.

Programming in Assembly

Programming in Assembly means telling the computer how to do things in a much more detailed manner than you would do with a High Level Programming Language (like C++). I have written a small introduction to assembly here. Assembly has everything to do with memory. Most of the time, you will have to move data from one place (register) of the memory to another place in the memory. This is conducted with the mov command. For example, the command...

mov     AscChar, al

...moves the contents of the AL memory register to the memory segment representing variable AscChar (this is the variable which holds the character entered by the user).

...
...

How to Use VS2010 to Write Assembly

Using Visual Studio to write an assembly program may be tricky. Specific steps are to be followed in order to be able to create your first MASM x86 assembly program with VS2010 / VS2012 (images from the configuration steps mentioned below are taken from here):

Expand the ‘Other Project Types‘ tree, Select ‘Visual Studio Solutions‘, and create a new ‘Blank Solution‘.

Inline image 1

File | Add | New Project…

Expand the ‘Other Languages‘, ‘Visual C++‘, ‘General‘ section and create a new ‘Empty Project‘.

Inline image 2

Now right click on the Project in the Solution Explorer and select ‘Build Customizations…‘.

Read more: Codeproject
QR: Inline image 3

Posted via email from Jasper-Net