MASM setup for windows (complete guide)

masm setup
Hey folks! 
This post is regarding How to install MASM software (Microsoft assembler) for running assembly language codes in your PC.
In this Tutorial, I'm going to tell you how to setup 8086 microprocessor programming environment using MASM by virtually running the MASM in DOS Box.

Follow the steps:
1. Firstly, download the MASM required files from - here (It's less than 2 MB in size).
2. Extract the downloaded zip file and you will find two folders named as "DOSBox-0.74" and "8086". (see the image below)
8086 & dosbox

3. Move the folder "8086" into the "C:\" directory of your PC's hard disk.
4. Now open your "DOSBox-0.74" and find the "DOSBox.exe" launcher. Launch it by a double click.
dosbox



dosbox screen

5. Now Type the exact lines found below in the DOSBox and hit enter.

"mount c c:\8086\
 You will find something like this,(see the image below)

mount c drive
   
6. Next, type "c:" and hit enter to get into C drive through DOSBox.(see the image below)

enter into c:

7. Now you are ready to compile and execute .asm programs.

Now,
Compiling and executing .asm programs,

1. First, write the assembly language code in notepad(any text editors) and save it exactly in "C:\8086\" with a ".asm" file extension. 

2. Now that your assembly language code is present in "C:\8086\", go to DOSBox and get into C drive using the above said steps. 


3. Compile your code using the command,

"masm program_name.asm;"

4. Link your object file of the code using the command,
"link program_name.obj;"

5. Run your code using  commands:
"program_name.exe" to run it normally.

or type,
"afdebug program_name.exe" if you want to debug the code in the debugging

screen.

See the screenshots below, 

1. Running normally using "program_name.exe"

normal execution


2. Running in debugging mode using "afdebug program_name.exe"

advanced debug screen

Find the video tutorial on this post here



That's it. Enjoy microprocessor programming. Cheers!

He is a simple passionate tech freak who himself is an engineering student at Canara Engineering college. He likes App Development, Web designing, Blogging, Youtubing, Debugging and also is a CodeGeek!

Sharing is sexy!

Related Articles

9 comments

Write comments
Anonymous
AUTHOR
7 May 2016 at 12:29 delete

Yo thanks :)

Reply
avatar
Unknown
AUTHOR
19 January 2017 at 17:42 delete

Thanx for reporting. Fixed it now. Please check :)

Reply
avatar
Unknown
AUTHOR
7 February 2017 at 21:11 delete

Hi, while using afdebug command, the system is throwing "program too big to fit in memory" error. And is not entering into debug mode. Kindly give a solution.

Reply
avatar
Unknown
AUTHOR
8 February 2017 at 02:00 delete

May be you are using a very long code which exceeds your virtual memory. Google search this problem. You can find many posts containing fix for this.

Reply
avatar
Anonymous
AUTHOR
31 August 2017 at 01:06 delete

Illegal command : afdebug

WHY?

Reply
avatar
Anonymous
AUTHOR
3 April 2018 at 19:00 delete

it is because you are running a windows version which is no longer supported by Microsoft Inc.
Please upgrade to latest Version and try again

Reply
avatar
Unknown
AUTHOR
26 February 2022 at 15:10 delete

after installing
C:\> masm aaaaa.asm
illegal command: masm.

messgae is came how to resolve it

Reply
avatar

Share your views about this article!