From the previous post we have learned to install DOSBox and to configure it so that we can run the programs written in Assembly Language. Now we have to write the hello world program and need to run that program using DOSBox.
Step 01 Open notepad or any other text editor
First of all we need to open Notepad or any other text editor. To open notepad press Windows Key+R and then type Notepad into the command box, finally press the Enter Key.
Step 02 Type the program given below
Now type the codes given below...
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'Hello World!$'
.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
.STACK 100H
.DATA
MSG DB 'Hello World!$'
.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
Step 03 Click on Save As...
Now we need to save the text document with .asm extension. That's why we need to click on File from the menu, then we need to click on Save As... as shown in the image below.
Step 04 Save the file with .asm extension into the folder 8086
After clicking on Save As... , a pop-up window will open as the image given below. Now we have to provide our expected name with .asm extension and most importantly we have to save the .asm file into the directory Local Disk(C:)>8086.
Step 05 Run the DOSBox and mount the C Drive
Now we need to run DOSBox to execute our hello world program. After running the program we will get a window like the image below. Then we need to type mount c c:/8086 and need to press the Enter Key.After pressing the Enter Key there will appear a message Drive C is mounted as local directory c:/8086\.
Step 06 Type c: and press the Enter Key
In this step we have to type c: and need to press the Enter Key again.
Step 07 Run the hello world program
Now type masm hello.asm and press the Enter Key several times till appearing c:\>. Then type link hello and again press the Enter Key several times till appearing c:\>. Finally type the file name hello and press the Enter Key, then the Hello World! message will appear on the screen.
No comments:
Post a Comment