In this article, you’ll be learning how to write a Assembly Language Program to print Strings in multiple lines (8086). For this example code, we’ll have three different strings saved on the Registers and will be printed in different lines.

Title: 8086 Assembly Program to print String “Hello World, Good Morning, Have Good Day” in 3 different lines

Description: If you have seen your first Hello World ALP, this assembly program prints STRING from .DATA, but in three different lines. So, here we’ll be saving 3 different Strings to .DATA, and then print them one by one. From our first Hello World ALP hope you have understood the use of mnemonics to display the string and the interrupt request.

Same instructions are used here, but repeatedly. This programs for 8086 Assembly Program to print different Strings in different lines.

8086 ALP to print string “HELLO WORLD, GOOD MORNING, HAVE GOOD DAY” in 3 three different lines:

Assembly Language Program to print Strings in multiple lines (8086)

.MODEL SMALL

.STACK

.DATA

STRING1 DB ‘HELLO WORLD $’                            ; declaring string

STRING2 DB 10, 13, ‘GOOD MORNING $’            ; declaring string

STRING3 DB 10, 13, ‘HAVE GOOD DAY $’            ; declaring string

.CODE

MAIN PROC                                                                   ; main procedure

MOV AX, @DATA                                                         ; initialize the data segment

MOV DS, AX

LEA DX, STRING1                                                        ; loading the effective address

MOV AH, 09H                                                               ; for string display

INT 21H                                                                          ; dos interrupt function

LEA DX, STRING2                                                       ; loading the effective address

MOV AH, 09H                                                               ; for string display

INT 21H                                                                           ; dos interrupt function

LEA DX, STRING3                                                        ; loading the effective address

MOV AH, 09H                                                                ; for string display

INT 21H                                                                           ; dos interrupt function

MOV AX, 4C00H                                                           ; end request

INT 21H

MAIN ENDP                                                                   ; end procedure

END MAIN                                                                      ; end program

 

More Assembly Language Programs