🖥️ Step 1: Download MASM and DOSBox
You’ll need two tools:
- MASM (Microsoft Macro Assembler) – for writing and assembling your 8086 code.
- DOSBox – an emulator that lets you run old DOS applications on Windows 10/11.
After downloading:
-
Extract MASM to your
C:
drive. This creates a folder:C:\8086
- Install DOSBox normally.
🔗 Step 2: Mount the 8086 Folder in DOSBox
- Open DOSBox from your desktop.
- Type the following commands:
mount c c:\8086 c:(code-box)
(Guide for you: 'mount c c:\8086' and press Enter, followed by 'c:' and press Enter again.)
This mounts the 8086 folder as drive C:
inside DOSBox.
✍️ Step 3: Write Your First Assembly Program
Use DOSBox’s editor to create your first program: You are now ready to write your first program. Open the editor by typing 'EDIT program_name.ASM', and a new window will appear as shown below where you can write your program.

Paste the following code:
Save the file as hello.asm and exit the editor.

Once you have saved the program, exit the editor, and you will be returned to the previous DOSBox window. You should see 'C:>'.
⚙️ Step 4: Assemble and Link the Program
Now you will write the following command to assemble your program:
masm program-name.asm
In our example, I have used the following command:masm hello.asm(code-box)
Then press Enter. You will see the following:
Now, press Enter again. You will see the following:
Press Enter again. You will see the following:
👉 “If there are any errors or warnings, they will be displayed. To fix them, open your file again by typing EDIT program_name.ASM
. Once corrected, reassemble the program.”
Now it is time to link your program. 'link program_name_without_extension'. In our example, we use the following:link hello (code-box)
Press Enter. You will see the following:
▶️ Step 5: Run Your Program
Finally, run the program:
hello.exe (code-box)
✅ You should see:
HELLO! (code-box)
🎉 Congratulations — you’ve just run your first 8086 Assembly Program!
To exit DOSBox:
exit (code-box)
❓ Frequently Asked Questions (FAQs)
Q1: Why do we need to assemble and link the program before running it?
.ASM
) is written in human-readable mnemonics. The assembler (MASM) converts it into object code (.OBJ
). The linker (LINK) then combines this object code with necessary system libraries to produce an executable (.EXE
). Without assembling and linking, the computer cannot run your program.Q2: Why do we use DOSBox instead of directly running MASM on Windows 10/11?
A: MASM 8086 is 16-bit software, which isn’t supported on 64-bit Windows. DOSBox emulates DOS so MASM can run.
Q3: Can I use TASM or emu8086 instead of MASM?
A: Yes. emu8086 is beginner-friendly with a built-in debugger. MASM + DOSBox is closer to real hardware usage.
Q4: Where should I place the MASM folder?
A: Place it in C:\8086
. This makes mounting easier (mount c c:\8086
).
Q5: How do I fix “Bad command or file name” error in DOSBox?
A: Ensure MASM.EXE is inside the mounted folder and you typed the mount command correctly.
Q6: Can I use Notepad instead of EDIT in DOSBox?
A: Yes. Write in Notepad/VS Code, then save as .ASM
in C:\8086
. Use DOSBox only to assemble and run.
Q7: Why doesn’t my message print correctly?
A: For INT 21h, AH=9
, strings must end with $
. Example: MSG DB 'HELLO!$'
.
Q8: What’s the difference between .MODEL SMALL
and .MODEL TINY
?
A: .MODEL SMALL
→ code & data in separate 64 KB segments. .MODEL TINY
→ everything in one 64 KB segment.
Q9: Can I run graphics programs in DOSBox?
A: Yes. Use INT 10h
BIOS interrupts for graphics. DOSBox supports both text and graphics modes.
Q10: How can I debug my assembly program?
A: Use DOS’s debug
tool (debug hello.exe
) or switch to emu8086 which has a built-in debugger.
Some useful program codes for practice
Did this tutorial help you? Comment below if you got stuck — I’ll reply with solutions!
it is helpful
ReplyDelete