0% found this document useful (0 votes)
39 views1 page

CSE 316 (Lab - 1) Echo and Print String Program Title Pgm4 - 1: Echo Program

This document contains code for two programs written in Assembly language. The first program, titled "ECHO PROGRAM", prompts the user to input a character, saves it to a variable, displays it on a new line, and returns to DOS. The second program, titled "PRINT STRING PROGRAM", initializes a data segment, displays the string "HELLO!" stored in a variable, and returns to DOS.

Uploaded by

Mehedi Al Masum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views1 page

CSE 316 (Lab - 1) Echo and Print String Program Title Pgm4 - 1: Echo Program

This document contains code for two programs written in Assembly language. The first program, titled "ECHO PROGRAM", prompts the user to input a character, saves it to a variable, displays it on a new line, and returns to DOS. The second program, titled "PRINT STRING PROGRAM", initializes a data segment, displays the string "HELLO!" stored in a variable, and returns to DOS.

Uploaded by

Mehedi Al Masum
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

CSE 316 (Lab -1) Echo and Print String Program

TITLE PGM4_1: ECHO PROGRAM


.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
;display prompt
MOV AH,2 ;display character function
MOV DL,'?' ;character is '?'
INT 21H ;display it
;input a character
MOV AH,1 ;read character function
INT 21H ;character in AL
MOV BL,AL ;save it in BL
;go to a new line
MOV AH,2 ;display character function
MOV DL,0DH ;carriage return
INT 21H ;execute carriage return
MOV DL,0AH ;line feed
INT 21H ;execute line feed
;display character
MOV DL,BL ;retrieve character
INT 21H ;and display it
;return to DOS
MOV AH,4CH ;DOS exit function
INT 21H ;exit to DOS
MAIN ENDP
END MAIN

TITLE PGM4_2: PRINT STRING PROGRAM


.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'HELLO!$'
.CODE
MAIN PROC
;initialize DS
MOV AX,@DATA
MOV DS,AX ;initialize DS
;display message
LEA DX, MSG ;get message
MOV AH,9 ;display string function
INT 21h ;display message
;return to DOS
MOV AH,4CH
INT 21h ;DOS exit
MAIN ENDP
END MAIN

You might also like