Breaking News

How to run your first Assembly Language Program using 8086 MASM Assembler and Dosbox at windows

If you are a beginner in assembly language, running your first program on a 64-bit Windows operating system may be difficult. However, I can help you with this. To begin with, download MASM and DosBox software.
1. MASM

After that, extract the MASM file into the 'C' drive, which will create a folder named 8086, and then install DosBox.

Once you have completed the installation, open the DosBox application from your desktop screen. You will see two files:

MASM assembler and Dosbox

Now, type 'mount c c:\8086' and press Enter, followed by 'c:' and press Enter again. You are now ready to write your first program. Open an editor by typing 'EDIT program_name.ASM', and a new window will appear as shown below where you can write your program:

8086 programming in Dosbox

For example, I have provided a sample program for you to try. 
.................................................................................................>

.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'HELLO!$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG
MOV AH,9
INT 21h
MOV AH,4CH
INT 21h
MAIN ENDP
END MAIN
....................................................>

You need to save the file with an extension '.asm', such as 'hello.asm.' 

8086 microprocessor programming

Once you have saved the program, exit the editor, and you will be returned to the previous DOSBox window. You should see 'C:>'.

Now you will write the following command:  
masm  program-name.asm
In our example, I will use the following command:
masm hello.asm
Then press Enter. You will see the following:

MASM assembler

Now, press Enter again. You will see the following:

assembler

Press Enter again. You will see the following:

8086 programming

If there are any errors or warnings, you will be notified of them, and you need to correct them by typing 'EDIT program_name.ASM.' Once you have fixed the issues, type 'link program_name_without_extension'. In our example, we use the following:
LINK  hello
Press Enter. You will see the following:

assembly language programming

Finally, type 'program-name.exe' .For our example, it would be: 
hello.exe
To exit the DOSBox window, type 'exit'.

1 comment:

Thank you for visiting my blog.

Designed By