8086 program to print a String
Problem: Write an assembly level program to print a given string .
Examples:
Input String: "This is a sample string" Output: This is a sample string Input String: "Geeks for Geeks" Output: Geeks for Geeks
Explanation:
- Create a string
- Load the effective address of the string in dx using LEA command
- Print the sting by calling the interrupt with 9H in AH
- The string must be terminated by ‘$’ sign
Program
.MODEL SMALL .STACK 100H .DATA ;The string to be printed STRING DB 'This is a sample string', '$' .CODE MAIN PROC FAR MOV AX,@DATA MOV DS,AX ; load address of the string LEA DX,STRING ;output the string ;loaded in dx MOV AH,09H INT 21H ;interrupt to exit MOV AH,4CH INT 21H MAIN ENDP END MAIN |
chevron_right
filter_none
Output:
This is a sample string
Note:
The program cannot be run on an online editor, please use MASM to run the program and use dos box to run MASM, you might use any 8086 emulator to run the program.
Recommended Posts:
- 8086 program to find GCD of two numbers and print the GCD
- 8086 program to Print a 16 bit Decimal number
- 8086 program to print the table of input integer
- 8086 program to reverse a string
- 8086 program to check whether a string is palindrome or not
- 8086 program to search a number in a string
- 8086 program to transfer a block of 4 bytes by using string instructions
- 8086 program to transfer a block of bytes by using string instruction
- 8086 program to add two 8 bit BCD numbers
- String manipulation instructions in 8086 microprocessor
- 8086 program to subtract two 8 bit BCD numbers
- 8086 program to add two 16 bit BCD numbers with carry
- 8086 program for selection sort
- 8086 program to find the min value in a given array
- 8086 program to multiply two 16-bit numbers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : andrew1234



