Assembly Language Programming Tutorial
Problem:
Write a program that print "Hello World" in Assembly Language.
Solution:
1. Create new file and save it as Hello World.asm
.model tiny ;code, data & program in 1 64K segment
.code ;code segment
MAIN PROC
MOV AH, 09h ;function to display a string
MOV DX, offset message ;offset of Message string terminated with $
int 21h ;DOS interrupt
MOV AH, 4ch ;funtion to terminate
int 21h ;DOS interrupt
ENDP
message db "Hello World $" ;Message to be displayed terminated with $(indicates end of string)
END MAIN
.code ;code segment
MAIN PROC
MOV AH, 09h ;function to display a string
MOV DX, offset message ;offset of Message string terminated with $
int 21h ;DOS interrupt
MOV AH, 4ch ;funtion to terminate
int 21h ;DOS interrupt
ENDP
message db "Hello World $" ;Message to be displayed terminated with $(indicates end of string)
END MAIN
3. Now compile the program and save the HelloWorld.com file.
5. You can see the output on the screen.
Output:
Previous Post:
Run your first program in assembly language using MASM