0% found this document useful (0 votes)
54 views5 pages

Experiment 5

The document describes experiments using DOS interrupt routines in assembly language to perform string operations and input/output. It explains how DOS interrupt 21h is used to display and read strings and characters by setting the AH register. The experiments demonstrate reading user input, converting case, and vertically displaying characters to showcase using DOS interrupts for fundamental input/output.

Uploaded by

ZAHID HOSSAIN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views5 pages

Experiment 5

The document describes experiments using DOS interrupt routines in assembly language to perform string operations and input/output. It explains how DOS interrupt 21h is used to display and read strings and characters by setting the AH register. The experiments demonstrate reading user input, converting case, and vertically displaying characters to showcase using DOS interrupts for fundamental input/output.

Uploaded by

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

Heaven’s Light is Our Guide

Rajshahi University of Engineering & Technology

Department of Electrical & Electronic Engineering

: Microprocessor, Interfacing and System design


Course Title Sessional

Course No : EEE 3210


Experiment No : 05
Name of the Experiment : String Operations in Assembly language invoking
DOS Routing.

Date of Experiment : 29 October, 2023


Date of Submission : 05 November, 2023

Submitted by Submitted to

Name : Zahid Hossain Belal Hossain

Roll : 1901145 Assistant Professor

Section : C Department of EEE

Session : 2019-20 RUET


Experiment No: 05
Experiment Name: String Operations in Assembly language invoking DOS Routing.
Objectives:
1. To know about DOS Routine.
2. To write and read character.
3. To display string.
Theory:
DOS is a family of operating systems that gained prominence in the early years of
personal computing. It was widely used on IBM-compatible personal computers, and
its most well-known variants are MS-DOS and PC-DOS. DOS provides a set of system
calls, also known as interrupt routines, that allow software applications to access a
variety of services provided by the operating system. These services include file
handling, I/O (input/output) operations, program execution, and more. In the context of
DOS, interrupt routines serve as the mechanism through which applications can request
specific services from the operating system. These routines are accessed using software
interrupts. For DOS, the most commonly used interrupt for invoking DOS services is
INT 21h. When a software interrupt INT 21h is executed, it transfers control to a
specific routine within the DOS operating system based on the value stored in the AH
(accumulator high) register. The AH register specifies the desired DOS service or
function to be performed. To display a string to the screen, the DOS interrupt INT 21h
with function code 09h is employed. To read a character from the user, the program
uses the DOS interrupt INT 21h with function code 01h. This function code reads a
single character from the keyboard and stores it in the al register. After reading the
character, the program displays it by uses INT 21h with function code 02h to display
the character stored.
Codes and Outputs:
Problem 01: Display two strings in new lines.
Codes:
.MODEL SMALL
.DATA
CR EQU 0DH ;CARRAGE RETURN
LF EQU 0AH ;LINE FEEDER
STR DB 'THIS IS RUET$'
STR1 DB CR,LF,'ZAHID$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX

MOV AH,9H
LEA DX,STR
INT 21H

MOV AH,9H
LEA DX,STR1
INT 21H
MAIN ENDP
END MAIN

Output on Display:

Fig. 01: Output for problem 01.

Problem 02: Take a small letter and convert it to Capital letter in new line.

Codes:

.MODEL SMALL
.STACK 100H
.DATA
CR EQU 0DH
LF EQU 0AH
MSG1 DB 'ENTER A LOWER CASE LETTER: $'
MSG2 DB 0DH,0AH,'IN UPPER CASE IT IS: '
CHAR DB ?,'$'

.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX

LEA DX,MSG1
MOV AH,9
INT 21H

MOV AH,1
INT 21H
SUB AL,20H
MOV CHAR,AL

LEA DX,MSG2
MOV AH,9
INT 21H

MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN

Output on Display:

Fig. 02: Output for problem 02.

Problem 03: Input a string from user and display each character in vertically.

Codes:

.MODEL SMALL
.DATA
.CODE
MAIN PROC

MOV BX,0000H
MOV CX,6
LOOP1:
MOV AH,1H
INT 21H
MOV [BX],AL
INC BX
LOOP LOOP1

MOV BX,0000H
MOV CX,6
LOOP2:
MOV AH,2H
MOV DL,10D
INT 21H
MOV DL,0DH
INT 21H
MOV DX,[BX]
INC BX
INT 21H
LOOP LOOP2

EXIT:
MOV AH,04CH
INT 21H

MAIN ENDP
END MAIN
Output on Display:

Fig. 03: Output for problem 03.

Discussion & Conclusion: This program showcases the utilization of DOS interrupt
routines to perform simple yet fundamental input/output operations. It highlights the
versatility and convenience of DOS routines, enabling assembly language programs to
interact with the user through messages and character input. Understanding and
applying these routines in assembly language programming is a crucial skill for
developing efficient and interactive software applications. The program's structure
serves as a foundation for more complex applications, where user interaction and
character input are integral to the functionality of the software.

You might also like