Assembly Language Programming Tutorial
Run your first program in Assembly Language using Visual Studio
1. First of all, download and installVisual Studio Community 2017
2. Open Visual Studio
3. Create New Project from
File > New > Project.
4. Select option for your project as visual studio allow you to program in a lot of languages, to write a program in assembly follow the following steps:
Installed > Templates > Visual C++ > Win32 > Win32 Console Application
Save the source file with .asm extension
6. Now to make your assembler work, you have to set a few options, Right click your project name and open build dependencies.
Select masm and click ok.
7. Now right click your program file name and open properties.
8. In Item Type select Microsoft Macro Assembler from drop down.
9. In Excluded from Build select No.
Copy the following code into your source file.
; AddTwo.asm - adds two 32-bit integers
; Chapter 3 example
.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.code
main PROC
mov eax,5
; move 5 to the eax register
add eax,6
; add 6 to the eax register
INVOKE ExitProcess,0
main ENDP
END main
; Chapter 3 example
.386
.model flat,stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.code
main PROC
mov eax,5
; move 5 to the eax register
add eax,6
; add 6 to the eax register
INVOKE ExitProcess,0
main ENDP
END main
10. Put a break point in your program and run your program.
If any window is not visible to you you can view it by selecting from
Windows > Registers
Right click register window to view status flags.
Now press F10 to see step by step execution of your program.
Congratulations! Your first program in assembly has run successfully.
Let me know in the comment section if you have any question.
Previous Post:
Run your first program in assembly language using emu 8086
Previous Post:
Run your first program in assembly language using emu 8086