Setting up Visual Studio for Assembly MASM

What is MASM ?

The Microsoft Macro Assembler (MASM) is an x86 assembler that uses the Intel syntax for MS-DOS and Microsoft Windows.

Let’s start

1. Create project

Create a new project -> Select Empty Project(C++)

2. Make the directory clean (Optional)

Delete Header Files And Source Files directory.

3. Create MASMTest.asm

Select project and right click -> Add -> New Item

4. Select Build Customization

Select project and right click -> Build Dependencies -> Build Customiztions

5. Set Item Type

Select MASMTest.asm and right click -> Properties

Select Microsoft Macro Assembler

6. Write test code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; MASMTest.asm - add two 32-bit integers
; HardyHu

.386
.model flat, stdcall
.stack 4096
ExitProcess proto, dwExitCode:dword

.data

sum DWORD ?

.code
main proc
mov eax, 7
add eax, 4
mov sum, eax

invoke ExitProcess, 0

main endp
end main
ASM

7. Run and Debug

Break point and run

Run to line 16

Run to line 17

No Registers or Memory Windows ?


Setting up Visual Studio for Assembly MASM
https://www.hardyhu.cn/2021/12/30/Setting-up-Visual-Studio-for-Assembly-MASM/
Author
John Doe
Posted on
December 30, 2021
Licensed under