To enable MASM (Microsoft Macro Assembler) in Visual Studio, you must first ensure you have the Desktop development with C++ workload installed via the Visual Studio Installer. Once installed, follow these steps to enable MASM inside your project:
1. Create an Empty C++ Project
- Open Visual Studio and select Create a new project.
- Choose Empty Project (under C++ / Windows / Console) and click Next.
- Name your project and click Create.
2. Enable MASM Build Customization
- In the Solution Explorer on the right side, right-click on your Project Name (not the Solution name).
- Navigate to Build Dependencies and click on Build Customizations…
- In the list that pops up, check the checkbox for masm (Microsoft Macro Assembler).
- Click OK to apply.
3. Add an Assembly Source File
- In the Solution Explorer, right-click the Source Files folder (or your project name), then select Add > New Item…
- Select C++ File (.cpp) from the center menu.
- At the bottom, change the file name and replace the
.cppextension with.asm(for example,main.asm). - Click Add.
4. Verify the File Properties
Visual Studio usually routes .asm files to the assembler automatically after following the steps above, but you should verify it:
- Right-click your newly created
.asmfile in the Solution Explorer and select Properties. - Ensure the Item Type dropdown is explicitly set to Microsoft Macro Assembler.
- Click OK.
Note: MASM is highly dependent on whether you target a 32-bit or 64-bit architecture. Ensure your build configuration dropdown in the top toolbar matches your intended assembly code (e.g., switch from x64 to x86 if you are writing standard 32-bit assembly or using libraries like Irvine).
- l. LETS STARTED WITH ASSEMBLY NOW
SAMPLE OF CODE :
https://drive.google.com/drive/folders/1HuGnBZrwH53F7etyH2NZq29X1xuE9R3j?usp=sharing